2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
134 ALC269_ASUS_EEEPC_P703,
135 ALC269_ASUS_EEEPC_P901,
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
217 ALC883_TARGA_2ch_DIG,
218 ALC883_TARGA_8ch_DIG,
221 ALC888_ACER_ASPIRE_4930G,
222 ALC888_ACER_ASPIRE_6530G,
223 ALC888_ACER_ASPIRE_8930G,
224 ALC888_ACER_ASPIRE_7730G,
228 ALC883_LENOVO_101E_2ch,
229 ALC883_LENOVO_NB0763,
230 ALC888_LENOVO_MS7195_DIG,
238 ALC883_FUJITSU_PI2515,
239 ALC888_FUJITSU_XA3530,
240 ALC883_3ST_6ch_INTEL,
253 #define GPIO_MASK 0x03
255 /* extra amp-initialization sequence types */
264 struct alc_mic_route {
266 unsigned char mux_idx;
267 unsigned char amix_idx;
270 #define MUX_IDX_UNDEF ((unsigned char)-1)
273 /* codec parameterization */
274 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
275 unsigned int num_mixers;
276 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
277 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
279 const struct hda_verb *init_verbs[10]; /* initialization verbs
283 unsigned int num_init_verbs;
285 char stream_name_analog[32]; /* analog PCM stream */
286 struct hda_pcm_stream *stream_analog_playback;
287 struct hda_pcm_stream *stream_analog_capture;
288 struct hda_pcm_stream *stream_analog_alt_playback;
289 struct hda_pcm_stream *stream_analog_alt_capture;
291 char stream_name_digital[32]; /* digital PCM stream */
292 struct hda_pcm_stream *stream_digital_playback;
293 struct hda_pcm_stream *stream_digital_capture;
296 struct hda_multi_out multiout; /* playback set-up
297 * max_channels, dacs must be set
298 * dig_out_nid and hp_nid are optional
300 hda_nid_t alt_dac_nid;
301 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
305 unsigned int num_adc_nids;
307 hda_nid_t *capsrc_nids;
308 hda_nid_t dig_in_nid; /* digital-in NID; optional */
311 unsigned int num_mux_defs;
312 const struct hda_input_mux *input_mux;
313 unsigned int cur_mux[3];
314 struct alc_mic_route ext_mic;
315 struct alc_mic_route int_mic;
318 const struct hda_channel_mode *channel_mode;
319 int num_channel_mode;
321 int const_channel_count;
322 int ext_channel_count;
324 /* PCM information */
325 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
327 /* dynamic controls, init_verbs and input_mux */
328 struct auto_pin_cfg autocfg;
329 struct snd_array kctls;
330 struct hda_input_mux private_imux[3];
331 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
332 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
333 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
336 void (*init_hook)(struct hda_codec *codec);
337 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
339 /* for pin sensing */
340 unsigned int sense_updated: 1;
341 unsigned int jack_present: 1;
342 unsigned int master_sw: 1;
343 unsigned int auto_mic:1;
346 unsigned int no_analog :1; /* digital I/O only */
349 /* for virtual master */
350 hda_nid_t vmaster_nid;
351 #ifdef CONFIG_SND_HDA_POWER_SAVE
352 struct hda_loopback_check loopback;
357 unsigned int pll_coef_idx, pll_coef_bit;
361 * configuration template - to be copied to the spec instance
363 struct alc_config_preset {
364 struct snd_kcontrol_new *mixers[5]; /* should be identical size
367 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
368 const struct hda_verb *init_verbs[5];
369 unsigned int num_dacs;
371 hda_nid_t dig_out_nid; /* optional */
372 hda_nid_t hp_nid; /* optional */
373 hda_nid_t *slave_dig_outs;
374 unsigned int num_adc_nids;
376 hda_nid_t *capsrc_nids;
377 hda_nid_t dig_in_nid;
378 unsigned int num_channel_mode;
379 const struct hda_channel_mode *channel_mode;
381 int const_channel_count;
382 unsigned int num_mux_defs;
383 const struct hda_input_mux *input_mux;
384 void (*unsol_event)(struct hda_codec *, unsigned int);
385 void (*setup)(struct hda_codec *);
386 void (*init_hook)(struct hda_codec *);
387 #ifdef CONFIG_SND_HDA_POWER_SAVE
388 struct hda_amp_list *loopbacks;
396 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
397 struct snd_ctl_elem_info *uinfo)
399 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
400 struct alc_spec *spec = codec->spec;
401 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
402 if (mux_idx >= spec->num_mux_defs)
404 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
407 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
408 struct snd_ctl_elem_value *ucontrol)
410 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
411 struct alc_spec *spec = codec->spec;
412 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
414 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
418 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
419 struct snd_ctl_elem_value *ucontrol)
421 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
422 struct alc_spec *spec = codec->spec;
423 const struct hda_input_mux *imux;
424 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
425 unsigned int mux_idx;
426 hda_nid_t nid = spec->capsrc_nids ?
427 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
430 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
431 imux = &spec->input_mux[mux_idx];
433 type = get_wcaps_type(get_wcaps(codec, nid));
434 if (type == AC_WID_AUD_MIX) {
435 /* Matrix-mixer style (e.g. ALC882) */
436 unsigned int *cur_val = &spec->cur_mux[adc_idx];
439 idx = ucontrol->value.enumerated.item[0];
440 if (idx >= imux->num_items)
441 idx = imux->num_items - 1;
444 for (i = 0; i < imux->num_items; i++) {
445 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
446 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
447 imux->items[i].index,
453 /* MUX style (e.g. ALC880) */
454 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
455 &spec->cur_mux[adc_idx]);
460 * channel mode setting
462 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
463 struct snd_ctl_elem_info *uinfo)
465 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
466 struct alc_spec *spec = codec->spec;
467 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
468 spec->num_channel_mode);
471 static int alc_ch_mode_get(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 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
477 spec->num_channel_mode,
478 spec->ext_channel_count);
481 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
482 struct snd_ctl_elem_value *ucontrol)
484 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
485 struct alc_spec *spec = codec->spec;
486 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
487 spec->num_channel_mode,
488 &spec->ext_channel_count);
489 if (err >= 0 && !spec->const_channel_count) {
490 spec->multiout.max_channels = spec->ext_channel_count;
491 if (spec->need_dac_fix)
492 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
498 * Control the mode of pin widget settings via the mixer. "pc" is used
499 * instead of "%" to avoid consequences of accidently treating the % as
500 * being part of a format specifier. Maximum allowed length of a value is
501 * 63 characters plus NULL terminator.
503 * Note: some retasking pin complexes seem to ignore requests for input
504 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
505 * are requested. Therefore order this list so that this behaviour will not
506 * cause problems when mixer clients move through the enum sequentially.
507 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
510 static char *alc_pin_mode_names[] = {
511 "Mic 50pc bias", "Mic 80pc bias",
512 "Line in", "Line out", "Headphone out",
514 static unsigned char alc_pin_mode_values[] = {
515 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
517 /* The control can present all 5 options, or it can limit the options based
518 * in the pin being assumed to be exclusively an input or an output pin. In
519 * addition, "input" pins may or may not process the mic bias option
520 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
521 * accept requests for bias as of chip versions up to March 2006) and/or
522 * wiring in the computer.
524 #define ALC_PIN_DIR_IN 0x00
525 #define ALC_PIN_DIR_OUT 0x01
526 #define ALC_PIN_DIR_INOUT 0x02
527 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
528 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
530 /* Info about the pin modes supported by the different pin direction modes.
531 * For each direction the minimum and maximum values are given.
533 static signed char alc_pin_mode_dir_info[5][2] = {
534 { 0, 2 }, /* ALC_PIN_DIR_IN */
535 { 3, 4 }, /* ALC_PIN_DIR_OUT */
536 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
537 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
538 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
540 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
541 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
542 #define alc_pin_mode_n_items(_dir) \
543 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
545 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
546 struct snd_ctl_elem_info *uinfo)
548 unsigned int item_num = uinfo->value.enumerated.item;
549 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
551 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
553 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
555 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
556 item_num = alc_pin_mode_min(dir);
557 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
561 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
562 struct snd_ctl_elem_value *ucontrol)
565 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
566 hda_nid_t nid = kcontrol->private_value & 0xffff;
567 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
568 long *valp = ucontrol->value.integer.value;
569 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
570 AC_VERB_GET_PIN_WIDGET_CONTROL,
573 /* Find enumerated value for current pinctl setting */
574 i = alc_pin_mode_min(dir);
575 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
577 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
581 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
582 struct snd_ctl_elem_value *ucontrol)
585 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
586 hda_nid_t nid = kcontrol->private_value & 0xffff;
587 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
588 long val = *ucontrol->value.integer.value;
589 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
590 AC_VERB_GET_PIN_WIDGET_CONTROL,
593 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
594 val = alc_pin_mode_min(dir);
596 change = pinctl != alc_pin_mode_values[val];
598 /* Set pin mode to that requested */
599 snd_hda_codec_write_cache(codec, nid, 0,
600 AC_VERB_SET_PIN_WIDGET_CONTROL,
601 alc_pin_mode_values[val]);
603 /* Also enable the retasking pin's input/output as required
604 * for the requested pin mode. Enum values of 2 or less are
607 * Dynamically switching the input/output buffers probably
608 * reduces noise slightly (particularly on input) so we'll
609 * do it. However, having both input and output buffers
610 * enabled simultaneously doesn't seem to be problematic if
611 * this turns out to be necessary in the future.
614 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
615 HDA_AMP_MUTE, HDA_AMP_MUTE);
616 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
619 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
620 HDA_AMP_MUTE, HDA_AMP_MUTE);
621 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
628 #define ALC_PIN_MODE(xname, nid, dir) \
629 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
630 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
631 .info = alc_pin_mode_info, \
632 .get = alc_pin_mode_get, \
633 .put = alc_pin_mode_put, \
634 .private_value = nid | (dir<<16) }
636 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
637 * together using a mask with more than one bit set. This control is
638 * currently used only by the ALC260 test model. At this stage they are not
639 * needed for any "production" models.
641 #ifdef CONFIG_SND_DEBUG
642 #define alc_gpio_data_info snd_ctl_boolean_mono_info
644 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
645 struct snd_ctl_elem_value *ucontrol)
647 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
648 hda_nid_t nid = kcontrol->private_value & 0xffff;
649 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
650 long *valp = ucontrol->value.integer.value;
651 unsigned int val = snd_hda_codec_read(codec, nid, 0,
652 AC_VERB_GET_GPIO_DATA, 0x00);
654 *valp = (val & mask) != 0;
657 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
658 struct snd_ctl_elem_value *ucontrol)
661 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
662 hda_nid_t nid = kcontrol->private_value & 0xffff;
663 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
664 long val = *ucontrol->value.integer.value;
665 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
666 AC_VERB_GET_GPIO_DATA,
669 /* Set/unset the masked GPIO bit(s) as needed */
670 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
675 snd_hda_codec_write_cache(codec, nid, 0,
676 AC_VERB_SET_GPIO_DATA, gpio_data);
680 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
681 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
682 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
683 .info = alc_gpio_data_info, \
684 .get = alc_gpio_data_get, \
685 .put = alc_gpio_data_put, \
686 .private_value = nid | (mask<<16) }
687 #endif /* CONFIG_SND_DEBUG */
689 /* A switch control to allow the enabling of the digital IO pins on the
690 * ALC260. This is incredibly simplistic; the intention of this control is
691 * to provide something in the test model allowing digital outputs to be
692 * identified if present. If models are found which can utilise these
693 * outputs a more complete mixer control can be devised for those models if
696 #ifdef CONFIG_SND_DEBUG
697 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
699 static int alc_spdif_ctrl_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_DIGI_CONVERT_1, 0x00);
709 *valp = (val & mask) != 0;
712 static int alc_spdif_ctrl_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 ctrl_data = snd_hda_codec_read(codec, nid, 0,
721 AC_VERB_GET_DIGI_CONVERT_1,
724 /* Set/unset the masked control bit(s) as needed */
725 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
730 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
735 #define ALC_SPDIF_CTRL_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_spdif_ctrl_info, \
739 .get = alc_spdif_ctrl_get, \
740 .put = alc_spdif_ctrl_put, \
741 .private_value = nid | (mask<<16) }
742 #endif /* CONFIG_SND_DEBUG */
744 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
745 * Again, this is only used in the ALC26x test models to help identify when
746 * the EAPD line must be asserted for features to work.
748 #ifdef CONFIG_SND_DEBUG
749 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
751 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
752 struct snd_ctl_elem_value *ucontrol)
754 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
755 hda_nid_t nid = kcontrol->private_value & 0xffff;
756 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
757 long *valp = ucontrol->value.integer.value;
758 unsigned int val = snd_hda_codec_read(codec, nid, 0,
759 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
761 *valp = (val & mask) != 0;
765 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
766 struct snd_ctl_elem_value *ucontrol)
769 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
770 hda_nid_t nid = kcontrol->private_value & 0xffff;
771 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
772 long val = *ucontrol->value.integer.value;
773 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
774 AC_VERB_GET_EAPD_BTLENABLE,
777 /* Set/unset the masked control bit(s) as needed */
778 change = (!val ? 0 : mask) != (ctrl_data & mask);
783 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
789 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
790 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
791 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
792 .info = alc_eapd_ctrl_info, \
793 .get = alc_eapd_ctrl_get, \
794 .put = alc_eapd_ctrl_put, \
795 .private_value = nid | (mask<<16) }
796 #endif /* CONFIG_SND_DEBUG */
799 * set up the input pin config (depending on the given auto-pin type)
801 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
804 unsigned int val = PIN_IN;
806 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
808 pincap = snd_hda_query_pin_caps(codec, nid);
809 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
810 if (pincap & AC_PINCAP_VREF_80)
812 else if (pincap & AC_PINCAP_VREF_50)
814 else if (pincap & AC_PINCAP_VREF_100)
816 else if (pincap & AC_PINCAP_VREF_GRD)
819 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
824 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
826 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
828 spec->mixers[spec->num_mixers++] = mix;
831 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
833 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
835 spec->init_verbs[spec->num_init_verbs++] = verb;
838 #ifdef CONFIG_PROC_FS
842 static void print_realtek_coef(struct snd_info_buffer *buffer,
843 struct hda_codec *codec, hda_nid_t nid)
849 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
850 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
851 coeff = snd_hda_codec_read(codec, nid, 0,
852 AC_VERB_GET_COEF_INDEX, 0);
853 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
856 #define print_realtek_coef NULL
860 * set up from the preset table
862 static void setup_preset(struct hda_codec *codec,
863 const struct alc_config_preset *preset)
865 struct alc_spec *spec = codec->spec;
868 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
869 add_mixer(spec, preset->mixers[i]);
870 spec->cap_mixer = preset->cap_mixer;
871 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
873 add_verb(spec, preset->init_verbs[i]);
875 spec->channel_mode = preset->channel_mode;
876 spec->num_channel_mode = preset->num_channel_mode;
877 spec->need_dac_fix = preset->need_dac_fix;
878 spec->const_channel_count = preset->const_channel_count;
880 if (preset->const_channel_count)
881 spec->multiout.max_channels = preset->const_channel_count;
883 spec->multiout.max_channels = spec->channel_mode[0].channels;
884 spec->ext_channel_count = spec->channel_mode[0].channels;
886 spec->multiout.num_dacs = preset->num_dacs;
887 spec->multiout.dac_nids = preset->dac_nids;
888 spec->multiout.dig_out_nid = preset->dig_out_nid;
889 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
890 spec->multiout.hp_nid = preset->hp_nid;
892 spec->num_mux_defs = preset->num_mux_defs;
893 if (!spec->num_mux_defs)
894 spec->num_mux_defs = 1;
895 spec->input_mux = preset->input_mux;
897 spec->num_adc_nids = preset->num_adc_nids;
898 spec->adc_nids = preset->adc_nids;
899 spec->capsrc_nids = preset->capsrc_nids;
900 spec->dig_in_nid = preset->dig_in_nid;
902 spec->unsol_event = preset->unsol_event;
903 spec->init_hook = preset->init_hook;
904 #ifdef CONFIG_SND_HDA_POWER_SAVE
905 spec->loopback.amplist = preset->loopbacks;
909 preset->setup(codec);
912 /* Enable GPIO mask and set output */
913 static struct hda_verb alc_gpio1_init_verbs[] = {
914 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
915 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
916 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
920 static struct hda_verb alc_gpio2_init_verbs[] = {
921 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
922 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
923 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
927 static struct hda_verb alc_gpio3_init_verbs[] = {
928 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
929 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
930 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
935 * Fix hardware PLL issue
936 * On some codecs, the analog PLL gating control must be off while
937 * the default value is 1.
939 static void alc_fix_pll(struct hda_codec *codec)
941 struct alc_spec *spec = codec->spec;
946 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
948 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
949 AC_VERB_GET_PROC_COEF, 0);
950 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
952 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
953 val & ~(1 << spec->pll_coef_bit));
956 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
957 unsigned int coef_idx, unsigned int coef_bit)
959 struct alc_spec *spec = codec->spec;
961 spec->pll_coef_idx = coef_idx;
962 spec->pll_coef_bit = coef_bit;
966 static void alc_automute_pin(struct hda_codec *codec)
968 struct alc_spec *spec = codec->spec;
969 unsigned int nid = spec->autocfg.hp_pins[0];
974 spec->jack_present = snd_hda_jack_detect(codec, nid);
975 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
976 nid = spec->autocfg.speaker_pins[i];
979 snd_hda_codec_write(codec, nid, 0,
980 AC_VERB_SET_PIN_WIDGET_CONTROL,
981 spec->jack_present ? 0 : PIN_OUT);
985 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
988 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
991 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
992 for (i = 0; i < nums; i++)
998 static void alc_mic_automute(struct hda_codec *codec)
1000 struct alc_spec *spec = codec->spec;
1001 struct alc_mic_route *dead, *alive;
1002 unsigned int present, type;
1005 if (!spec->auto_mic)
1007 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1009 if (snd_BUG_ON(!spec->adc_nids))
1012 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1014 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1016 alive = &spec->ext_mic;
1017 dead = &spec->int_mic;
1019 alive = &spec->int_mic;
1020 dead = &spec->ext_mic;
1023 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1024 if (type == AC_WID_AUD_MIX) {
1025 /* Matrix-mixer style (e.g. ALC882) */
1026 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1029 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1031 HDA_AMP_MUTE, HDA_AMP_MUTE);
1033 /* MUX style (e.g. ALC880) */
1034 snd_hda_codec_write_cache(codec, cap_nid, 0,
1035 AC_VERB_SET_CONNECT_SEL,
1039 /* FIXME: analog mixer */
1042 /* unsolicited event for HP jack sensing */
1043 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1045 if (codec->vendor_id == 0x10ec0880)
1050 case ALC880_HP_EVENT:
1051 alc_automute_pin(codec);
1053 case ALC880_MIC_EVENT:
1054 alc_mic_automute(codec);
1059 static void alc_inithook(struct hda_codec *codec)
1061 alc_automute_pin(codec);
1062 alc_mic_automute(codec);
1065 /* additional initialization for ALC888 variants */
1066 static void alc888_coef_init(struct hda_codec *codec)
1070 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1071 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1072 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1073 if ((tmp & 0xf0) == 0x20)
1075 snd_hda_codec_read(codec, 0x20, 0,
1076 AC_VERB_SET_PROC_COEF, 0x830);
1079 snd_hda_codec_read(codec, 0x20, 0,
1080 AC_VERB_SET_PROC_COEF, 0x3030);
1083 static void alc889_coef_init(struct hda_codec *codec)
1087 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1088 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1089 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1090 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1093 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1098 case ALC_INIT_GPIO1:
1099 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1101 case ALC_INIT_GPIO2:
1102 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1104 case ALC_INIT_GPIO3:
1105 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1107 case ALC_INIT_DEFAULT:
1108 switch (codec->vendor_id) {
1110 snd_hda_codec_write(codec, 0x0f, 0,
1111 AC_VERB_SET_EAPD_BTLENABLE, 2);
1112 snd_hda_codec_write(codec, 0x10, 0,
1113 AC_VERB_SET_EAPD_BTLENABLE, 2);
1125 snd_hda_codec_write(codec, 0x14, 0,
1126 AC_VERB_SET_EAPD_BTLENABLE, 2);
1127 snd_hda_codec_write(codec, 0x15, 0,
1128 AC_VERB_SET_EAPD_BTLENABLE, 2);
1131 switch (codec->vendor_id) {
1133 snd_hda_codec_write(codec, 0x1a, 0,
1134 AC_VERB_SET_COEF_INDEX, 7);
1135 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1136 AC_VERB_GET_PROC_COEF, 0);
1137 snd_hda_codec_write(codec, 0x1a, 0,
1138 AC_VERB_SET_COEF_INDEX, 7);
1139 snd_hda_codec_write(codec, 0x1a, 0,
1140 AC_VERB_SET_PROC_COEF,
1150 alc889_coef_init(codec);
1153 alc888_coef_init(codec);
1157 snd_hda_codec_write(codec, 0x20, 0,
1158 AC_VERB_SET_COEF_INDEX, 7);
1159 tmp = snd_hda_codec_read(codec, 0x20, 0,
1160 AC_VERB_GET_PROC_COEF, 0);
1161 snd_hda_codec_write(codec, 0x20, 0,
1162 AC_VERB_SET_COEF_INDEX, 7);
1163 snd_hda_codec_write(codec, 0x20, 0,
1164 AC_VERB_SET_PROC_COEF,
1172 static void alc_init_auto_hp(struct hda_codec *codec)
1174 struct alc_spec *spec = codec->spec;
1176 if (!spec->autocfg.hp_pins[0])
1179 if (!spec->autocfg.speaker_pins[0]) {
1180 if (spec->autocfg.line_out_pins[0] &&
1181 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1182 spec->autocfg.speaker_pins[0] =
1183 spec->autocfg.line_out_pins[0];
1188 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1189 spec->autocfg.hp_pins[0]);
1190 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1191 AC_VERB_SET_UNSOLICITED_ENABLE,
1192 AC_USRSP_EN | ALC880_HP_EVENT);
1193 spec->unsol_event = alc_sku_unsol_event;
1196 static void alc_init_auto_mic(struct hda_codec *codec)
1198 struct alc_spec *spec = codec->spec;
1199 struct auto_pin_cfg *cfg = &spec->autocfg;
1200 hda_nid_t fixed, ext;
1203 /* there must be only two mic inputs exclusively */
1204 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1205 if (cfg->input_pins[i])
1209 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1210 hda_nid_t nid = cfg->input_pins[i];
1211 unsigned int defcfg;
1214 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1215 switch (get_defcfg_connect(defcfg)) {
1216 case AC_JACK_PORT_FIXED:
1218 return; /* already occupied */
1221 case AC_JACK_PORT_COMPLEX:
1223 return; /* already occupied */
1227 return; /* invalid entry */
1230 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1231 return; /* no unsol support */
1232 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1234 spec->ext_mic.pin = ext;
1235 spec->int_mic.pin = fixed;
1236 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1237 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1239 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1240 AC_VERB_SET_UNSOLICITED_ENABLE,
1241 AC_USRSP_EN | ALC880_MIC_EVENT);
1242 spec->unsol_event = alc_sku_unsol_event;
1245 /* check subsystem ID and set up device-specific initialization;
1246 * return 1 if initialized, 0 if invalid SSID
1248 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1249 * 31 ~ 16 : Manufacture ID
1251 * 7 ~ 0 : Assembly ID
1252 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1254 static int alc_subsystem_id(struct hda_codec *codec,
1255 hda_nid_t porta, hda_nid_t porte,
1258 unsigned int ass, tmp, i;
1260 struct alc_spec *spec = codec->spec;
1262 ass = codec->subsystem_id & 0xffff;
1263 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1266 /* invalid SSID, check the special NID pin defcfg instead */
1268 * 31~30 : port connectivity
1271 * 19~16 : Check sum (15:1)
1276 if (codec->vendor_id == 0x10ec0260)
1278 ass = snd_hda_codec_get_pincfg(codec, nid);
1279 snd_printd("realtek: No valid SSID, "
1280 "checking pincfg 0x%08x for NID 0x%x\n",
1282 if (!(ass & 1) && !(ass & 0x100000))
1284 if ((ass >> 30) != 1) /* no physical connection */
1289 for (i = 1; i < 16; i++) {
1293 if (((ass >> 16) & 0xf) != tmp)
1296 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1297 ass & 0xffff, codec->vendor_id);
1301 * 2 : 0 --> Desktop, 1 --> Laptop
1302 * 3~5 : External Amplifier control
1305 tmp = (ass & 0x38) >> 3; /* external Amp control */
1308 spec->init_amp = ALC_INIT_GPIO1;
1311 spec->init_amp = ALC_INIT_GPIO2;
1314 spec->init_amp = ALC_INIT_GPIO3;
1317 spec->init_amp = ALC_INIT_DEFAULT;
1321 /* is laptop or Desktop and enable the function "Mute internal speaker
1322 * when the external headphone out jack is plugged"
1324 if (!(ass & 0x8000))
1327 * 10~8 : Jack location
1328 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1330 * 15 : 1 --> enable the function "Mute internal speaker
1331 * when the external headphone out jack is plugged"
1333 if (!spec->autocfg.hp_pins[0]) {
1335 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1344 for (i = 0; i < spec->autocfg.line_outs; i++)
1345 if (spec->autocfg.line_out_pins[i] == nid)
1347 spec->autocfg.hp_pins[0] = nid;
1350 alc_init_auto_hp(codec);
1351 alc_init_auto_mic(codec);
1355 static void alc_ssid_check(struct hda_codec *codec,
1356 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1358 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1359 struct alc_spec *spec = codec->spec;
1360 snd_printd("realtek: "
1361 "Enable default setup for auto mode as fallback\n");
1362 spec->init_amp = ALC_INIT_DEFAULT;
1363 alc_init_auto_hp(codec);
1364 alc_init_auto_mic(codec);
1369 * Fix-up pin default configurations and add default verbs
1378 const struct alc_pincfg *pins;
1379 const struct hda_verb *verbs;
1382 static void alc_pick_fixup(struct hda_codec *codec,
1383 const struct snd_pci_quirk *quirk,
1384 const struct alc_fixup *fix)
1386 const struct alc_pincfg *cfg;
1388 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1392 fix += quirk->value;
1395 for (; cfg->nid; cfg++)
1396 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1399 add_verb(codec->spec, fix->verbs);
1402 static int alc_read_coef_idx(struct hda_codec *codec,
1403 unsigned int coef_idx)
1406 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1408 val = snd_hda_codec_read(codec, 0x20, 0,
1409 AC_VERB_GET_PROC_COEF, 0);
1420 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1421 /* Mic-in jack as mic in */
1422 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1423 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1424 /* Line-in jack as Line in */
1425 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1426 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1427 /* Line-Out as Front */
1428 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1435 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1436 /* Mic-in jack as mic in */
1437 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1438 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1439 /* Line-in jack as Surround */
1440 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1441 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1442 /* Line-Out as Front */
1443 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1450 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1451 /* Mic-in jack as CLFE */
1452 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1453 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1454 /* Line-in jack as Surround */
1455 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1456 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1457 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1458 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1465 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1466 /* Mic-in jack as CLFE */
1467 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1468 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1469 /* Line-in jack as Surround */
1470 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1471 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1472 /* Line-Out as Side */
1473 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1477 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1478 { 2, alc888_4ST_ch2_intel_init },
1479 { 4, alc888_4ST_ch4_intel_init },
1480 { 6, alc888_4ST_ch6_intel_init },
1481 { 8, alc888_4ST_ch8_intel_init },
1485 * ALC888 Fujitsu Siemens Amillo xa3530
1488 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1489 /* Front Mic: set to PIN_IN (empty by default) */
1490 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1491 /* Connect Internal HP to Front */
1492 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1493 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1494 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1495 /* Connect Bass HP to Front */
1496 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1497 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1498 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1499 /* Connect Line-Out side jack (SPDIF) to Side */
1500 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1501 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1502 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1503 /* Connect Mic jack to CLFE */
1504 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1505 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1506 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1507 /* Connect Line-in jack to Surround */
1508 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1509 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1510 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1511 /* Connect HP out jack to Front */
1512 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1513 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1514 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1515 /* Enable unsolicited event for HP jack and Line-out jack */
1516 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1517 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1521 static void alc_automute_amp(struct hda_codec *codec)
1523 struct alc_spec *spec = codec->spec;
1528 spec->jack_present = 0;
1529 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1530 nid = spec->autocfg.hp_pins[i];
1533 if (snd_hda_jack_detect(codec, nid)) {
1534 spec->jack_present = 1;
1539 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1540 /* Toggle internal speakers muting */
1541 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1542 nid = spec->autocfg.speaker_pins[i];
1545 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1546 HDA_AMP_MUTE, mute);
1550 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1553 if (codec->vendor_id == 0x10ec0880)
1557 if (res == ALC880_HP_EVENT)
1558 alc_automute_amp(codec);
1561 static void alc889_automute_setup(struct hda_codec *codec)
1563 struct alc_spec *spec = codec->spec;
1565 spec->autocfg.hp_pins[0] = 0x15;
1566 spec->autocfg.speaker_pins[0] = 0x14;
1567 spec->autocfg.speaker_pins[1] = 0x16;
1568 spec->autocfg.speaker_pins[2] = 0x17;
1569 spec->autocfg.speaker_pins[3] = 0x19;
1570 spec->autocfg.speaker_pins[4] = 0x1a;
1573 static void alc889_intel_init_hook(struct hda_codec *codec)
1575 alc889_coef_init(codec);
1576 alc_automute_amp(codec);
1579 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1581 struct alc_spec *spec = codec->spec;
1583 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1584 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1585 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1586 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1590 * ALC888 Acer Aspire 4930G model
1593 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1594 /* Front Mic: set to PIN_IN (empty by default) */
1595 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1596 /* Unselect Front Mic by default in input mixer 3 */
1597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1598 /* Enable unsolicited event for HP jack */
1599 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1600 /* Connect Internal HP to front */
1601 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1602 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1603 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1604 /* Connect HP out to front */
1605 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1606 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1607 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1612 * ALC888 Acer Aspire 6530G model
1615 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1616 /* Bias voltage on for external mic port */
1617 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1618 /* Front Mic: set to PIN_IN (empty by default) */
1619 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1620 /* Unselect Front Mic by default in input mixer 3 */
1621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1622 /* Enable unsolicited event for HP jack */
1623 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1624 /* Enable speaker output */
1625 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1626 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1627 /* Enable headphone output */
1628 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1629 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1630 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1635 * ALC889 Acer Aspire 8930G model
1638 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1639 /* Front Mic: set to PIN_IN (empty by default) */
1640 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1641 /* Unselect Front Mic by default in input mixer 3 */
1642 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1643 /* Enable unsolicited event for HP jack */
1644 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1645 /* Connect Internal Front to Front */
1646 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1647 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1648 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1649 /* Connect Internal Rear to Rear */
1650 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1651 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1652 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1653 /* Connect Internal CLFE to CLFE */
1654 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1655 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1656 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1657 /* Connect HP out to Front */
1658 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1659 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1660 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1661 /* Enable all DACs */
1662 /* DAC DISABLE/MUTE 1? */
1663 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1664 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1665 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1666 /* DAC DISABLE/MUTE 2? */
1667 /* some bit here disables the other DACs. Init=0x4900 */
1668 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1669 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1670 /* Enable amplifiers */
1671 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1672 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1674 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1675 * which makes the stereo useless. However, either the mic or the ALC889
1676 * makes the signal become a difference/sum signal instead of standard
1677 * stereo, which is annoying. So instead we flip this bit which makes the
1678 * codec replicate the sum signal to both channels, turning it into a
1681 /* DMIC_CONTROL? Init value = 0x0001 */
1682 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1683 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1687 static struct hda_input_mux alc888_2_capture_sources[2] = {
1688 /* Front mic only available on one ADC */
1695 { "Front Mic", 0xb },
1708 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1709 /* Interal mic only available on one ADC */
1716 { "Input Mix", 0xa },
1726 { "Input Mix", 0xa },
1731 static struct hda_input_mux alc889_capture_sources[3] = {
1732 /* Digital mic only available on first "ADC" */
1739 { "Front Mic", 0xb },
1740 { "Input Mix", 0xa },
1749 { "Input Mix", 0xa },
1758 { "Input Mix", 0xa },
1763 static struct snd_kcontrol_new alc888_base_mixer[] = {
1764 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1765 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1766 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1767 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1768 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1770 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1771 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1772 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1773 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1774 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1775 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1776 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1777 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1778 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1780 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1781 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1785 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1787 struct alc_spec *spec = codec->spec;
1789 spec->autocfg.hp_pins[0] = 0x15;
1790 spec->autocfg.speaker_pins[0] = 0x14;
1791 spec->autocfg.speaker_pins[1] = 0x16;
1792 spec->autocfg.speaker_pins[2] = 0x17;
1795 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1797 struct alc_spec *spec = codec->spec;
1799 spec->autocfg.hp_pins[0] = 0x15;
1800 spec->autocfg.speaker_pins[0] = 0x14;
1801 spec->autocfg.speaker_pins[1] = 0x16;
1802 spec->autocfg.speaker_pins[2] = 0x17;
1805 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1807 struct alc_spec *spec = codec->spec;
1809 spec->autocfg.hp_pins[0] = 0x15;
1810 spec->autocfg.speaker_pins[0] = 0x14;
1811 spec->autocfg.speaker_pins[1] = 0x16;
1812 spec->autocfg.speaker_pins[2] = 0x1b;
1816 * ALC880 3-stack model
1818 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1819 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1820 * F-Mic = 0x1b, HP = 0x19
1823 static hda_nid_t alc880_dac_nids[4] = {
1824 /* front, rear, clfe, rear_surr */
1825 0x02, 0x05, 0x04, 0x03
1828 static hda_nid_t alc880_adc_nids[3] = {
1833 /* The datasheet says the node 0x07 is connected from inputs,
1834 * but it shows zero connection in the real implementation on some devices.
1835 * Note: this is a 915GAV bug, fixed on 915GLV
1837 static hda_nid_t alc880_adc_nids_alt[2] = {
1842 #define ALC880_DIGOUT_NID 0x06
1843 #define ALC880_DIGIN_NID 0x0a
1845 static struct hda_input_mux alc880_capture_source = {
1849 { "Front Mic", 0x3 },
1855 /* channel source setting (2/6 channel selection for 3-stack) */
1857 static struct hda_verb alc880_threestack_ch2_init[] = {
1858 /* set line-in to input, mute it */
1859 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1860 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1861 /* set mic-in to input vref 80%, mute it */
1862 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1863 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1868 static struct hda_verb alc880_threestack_ch6_init[] = {
1869 /* set line-in to output, unmute it */
1870 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1871 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1872 /* set mic-in to output, unmute it */
1873 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1874 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1878 static struct hda_channel_mode alc880_threestack_modes[2] = {
1879 { 2, alc880_threestack_ch2_init },
1880 { 6, alc880_threestack_ch6_init },
1883 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1884 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1885 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1886 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1887 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1888 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1889 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1890 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1891 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1892 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1893 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1894 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1895 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1896 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1897 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1898 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1899 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1900 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1902 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1903 .name = "Channel Mode",
1904 .info = alc_ch_mode_info,
1905 .get = alc_ch_mode_get,
1906 .put = alc_ch_mode_put,
1911 /* capture mixer elements */
1912 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1913 struct snd_ctl_elem_info *uinfo)
1915 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1916 struct alc_spec *spec = codec->spec;
1919 mutex_lock(&codec->control_mutex);
1920 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1922 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1923 mutex_unlock(&codec->control_mutex);
1927 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1928 unsigned int size, unsigned int __user *tlv)
1930 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1931 struct alc_spec *spec = codec->spec;
1934 mutex_lock(&codec->control_mutex);
1935 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1937 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1938 mutex_unlock(&codec->control_mutex);
1942 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1943 struct snd_ctl_elem_value *ucontrol);
1945 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1946 struct snd_ctl_elem_value *ucontrol,
1949 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1950 struct alc_spec *spec = codec->spec;
1951 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1954 mutex_lock(&codec->control_mutex);
1955 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1957 err = func(kcontrol, ucontrol);
1958 mutex_unlock(&codec->control_mutex);
1962 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1963 struct snd_ctl_elem_value *ucontrol)
1965 return alc_cap_getput_caller(kcontrol, ucontrol,
1966 snd_hda_mixer_amp_volume_get);
1969 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1970 struct snd_ctl_elem_value *ucontrol)
1972 return alc_cap_getput_caller(kcontrol, ucontrol,
1973 snd_hda_mixer_amp_volume_put);
1976 /* capture mixer elements */
1977 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1979 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1980 struct snd_ctl_elem_value *ucontrol)
1982 return alc_cap_getput_caller(kcontrol, ucontrol,
1983 snd_hda_mixer_amp_switch_get);
1986 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1987 struct snd_ctl_elem_value *ucontrol)
1989 return alc_cap_getput_caller(kcontrol, ucontrol,
1990 snd_hda_mixer_amp_switch_put);
1993 #define _DEFINE_CAPMIX(num) \
1995 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1996 .name = "Capture Switch", \
1997 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1999 .info = alc_cap_sw_info, \
2000 .get = alc_cap_sw_get, \
2001 .put = alc_cap_sw_put, \
2004 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2005 .name = "Capture Volume", \
2006 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2007 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2008 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2010 .info = alc_cap_vol_info, \
2011 .get = alc_cap_vol_get, \
2012 .put = alc_cap_vol_put, \
2013 .tlv = { .c = alc_cap_vol_tlv }, \
2016 #define _DEFINE_CAPSRC(num) \
2018 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2019 /* .name = "Capture Source", */ \
2020 .name = "Input Source", \
2022 .info = alc_mux_enum_info, \
2023 .get = alc_mux_enum_get, \
2024 .put = alc_mux_enum_put, \
2027 #define DEFINE_CAPMIX(num) \
2028 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2029 _DEFINE_CAPMIX(num), \
2030 _DEFINE_CAPSRC(num), \
2034 #define DEFINE_CAPMIX_NOSRC(num) \
2035 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2036 _DEFINE_CAPMIX(num), \
2040 /* up to three ADCs */
2044 DEFINE_CAPMIX_NOSRC(1);
2045 DEFINE_CAPMIX_NOSRC(2);
2046 DEFINE_CAPMIX_NOSRC(3);
2049 * ALC880 5-stack model
2051 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2053 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2054 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2057 /* additional mixers to alc880_three_stack_mixer */
2058 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2059 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2060 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2064 /* channel source setting (6/8 channel selection for 5-stack) */
2066 static struct hda_verb alc880_fivestack_ch6_init[] = {
2067 /* set line-in to input, mute it */
2068 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2069 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2074 static struct hda_verb alc880_fivestack_ch8_init[] = {
2075 /* set line-in to output, unmute it */
2076 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2077 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2081 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2082 { 6, alc880_fivestack_ch6_init },
2083 { 8, alc880_fivestack_ch8_init },
2088 * ALC880 6-stack model
2090 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2091 * Side = 0x05 (0x0f)
2092 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2093 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2096 static hda_nid_t alc880_6st_dac_nids[4] = {
2097 /* front, rear, clfe, rear_surr */
2098 0x02, 0x03, 0x04, 0x05
2101 static struct hda_input_mux alc880_6stack_capture_source = {
2105 { "Front Mic", 0x1 },
2111 /* fixed 8-channels */
2112 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2116 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2117 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2118 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2119 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2120 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2121 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2122 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2123 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2124 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2125 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2126 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2127 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2128 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2130 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2132 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2133 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2134 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2136 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2137 .name = "Channel Mode",
2138 .info = alc_ch_mode_info,
2139 .get = alc_ch_mode_get,
2140 .put = alc_ch_mode_put,
2149 * W810 has rear IO for:
2152 * Center/LFE (DAC 04)
2155 * The system also has a pair of internal speakers, and a headphone jack.
2156 * These are both connected to Line2 on the codec, hence to DAC 02.
2158 * There is a variable resistor to control the speaker or headphone
2159 * volume. This is a hardware-only device without a software API.
2161 * Plugging headphones in will disable the internal speakers. This is
2162 * implemented in hardware, not via the driver using jack sense. In
2163 * a similar fashion, plugging into the rear socket marked "front" will
2164 * disable both the speakers and headphones.
2166 * For input, there's a microphone jack, and an "audio in" jack.
2167 * These may not do anything useful with this driver yet, because I
2168 * haven't setup any initialization verbs for these yet...
2171 static hda_nid_t alc880_w810_dac_nids[3] = {
2172 /* front, rear/surround, clfe */
2176 /* fixed 6 channels */
2177 static struct hda_channel_mode alc880_w810_modes[1] = {
2181 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2182 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2183 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2184 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2185 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2186 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2187 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2188 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2189 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2190 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2191 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2199 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2200 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2204 static hda_nid_t alc880_z71v_dac_nids[1] = {
2207 #define ALC880_Z71V_HP_DAC 0x03
2209 /* fixed 2 channels */
2210 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2214 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2215 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2216 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2217 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2218 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2219 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2220 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2228 * ALC880 F1734 model
2230 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2231 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2234 static hda_nid_t alc880_f1734_dac_nids[1] = {
2237 #define ALC880_F1734_HP_DAC 0x02
2239 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2240 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2241 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2242 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2243 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2244 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2245 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2251 static struct hda_input_mux alc880_f1734_capture_source = {
2263 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2264 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2265 * Mic = 0x18, Line = 0x1a
2268 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2269 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2271 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2272 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2273 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2274 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2275 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2276 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2277 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2278 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2279 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2280 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2281 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2282 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2283 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2284 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2285 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2287 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2288 .name = "Channel Mode",
2289 .info = alc_ch_mode_info,
2290 .get = alc_ch_mode_get,
2291 .put = alc_ch_mode_put,
2297 * ALC880 ASUS W1V model
2299 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2300 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2301 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2304 /* additional mixers to alc880_asus_mixer */
2305 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2306 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2307 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2312 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2313 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2314 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2315 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2316 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2317 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2318 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2319 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2320 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2321 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2326 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2327 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2328 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2329 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2330 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2331 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2332 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2333 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2334 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2335 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2336 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2337 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2338 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2339 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2340 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2341 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2342 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2344 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2345 .name = "Channel Mode",
2346 .info = alc_ch_mode_info,
2347 .get = alc_ch_mode_get,
2348 .put = alc_ch_mode_put,
2353 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2354 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2355 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2356 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2357 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2358 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2359 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2360 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2361 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2362 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2363 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2367 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2368 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2369 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2370 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2371 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2372 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2373 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2378 * virtual master controls
2382 * slave controls for virtual master
2384 static const char *alc_slave_vols[] = {
2385 "Front Playback Volume",
2386 "Surround Playback Volume",
2387 "Center Playback Volume",
2388 "LFE Playback Volume",
2389 "Side Playback Volume",
2390 "Headphone Playback Volume",
2391 "Speaker Playback Volume",
2392 "Mono Playback Volume",
2393 "Line-Out Playback Volume",
2394 "PCM Playback Volume",
2398 static const char *alc_slave_sws[] = {
2399 "Front Playback Switch",
2400 "Surround Playback Switch",
2401 "Center Playback Switch",
2402 "LFE Playback Switch",
2403 "Side Playback Switch",
2404 "Headphone Playback Switch",
2405 "Speaker Playback Switch",
2406 "Mono Playback Switch",
2407 "IEC958 Playback Switch",
2408 "Line-Out Playback Switch",
2409 "PCM Playback Switch",
2414 * build control elements
2417 #define NID_MAPPING (-1)
2419 #define SUBDEV_SPEAKER_ (0 << 6)
2420 #define SUBDEV_HP_ (1 << 6)
2421 #define SUBDEV_LINE_ (2 << 6)
2422 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2423 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2424 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2426 static void alc_free_kctls(struct hda_codec *codec);
2428 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2429 /* additional beep mixers; the actual parameters are overwritten at build */
2430 static struct snd_kcontrol_new alc_beep_mixer[] = {
2431 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2432 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2437 static int alc_build_controls(struct hda_codec *codec)
2439 struct alc_spec *spec = codec->spec;
2440 struct snd_kcontrol *kctl;
2441 struct snd_kcontrol_new *knew;
2446 for (i = 0; i < spec->num_mixers; i++) {
2447 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2451 if (spec->cap_mixer) {
2452 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2456 if (spec->multiout.dig_out_nid) {
2457 err = snd_hda_create_spdif_out_ctls(codec,
2458 spec->multiout.dig_out_nid);
2461 if (!spec->no_analog) {
2462 err = snd_hda_create_spdif_share_sw(codec,
2466 spec->multiout.share_spdif = 1;
2469 if (spec->dig_in_nid) {
2470 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2475 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2476 /* create beep controls if needed */
2477 if (spec->beep_amp) {
2478 struct snd_kcontrol_new *knew;
2479 for (knew = alc_beep_mixer; knew->name; knew++) {
2480 struct snd_kcontrol *kctl;
2481 kctl = snd_ctl_new1(knew, codec);
2484 kctl->private_value = spec->beep_amp;
2485 err = snd_hda_ctl_add(codec,
2486 get_amp_nid_(spec->beep_amp), kctl);
2493 /* if we have no master control, let's create it */
2494 if (!spec->no_analog &&
2495 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2496 unsigned int vmaster_tlv[4];
2497 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2498 HDA_OUTPUT, vmaster_tlv);
2499 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2500 vmaster_tlv, alc_slave_vols);
2504 if (!spec->no_analog &&
2505 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2506 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2507 NULL, alc_slave_sws);
2512 alc_free_kctls(codec); /* no longer needed */
2514 /* assign Capture Source enums to NID */
2515 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2517 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2518 for (i = 0; kctl && i < kctl->count; i++) {
2519 err = snd_hda_add_nids(codec, kctl, i, spec->capsrc_nids,
2520 spec->input_mux->num_items);
2524 if (spec->cap_mixer) {
2525 const char *kname = kctl ? kctl->id.name : NULL;
2526 for (knew = spec->cap_mixer; knew->name; knew++) {
2527 if (kname && strcmp(knew->name, kname) == 0)
2529 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2530 for (i = 0; kctl && i < kctl->count; i++) {
2531 err = snd_hda_add_nid(codec, kctl, i,
2539 /* other nid->control mapping */
2540 for (i = 0; i < spec->num_mixers; i++) {
2541 for (knew = spec->mixers[i]; knew->name; knew++) {
2542 if (knew->iface != NID_MAPPING)
2544 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2547 u = knew->subdevice;
2548 for (j = 0; j < 4; j++, u >>= 8) {
2553 case SUBDEV_SPEAKER_:
2554 nid = spec->autocfg.speaker_pins[nid];
2557 nid = spec->autocfg.line_out_pins[nid];
2560 nid = spec->autocfg.hp_pins[nid];
2565 err = snd_hda_add_nid(codec, kctl, 0, nid);
2569 u = knew->private_value;
2570 for (j = 0; j < 4; j++, u >>= 8) {
2574 err = snd_hda_add_nid(codec, kctl, 0, nid);
2585 * initialize the codec volumes, etc
2589 * generic initialization of ADC, input mixers and output mixers
2591 static struct hda_verb alc880_volume_init_verbs[] = {
2593 * Unmute ADC0-2 and set the default input to mic-in
2595 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2597 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2598 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2599 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2600 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2602 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2604 * Note: PASD motherboards uses the Line In 2 as the input for front
2607 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2608 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2617 * Set up output mixers (0x0c - 0x0f)
2619 /* set vol=0 to output mixers */
2620 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2621 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2622 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2623 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2624 /* set up input amps for analog loopback */
2625 /* Amp Indices: DAC = 0, mixer = 1 */
2626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2630 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2632 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2633 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2639 * 3-stack pin configuration:
2640 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2642 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2644 * preset connection lists of input pins
2645 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2647 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2648 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2649 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2652 * Set pin mode and muting
2654 /* set front pin widgets 0x14 for output */
2655 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2656 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2657 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2658 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2659 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2660 /* Mic2 (as headphone out) for HP output */
2661 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2662 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2663 /* Line In pin widget for input */
2664 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2665 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2666 /* Line2 (as front mic) pin widget for input and vref at 80% */
2667 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2668 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2669 /* CD pin widget for input */
2670 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2676 * 5-stack pin configuration:
2677 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2678 * line-in/side = 0x1a, f-mic = 0x1b
2680 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2682 * preset connection lists of input pins
2683 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2685 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2686 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2689 * Set pin mode and muting
2691 /* set pin widgets 0x14-0x17 for output */
2692 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2693 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2694 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2695 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2696 /* unmute pins for output (no gain on this amp) */
2697 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2698 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2699 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2700 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2702 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2703 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2704 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2705 /* Mic2 (as headphone out) for HP output */
2706 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2707 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2708 /* Line In pin widget for input */
2709 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2710 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2711 /* Line2 (as front mic) pin widget for input and vref at 80% */
2712 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2713 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2714 /* CD pin widget for input */
2715 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2721 * W810 pin configuration:
2722 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2724 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2725 /* hphone/speaker input selector: front DAC */
2726 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2728 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2729 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2730 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2731 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2732 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2733 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2735 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2736 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2742 * Z71V pin configuration:
2743 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2745 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2746 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2747 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2748 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2749 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2751 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2752 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2753 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2754 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2760 * 6-stack pin configuration:
2761 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2762 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2764 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2765 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2767 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2768 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2769 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2770 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2771 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2772 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2773 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2774 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2776 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2777 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2778 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2779 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2780 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2781 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2782 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2783 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2784 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2790 * Uniwill pin configuration:
2791 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2794 static struct hda_verb alc880_uniwill_init_verbs[] = {
2795 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2797 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2798 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2799 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2800 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2801 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2802 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2803 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2804 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2805 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2806 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2807 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2809 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2810 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2812 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2813 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2814 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2815 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2816 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2817 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2818 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2819 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2820 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2822 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2823 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2830 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2832 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2833 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2835 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2836 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2837 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2838 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2839 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2840 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2841 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2842 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2843 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2844 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2845 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2846 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2848 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2849 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2850 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2851 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2852 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2853 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2855 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2856 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2861 static struct hda_verb alc880_beep_init_verbs[] = {
2862 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2866 /* auto-toggle front mic */
2867 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2869 unsigned int present;
2872 present = snd_hda_jack_detect(codec, 0x18);
2873 bits = present ? HDA_AMP_MUTE : 0;
2874 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2877 static void alc880_uniwill_setup(struct hda_codec *codec)
2879 struct alc_spec *spec = codec->spec;
2881 spec->autocfg.hp_pins[0] = 0x14;
2882 spec->autocfg.speaker_pins[0] = 0x15;
2883 spec->autocfg.speaker_pins[0] = 0x16;
2886 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2888 alc_automute_amp(codec);
2889 alc880_uniwill_mic_automute(codec);
2892 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2895 /* Looks like the unsol event is incompatible with the standard
2896 * definition. 4bit tag is placed at 28 bit!
2898 switch (res >> 28) {
2899 case ALC880_MIC_EVENT:
2900 alc880_uniwill_mic_automute(codec);
2903 alc_automute_amp_unsol_event(codec, res);
2908 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2910 struct alc_spec *spec = codec->spec;
2912 spec->autocfg.hp_pins[0] = 0x14;
2913 spec->autocfg.speaker_pins[0] = 0x15;
2916 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2918 unsigned int present;
2920 present = snd_hda_codec_read(codec, 0x21, 0,
2921 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2922 present &= HDA_AMP_VOLMASK;
2923 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2924 HDA_AMP_VOLMASK, present);
2925 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2926 HDA_AMP_VOLMASK, present);
2929 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2932 /* Looks like the unsol event is incompatible with the standard
2933 * definition. 4bit tag is placed at 28 bit!
2935 if ((res >> 28) == ALC880_DCVOL_EVENT)
2936 alc880_uniwill_p53_dcvol_automute(codec);
2938 alc_automute_amp_unsol_event(codec, res);
2942 * F1734 pin configuration:
2943 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2945 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2946 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2947 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2948 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2949 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2950 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2952 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2953 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2954 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2955 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2957 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2958 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2959 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2960 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2961 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2962 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2963 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2964 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2965 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2967 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2968 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2974 * ASUS pin configuration:
2975 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2977 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2978 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2979 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2980 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2981 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2983 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2984 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2985 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2986 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2987 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2988 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2989 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2990 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2992 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2993 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2994 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2995 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2996 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2997 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2998 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2999 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3000 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3005 /* Enable GPIO mask and set output */
3006 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3007 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3008 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3010 /* Clevo m520g init */
3011 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3012 /* headphone output */
3013 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3015 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3016 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3018 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3019 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3021 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3022 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3023 /* Mic1 (rear panel) */
3024 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3025 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3026 /* Mic2 (front panel) */
3027 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3028 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3030 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3031 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3032 /* change to EAPD mode */
3033 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3034 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3039 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3040 /* change to EAPD mode */
3041 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3042 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3044 /* Headphone output */
3045 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3047 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3048 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3050 /* Line In pin widget for input */
3051 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3052 /* CD pin widget for input */
3053 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3054 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3055 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3057 /* change to EAPD mode */
3058 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3059 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3065 * LG m1 express dual
3068 * Rear Line-In/Out (blue): 0x14
3069 * Build-in Mic-In: 0x15
3071 * HP-Out (green): 0x1b
3072 * Mic-In/Out (red): 0x19
3076 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3077 static hda_nid_t alc880_lg_dac_nids[3] = {
3081 /* seems analog CD is not working */
3082 static struct hda_input_mux alc880_lg_capture_source = {
3087 { "Internal Mic", 0x6 },
3091 /* 2,4,6 channel modes */
3092 static struct hda_verb alc880_lg_ch2_init[] = {
3093 /* set line-in and mic-in to input */
3094 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3095 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3099 static struct hda_verb alc880_lg_ch4_init[] = {
3100 /* set line-in to out and mic-in to input */
3101 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3102 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3106 static struct hda_verb alc880_lg_ch6_init[] = {
3107 /* set line-in and mic-in to output */
3108 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3109 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3113 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3114 { 2, alc880_lg_ch2_init },
3115 { 4, alc880_lg_ch4_init },
3116 { 6, alc880_lg_ch6_init },
3119 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3120 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3121 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3122 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3123 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3124 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3125 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3126 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3127 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3129 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3130 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3131 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3132 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3133 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3135 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3136 .name = "Channel Mode",
3137 .info = alc_ch_mode_info,
3138 .get = alc_ch_mode_get,
3139 .put = alc_ch_mode_put,
3144 static struct hda_verb alc880_lg_init_verbs[] = {
3145 /* set capture source to mic-in */
3146 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3147 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3148 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3149 /* mute all amp mixer inputs */
3150 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3151 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3152 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3153 /* line-in to input */
3154 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3155 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3157 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3158 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3160 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3161 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3162 /* mic-in to input */
3163 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3164 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3165 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3167 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3168 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3169 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3171 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3175 /* toggle speaker-output according to the hp-jack state */
3176 static void alc880_lg_setup(struct hda_codec *codec)
3178 struct alc_spec *spec = codec->spec;
3180 spec->autocfg.hp_pins[0] = 0x1b;
3181 spec->autocfg.speaker_pins[0] = 0x17;
3190 * Built-in Mic-In: 0x19
3196 static struct hda_input_mux alc880_lg_lw_capture_source = {
3200 { "Internal Mic", 0x1 },
3205 #define alc880_lg_lw_modes alc880_threestack_modes
3207 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3208 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3209 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3210 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3211 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3212 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3213 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3214 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3215 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3216 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3217 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3218 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3219 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3220 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3221 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3223 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3224 .name = "Channel Mode",
3225 .info = alc_ch_mode_info,
3226 .get = alc_ch_mode_get,
3227 .put = alc_ch_mode_put,
3232 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3233 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3234 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3235 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3237 /* set capture source to mic-in */
3238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3239 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3240 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3241 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3243 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3244 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3246 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3247 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3248 /* mic-in to input */
3249 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3250 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3252 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3253 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3255 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3259 /* toggle speaker-output according to the hp-jack state */
3260 static void alc880_lg_lw_setup(struct hda_codec *codec)
3262 struct alc_spec *spec = codec->spec;
3264 spec->autocfg.hp_pins[0] = 0x1b;
3265 spec->autocfg.speaker_pins[0] = 0x14;
3268 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3269 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3270 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3272 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3273 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3274 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3278 static struct hda_input_mux alc880_medion_rim_capture_source = {
3282 { "Internal Mic", 0x1 },
3286 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3287 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3289 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3290 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3292 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3293 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3294 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3295 /* Mic2 (as headphone out) for HP output */
3296 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3297 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3298 /* Internal Speaker */
3299 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3300 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3302 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3303 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3305 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3309 /* toggle speaker-output according to the hp-jack state */
3310 static void alc880_medion_rim_automute(struct hda_codec *codec)
3312 struct alc_spec *spec = codec->spec;
3313 alc_automute_amp(codec);
3315 if (spec->jack_present)
3316 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3318 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3321 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3324 /* Looks like the unsol event is incompatible with the standard
3325 * definition. 4bit tag is placed at 28 bit!
3327 if ((res >> 28) == ALC880_HP_EVENT)
3328 alc880_medion_rim_automute(codec);
3331 static void alc880_medion_rim_setup(struct hda_codec *codec)
3333 struct alc_spec *spec = codec->spec;
3335 spec->autocfg.hp_pins[0] = 0x14;
3336 spec->autocfg.speaker_pins[0] = 0x1b;
3339 #ifdef CONFIG_SND_HDA_POWER_SAVE
3340 static struct hda_amp_list alc880_loopbacks[] = {
3341 { 0x0b, HDA_INPUT, 0 },
3342 { 0x0b, HDA_INPUT, 1 },
3343 { 0x0b, HDA_INPUT, 2 },
3344 { 0x0b, HDA_INPUT, 3 },
3345 { 0x0b, HDA_INPUT, 4 },
3349 static struct hda_amp_list alc880_lg_loopbacks[] = {
3350 { 0x0b, HDA_INPUT, 1 },
3351 { 0x0b, HDA_INPUT, 6 },
3352 { 0x0b, HDA_INPUT, 7 },
3361 static int alc_init(struct hda_codec *codec)
3363 struct alc_spec *spec = codec->spec;
3367 alc_auto_init_amp(codec, spec->init_amp);
3369 for (i = 0; i < spec->num_init_verbs; i++)
3370 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3372 if (spec->init_hook)
3373 spec->init_hook(codec);
3378 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3380 struct alc_spec *spec = codec->spec;
3382 if (spec->unsol_event)
3383 spec->unsol_event(codec, res);
3386 #ifdef CONFIG_SND_HDA_POWER_SAVE
3387 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3389 struct alc_spec *spec = codec->spec;
3390 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3395 * Analog playback callbacks
3397 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3398 struct hda_codec *codec,
3399 struct snd_pcm_substream *substream)
3401 struct alc_spec *spec = codec->spec;
3402 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3406 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3407 struct hda_codec *codec,
3408 unsigned int stream_tag,
3409 unsigned int format,
3410 struct snd_pcm_substream *substream)
3412 struct alc_spec *spec = codec->spec;
3413 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3414 stream_tag, format, substream);
3417 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3418 struct hda_codec *codec,
3419 struct snd_pcm_substream *substream)
3421 struct alc_spec *spec = codec->spec;
3422 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3428 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3429 struct hda_codec *codec,
3430 struct snd_pcm_substream *substream)
3432 struct alc_spec *spec = codec->spec;
3433 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3436 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3437 struct hda_codec *codec,
3438 unsigned int stream_tag,
3439 unsigned int format,
3440 struct snd_pcm_substream *substream)
3442 struct alc_spec *spec = codec->spec;
3443 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3444 stream_tag, format, substream);
3447 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3448 struct hda_codec *codec,
3449 struct snd_pcm_substream *substream)
3451 struct alc_spec *spec = codec->spec;
3452 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3455 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3456 struct hda_codec *codec,
3457 struct snd_pcm_substream *substream)
3459 struct alc_spec *spec = codec->spec;
3460 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3466 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3467 struct hda_codec *codec,
3468 unsigned int stream_tag,
3469 unsigned int format,
3470 struct snd_pcm_substream *substream)
3472 struct alc_spec *spec = codec->spec;
3474 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3475 stream_tag, 0, format);
3479 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3480 struct hda_codec *codec,
3481 struct snd_pcm_substream *substream)
3483 struct alc_spec *spec = codec->spec;
3485 snd_hda_codec_cleanup_stream(codec,
3486 spec->adc_nids[substream->number + 1]);
3493 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3497 /* NID is set in alc_build_pcms */
3499 .open = alc880_playback_pcm_open,
3500 .prepare = alc880_playback_pcm_prepare,
3501 .cleanup = alc880_playback_pcm_cleanup
3505 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3509 /* NID is set in alc_build_pcms */
3512 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3516 /* NID is set in alc_build_pcms */
3519 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3520 .substreams = 2, /* can be overridden */
3523 /* NID is set in alc_build_pcms */
3525 .prepare = alc880_alt_capture_pcm_prepare,
3526 .cleanup = alc880_alt_capture_pcm_cleanup
3530 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3534 /* NID is set in alc_build_pcms */
3536 .open = alc880_dig_playback_pcm_open,
3537 .close = alc880_dig_playback_pcm_close,
3538 .prepare = alc880_dig_playback_pcm_prepare,
3539 .cleanup = alc880_dig_playback_pcm_cleanup
3543 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3547 /* NID is set in alc_build_pcms */
3550 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3551 static struct hda_pcm_stream alc_pcm_null_stream = {
3557 static int alc_build_pcms(struct hda_codec *codec)
3559 struct alc_spec *spec = codec->spec;
3560 struct hda_pcm *info = spec->pcm_rec;
3563 codec->num_pcms = 1;
3564 codec->pcm_info = info;
3566 if (spec->no_analog)
3569 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3570 "%s Analog", codec->chip_name);
3571 info->name = spec->stream_name_analog;
3573 if (spec->stream_analog_playback) {
3574 if (snd_BUG_ON(!spec->multiout.dac_nids))
3576 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3577 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3579 if (spec->stream_analog_capture) {
3580 if (snd_BUG_ON(!spec->adc_nids))
3582 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3583 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3586 if (spec->channel_mode) {
3587 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3588 for (i = 0; i < spec->num_channel_mode; i++) {
3589 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3590 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3596 /* SPDIF for stream index #1 */
3597 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3598 snprintf(spec->stream_name_digital,
3599 sizeof(spec->stream_name_digital),
3600 "%s Digital", codec->chip_name);
3601 codec->num_pcms = 2;
3602 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3603 info = spec->pcm_rec + 1;
3604 info->name = spec->stream_name_digital;
3605 if (spec->dig_out_type)
3606 info->pcm_type = spec->dig_out_type;
3608 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3609 if (spec->multiout.dig_out_nid &&
3610 spec->stream_digital_playback) {
3611 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3612 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3614 if (spec->dig_in_nid &&
3615 spec->stream_digital_capture) {
3616 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3617 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3619 /* FIXME: do we need this for all Realtek codec models? */
3620 codec->spdif_status_reset = 1;
3623 if (spec->no_analog)
3626 /* If the use of more than one ADC is requested for the current
3627 * model, configure a second analog capture-only PCM.
3629 /* Additional Analaog capture for index #2 */
3630 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3631 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3632 codec->num_pcms = 3;
3633 info = spec->pcm_rec + 2;
3634 info->name = spec->stream_name_analog;
3635 if (spec->alt_dac_nid) {
3636 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3637 *spec->stream_analog_alt_playback;
3638 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3641 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3642 alc_pcm_null_stream;
3643 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3645 if (spec->num_adc_nids > 1) {
3646 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3647 *spec->stream_analog_alt_capture;
3648 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3650 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3651 spec->num_adc_nids - 1;
3653 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3654 alc_pcm_null_stream;
3655 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3662 static void alc_free_kctls(struct hda_codec *codec)
3664 struct alc_spec *spec = codec->spec;
3666 if (spec->kctls.list) {
3667 struct snd_kcontrol_new *kctl = spec->kctls.list;
3669 for (i = 0; i < spec->kctls.used; i++)
3670 kfree(kctl[i].name);
3672 snd_array_free(&spec->kctls);
3675 static void alc_free(struct hda_codec *codec)
3677 struct alc_spec *spec = codec->spec;
3682 alc_free_kctls(codec);
3684 snd_hda_detach_beep_device(codec);
3687 #ifdef SND_HDA_NEEDS_RESUME
3688 static int alc_resume(struct hda_codec *codec)
3690 codec->patch_ops.init(codec);
3691 snd_hda_codec_resume_amp(codec);
3692 snd_hda_codec_resume_cache(codec);
3699 static struct hda_codec_ops alc_patch_ops = {
3700 .build_controls = alc_build_controls,
3701 .build_pcms = alc_build_pcms,
3704 .unsol_event = alc_unsol_event,
3705 #ifdef SND_HDA_NEEDS_RESUME
3706 .resume = alc_resume,
3708 #ifdef CONFIG_SND_HDA_POWER_SAVE
3709 .check_power_status = alc_check_power_status,
3715 * Test configuration for debugging
3717 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3720 #ifdef CONFIG_SND_DEBUG
3721 static hda_nid_t alc880_test_dac_nids[4] = {
3722 0x02, 0x03, 0x04, 0x05
3725 static struct hda_input_mux alc880_test_capture_source = {
3734 { "Surround", 0x6 },
3738 static struct hda_channel_mode alc880_test_modes[4] = {
3745 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3746 struct snd_ctl_elem_info *uinfo)
3748 static char *texts[] = {
3749 "N/A", "Line Out", "HP Out",
3750 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3752 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3754 uinfo->value.enumerated.items = 8;
3755 if (uinfo->value.enumerated.item >= 8)
3756 uinfo->value.enumerated.item = 7;
3757 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3761 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3762 struct snd_ctl_elem_value *ucontrol)
3764 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3765 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3766 unsigned int pin_ctl, item = 0;
3768 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3769 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3770 if (pin_ctl & AC_PINCTL_OUT_EN) {
3771 if (pin_ctl & AC_PINCTL_HP_EN)
3775 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3776 switch (pin_ctl & AC_PINCTL_VREFEN) {
3777 case AC_PINCTL_VREF_HIZ: item = 3; break;
3778 case AC_PINCTL_VREF_50: item = 4; break;
3779 case AC_PINCTL_VREF_GRD: item = 5; break;
3780 case AC_PINCTL_VREF_80: item = 6; break;
3781 case AC_PINCTL_VREF_100: item = 7; break;
3784 ucontrol->value.enumerated.item[0] = item;
3788 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3789 struct snd_ctl_elem_value *ucontrol)
3791 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3792 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3793 static unsigned int ctls[] = {
3794 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3795 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3796 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3797 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3798 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3799 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3801 unsigned int old_ctl, new_ctl;
3803 old_ctl = snd_hda_codec_read(codec, nid, 0,
3804 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3805 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3806 if (old_ctl != new_ctl) {
3808 snd_hda_codec_write_cache(codec, nid, 0,
3809 AC_VERB_SET_PIN_WIDGET_CONTROL,
3811 val = ucontrol->value.enumerated.item[0] >= 3 ?
3813 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3820 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3821 struct snd_ctl_elem_info *uinfo)
3823 static char *texts[] = {
3824 "Front", "Surround", "CLFE", "Side"
3826 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3828 uinfo->value.enumerated.items = 4;
3829 if (uinfo->value.enumerated.item >= 4)
3830 uinfo->value.enumerated.item = 3;
3831 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3835 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3836 struct snd_ctl_elem_value *ucontrol)
3838 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3839 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3842 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3843 ucontrol->value.enumerated.item[0] = sel & 3;
3847 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3848 struct snd_ctl_elem_value *ucontrol)
3850 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3851 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3854 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3855 if (ucontrol->value.enumerated.item[0] != sel) {
3856 sel = ucontrol->value.enumerated.item[0] & 3;
3857 snd_hda_codec_write_cache(codec, nid, 0,
3858 AC_VERB_SET_CONNECT_SEL, sel);
3864 #define PIN_CTL_TEST(xname,nid) { \
3865 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3867 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3868 .info = alc_test_pin_ctl_info, \
3869 .get = alc_test_pin_ctl_get, \
3870 .put = alc_test_pin_ctl_put, \
3871 .private_value = nid \
3874 #define PIN_SRC_TEST(xname,nid) { \
3875 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3877 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3878 .info = alc_test_pin_src_info, \
3879 .get = alc_test_pin_src_get, \
3880 .put = alc_test_pin_src_put, \
3881 .private_value = nid \
3884 static struct snd_kcontrol_new alc880_test_mixer[] = {
3885 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3886 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3887 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3888 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3889 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3890 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3891 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3892 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3893 PIN_CTL_TEST("Front Pin Mode", 0x14),
3894 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3895 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3896 PIN_CTL_TEST("Side Pin Mode", 0x17),
3897 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3898 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3899 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3900 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3901 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3902 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3903 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3904 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3905 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3906 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3907 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3908 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3909 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3910 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3911 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3912 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3913 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3914 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3916 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3917 .name = "Channel Mode",
3918 .info = alc_ch_mode_info,
3919 .get = alc_ch_mode_get,
3920 .put = alc_ch_mode_put,
3925 static struct hda_verb alc880_test_init_verbs[] = {
3926 /* Unmute inputs of 0x0c - 0x0f */
3927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3928 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3929 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3930 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3931 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3932 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3933 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3934 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3935 /* Vol output for 0x0c-0x0f */
3936 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3937 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3938 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3939 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3940 /* Set output pins 0x14-0x17 */
3941 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3942 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3943 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3944 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3945 /* Unmute output pins 0x14-0x17 */
3946 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3947 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3948 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3949 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3950 /* Set input pins 0x18-0x1c */
3951 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3952 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3953 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3954 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3955 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3956 /* Mute input pins 0x18-0x1b */
3957 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3958 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3959 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3960 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3962 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3963 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3964 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3965 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3966 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3967 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3968 /* Analog input/passthru */
3969 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3970 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3971 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3972 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3973 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3981 static const char *alc880_models[ALC880_MODEL_LAST] = {
3982 [ALC880_3ST] = "3stack",
3983 [ALC880_TCL_S700] = "tcl",
3984 [ALC880_3ST_DIG] = "3stack-digout",
3985 [ALC880_CLEVO] = "clevo",
3986 [ALC880_5ST] = "5stack",
3987 [ALC880_5ST_DIG] = "5stack-digout",
3988 [ALC880_W810] = "w810",
3989 [ALC880_Z71V] = "z71v",
3990 [ALC880_6ST] = "6stack",
3991 [ALC880_6ST_DIG] = "6stack-digout",
3992 [ALC880_ASUS] = "asus",
3993 [ALC880_ASUS_W1V] = "asus-w1v",
3994 [ALC880_ASUS_DIG] = "asus-dig",
3995 [ALC880_ASUS_DIG2] = "asus-dig2",
3996 [ALC880_UNIWILL_DIG] = "uniwill",
3997 [ALC880_UNIWILL_P53] = "uniwill-p53",
3998 [ALC880_FUJITSU] = "fujitsu",
3999 [ALC880_F1734] = "F1734",
4001 [ALC880_LG_LW] = "lg-lw",
4002 [ALC880_MEDION_RIM] = "medion",
4003 #ifdef CONFIG_SND_DEBUG
4004 [ALC880_TEST] = "test",
4006 [ALC880_AUTO] = "auto",
4009 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4010 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4011 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4012 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4013 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4014 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4015 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4016 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4017 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4018 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4019 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4020 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4021 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4022 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4023 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4024 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4025 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4026 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4027 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4028 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4029 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4030 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4031 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4032 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4033 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4034 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4035 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4036 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4037 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4038 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4039 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4040 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4041 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4042 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4043 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4044 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4045 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4046 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4047 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4048 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4049 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4050 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4051 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4052 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4053 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4054 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4055 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4056 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4057 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4058 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4059 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4060 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4061 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4062 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4063 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4064 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4065 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4066 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4067 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4068 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4069 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4070 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4071 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4072 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4073 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4074 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4075 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4076 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4077 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4079 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4080 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4081 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4086 * ALC880 codec presets
4088 static struct alc_config_preset alc880_presets[] = {
4090 .mixers = { alc880_three_stack_mixer },
4091 .init_verbs = { alc880_volume_init_verbs,
4092 alc880_pin_3stack_init_verbs },
4093 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4094 .dac_nids = alc880_dac_nids,
4095 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4096 .channel_mode = alc880_threestack_modes,
4098 .input_mux = &alc880_capture_source,
4100 [ALC880_3ST_DIG] = {
4101 .mixers = { alc880_three_stack_mixer },
4102 .init_verbs = { alc880_volume_init_verbs,
4103 alc880_pin_3stack_init_verbs },
4104 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4105 .dac_nids = alc880_dac_nids,
4106 .dig_out_nid = ALC880_DIGOUT_NID,
4107 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4108 .channel_mode = alc880_threestack_modes,
4110 .input_mux = &alc880_capture_source,
4112 [ALC880_TCL_S700] = {
4113 .mixers = { alc880_tcl_s700_mixer },
4114 .init_verbs = { alc880_volume_init_verbs,
4115 alc880_pin_tcl_S700_init_verbs,
4116 alc880_gpio2_init_verbs },
4117 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4118 .dac_nids = alc880_dac_nids,
4119 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4120 .num_adc_nids = 1, /* single ADC */
4122 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4123 .channel_mode = alc880_2_jack_modes,
4124 .input_mux = &alc880_capture_source,
4127 .mixers = { alc880_three_stack_mixer,
4128 alc880_five_stack_mixer},
4129 .init_verbs = { alc880_volume_init_verbs,
4130 alc880_pin_5stack_init_verbs },
4131 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4132 .dac_nids = alc880_dac_nids,
4133 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4134 .channel_mode = alc880_fivestack_modes,
4135 .input_mux = &alc880_capture_source,
4137 [ALC880_5ST_DIG] = {
4138 .mixers = { alc880_three_stack_mixer,
4139 alc880_five_stack_mixer },
4140 .init_verbs = { alc880_volume_init_verbs,
4141 alc880_pin_5stack_init_verbs },
4142 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4143 .dac_nids = alc880_dac_nids,
4144 .dig_out_nid = ALC880_DIGOUT_NID,
4145 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4146 .channel_mode = alc880_fivestack_modes,
4147 .input_mux = &alc880_capture_source,
4150 .mixers = { alc880_six_stack_mixer },
4151 .init_verbs = { alc880_volume_init_verbs,
4152 alc880_pin_6stack_init_verbs },
4153 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4154 .dac_nids = alc880_6st_dac_nids,
4155 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4156 .channel_mode = alc880_sixstack_modes,
4157 .input_mux = &alc880_6stack_capture_source,
4159 [ALC880_6ST_DIG] = {
4160 .mixers = { alc880_six_stack_mixer },
4161 .init_verbs = { alc880_volume_init_verbs,
4162 alc880_pin_6stack_init_verbs },
4163 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4164 .dac_nids = alc880_6st_dac_nids,
4165 .dig_out_nid = ALC880_DIGOUT_NID,
4166 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4167 .channel_mode = alc880_sixstack_modes,
4168 .input_mux = &alc880_6stack_capture_source,
4171 .mixers = { alc880_w810_base_mixer },
4172 .init_verbs = { alc880_volume_init_verbs,
4173 alc880_pin_w810_init_verbs,
4174 alc880_gpio2_init_verbs },
4175 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4176 .dac_nids = alc880_w810_dac_nids,
4177 .dig_out_nid = ALC880_DIGOUT_NID,
4178 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4179 .channel_mode = alc880_w810_modes,
4180 .input_mux = &alc880_capture_source,
4183 .mixers = { alc880_z71v_mixer },
4184 .init_verbs = { alc880_volume_init_verbs,
4185 alc880_pin_z71v_init_verbs },
4186 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4187 .dac_nids = alc880_z71v_dac_nids,
4188 .dig_out_nid = ALC880_DIGOUT_NID,
4190 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4191 .channel_mode = alc880_2_jack_modes,
4192 .input_mux = &alc880_capture_source,
4195 .mixers = { alc880_f1734_mixer },
4196 .init_verbs = { alc880_volume_init_verbs,
4197 alc880_pin_f1734_init_verbs },
4198 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4199 .dac_nids = alc880_f1734_dac_nids,
4201 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4202 .channel_mode = alc880_2_jack_modes,
4203 .input_mux = &alc880_f1734_capture_source,
4204 .unsol_event = alc880_uniwill_p53_unsol_event,
4205 .setup = alc880_uniwill_p53_setup,
4206 .init_hook = alc_automute_amp,
4209 .mixers = { alc880_asus_mixer },
4210 .init_verbs = { alc880_volume_init_verbs,
4211 alc880_pin_asus_init_verbs,
4212 alc880_gpio1_init_verbs },
4213 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4214 .dac_nids = alc880_asus_dac_nids,
4215 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4216 .channel_mode = alc880_asus_modes,
4218 .input_mux = &alc880_capture_source,
4220 [ALC880_ASUS_DIG] = {
4221 .mixers = { alc880_asus_mixer },
4222 .init_verbs = { alc880_volume_init_verbs,
4223 alc880_pin_asus_init_verbs,
4224 alc880_gpio1_init_verbs },
4225 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4226 .dac_nids = alc880_asus_dac_nids,
4227 .dig_out_nid = ALC880_DIGOUT_NID,
4228 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4229 .channel_mode = alc880_asus_modes,
4231 .input_mux = &alc880_capture_source,
4233 [ALC880_ASUS_DIG2] = {
4234 .mixers = { alc880_asus_mixer },
4235 .init_verbs = { alc880_volume_init_verbs,
4236 alc880_pin_asus_init_verbs,
4237 alc880_gpio2_init_verbs }, /* use GPIO2 */
4238 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4239 .dac_nids = alc880_asus_dac_nids,
4240 .dig_out_nid = ALC880_DIGOUT_NID,
4241 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4242 .channel_mode = alc880_asus_modes,
4244 .input_mux = &alc880_capture_source,
4246 [ALC880_ASUS_W1V] = {
4247 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4248 .init_verbs = { alc880_volume_init_verbs,
4249 alc880_pin_asus_init_verbs,
4250 alc880_gpio1_init_verbs },
4251 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4252 .dac_nids = alc880_asus_dac_nids,
4253 .dig_out_nid = ALC880_DIGOUT_NID,
4254 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4255 .channel_mode = alc880_asus_modes,
4257 .input_mux = &alc880_capture_source,
4259 [ALC880_UNIWILL_DIG] = {
4260 .mixers = { alc880_asus_mixer },
4261 .init_verbs = { alc880_volume_init_verbs,
4262 alc880_pin_asus_init_verbs },
4263 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4264 .dac_nids = alc880_asus_dac_nids,
4265 .dig_out_nid = ALC880_DIGOUT_NID,
4266 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4267 .channel_mode = alc880_asus_modes,
4269 .input_mux = &alc880_capture_source,
4271 [ALC880_UNIWILL] = {
4272 .mixers = { alc880_uniwill_mixer },
4273 .init_verbs = { alc880_volume_init_verbs,
4274 alc880_uniwill_init_verbs },
4275 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4276 .dac_nids = alc880_asus_dac_nids,
4277 .dig_out_nid = ALC880_DIGOUT_NID,
4278 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4279 .channel_mode = alc880_threestack_modes,
4281 .input_mux = &alc880_capture_source,
4282 .unsol_event = alc880_uniwill_unsol_event,
4283 .setup = alc880_uniwill_setup,
4284 .init_hook = alc880_uniwill_init_hook,
4286 [ALC880_UNIWILL_P53] = {
4287 .mixers = { alc880_uniwill_p53_mixer },
4288 .init_verbs = { alc880_volume_init_verbs,
4289 alc880_uniwill_p53_init_verbs },
4290 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4291 .dac_nids = alc880_asus_dac_nids,
4292 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4293 .channel_mode = alc880_threestack_modes,
4294 .input_mux = &alc880_capture_source,
4295 .unsol_event = alc880_uniwill_p53_unsol_event,
4296 .setup = alc880_uniwill_p53_setup,
4297 .init_hook = alc_automute_amp,
4299 [ALC880_FUJITSU] = {
4300 .mixers = { alc880_fujitsu_mixer },
4301 .init_verbs = { alc880_volume_init_verbs,
4302 alc880_uniwill_p53_init_verbs,
4303 alc880_beep_init_verbs },
4304 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4305 .dac_nids = alc880_dac_nids,
4306 .dig_out_nid = ALC880_DIGOUT_NID,
4307 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4308 .channel_mode = alc880_2_jack_modes,
4309 .input_mux = &alc880_capture_source,
4310 .unsol_event = alc880_uniwill_p53_unsol_event,
4311 .setup = alc880_uniwill_p53_setup,
4312 .init_hook = alc_automute_amp,
4315 .mixers = { alc880_three_stack_mixer },
4316 .init_verbs = { alc880_volume_init_verbs,
4317 alc880_pin_clevo_init_verbs },
4318 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4319 .dac_nids = alc880_dac_nids,
4321 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4322 .channel_mode = alc880_threestack_modes,
4324 .input_mux = &alc880_capture_source,
4327 .mixers = { alc880_lg_mixer },
4328 .init_verbs = { alc880_volume_init_verbs,
4329 alc880_lg_init_verbs },
4330 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4331 .dac_nids = alc880_lg_dac_nids,
4332 .dig_out_nid = ALC880_DIGOUT_NID,
4333 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4334 .channel_mode = alc880_lg_ch_modes,
4336 .input_mux = &alc880_lg_capture_source,
4337 .unsol_event = alc_automute_amp_unsol_event,
4338 .setup = alc880_lg_setup,
4339 .init_hook = alc_automute_amp,
4340 #ifdef CONFIG_SND_HDA_POWER_SAVE
4341 .loopbacks = alc880_lg_loopbacks,
4345 .mixers = { alc880_lg_lw_mixer },
4346 .init_verbs = { alc880_volume_init_verbs,
4347 alc880_lg_lw_init_verbs },
4348 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4349 .dac_nids = alc880_dac_nids,
4350 .dig_out_nid = ALC880_DIGOUT_NID,
4351 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4352 .channel_mode = alc880_lg_lw_modes,
4353 .input_mux = &alc880_lg_lw_capture_source,
4354 .unsol_event = alc_automute_amp_unsol_event,
4355 .setup = alc880_lg_lw_setup,
4356 .init_hook = alc_automute_amp,
4358 [ALC880_MEDION_RIM] = {
4359 .mixers = { alc880_medion_rim_mixer },
4360 .init_verbs = { alc880_volume_init_verbs,
4361 alc880_medion_rim_init_verbs,
4362 alc_gpio2_init_verbs },
4363 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4364 .dac_nids = alc880_dac_nids,
4365 .dig_out_nid = ALC880_DIGOUT_NID,
4366 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4367 .channel_mode = alc880_2_jack_modes,
4368 .input_mux = &alc880_medion_rim_capture_source,
4369 .unsol_event = alc880_medion_rim_unsol_event,
4370 .setup = alc880_medion_rim_setup,
4371 .init_hook = alc880_medion_rim_automute,
4373 #ifdef CONFIG_SND_DEBUG
4375 .mixers = { alc880_test_mixer },
4376 .init_verbs = { alc880_test_init_verbs },
4377 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4378 .dac_nids = alc880_test_dac_nids,
4379 .dig_out_nid = ALC880_DIGOUT_NID,
4380 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4381 .channel_mode = alc880_test_modes,
4382 .input_mux = &alc880_test_capture_source,
4388 * Automatic parse of I/O pins from the BIOS configuration
4393 ALC_CTL_WIDGET_MUTE,
4396 static struct snd_kcontrol_new alc880_control_templates[] = {
4397 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4398 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4399 HDA_BIND_MUTE(NULL, 0, 0, 0),
4402 /* add dynamic controls */
4403 static int add_control(struct alc_spec *spec, int type, const char *name,
4406 struct snd_kcontrol_new *knew;
4408 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4409 knew = snd_array_new(&spec->kctls);
4412 *knew = alc880_control_templates[type];
4413 knew->name = kstrdup(name, GFP_KERNEL);
4416 if (get_amp_nid_(val))
4417 knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val);
4418 knew->private_value = val;
4422 static int add_control_with_pfx(struct alc_spec *spec, int type,
4423 const char *pfx, const char *dir,
4424 const char *sfx, unsigned long val)
4427 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4428 return add_control(spec, type, name, val);
4431 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4432 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4433 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4434 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4436 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4437 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4438 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4439 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4440 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4441 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4442 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4443 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4444 #define ALC880_PIN_CD_NID 0x1c
4446 /* fill in the dac_nids table from the parsed pin configuration */
4447 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4448 const struct auto_pin_cfg *cfg)
4454 memset(assigned, 0, sizeof(assigned));
4455 spec->multiout.dac_nids = spec->private_dac_nids;
4457 /* check the pins hardwired to audio widget */
4458 for (i = 0; i < cfg->line_outs; i++) {
4459 nid = cfg->line_out_pins[i];
4460 if (alc880_is_fixed_pin(nid)) {
4461 int idx = alc880_fixed_pin_idx(nid);
4462 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4466 /* left pins can be connect to any audio widget */
4467 for (i = 0; i < cfg->line_outs; i++) {
4468 nid = cfg->line_out_pins[i];
4469 if (alc880_is_fixed_pin(nid))
4471 /* search for an empty channel */
4472 for (j = 0; j < cfg->line_outs; j++) {
4474 spec->multiout.dac_nids[i] =
4475 alc880_idx_to_dac(j);
4481 spec->multiout.num_dacs = cfg->line_outs;
4485 /* add playback controls from the parsed DAC table */
4486 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4487 const struct auto_pin_cfg *cfg)
4489 static const char *chname[4] = {
4490 "Front", "Surround", NULL /*CLFE*/, "Side"
4495 for (i = 0; i < cfg->line_outs; i++) {
4496 if (!spec->multiout.dac_nids[i])
4498 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4501 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4503 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4507 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4509 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4513 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4515 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4519 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4521 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4527 if (cfg->line_outs == 1 &&
4528 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4532 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4533 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4537 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4538 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4547 /* add playback controls for speaker and HP outputs */
4548 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4557 if (alc880_is_fixed_pin(pin)) {
4558 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4559 /* specify the DAC as the extra output */
4560 if (!spec->multiout.hp_nid)
4561 spec->multiout.hp_nid = nid;
4563 spec->multiout.extra_out_nid[0] = nid;
4564 /* control HP volume/switch on the output mixer amp */
4565 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4566 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4567 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4570 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4571 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4574 } else if (alc880_is_multi_pin(pin)) {
4575 /* set manual connection */
4576 /* we have only a switch on HP-out PIN */
4577 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4578 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4585 /* create input playback/capture controls for the given pin */
4586 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4587 const char *ctlname,
4588 int idx, hda_nid_t mix_nid)
4592 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4593 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4596 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4597 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4603 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4605 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4606 return (pincap & AC_PINCAP_IN) != 0;
4609 /* create playback/capture controls for input pins */
4610 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4611 const struct auto_pin_cfg *cfg,
4613 hda_nid_t cap1, hda_nid_t cap2)
4615 struct alc_spec *spec = codec->spec;
4616 struct hda_input_mux *imux = &spec->private_imux[0];
4619 for (i = 0; i < AUTO_PIN_LAST; i++) {
4622 pin = cfg->input_pins[i];
4623 if (!alc_is_input_pin(codec, pin))
4627 idx = get_connection_index(codec, mixer, pin);
4629 err = new_analog_input(spec, pin,
4630 auto_pin_cfg_labels[i],
4639 idx = get_connection_index(codec, cap1, pin);
4640 if (idx < 0 && cap2)
4641 idx = get_connection_index(codec, cap2, pin);
4643 imux->items[imux->num_items].label =
4644 auto_pin_cfg_labels[i];
4645 imux->items[imux->num_items].index = idx;
4652 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4653 const struct auto_pin_cfg *cfg)
4655 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4658 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4659 unsigned int pin_type)
4661 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4664 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4668 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4669 hda_nid_t nid, int pin_type,
4672 alc_set_pin_output(codec, nid, pin_type);
4673 /* need the manual connection? */
4674 if (alc880_is_multi_pin(nid)) {
4675 struct alc_spec *spec = codec->spec;
4676 int idx = alc880_multi_pin_idx(nid);
4677 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4678 AC_VERB_SET_CONNECT_SEL,
4679 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4683 static int get_pin_type(int line_out_type)
4685 if (line_out_type == AUTO_PIN_HP_OUT)
4691 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4693 struct alc_spec *spec = codec->spec;
4696 for (i = 0; i < spec->autocfg.line_outs; i++) {
4697 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4698 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4699 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4703 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4705 struct alc_spec *spec = codec->spec;
4708 pin = spec->autocfg.speaker_pins[0];
4709 if (pin) /* connect to front */
4710 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4711 pin = spec->autocfg.hp_pins[0];
4712 if (pin) /* connect to front */
4713 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4716 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4718 struct alc_spec *spec = codec->spec;
4721 for (i = 0; i < AUTO_PIN_LAST; i++) {
4722 hda_nid_t nid = spec->autocfg.input_pins[i];
4723 if (alc_is_input_pin(codec, nid)) {
4724 alc_set_input_pin(codec, nid, i);
4725 if (nid != ALC880_PIN_CD_NID &&
4726 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4727 snd_hda_codec_write(codec, nid, 0,
4728 AC_VERB_SET_AMP_GAIN_MUTE,
4734 /* parse the BIOS configuration and set up the alc_spec */
4735 /* return 1 if successful, 0 if the proper config is not found,
4736 * or a negative error code
4738 static int alc880_parse_auto_config(struct hda_codec *codec)
4740 struct alc_spec *spec = codec->spec;
4742 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4744 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4748 if (!spec->autocfg.line_outs)
4749 return 0; /* can't find valid BIOS pin config */
4751 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4754 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4757 err = alc880_auto_create_extra_out(spec,
4758 spec->autocfg.speaker_pins[0],
4762 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4766 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4770 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4772 /* check multiple SPDIF-out (for recent codecs) */
4773 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4775 err = snd_hda_get_connections(codec,
4776 spec->autocfg.dig_out_pins[i],
4781 spec->multiout.dig_out_nid = dig_nid;
4783 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4784 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4786 spec->slave_dig_outs[i - 1] = dig_nid;
4789 if (spec->autocfg.dig_in_pin)
4790 spec->dig_in_nid = ALC880_DIGIN_NID;
4792 if (spec->kctls.list)
4793 add_mixer(spec, spec->kctls.list);
4795 add_verb(spec, alc880_volume_init_verbs);
4797 spec->num_mux_defs = 1;
4798 spec->input_mux = &spec->private_imux[0];
4800 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4805 /* additional initialization for auto-configuration model */
4806 static void alc880_auto_init(struct hda_codec *codec)
4808 struct alc_spec *spec = codec->spec;
4809 alc880_auto_init_multi_out(codec);
4810 alc880_auto_init_extra_out(codec);
4811 alc880_auto_init_analog_input(codec);
4812 if (spec->unsol_event)
4813 alc_inithook(codec);
4816 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4817 * one of two digital mic pins, e.g. on ALC272
4819 static void fixup_automic_adc(struct hda_codec *codec)
4821 struct alc_spec *spec = codec->spec;
4824 for (i = 0; i < spec->num_adc_nids; i++) {
4825 hda_nid_t cap = spec->capsrc_nids ?
4826 spec->capsrc_nids[i] : spec->adc_nids[i];
4829 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4832 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4835 spec->int_mic.mux_idx = iidx;
4836 spec->ext_mic.mux_idx = eidx;
4837 if (spec->capsrc_nids)
4838 spec->capsrc_nids += i;
4839 spec->adc_nids += i;
4840 spec->num_adc_nids = 1;
4843 snd_printd(KERN_INFO "hda_codec: %s: "
4844 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4845 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4846 spec->auto_mic = 0; /* disable auto-mic to be sure */
4849 static void set_capture_mixer(struct hda_codec *codec)
4851 struct alc_spec *spec = codec->spec;
4852 static struct snd_kcontrol_new *caps[2][3] = {
4853 { alc_capture_mixer_nosrc1,
4854 alc_capture_mixer_nosrc2,
4855 alc_capture_mixer_nosrc3 },
4856 { alc_capture_mixer1,
4858 alc_capture_mixer3 },
4860 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4862 if (spec->auto_mic) {
4864 fixup_automic_adc(codec);
4865 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4869 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4873 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4874 #define set_beep_amp(spec, nid, idx, dir) \
4875 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4877 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4881 * OK, here we have finally the patch for ALC880
4884 static int patch_alc880(struct hda_codec *codec)
4886 struct alc_spec *spec;
4890 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4896 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4899 if (board_config < 0) {
4900 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4902 board_config = ALC880_AUTO;
4905 if (board_config == ALC880_AUTO) {
4906 /* automatic parse from the BIOS config */
4907 err = alc880_parse_auto_config(codec);
4913 "hda_codec: Cannot set up configuration "
4914 "from BIOS. Using 3-stack mode...\n");
4915 board_config = ALC880_3ST;
4919 err = snd_hda_attach_beep_device(codec, 0x1);
4925 if (board_config != ALC880_AUTO)
4926 setup_preset(codec, &alc880_presets[board_config]);
4928 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4929 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4930 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4932 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4933 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4935 if (!spec->adc_nids && spec->input_mux) {
4936 /* check whether NID 0x07 is valid */
4937 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4939 wcap = get_wcaps_type(wcap);
4940 if (wcap != AC_WID_AUD_IN) {
4941 spec->adc_nids = alc880_adc_nids_alt;
4942 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4944 spec->adc_nids = alc880_adc_nids;
4945 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4948 set_capture_mixer(codec);
4949 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4951 spec->vmaster_nid = 0x0c;
4953 codec->patch_ops = alc_patch_ops;
4954 if (board_config == ALC880_AUTO)
4955 spec->init_hook = alc880_auto_init;
4956 #ifdef CONFIG_SND_HDA_POWER_SAVE
4957 if (!spec->loopback.amplist)
4958 spec->loopback.amplist = alc880_loopbacks;
4960 codec->proc_widget_hook = print_realtek_coef;
4970 static hda_nid_t alc260_dac_nids[1] = {
4975 static hda_nid_t alc260_adc_nids[1] = {
4980 static hda_nid_t alc260_adc_nids_alt[1] = {
4985 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4986 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4988 static hda_nid_t alc260_dual_adc_nids[2] = {
4993 #define ALC260_DIGOUT_NID 0x03
4994 #define ALC260_DIGIN_NID 0x06
4996 static struct hda_input_mux alc260_capture_source = {
5000 { "Front Mic", 0x1 },
5006 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5007 * headphone jack and the internal CD lines since these are the only pins at
5008 * which audio can appear. For flexibility, also allow the option of
5009 * recording the mixer output on the second ADC (ADC0 doesn't have a
5010 * connection to the mixer output).
5012 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5016 { "Mic/Line", 0x0 },
5018 { "Headphone", 0x2 },
5024 { "Mic/Line", 0x0 },
5026 { "Headphone", 0x2 },
5033 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5034 * the Fujitsu S702x, but jacks are marked differently.
5036 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5043 { "Headphone", 0x5 },
5052 { "Headphone", 0x6 },
5058 /* Maxdata Favorit 100XS */
5059 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5063 { "Line/Mic", 0x0 },
5070 { "Line/Mic", 0x0 },
5078 * This is just place-holder, so there's something for alc_build_pcms to look
5079 * at when it calculates the maximum number of channels. ALC260 has no mixer
5080 * element which allows changing the channel mode, so the verb list is
5083 static struct hda_channel_mode alc260_modes[1] = {
5088 /* Mixer combinations
5090 * basic: base_output + input + pc_beep + capture
5091 * HP: base_output + input + capture_alt
5092 * HP_3013: hp_3013 + input + capture
5093 * fujitsu: fujitsu + capture
5094 * acer: acer + capture
5097 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5098 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5099 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5100 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5101 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5102 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5103 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5107 static struct snd_kcontrol_new alc260_input_mixer[] = {
5108 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5109 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5110 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5111 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5112 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5113 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5114 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5115 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5119 /* update HP, line and mono out pins according to the master switch */
5120 static void alc260_hp_master_update(struct hda_codec *codec,
5121 hda_nid_t hp, hda_nid_t line,
5124 struct alc_spec *spec = codec->spec;
5125 unsigned int val = spec->master_sw ? PIN_HP : 0;
5126 /* change HP and line-out pins */
5127 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5129 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5131 /* mono (speaker) depending on the HP jack sense */
5132 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5133 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5137 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5138 struct snd_ctl_elem_value *ucontrol)
5140 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5141 struct alc_spec *spec = codec->spec;
5142 *ucontrol->value.integer.value = spec->master_sw;
5146 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5147 struct snd_ctl_elem_value *ucontrol)
5149 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5150 struct alc_spec *spec = codec->spec;
5151 int val = !!*ucontrol->value.integer.value;
5152 hda_nid_t hp, line, mono;
5154 if (val == spec->master_sw)
5156 spec->master_sw = val;
5157 hp = (kcontrol->private_value >> 16) & 0xff;
5158 line = (kcontrol->private_value >> 8) & 0xff;
5159 mono = kcontrol->private_value & 0xff;
5160 alc260_hp_master_update(codec, hp, line, mono);
5164 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5166 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5167 .name = "Master Playback Switch",
5168 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5169 .info = snd_ctl_boolean_mono_info,
5170 .get = alc260_hp_master_sw_get,
5171 .put = alc260_hp_master_sw_put,
5172 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5174 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5175 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5176 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5177 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5178 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5180 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5184 static struct hda_verb alc260_hp_unsol_verbs[] = {
5185 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5189 static void alc260_hp_automute(struct hda_codec *codec)
5191 struct alc_spec *spec = codec->spec;
5193 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5194 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5197 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5199 if ((res >> 26) == ALC880_HP_EVENT)
5200 alc260_hp_automute(codec);
5203 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5205 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5206 .name = "Master Playback Switch",
5207 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5208 .info = snd_ctl_boolean_mono_info,
5209 .get = alc260_hp_master_sw_get,
5210 .put = alc260_hp_master_sw_put,
5211 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5213 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5214 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5215 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5216 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5217 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5218 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5219 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5220 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5224 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5225 .ops = &snd_hda_bind_vol,
5227 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5228 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5229 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5234 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5235 .ops = &snd_hda_bind_sw,
5237 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5238 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5243 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5244 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5245 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5246 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5247 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5251 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5252 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5256 static void alc260_hp_3013_automute(struct hda_codec *codec)
5258 struct alc_spec *spec = codec->spec;
5260 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5261 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5264 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5267 if ((res >> 26) == ALC880_HP_EVENT)
5268 alc260_hp_3013_automute(codec);
5271 static void alc260_hp_3012_automute(struct hda_codec *codec)
5273 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5275 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5277 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5279 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5283 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5286 if ((res >> 26) == ALC880_HP_EVENT)
5287 alc260_hp_3012_automute(codec);
5290 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5291 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5293 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5294 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5295 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5296 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5297 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5298 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5299 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5300 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5301 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5302 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5303 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5307 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5308 * versions of the ALC260 don't act on requests to enable mic bias from NID
5309 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5310 * datasheet doesn't mention this restriction. At this stage it's not clear
5311 * whether this behaviour is intentional or is a hardware bug in chip
5312 * revisions available in early 2006. Therefore for now allow the
5313 * "Headphone Jack Mode" control to span all choices, but if it turns out
5314 * that the lack of mic bias for this NID is intentional we could change the
5315 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5317 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5318 * don't appear to make the mic bias available from the "line" jack, even
5319 * though the NID used for this jack (0x14) can supply it. The theory is
5320 * that perhaps Acer have included blocking capacitors between the ALC260
5321 * and the output jack. If this turns out to be the case for all such
5322 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5323 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5325 * The C20x Tablet series have a mono internal speaker which is controlled
5326 * via the chip's Mono sum widget and pin complex, so include the necessary
5327 * controls for such models. On models without a "mono speaker" the control
5328 * won't do anything.
5330 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5331 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5332 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5333 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5334 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5336 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5338 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5339 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5340 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5341 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5342 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5343 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5344 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5345 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5349 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5351 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5352 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5353 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5354 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5355 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5356 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5357 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5361 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5362 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5364 static struct snd_kcontrol_new alc260_will_mixer[] = {
5365 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5366 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5367 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5368 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5369 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5370 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5371 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5372 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5373 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5374 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5378 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5379 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5381 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5382 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5383 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5384 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5385 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5386 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5387 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5388 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5389 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5390 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5391 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5396 * initialization verbs
5398 static struct hda_verb alc260_init_verbs[] = {
5399 /* Line In pin widget for input */
5400 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5401 /* CD pin widget for input */
5402 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5403 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5404 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5405 /* Mic2 (front panel) pin widget for input and vref at 80% */
5406 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5407 /* LINE-2 is used for line-out in rear */
5408 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5409 /* select line-out */
5410 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5412 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5414 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5416 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5417 /* mute capture amp left and right */
5418 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5419 /* set connection select to line in (default select for this ADC) */
5420 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5421 /* mute capture amp left and right */
5422 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5423 /* set connection select to line in (default select for this ADC) */
5424 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5425 /* set vol=0 Line-Out mixer amp left and right */
5426 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5427 /* unmute pin widget amp left and right (no gain on this amp) */
5428 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5429 /* set vol=0 HP mixer amp left and right */
5430 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5431 /* unmute pin widget amp left and right (no gain on this amp) */
5432 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5433 /* set vol=0 Mono mixer amp left and right */
5434 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5435 /* unmute pin widget amp left and right (no gain on this amp) */
5436 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5437 /* unmute LINE-2 out pin */
5438 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5439 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5442 /* mute analog inputs */
5443 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5444 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5445 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5446 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5447 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5448 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5449 /* mute Front out path */
5450 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5451 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5452 /* mute Headphone out path */
5453 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5454 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5455 /* mute Mono out path */
5456 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5457 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5461 #if 0 /* should be identical with alc260_init_verbs? */
5462 static struct hda_verb alc260_hp_init_verbs[] = {
5463 /* Headphone and output */
5464 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5466 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5467 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5468 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5469 /* Mic2 (front panel) pin widget for input and vref at 80% */
5470 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5471 /* Line In pin widget for input */
5472 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5473 /* Line-2 pin widget for output */
5474 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5475 /* CD pin widget for input */
5476 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5477 /* unmute amp left and right */
5478 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5479 /* set connection select to line in (default select for this ADC) */
5480 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5481 /* unmute Line-Out mixer amp left and right (volume = 0) */
5482 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5483 /* mute pin widget amp left and right (no gain on this amp) */
5484 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5485 /* unmute HP mixer amp left and right (volume = 0) */
5486 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5487 /* mute pin widget amp left and right (no gain on this amp) */
5488 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5489 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5492 /* mute analog inputs */
5493 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5494 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5495 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5496 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5497 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5498 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5499 /* Unmute Front out path */
5500 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5501 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5502 /* Unmute Headphone out path */
5503 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5504 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5505 /* Unmute Mono out path */
5506 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5507 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5512 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5513 /* Line out and output */
5514 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5516 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5517 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5518 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5519 /* Mic2 (front panel) pin widget for input and vref at 80% */
5520 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5521 /* Line In pin widget for input */
5522 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5523 /* Headphone pin widget for output */
5524 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5525 /* CD pin widget for input */
5526 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5527 /* unmute amp left and right */
5528 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5529 /* set connection select to line in (default select for this ADC) */
5530 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5531 /* unmute Line-Out mixer amp left and right (volume = 0) */
5532 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5533 /* mute pin widget amp left and right (no gain on this amp) */
5534 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5535 /* unmute HP mixer amp left and right (volume = 0) */
5536 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5537 /* mute pin widget amp left and right (no gain on this amp) */
5538 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5539 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5542 /* mute analog inputs */
5543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5548 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5549 /* Unmute Front out path */
5550 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5551 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5552 /* Unmute Headphone out path */
5553 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5554 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5555 /* Unmute Mono out path */
5556 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5557 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5561 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5562 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5563 * audio = 0x16, internal speaker = 0x10.
5565 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5566 /* Disable all GPIOs */
5567 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5568 /* Internal speaker is connected to headphone pin */
5569 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5570 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5571 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5572 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5573 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5574 /* Ensure all other unused pins are disabled and muted. */
5575 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5576 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5577 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5578 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5579 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5580 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5581 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5582 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5584 /* Disable digital (SPDIF) pins */
5585 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5586 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5588 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5589 * when acting as an output.
5591 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5593 /* Start with output sum widgets muted and their output gains at min */
5594 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5596 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5598 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5599 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5600 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5601 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5602 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5604 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5605 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5606 /* Unmute Line1 pin widget output buffer since it starts as an output.
5607 * If the pin mode is changed by the user the pin mode control will
5608 * take care of enabling the pin's input/output buffers as needed.
5609 * Therefore there's no need to enable the input buffer at this
5612 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5613 /* Unmute input buffer of pin widget used for Line-in (no equiv
5616 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5618 /* Mute capture amp left and right */
5619 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5620 /* Set ADC connection select to match default mixer setting - line
5623 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5625 /* Do the same for the second ADC: mute capture input amp and
5626 * set ADC connection to line in (on mic1 pin)
5628 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5629 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5631 /* Mute all inputs to mixer widget (even unconnected ones) */
5632 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5633 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5638 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5639 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5644 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5645 * similar laptops (adapted from Fujitsu init verbs).
5647 static struct hda_verb alc260_acer_init_verbs[] = {
5648 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5649 * the headphone jack. Turn this on and rely on the standard mute
5650 * methods whenever the user wants to turn these outputs off.
5652 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5653 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5654 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5655 /* Internal speaker/Headphone jack is connected to Line-out pin */
5656 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5657 /* Internal microphone/Mic jack is connected to Mic1 pin */
5658 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5659 /* Line In jack is connected to Line1 pin */
5660 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5661 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5662 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5663 /* Ensure all other unused pins are disabled and muted. */
5664 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5665 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5666 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5667 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5668 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5669 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5670 /* Disable digital (SPDIF) pins */
5671 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5672 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5674 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5675 * bus when acting as outputs.
5677 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5678 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5680 /* Start with output sum widgets muted and their output gains at min */
5681 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5682 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5683 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5684 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5685 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5686 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5687 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5688 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5689 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5691 /* Unmute Line-out pin widget amp left and right
5692 * (no equiv mixer ctrl)
5694 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5695 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5696 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5697 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5698 * inputs. If the pin mode is changed by the user the pin mode control
5699 * will take care of enabling the pin's input/output buffers as needed.
5700 * Therefore there's no need to enable the input buffer at this
5703 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5704 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5706 /* Mute capture amp left and right */
5707 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5708 /* Set ADC connection select to match default mixer setting - mic
5711 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5713 /* Do similar with the second ADC: mute capture input amp and
5714 * set ADC connection to mic to match ALSA's default state.
5716 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5717 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5719 /* Mute all inputs to mixer widget (even unconnected ones) */
5720 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5722 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5724 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5725 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5726 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5727 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5732 /* Initialisation sequence for Maxdata Favorit 100XS
5733 * (adapted from Acer init verbs).
5735 static struct hda_verb alc260_favorit100_init_verbs[] = {
5736 /* GPIO 0 enables the output jack.
5737 * Turn this on and rely on the standard mute
5738 * methods whenever the user wants to turn these outputs off.
5740 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5741 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5742 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5743 /* Line/Mic input jack is connected to Mic1 pin */
5744 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5745 /* Ensure all other unused pins are disabled and muted. */
5746 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5747 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5748 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5749 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5750 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5751 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5752 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5753 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5754 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5755 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5756 /* Disable digital (SPDIF) pins */
5757 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5758 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5760 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5761 * bus when acting as outputs.
5763 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5764 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5766 /* Start with output sum widgets muted and their output gains at min */
5767 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5768 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5769 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5770 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5771 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5772 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5773 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5774 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5775 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5777 /* Unmute Line-out pin widget amp left and right
5778 * (no equiv mixer ctrl)
5780 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5781 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5782 * inputs. If the pin mode is changed by the user the pin mode control
5783 * will take care of enabling the pin's input/output buffers as needed.
5784 * Therefore there's no need to enable the input buffer at this
5787 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5789 /* Mute capture amp left and right */
5790 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5791 /* Set ADC connection select to match default mixer setting - mic
5794 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5796 /* Do similar with the second ADC: mute capture input amp and
5797 * set ADC connection to mic to match ALSA's default state.
5799 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5800 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5802 /* Mute all inputs to mixer widget (even unconnected ones) */
5803 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5804 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5805 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5806 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5807 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5808 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5809 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5810 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5815 static struct hda_verb alc260_will_verbs[] = {
5816 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5817 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5818 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5819 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5820 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5821 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5825 static struct hda_verb alc260_replacer_672v_verbs[] = {
5826 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5827 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5828 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5830 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5831 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5832 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5834 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5838 /* toggle speaker-output according to the hp-jack state */
5839 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5841 unsigned int present;
5843 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5844 present = snd_hda_jack_detect(codec, 0x0f);
5846 snd_hda_codec_write_cache(codec, 0x01, 0,
5847 AC_VERB_SET_GPIO_DATA, 1);
5848 snd_hda_codec_write_cache(codec, 0x0f, 0,
5849 AC_VERB_SET_PIN_WIDGET_CONTROL,
5852 snd_hda_codec_write_cache(codec, 0x01, 0,
5853 AC_VERB_SET_GPIO_DATA, 0);
5854 snd_hda_codec_write_cache(codec, 0x0f, 0,
5855 AC_VERB_SET_PIN_WIDGET_CONTROL,
5860 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5863 if ((res >> 26) == ALC880_HP_EVENT)
5864 alc260_replacer_672v_automute(codec);
5867 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5868 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5869 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5870 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5871 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5872 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5873 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5874 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5875 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5876 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5877 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5881 /* Test configuration for debugging, modelled after the ALC880 test
5884 #ifdef CONFIG_SND_DEBUG
5885 static hda_nid_t alc260_test_dac_nids[1] = {
5888 static hda_nid_t alc260_test_adc_nids[2] = {
5891 /* For testing the ALC260, each input MUX needs its own definition since
5892 * the signal assignments are different. This assumes that the first ADC
5895 static struct hda_input_mux alc260_test_capture_sources[2] = {
5899 { "MIC1 pin", 0x0 },
5900 { "MIC2 pin", 0x1 },
5901 { "LINE1 pin", 0x2 },
5902 { "LINE2 pin", 0x3 },
5904 { "LINE-OUT pin", 0x5 },
5905 { "HP-OUT pin", 0x6 },
5911 { "MIC1 pin", 0x0 },
5912 { "MIC2 pin", 0x1 },
5913 { "LINE1 pin", 0x2 },
5914 { "LINE2 pin", 0x3 },
5917 { "LINE-OUT pin", 0x6 },
5918 { "HP-OUT pin", 0x7 },
5922 static struct snd_kcontrol_new alc260_test_mixer[] = {
5923 /* Output driver widgets */
5924 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5925 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5926 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5927 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5928 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5929 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5931 /* Modes for retasking pin widgets
5932 * Note: the ALC260 doesn't seem to act on requests to enable mic
5933 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5934 * mention this restriction. At this stage it's not clear whether
5935 * this behaviour is intentional or is a hardware bug in chip
5936 * revisions available at least up until early 2006. Therefore for
5937 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5938 * choices, but if it turns out that the lack of mic bias for these
5939 * NIDs is intentional we could change their modes from
5940 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5942 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5943 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5944 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5945 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5946 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5947 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5949 /* Loopback mixer controls */
5950 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5951 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5952 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5953 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5954 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5955 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5956 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5957 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5958 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5959 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5960 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5961 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5962 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5963 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5965 /* Controls for GPIO pins, assuming they are configured as outputs */
5966 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5967 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5968 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5969 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5971 /* Switches to allow the digital IO pins to be enabled. The datasheet
5972 * is ambigious as to which NID is which; testing on laptops which
5973 * make this output available should provide clarification.
5975 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5976 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5978 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5979 * this output to turn on an external amplifier.
5981 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5982 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5986 static struct hda_verb alc260_test_init_verbs[] = {
5987 /* Enable all GPIOs as outputs with an initial value of 0 */
5988 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5989 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5990 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5992 /* Enable retasking pins as output, initially without power amp */
5993 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5994 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5995 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5996 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5997 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5998 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6000 /* Disable digital (SPDIF) pins initially, but users can enable
6001 * them via a mixer switch. In the case of SPDIF-out, this initverb
6002 * payload also sets the generation to 0, output to be in "consumer"
6003 * PCM format, copyright asserted, no pre-emphasis and no validity
6006 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6007 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6009 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6010 * OUT1 sum bus when acting as an output.
6012 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6013 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6014 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6015 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6017 /* Start with output sum widgets muted and their output gains at min */
6018 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6019 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6020 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6021 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6022 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6023 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6024 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6025 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6026 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6028 /* Unmute retasking pin widget output buffers since the default
6029 * state appears to be output. As the pin mode is changed by the
6030 * user the pin mode control will take care of enabling the pin's
6031 * input/output buffers as needed.
6033 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6034 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6035 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6036 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6037 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6038 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6039 /* Also unmute the mono-out pin widget */
6040 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6042 /* Mute capture amp left and right */
6043 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6044 /* Set ADC connection select to match default mixer setting (mic1
6047 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6049 /* Do the same for the second ADC: mute capture input amp and
6050 * set ADC connection to mic1 pin
6052 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6053 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6055 /* Mute all inputs to mixer widget (even unconnected ones) */
6056 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6057 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6058 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6059 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6060 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6061 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6062 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6063 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6069 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6070 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6072 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6073 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6076 * for BIOS auto-configuration
6079 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6080 const char *pfx, int *vol_bits)
6083 unsigned long vol_val, sw_val;
6086 if (nid >= 0x0f && nid < 0x11) {
6087 nid_vol = nid - 0x7;
6088 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6089 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6090 } else if (nid == 0x11) {
6091 nid_vol = nid - 0x7;
6092 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6093 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6094 } else if (nid >= 0x12 && nid <= 0x15) {
6096 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6097 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6101 if (!(*vol_bits & (1 << nid_vol))) {
6102 /* first control for the volume widget */
6103 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6106 *vol_bits |= (1 << nid_vol);
6108 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6114 /* add playback controls from the parsed DAC table */
6115 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6116 const struct auto_pin_cfg *cfg)
6122 spec->multiout.num_dacs = 1;
6123 spec->multiout.dac_nids = spec->private_dac_nids;
6124 spec->multiout.dac_nids[0] = 0x02;
6126 nid = cfg->line_out_pins[0];
6129 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6131 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6135 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6140 nid = cfg->speaker_pins[0];
6142 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6147 nid = cfg->hp_pins[0];
6149 err = alc260_add_playback_controls(spec, nid, "Headphone",
6157 /* create playback/capture controls for input pins */
6158 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6159 const struct auto_pin_cfg *cfg)
6161 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6164 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6165 hda_nid_t nid, int pin_type,
6168 alc_set_pin_output(codec, nid, pin_type);
6169 /* need the manual connection? */
6171 int idx = nid - 0x12;
6172 snd_hda_codec_write(codec, idx + 0x0b, 0,
6173 AC_VERB_SET_CONNECT_SEL, sel_idx);
6177 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6179 struct alc_spec *spec = codec->spec;
6182 nid = spec->autocfg.line_out_pins[0];
6184 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6185 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6188 nid = spec->autocfg.speaker_pins[0];
6190 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6192 nid = spec->autocfg.hp_pins[0];
6194 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6197 #define ALC260_PIN_CD_NID 0x16
6198 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6200 struct alc_spec *spec = codec->spec;
6203 for (i = 0; i < AUTO_PIN_LAST; i++) {
6204 hda_nid_t nid = spec->autocfg.input_pins[i];
6206 alc_set_input_pin(codec, nid, i);
6207 if (nid != ALC260_PIN_CD_NID &&
6208 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6209 snd_hda_codec_write(codec, nid, 0,
6210 AC_VERB_SET_AMP_GAIN_MUTE,
6217 * generic initialization of ADC, input mixers and output mixers
6219 static struct hda_verb alc260_volume_init_verbs[] = {
6221 * Unmute ADC0-1 and set the default input to mic-in
6223 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6224 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6225 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6226 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6228 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6230 * Note: PASD motherboards uses the Line In 2 as the input for
6231 * front panel mic (mic 2)
6233 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6234 /* mute analog inputs */
6235 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6236 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6237 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6239 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6242 * Set up output mixers (0x08 - 0x0a)
6244 /* set vol=0 to output mixers */
6245 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6246 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6247 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6248 /* set up input amps for analog loopback */
6249 /* Amp Indices: DAC = 0, mixer = 1 */
6250 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6251 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6252 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6253 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6254 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6255 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6260 static int alc260_parse_auto_config(struct hda_codec *codec)
6262 struct alc_spec *spec = codec->spec;
6264 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6266 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6270 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6273 if (!spec->kctls.list)
6274 return 0; /* can't find valid BIOS pin config */
6275 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6279 spec->multiout.max_channels = 2;
6281 if (spec->autocfg.dig_outs)
6282 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6283 if (spec->kctls.list)
6284 add_mixer(spec, spec->kctls.list);
6286 add_verb(spec, alc260_volume_init_verbs);
6288 spec->num_mux_defs = 1;
6289 spec->input_mux = &spec->private_imux[0];
6291 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6296 /* additional initialization for auto-configuration model */
6297 static void alc260_auto_init(struct hda_codec *codec)
6299 struct alc_spec *spec = codec->spec;
6300 alc260_auto_init_multi_out(codec);
6301 alc260_auto_init_analog_input(codec);
6302 if (spec->unsol_event)
6303 alc_inithook(codec);
6306 #ifdef CONFIG_SND_HDA_POWER_SAVE
6307 static struct hda_amp_list alc260_loopbacks[] = {
6308 { 0x07, HDA_INPUT, 0 },
6309 { 0x07, HDA_INPUT, 1 },
6310 { 0x07, HDA_INPUT, 2 },
6311 { 0x07, HDA_INPUT, 3 },
6312 { 0x07, HDA_INPUT, 4 },
6318 * ALC260 configurations
6320 static const char *alc260_models[ALC260_MODEL_LAST] = {
6321 [ALC260_BASIC] = "basic",
6323 [ALC260_HP_3013] = "hp-3013",
6324 [ALC260_HP_DC7600] = "hp-dc7600",
6325 [ALC260_FUJITSU_S702X] = "fujitsu",
6326 [ALC260_ACER] = "acer",
6327 [ALC260_WILL] = "will",
6328 [ALC260_REPLACER_672V] = "replacer",
6329 [ALC260_FAVORIT100] = "favorit100",
6330 #ifdef CONFIG_SND_DEBUG
6331 [ALC260_TEST] = "test",
6333 [ALC260_AUTO] = "auto",
6336 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6337 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6338 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6339 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6340 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6341 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6342 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6343 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6344 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6345 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6346 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6347 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6348 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6349 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6350 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6351 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6352 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6353 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6354 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6355 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6359 static struct alc_config_preset alc260_presets[] = {
6361 .mixers = { alc260_base_output_mixer,
6362 alc260_input_mixer },
6363 .init_verbs = { alc260_init_verbs },
6364 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6365 .dac_nids = alc260_dac_nids,
6366 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6367 .adc_nids = alc260_adc_nids,
6368 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6369 .channel_mode = alc260_modes,
6370 .input_mux = &alc260_capture_source,
6373 .mixers = { alc260_hp_output_mixer,
6374 alc260_input_mixer },
6375 .init_verbs = { alc260_init_verbs,
6376 alc260_hp_unsol_verbs },
6377 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6378 .dac_nids = alc260_dac_nids,
6379 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6380 .adc_nids = alc260_adc_nids_alt,
6381 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6382 .channel_mode = alc260_modes,
6383 .input_mux = &alc260_capture_source,
6384 .unsol_event = alc260_hp_unsol_event,
6385 .init_hook = alc260_hp_automute,
6387 [ALC260_HP_DC7600] = {
6388 .mixers = { alc260_hp_dc7600_mixer,
6389 alc260_input_mixer },
6390 .init_verbs = { alc260_init_verbs,
6391 alc260_hp_dc7600_verbs },
6392 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6393 .dac_nids = alc260_dac_nids,
6394 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6395 .adc_nids = alc260_adc_nids_alt,
6396 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6397 .channel_mode = alc260_modes,
6398 .input_mux = &alc260_capture_source,
6399 .unsol_event = alc260_hp_3012_unsol_event,
6400 .init_hook = alc260_hp_3012_automute,
6402 [ALC260_HP_3013] = {
6403 .mixers = { alc260_hp_3013_mixer,
6404 alc260_input_mixer },
6405 .init_verbs = { alc260_hp_3013_init_verbs,
6406 alc260_hp_3013_unsol_verbs },
6407 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6408 .dac_nids = alc260_dac_nids,
6409 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6410 .adc_nids = alc260_adc_nids_alt,
6411 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6412 .channel_mode = alc260_modes,
6413 .input_mux = &alc260_capture_source,
6414 .unsol_event = alc260_hp_3013_unsol_event,
6415 .init_hook = alc260_hp_3013_automute,
6417 [ALC260_FUJITSU_S702X] = {
6418 .mixers = { alc260_fujitsu_mixer },
6419 .init_verbs = { alc260_fujitsu_init_verbs },
6420 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6421 .dac_nids = alc260_dac_nids,
6422 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6423 .adc_nids = alc260_dual_adc_nids,
6424 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6425 .channel_mode = alc260_modes,
6426 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6427 .input_mux = alc260_fujitsu_capture_sources,
6430 .mixers = { alc260_acer_mixer },
6431 .init_verbs = { alc260_acer_init_verbs },
6432 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6433 .dac_nids = alc260_dac_nids,
6434 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6435 .adc_nids = alc260_dual_adc_nids,
6436 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6437 .channel_mode = alc260_modes,
6438 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6439 .input_mux = alc260_acer_capture_sources,
6441 [ALC260_FAVORIT100] = {
6442 .mixers = { alc260_favorit100_mixer },
6443 .init_verbs = { alc260_favorit100_init_verbs },
6444 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6445 .dac_nids = alc260_dac_nids,
6446 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6447 .adc_nids = alc260_dual_adc_nids,
6448 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6449 .channel_mode = alc260_modes,
6450 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6451 .input_mux = alc260_favorit100_capture_sources,
6454 .mixers = { alc260_will_mixer },
6455 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6456 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6457 .dac_nids = alc260_dac_nids,
6458 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6459 .adc_nids = alc260_adc_nids,
6460 .dig_out_nid = ALC260_DIGOUT_NID,
6461 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6462 .channel_mode = alc260_modes,
6463 .input_mux = &alc260_capture_source,
6465 [ALC260_REPLACER_672V] = {
6466 .mixers = { alc260_replacer_672v_mixer },
6467 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6468 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6469 .dac_nids = alc260_dac_nids,
6470 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6471 .adc_nids = alc260_adc_nids,
6472 .dig_out_nid = ALC260_DIGOUT_NID,
6473 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6474 .channel_mode = alc260_modes,
6475 .input_mux = &alc260_capture_source,
6476 .unsol_event = alc260_replacer_672v_unsol_event,
6477 .init_hook = alc260_replacer_672v_automute,
6479 #ifdef CONFIG_SND_DEBUG
6481 .mixers = { alc260_test_mixer },
6482 .init_verbs = { alc260_test_init_verbs },
6483 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6484 .dac_nids = alc260_test_dac_nids,
6485 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6486 .adc_nids = alc260_test_adc_nids,
6487 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6488 .channel_mode = alc260_modes,
6489 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6490 .input_mux = alc260_test_capture_sources,
6495 static int patch_alc260(struct hda_codec *codec)
6497 struct alc_spec *spec;
6498 int err, board_config;
6500 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6506 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6509 if (board_config < 0) {
6510 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6512 board_config = ALC260_AUTO;
6515 if (board_config == ALC260_AUTO) {
6516 /* automatic parse from the BIOS config */
6517 err = alc260_parse_auto_config(codec);
6523 "hda_codec: Cannot set up configuration "
6524 "from BIOS. Using base mode...\n");
6525 board_config = ALC260_BASIC;
6529 err = snd_hda_attach_beep_device(codec, 0x1);
6535 if (board_config != ALC260_AUTO)
6536 setup_preset(codec, &alc260_presets[board_config]);
6538 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6539 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6541 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6542 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6544 if (!spec->adc_nids && spec->input_mux) {
6545 /* check whether NID 0x04 is valid */
6546 unsigned int wcap = get_wcaps(codec, 0x04);
6547 wcap = get_wcaps_type(wcap);
6549 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6550 spec->adc_nids = alc260_adc_nids_alt;
6551 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6553 spec->adc_nids = alc260_adc_nids;
6554 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6557 set_capture_mixer(codec);
6558 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6560 spec->vmaster_nid = 0x08;
6562 codec->patch_ops = alc_patch_ops;
6563 if (board_config == ALC260_AUTO)
6564 spec->init_hook = alc260_auto_init;
6565 #ifdef CONFIG_SND_HDA_POWER_SAVE
6566 if (!spec->loopback.amplist)
6567 spec->loopback.amplist = alc260_loopbacks;
6569 codec->proc_widget_hook = print_realtek_coef;
6576 * ALC882/883/885/888/889 support
6578 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6579 * configuration. Each pin widget can choose any input DACs and a mixer.
6580 * Each ADC is connected from a mixer of all inputs. This makes possible
6581 * 6-channel independent captures.
6583 * In addition, an independent DAC for the multi-playback (not used in this
6586 #define ALC882_DIGOUT_NID 0x06
6587 #define ALC882_DIGIN_NID 0x0a
6588 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6589 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6590 #define ALC1200_DIGOUT_NID 0x10
6593 static struct hda_channel_mode alc882_ch_modes[1] = {
6598 static hda_nid_t alc882_dac_nids[4] = {
6599 /* front, rear, clfe, rear_surr */
6600 0x02, 0x03, 0x04, 0x05
6602 #define alc883_dac_nids alc882_dac_nids
6605 #define alc882_adc_nids alc880_adc_nids
6606 #define alc882_adc_nids_alt alc880_adc_nids_alt
6607 #define alc883_adc_nids alc882_adc_nids_alt
6608 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6609 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6610 #define alc889_adc_nids alc880_adc_nids
6612 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6613 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6614 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6615 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6616 #define alc889_capsrc_nids alc882_capsrc_nids
6619 /* FIXME: should be a matrix-type input source selection */
6621 static struct hda_input_mux alc882_capture_source = {
6625 { "Front Mic", 0x1 },
6631 #define alc883_capture_source alc882_capture_source
6633 static struct hda_input_mux alc889_capture_source = {
6636 { "Front Mic", 0x0 },
6642 static struct hda_input_mux mb5_capture_source = {
6651 static struct hda_input_mux alc883_3stack_6ch_intel = {
6655 { "Front Mic", 0x0 },
6661 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6669 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6679 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6687 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6691 { "Front Mic", 0x1 },
6696 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6704 static struct hda_input_mux alc889A_mb31_capture_source = {
6708 /* Front Mic (0x01) unused */
6710 /* Line 2 (0x03) unused */
6711 /* CD (0x04) unused? */
6718 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6725 static struct hda_verb alc882_3ST_ch2_init[] = {
6726 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6727 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6728 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6729 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6736 static struct hda_verb alc882_3ST_ch4_init[] = {
6737 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6738 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6739 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6740 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6741 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6748 static struct hda_verb alc882_3ST_ch6_init[] = {
6749 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6750 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6751 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6752 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6753 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6754 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6758 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6759 { 2, alc882_3ST_ch2_init },
6760 { 4, alc882_3ST_ch4_init },
6761 { 6, alc882_3ST_ch6_init },
6764 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6769 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6770 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6771 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6772 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6773 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6774 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6781 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6782 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6783 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6784 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6785 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6786 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6787 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6794 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6795 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6796 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6797 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6798 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6799 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6800 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6801 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6805 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6806 { 2, alc883_3ST_ch2_clevo_init },
6807 { 4, alc883_3ST_ch4_clevo_init },
6808 { 6, alc883_3ST_ch6_clevo_init },
6815 static struct hda_verb alc882_sixstack_ch6_init[] = {
6816 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6817 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6818 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6819 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6826 static struct hda_verb alc882_sixstack_ch8_init[] = {
6827 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6828 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6829 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6830 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6834 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6835 { 6, alc882_sixstack_ch6_init },
6836 { 8, alc882_sixstack_ch8_init },
6840 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6846 static struct hda_verb alc885_mbp_ch2_init[] = {
6847 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6848 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6849 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6856 static struct hda_verb alc885_mbp_ch4_init[] = {
6857 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6858 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6859 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6860 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6861 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6865 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6866 { 2, alc885_mbp_ch2_init },
6867 { 4, alc885_mbp_ch4_init },
6872 * Speakers/Woofer/HP = Front
6875 static struct hda_verb alc885_mb5_ch2_init[] = {
6876 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6877 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6883 * Speakers/HP = Front
6887 static struct hda_verb alc885_mb5_ch6_init[] = {
6888 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6889 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6890 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6894 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6895 { 2, alc885_mb5_ch2_init },
6896 { 6, alc885_mb5_ch6_init },
6903 static struct hda_verb alc883_4ST_ch2_init[] = {
6904 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6905 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6906 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6907 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6908 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6909 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6916 static struct hda_verb alc883_4ST_ch4_init[] = {
6917 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6918 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6919 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6920 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6921 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6922 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6923 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6930 static struct hda_verb alc883_4ST_ch6_init[] = {
6931 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6932 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6933 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6934 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6935 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6936 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6937 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6938 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6945 static struct hda_verb alc883_4ST_ch8_init[] = {
6946 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6947 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6948 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6949 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6950 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6951 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6952 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6953 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6954 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6958 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6959 { 2, alc883_4ST_ch2_init },
6960 { 4, alc883_4ST_ch4_init },
6961 { 6, alc883_4ST_ch6_init },
6962 { 8, alc883_4ST_ch8_init },
6969 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6970 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6971 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6972 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6973 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6980 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6981 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6982 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6983 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6984 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6985 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6992 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6993 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6994 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6995 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6996 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6997 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6998 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7002 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7003 { 2, alc883_3ST_ch2_intel_init },
7004 { 4, alc883_3ST_ch4_intel_init },
7005 { 6, alc883_3ST_ch6_intel_init },
7011 static struct hda_verb alc889_ch2_intel_init[] = {
7012 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7013 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7014 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7015 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7016 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7017 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7024 static struct hda_verb alc889_ch6_intel_init[] = {
7025 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7026 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7027 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7028 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7029 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7030 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7037 static struct hda_verb alc889_ch8_intel_init[] = {
7038 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7039 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7040 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7041 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7042 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7043 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7044 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7048 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7049 { 2, alc889_ch2_intel_init },
7050 { 6, alc889_ch6_intel_init },
7051 { 8, alc889_ch8_intel_init },
7057 static struct hda_verb alc883_sixstack_ch6_init[] = {
7058 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7059 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7060 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7061 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7068 static struct hda_verb alc883_sixstack_ch8_init[] = {
7069 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7070 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7071 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7072 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7076 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7077 { 6, alc883_sixstack_ch6_init },
7078 { 8, alc883_sixstack_ch8_init },
7082 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7083 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7085 static struct snd_kcontrol_new alc882_base_mixer[] = {
7086 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7087 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7088 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7089 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7090 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7091 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7092 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7093 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7094 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7095 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7096 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7097 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7098 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7100 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7102 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7103 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7104 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7105 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7106 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7110 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7111 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7112 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7113 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7114 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7115 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7116 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7117 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7118 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7119 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7120 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7121 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7125 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7126 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7127 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7128 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7129 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7130 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7131 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7132 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7133 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
7134 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7135 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7136 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7137 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7138 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7139 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7143 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7144 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7145 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7146 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7147 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7148 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7149 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7150 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7151 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7152 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7157 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7158 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7159 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7160 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7161 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7162 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7163 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7164 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7165 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7166 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7170 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7171 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7172 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7173 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7174 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7175 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7176 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7177 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7178 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7179 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7180 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7181 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7182 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7183 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7187 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7188 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7190 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7191 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7192 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7193 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7194 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7195 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7196 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7197 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7198 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7199 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7200 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7202 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7203 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7207 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7208 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7209 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7210 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7211 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7212 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7213 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7214 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7216 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7217 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7221 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7223 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7224 .name = "Channel Mode",
7225 .info = alc_ch_mode_info,
7226 .get = alc_ch_mode_get,
7227 .put = alc_ch_mode_put,
7232 static struct hda_verb alc882_base_init_verbs[] = {
7233 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7234 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7235 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7236 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7238 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7239 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7240 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7242 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7243 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7244 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7246 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7247 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7248 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7250 /* mute analog input loopbacks */
7251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7254 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7255 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7257 /* Front Pin: output 0 (0x0c) */
7258 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7259 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7260 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7261 /* Rear Pin: output 1 (0x0d) */
7262 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7263 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7264 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7265 /* CLFE Pin: output 2 (0x0e) */
7266 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7267 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7268 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7269 /* Side Pin: output 3 (0x0f) */
7270 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7271 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7272 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7273 /* Mic (rear) pin: input vref at 80% */
7274 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7275 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7276 /* Front Mic pin: input vref at 80% */
7277 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7278 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7279 /* Line In pin: input */
7280 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7281 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7282 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7283 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7284 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7285 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7286 /* CD pin widget for input */
7287 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7289 /* FIXME: use matrix-type input source selection */
7290 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7292 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7293 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7294 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7295 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7297 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7298 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7299 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7300 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7301 /* ADC2: mute amp left and right */
7302 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7303 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7304 /* ADC3: mute amp left and right */
7305 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7306 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7311 static struct hda_verb alc882_adc1_init_verbs[] = {
7312 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7313 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7314 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7315 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7316 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7317 /* ADC1: mute amp left and right */
7318 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7319 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7323 static struct hda_verb alc882_eapd_verbs[] = {
7324 /* change to EAPD mode */
7325 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7326 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7330 static struct hda_verb alc889_eapd_verbs[] = {
7331 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7332 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7336 static struct hda_verb alc_hp15_unsol_verbs[] = {
7337 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7338 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7342 static struct hda_verb alc885_init_verbs[] = {
7343 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7345 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7346 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7348 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7349 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7350 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7352 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7353 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7354 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7356 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7357 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7358 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7360 /* mute analog input loopbacks */
7361 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7362 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7363 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7365 /* Front HP Pin: output 0 (0x0c) */
7366 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7367 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7368 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7369 /* Front Pin: output 0 (0x0c) */
7370 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7371 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7372 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7373 /* Rear Pin: output 1 (0x0d) */
7374 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7375 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7376 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7377 /* CLFE Pin: output 2 (0x0e) */
7378 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7379 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7380 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7381 /* Side Pin: output 3 (0x0f) */
7382 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7383 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7384 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7385 /* Mic (rear) pin: input vref at 80% */
7386 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7387 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7388 /* Front Mic pin: input vref at 80% */
7389 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7390 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7391 /* Line In pin: input */
7392 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7393 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7395 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7397 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7398 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7401 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7402 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7403 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7405 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7406 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7407 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7408 /* ADC2: mute amp left and right */
7409 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7410 /* ADC3: mute amp left and right */
7411 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7416 static struct hda_verb alc885_init_input_verbs[] = {
7417 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7418 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7424 /* Unmute Selector 24h and set the default input to front mic */
7425 static struct hda_verb alc889_init_input_verbs[] = {
7426 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7427 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7432 #define alc883_init_verbs alc882_base_init_verbs
7435 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7436 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7437 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7438 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7439 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7440 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7441 /* FIXME: this looks suspicious...
7442 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7443 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7448 static struct hda_verb alc882_macpro_init_verbs[] = {
7449 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7450 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7451 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7452 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7453 /* Front Pin: output 0 (0x0c) */
7454 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7455 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7456 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7457 /* Front Mic pin: input vref at 80% */
7458 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7459 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7460 /* Speaker: output */
7461 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7462 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7463 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7464 /* Headphone output (output 0 - 0x0c) */
7465 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7466 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7467 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7469 /* FIXME: use matrix-type input source selection */
7470 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7471 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7472 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7473 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7474 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7475 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7477 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7478 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7479 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7480 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7484 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7485 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7486 /* ADC1: mute amp left and right */
7487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7488 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7489 /* ADC2: mute amp left and right */
7490 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7491 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7492 /* ADC3: mute amp left and right */
7493 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7494 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7500 static struct hda_verb alc885_mb5_init_verbs[] = {
7502 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7503 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7504 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7505 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7507 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7509 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7510 /* Surround mixer */
7511 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7512 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7513 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7515 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7516 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7517 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7519 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7520 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7521 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7522 /* Front Pin (0x0c) */
7523 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7524 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7525 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7526 /* LFE Pin (0x0e) */
7527 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7528 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7529 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7531 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7532 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7533 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7534 /* Front Mic pin: input vref at 80% */
7535 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7536 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7538 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7539 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7541 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7542 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7543 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7544 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7548 /* Macbook Pro rev3 */
7549 static struct hda_verb alc885_mbp3_init_verbs[] = {
7550 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7551 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7552 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7555 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7556 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7557 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7559 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7560 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7561 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7562 /* Front Pin: output 0 (0x0c) */
7563 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7564 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7565 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7566 /* HP Pin: output 0 (0x0e) */
7567 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7568 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7569 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7570 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7571 /* Mic (rear) pin: input vref at 80% */
7572 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7573 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7574 /* Front Mic pin: input vref at 80% */
7575 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7576 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7577 /* Line In pin: use output 1 when in LineOut mode */
7578 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7579 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7580 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7582 /* FIXME: use matrix-type input source selection */
7583 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7584 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7585 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7586 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7587 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7588 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7590 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7591 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7592 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7593 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7595 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7596 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7598 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7599 /* ADC1: mute amp left and right */
7600 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7601 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7602 /* ADC2: mute amp left and right */
7603 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7604 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7605 /* ADC3: mute amp left and right */
7606 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7607 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7613 static struct hda_verb alc885_imac91_init_verbs[] = {
7614 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7615 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7616 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7619 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7620 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7621 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7622 /* HP Pin: output 0 (0x0c) */
7623 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7624 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7625 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7626 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7627 /* Internal Speakers: output 0 (0x0d) */
7628 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7629 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7630 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7631 /* Mic (rear) pin: input vref at 80% */
7632 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7633 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7634 /* Front Mic pin: input vref at 80% */
7635 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7636 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7637 /* Line In pin: use output 1 when in LineOut mode */
7638 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7639 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7640 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7642 /* FIXME: use matrix-type input source selection */
7643 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7644 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7645 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7646 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7647 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7648 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7650 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7651 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7653 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7657 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7658 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7659 /* ADC1: mute amp left and right */
7660 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7661 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7662 /* ADC2: mute amp left and right */
7663 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7664 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7665 /* ADC3: mute amp left and right */
7666 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7667 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7672 /* iMac 24 mixer. */
7673 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7674 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7675 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7679 /* iMac 24 init verbs. */
7680 static struct hda_verb alc885_imac24_init_verbs[] = {
7681 /* Internal speakers: output 0 (0x0c) */
7682 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7683 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7684 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7685 /* Internal speakers: output 0 (0x0c) */
7686 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7687 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7688 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7689 /* Headphone: output 0 (0x0c) */
7690 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7691 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7692 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7693 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7694 /* Front Mic: input vref at 80% */
7695 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7696 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7700 /* Toggle speaker-output according to the hp-jack state */
7701 static void alc885_imac24_setup(struct hda_codec *codec)
7703 struct alc_spec *spec = codec->spec;
7705 spec->autocfg.hp_pins[0] = 0x14;
7706 spec->autocfg.speaker_pins[0] = 0x18;
7707 spec->autocfg.speaker_pins[1] = 0x1a;
7710 static void alc885_mbp3_setup(struct hda_codec *codec)
7712 struct alc_spec *spec = codec->spec;
7714 spec->autocfg.hp_pins[0] = 0x15;
7715 spec->autocfg.speaker_pins[0] = 0x14;
7718 static void alc885_imac91_automute(struct hda_codec *codec)
7720 unsigned int present;
7722 present = snd_hda_codec_read(codec, 0x14, 0,
7723 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7724 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7725 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7726 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7727 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7731 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7734 /* Headphone insertion or removal. */
7735 if ((res >> 26) == ALC880_HP_EVENT)
7736 alc885_imac91_automute(codec);
7739 static struct hda_verb alc882_targa_verbs[] = {
7740 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7741 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7743 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7744 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7746 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7747 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7748 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7750 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7754 /* toggle speaker-output according to the hp-jack state */
7755 static void alc882_targa_automute(struct hda_codec *codec)
7757 struct alc_spec *spec = codec->spec;
7758 alc_automute_amp(codec);
7759 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7760 spec->jack_present ? 1 : 3);
7763 static void alc882_targa_setup(struct hda_codec *codec)
7765 struct alc_spec *spec = codec->spec;
7767 spec->autocfg.hp_pins[0] = 0x14;
7768 spec->autocfg.speaker_pins[0] = 0x1b;
7771 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7773 if ((res >> 26) == ALC880_HP_EVENT)
7774 alc882_targa_automute(codec);
7777 static struct hda_verb alc882_asus_a7j_verbs[] = {
7778 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7779 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7781 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7782 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7783 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7785 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7786 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7787 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7789 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7790 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7791 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7795 static struct hda_verb alc882_asus_a7m_verbs[] = {
7796 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7797 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7799 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7800 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7801 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7803 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7804 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7805 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7807 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7808 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7809 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7813 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7815 unsigned int gpiostate, gpiomask, gpiodir;
7817 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7818 AC_VERB_GET_GPIO_DATA, 0);
7821 gpiostate |= (1 << pin);
7823 gpiostate &= ~(1 << pin);
7825 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7826 AC_VERB_GET_GPIO_MASK, 0);
7827 gpiomask |= (1 << pin);
7829 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7830 AC_VERB_GET_GPIO_DIRECTION, 0);
7831 gpiodir |= (1 << pin);
7834 snd_hda_codec_write(codec, codec->afg, 0,
7835 AC_VERB_SET_GPIO_MASK, gpiomask);
7836 snd_hda_codec_write(codec, codec->afg, 0,
7837 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7841 snd_hda_codec_write(codec, codec->afg, 0,
7842 AC_VERB_SET_GPIO_DATA, gpiostate);
7845 /* set up GPIO at initialization */
7846 static void alc885_macpro_init_hook(struct hda_codec *codec)
7848 alc882_gpio_mute(codec, 0, 0);
7849 alc882_gpio_mute(codec, 1, 0);
7852 /* set up GPIO and update auto-muting at initialization */
7853 static void alc885_imac24_init_hook(struct hda_codec *codec)
7855 alc885_macpro_init_hook(codec);
7856 alc_automute_amp(codec);
7860 * generic initialization of ADC, input mixers and output mixers
7862 static struct hda_verb alc883_auto_init_verbs[] = {
7864 * Unmute ADC0-2 and set the default input to mic-in
7866 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7867 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7868 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7869 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7871 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7873 * Note: PASD motherboards uses the Line In 2 as the input for
7874 * front panel mic (mic 2)
7876 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7877 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7878 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7879 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7881 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7884 * Set up output mixers (0x0c - 0x0f)
7886 /* set vol=0 to output mixers */
7887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7888 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7889 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7890 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7891 /* set up input amps for analog loopback */
7892 /* Amp Indices: DAC = 0, mixer = 1 */
7893 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7894 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7895 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7896 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7897 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7898 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7899 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7900 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7901 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7902 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7904 /* FIXME: use matrix-type input source selection */
7905 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7907 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7908 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7909 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7910 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7912 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7913 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7914 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7915 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7920 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7921 static struct hda_verb alc889A_mb31_ch2_init[] = {
7922 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7923 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7924 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7925 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7929 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7930 static struct hda_verb alc889A_mb31_ch4_init[] = {
7931 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7932 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7933 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7934 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7938 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7939 static struct hda_verb alc889A_mb31_ch5_init[] = {
7940 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7941 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7942 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7943 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7947 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7948 static struct hda_verb alc889A_mb31_ch6_init[] = {
7949 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7950 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7951 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7952 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7956 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7957 { 2, alc889A_mb31_ch2_init },
7958 { 4, alc889A_mb31_ch4_init },
7959 { 5, alc889A_mb31_ch5_init },
7960 { 6, alc889A_mb31_ch6_init },
7963 static struct hda_verb alc883_medion_eapd_verbs[] = {
7964 /* eanable EAPD on medion laptop */
7965 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7966 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7970 #define alc883_base_mixer alc882_base_mixer
7972 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7973 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7974 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7975 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7976 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7977 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7978 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7979 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7980 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7981 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7982 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7983 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7984 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7985 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7989 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7990 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7991 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7992 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7993 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7994 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7995 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7996 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7997 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7998 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7999 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8003 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8004 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8005 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8006 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8007 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8008 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8009 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8010 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8011 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8012 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8013 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8017 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8018 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8019 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8020 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8021 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8022 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8023 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8024 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8025 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8026 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8027 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8028 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8029 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8030 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8034 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8035 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8036 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8037 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8038 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8039 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8040 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8041 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8042 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8043 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8044 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8045 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8046 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8047 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8048 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8049 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8050 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8051 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8052 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8053 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8057 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8058 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8059 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8060 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8061 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8062 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8064 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8065 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8066 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8067 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8068 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8069 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8070 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8071 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8072 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8073 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8074 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8075 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8076 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8077 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8081 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8082 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8083 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8084 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8085 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8086 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8088 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8089 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8090 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8091 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8092 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8093 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8094 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8095 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8096 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8097 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8098 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8099 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8100 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8101 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8105 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8106 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8107 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8108 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8109 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8110 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8111 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8112 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8113 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8114 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8115 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8116 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8117 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8118 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8120 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8121 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8122 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8123 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8124 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8128 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8129 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8130 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8131 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8132 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8133 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8134 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8135 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8136 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8137 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8138 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8139 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8140 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8141 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8142 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8143 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8144 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8145 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8149 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8150 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8151 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8152 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8153 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8154 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8155 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8156 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8157 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8158 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8159 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8160 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8161 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8165 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8166 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8167 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8168 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8169 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8170 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8174 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8175 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8176 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8177 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8178 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8179 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8180 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8181 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8182 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8186 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8187 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8188 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8189 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8190 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8191 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8192 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8193 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8194 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8195 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8199 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8200 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8201 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8202 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8203 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8204 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8205 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8206 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8207 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8208 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8212 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8213 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8214 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8215 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8216 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8217 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8218 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8219 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8220 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8224 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8225 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8226 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8227 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8228 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8229 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8230 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8231 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8232 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8234 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8239 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8240 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8241 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8242 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8243 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8244 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8245 0x0d, 1, 0x0, HDA_OUTPUT),
8246 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8247 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8248 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8249 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8250 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8251 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8252 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8253 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8254 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8255 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8256 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8257 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8258 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8259 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8260 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8264 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8266 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8267 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8268 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8269 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8270 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8272 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8273 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8274 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8275 /* Output switches */
8276 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8277 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8278 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8280 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8281 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8283 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8284 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8285 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8286 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8290 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8291 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8292 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8293 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8294 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8295 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8296 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8300 static struct hda_bind_ctls alc883_bind_cap_vol = {
8301 .ops = &snd_hda_bind_vol,
8303 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8304 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8309 static struct hda_bind_ctls alc883_bind_cap_switch = {
8310 .ops = &snd_hda_bind_sw,
8312 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8313 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8318 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8319 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8320 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8321 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8322 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8323 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8324 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8325 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8326 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8330 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8331 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8332 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8334 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8335 /* .name = "Capture Source", */
8336 .name = "Input Source",
8338 .info = alc_mux_enum_info,
8339 .get = alc_mux_enum_get,
8340 .put = alc_mux_enum_put,
8345 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8347 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8348 .name = "Channel Mode",
8349 .info = alc_ch_mode_info,
8350 .get = alc_ch_mode_get,
8351 .put = alc_ch_mode_put,
8356 /* toggle speaker-output according to the hp-jack state */
8357 static void alc883_mitac_setup(struct hda_codec *codec)
8359 struct alc_spec *spec = codec->spec;
8361 spec->autocfg.hp_pins[0] = 0x15;
8362 spec->autocfg.speaker_pins[0] = 0x14;
8363 spec->autocfg.speaker_pins[1] = 0x17;
8366 /* auto-toggle front mic */
8368 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8370 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8372 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8376 static struct hda_verb alc883_mitac_verbs[] = {
8378 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8381 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8382 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8384 /* enable unsolicited event */
8385 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8386 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8391 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8393 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8394 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8396 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8398 /* enable unsolicited event */
8400 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8401 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8407 static struct hda_verb alc883_clevo_m720_verbs[] = {
8409 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8410 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8412 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8413 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8415 /* enable unsolicited event */
8416 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8417 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8422 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8424 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8425 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8427 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8428 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8430 /* enable unsolicited event */
8431 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8436 static struct hda_verb alc883_targa_verbs[] = {
8437 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8438 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8440 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8441 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8443 /* Connect Line-Out side jack (SPDIF) to Side */
8444 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8445 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8446 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8447 /* Connect Mic jack to CLFE */
8448 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8449 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8450 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8451 /* Connect Line-in jack to Surround */
8452 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8453 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8454 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8455 /* Connect HP out jack to Front */
8456 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8457 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8458 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8460 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8465 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8466 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8467 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8468 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8472 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8473 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8474 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8475 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8476 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8480 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8481 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8482 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8483 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8484 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8485 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8489 static struct hda_verb alc883_haier_w66_verbs[] = {
8490 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8491 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8493 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8495 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8496 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8497 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8498 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8502 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8504 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8505 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8506 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8507 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8508 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8509 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8510 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8514 static struct hda_verb alc888_6st_dell_verbs[] = {
8515 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8519 static struct hda_verb alc883_vaiott_verbs[] = {
8521 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8522 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8524 /* enable unsolicited event */
8525 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8530 static void alc888_3st_hp_setup(struct hda_codec *codec)
8532 struct alc_spec *spec = codec->spec;
8534 spec->autocfg.hp_pins[0] = 0x1b;
8535 spec->autocfg.speaker_pins[0] = 0x14;
8536 spec->autocfg.speaker_pins[1] = 0x16;
8537 spec->autocfg.speaker_pins[2] = 0x18;
8540 static struct hda_verb alc888_3st_hp_verbs[] = {
8541 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8542 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8543 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8544 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8551 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8552 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8553 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8554 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8555 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8562 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8563 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8564 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8565 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8566 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8567 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8574 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8575 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8576 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8577 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8578 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8579 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8580 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8584 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8585 { 2, alc888_3st_hp_2ch_init },
8586 { 4, alc888_3st_hp_4ch_init },
8587 { 6, alc888_3st_hp_6ch_init },
8590 /* toggle front-jack and RCA according to the hp-jack state */
8591 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8593 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8595 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8596 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8597 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8598 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8601 /* toggle RCA according to the front-jack state */
8602 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8604 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8606 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8607 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8610 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8613 if ((res >> 26) == ALC880_HP_EVENT)
8614 alc888_lenovo_ms7195_front_automute(codec);
8615 if ((res >> 26) == ALC880_FRONT_EVENT)
8616 alc888_lenovo_ms7195_rca_automute(codec);
8619 static struct hda_verb alc883_medion_md2_verbs[] = {
8620 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8623 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8625 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8629 /* toggle speaker-output according to the hp-jack state */
8630 static void alc883_medion_md2_setup(struct hda_codec *codec)
8632 struct alc_spec *spec = codec->spec;
8634 spec->autocfg.hp_pins[0] = 0x14;
8635 spec->autocfg.speaker_pins[0] = 0x15;
8638 /* toggle speaker-output according to the hp-jack state */
8639 #define alc883_targa_init_hook alc882_targa_init_hook
8640 #define alc883_targa_unsol_event alc882_targa_unsol_event
8642 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8644 unsigned int present;
8646 present = snd_hda_jack_detect(codec, 0x18);
8647 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8648 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8651 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8653 struct alc_spec *spec = codec->spec;
8655 spec->autocfg.hp_pins[0] = 0x15;
8656 spec->autocfg.speaker_pins[0] = 0x14;
8659 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8661 alc_automute_amp(codec);
8662 alc883_clevo_m720_mic_automute(codec);
8665 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8668 switch (res >> 26) {
8669 case ALC880_MIC_EVENT:
8670 alc883_clevo_m720_mic_automute(codec);
8673 alc_automute_amp_unsol_event(codec, res);
8678 /* toggle speaker-output according to the hp-jack state */
8679 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8681 struct alc_spec *spec = codec->spec;
8683 spec->autocfg.hp_pins[0] = 0x14;
8684 spec->autocfg.speaker_pins[0] = 0x15;
8687 static void alc883_haier_w66_setup(struct hda_codec *codec)
8689 struct alc_spec *spec = codec->spec;
8691 spec->autocfg.hp_pins[0] = 0x1b;
8692 spec->autocfg.speaker_pins[0] = 0x14;
8695 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8697 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8699 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8700 HDA_AMP_MUTE, bits);
8703 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8705 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8707 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8708 HDA_AMP_MUTE, bits);
8709 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8710 HDA_AMP_MUTE, bits);
8713 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8716 if ((res >> 26) == ALC880_HP_EVENT)
8717 alc883_lenovo_101e_all_automute(codec);
8718 if ((res >> 26) == ALC880_FRONT_EVENT)
8719 alc883_lenovo_101e_ispeaker_automute(codec);
8722 /* toggle speaker-output according to the hp-jack state */
8723 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8725 struct alc_spec *spec = codec->spec;
8727 spec->autocfg.hp_pins[0] = 0x14;
8728 spec->autocfg.speaker_pins[0] = 0x15;
8729 spec->autocfg.speaker_pins[1] = 0x16;
8732 static struct hda_verb alc883_acer_eapd_verbs[] = {
8733 /* HP Pin: output 0 (0x0c) */
8734 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8735 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8736 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8737 /* Front Pin: output 0 (0x0c) */
8738 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8739 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8740 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8741 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8742 /* eanable EAPD on medion laptop */
8743 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8744 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8745 /* enable unsolicited event */
8746 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8750 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8751 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8752 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8753 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8757 static void alc888_6st_dell_setup(struct hda_codec *codec)
8759 struct alc_spec *spec = codec->spec;
8761 spec->autocfg.hp_pins[0] = 0x1b;
8762 spec->autocfg.speaker_pins[0] = 0x14;
8763 spec->autocfg.speaker_pins[1] = 0x15;
8764 spec->autocfg.speaker_pins[2] = 0x16;
8765 spec->autocfg.speaker_pins[3] = 0x17;
8768 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8770 struct alc_spec *spec = codec->spec;
8772 spec->autocfg.hp_pins[0] = 0x1b;
8773 spec->autocfg.speaker_pins[0] = 0x14;
8774 spec->autocfg.speaker_pins[1] = 0x15;
8775 spec->autocfg.speaker_pins[2] = 0x16;
8776 spec->autocfg.speaker_pins[3] = 0x17;
8777 spec->autocfg.speaker_pins[4] = 0x1a;
8780 static void alc883_vaiott_setup(struct hda_codec *codec)
8782 struct alc_spec *spec = codec->spec;
8784 spec->autocfg.hp_pins[0] = 0x15;
8785 spec->autocfg.speaker_pins[0] = 0x14;
8786 spec->autocfg.speaker_pins[1] = 0x17;
8789 static struct hda_verb alc888_asus_m90v_verbs[] = {
8790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8791 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8792 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8793 /* enable unsolicited event */
8794 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8795 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8799 static void alc883_mode2_setup(struct hda_codec *codec)
8801 struct alc_spec *spec = codec->spec;
8803 spec->autocfg.hp_pins[0] = 0x1b;
8804 spec->autocfg.speaker_pins[0] = 0x14;
8805 spec->autocfg.speaker_pins[1] = 0x15;
8806 spec->autocfg.speaker_pins[2] = 0x16;
8807 spec->ext_mic.pin = 0x18;
8808 spec->int_mic.pin = 0x19;
8809 spec->ext_mic.mux_idx = 0;
8810 spec->int_mic.mux_idx = 1;
8814 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8815 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8816 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8817 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8818 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8819 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8820 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8821 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8822 /* enable unsolicited event */
8823 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8827 static void alc883_eee1601_inithook(struct hda_codec *codec)
8829 struct alc_spec *spec = codec->spec;
8831 spec->autocfg.hp_pins[0] = 0x14;
8832 spec->autocfg.speaker_pins[0] = 0x1b;
8833 alc_automute_pin(codec);
8836 static struct hda_verb alc889A_mb31_verbs[] = {
8837 /* Init rear pin (used as headphone output) */
8838 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8839 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8840 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8841 /* Init line pin (used as output in 4ch and 6ch mode) */
8842 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8843 /* Init line 2 pin (used as headphone out by default) */
8844 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8845 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8849 /* Mute speakers according to the headphone jack state */
8850 static void alc889A_mb31_automute(struct hda_codec *codec)
8852 unsigned int present;
8854 /* Mute only in 2ch or 4ch mode */
8855 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8857 present = snd_hda_jack_detect(codec, 0x15);
8858 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8859 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8860 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8861 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8865 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8867 if ((res >> 26) == ALC880_HP_EVENT)
8868 alc889A_mb31_automute(codec);
8872 #ifdef CONFIG_SND_HDA_POWER_SAVE
8873 #define alc882_loopbacks alc880_loopbacks
8876 /* pcm configuration: identical with ALC880 */
8877 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8878 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8879 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8880 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8882 static hda_nid_t alc883_slave_dig_outs[] = {
8883 ALC1200_DIGOUT_NID, 0,
8886 static hda_nid_t alc1200_slave_dig_outs[] = {
8887 ALC883_DIGOUT_NID, 0,
8891 * configuration and preset
8893 static const char *alc882_models[ALC882_MODEL_LAST] = {
8894 [ALC882_3ST_DIG] = "3stack-dig",
8895 [ALC882_6ST_DIG] = "6stack-dig",
8896 [ALC882_ARIMA] = "arima",
8897 [ALC882_W2JC] = "w2jc",
8898 [ALC882_TARGA] = "targa",
8899 [ALC882_ASUS_A7J] = "asus-a7j",
8900 [ALC882_ASUS_A7M] = "asus-a7m",
8901 [ALC885_MACPRO] = "macpro",
8902 [ALC885_MB5] = "mb5",
8903 [ALC885_MBP3] = "mbp3",
8904 [ALC885_IMAC24] = "imac24",
8905 [ALC885_IMAC91] = "imac91",
8906 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8907 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8908 [ALC883_3ST_6ch] = "3stack-6ch",
8909 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8910 [ALC883_TARGA_DIG] = "targa-dig",
8911 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8912 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8913 [ALC883_ACER] = "acer",
8914 [ALC883_ACER_ASPIRE] = "acer-aspire",
8915 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8916 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8917 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8918 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8919 [ALC883_MEDION] = "medion",
8920 [ALC883_MEDION_MD2] = "medion-md2",
8921 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8922 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8923 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8924 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8925 [ALC888_LENOVO_SKY] = "lenovo-sky",
8926 [ALC883_HAIER_W66] = "haier-w66",
8927 [ALC888_3ST_HP] = "3stack-hp",
8928 [ALC888_6ST_DELL] = "6stack-dell",
8929 [ALC883_MITAC] = "mitac",
8930 [ALC883_CLEVO_M540R] = "clevo-m540r",
8931 [ALC883_CLEVO_M720] = "clevo-m720",
8932 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8933 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8934 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8935 [ALC889A_INTEL] = "intel-alc889a",
8936 [ALC889_INTEL] = "intel-x58",
8937 [ALC1200_ASUS_P5Q] = "asus-p5q",
8938 [ALC889A_MB31] = "mb31",
8939 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8940 [ALC882_AUTO] = "auto",
8943 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8944 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8946 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8947 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8948 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8949 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8950 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8951 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8952 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8953 ALC888_ACER_ASPIRE_4930G),
8954 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8955 ALC888_ACER_ASPIRE_4930G),
8956 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8957 ALC888_ACER_ASPIRE_8930G),
8958 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8959 ALC888_ACER_ASPIRE_8930G),
8960 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8961 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8962 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8963 ALC888_ACER_ASPIRE_6530G),
8964 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8965 ALC888_ACER_ASPIRE_6530G),
8966 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
8967 ALC888_ACER_ASPIRE_7730G),
8968 /* default Acer -- disabled as it causes more problems.
8969 * model=auto should work fine now
8971 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8973 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8975 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8976 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8977 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8978 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8979 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8980 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8982 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8983 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8984 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8985 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8986 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8987 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8988 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8989 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8990 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8991 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8992 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8994 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8995 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8996 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8997 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8998 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8999 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9000 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9001 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9002 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9004 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9005 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9006 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9007 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9008 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
9009 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9010 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9011 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9012 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9013 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9014 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9015 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9016 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9017 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9018 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9019 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9020 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9021 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9022 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9023 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9024 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9025 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9026 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9027 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9028 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9029 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9030 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9031 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9032 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9034 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9035 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9036 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9037 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9038 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9039 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9040 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9041 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9042 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9043 ALC883_FUJITSU_PI2515),
9044 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9045 ALC888_FUJITSU_XA3530),
9046 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9047 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9048 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9049 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9050 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9051 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9052 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9053 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9054 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9056 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9057 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9058 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9059 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9060 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9061 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9062 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9067 /* codec SSID table for Intel Mac */
9068 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9069 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9070 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9071 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9072 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9073 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9074 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9075 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9076 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9077 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9078 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9079 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9080 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9081 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9082 * so apparently no perfect solution yet
9084 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9085 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9089 static struct alc_config_preset alc882_presets[] = {
9090 [ALC882_3ST_DIG] = {
9091 .mixers = { alc882_base_mixer },
9092 .init_verbs = { alc882_base_init_verbs,
9093 alc882_adc1_init_verbs },
9094 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9095 .dac_nids = alc882_dac_nids,
9096 .dig_out_nid = ALC882_DIGOUT_NID,
9097 .dig_in_nid = ALC882_DIGIN_NID,
9098 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9099 .channel_mode = alc882_ch_modes,
9101 .input_mux = &alc882_capture_source,
9103 [ALC882_6ST_DIG] = {
9104 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9105 .init_verbs = { alc882_base_init_verbs,
9106 alc882_adc1_init_verbs },
9107 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9108 .dac_nids = alc882_dac_nids,
9109 .dig_out_nid = ALC882_DIGOUT_NID,
9110 .dig_in_nid = ALC882_DIGIN_NID,
9111 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9112 .channel_mode = alc882_sixstack_modes,
9113 .input_mux = &alc882_capture_source,
9116 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9117 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9118 alc882_eapd_verbs },
9119 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9120 .dac_nids = alc882_dac_nids,
9121 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9122 .channel_mode = alc882_sixstack_modes,
9123 .input_mux = &alc882_capture_source,
9126 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9127 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9128 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9129 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9130 .dac_nids = alc882_dac_nids,
9131 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9132 .channel_mode = alc880_threestack_modes,
9134 .input_mux = &alc882_capture_source,
9135 .dig_out_nid = ALC882_DIGOUT_NID,
9138 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9139 .init_verbs = { alc885_mbp3_init_verbs,
9140 alc880_gpio1_init_verbs },
9142 .dac_nids = alc882_dac_nids,
9144 .channel_mode = alc885_mbp_4ch_modes,
9145 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9146 .input_mux = &alc882_capture_source,
9147 .dig_out_nid = ALC882_DIGOUT_NID,
9148 .dig_in_nid = ALC882_DIGIN_NID,
9149 .unsol_event = alc_automute_amp_unsol_event,
9150 .setup = alc885_mbp3_setup,
9151 .init_hook = alc_automute_amp,
9154 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9155 .init_verbs = { alc885_mb5_init_verbs,
9156 alc880_gpio1_init_verbs },
9157 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9158 .dac_nids = alc882_dac_nids,
9159 .channel_mode = alc885_mb5_6ch_modes,
9160 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9161 .input_mux = &mb5_capture_source,
9162 .dig_out_nid = ALC882_DIGOUT_NID,
9163 .dig_in_nid = ALC882_DIGIN_NID,
9166 .mixers = { alc882_macpro_mixer },
9167 .init_verbs = { alc882_macpro_init_verbs },
9168 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9169 .dac_nids = alc882_dac_nids,
9170 .dig_out_nid = ALC882_DIGOUT_NID,
9171 .dig_in_nid = ALC882_DIGIN_NID,
9172 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9173 .channel_mode = alc882_ch_modes,
9174 .input_mux = &alc882_capture_source,
9175 .init_hook = alc885_macpro_init_hook,
9178 .mixers = { alc885_imac24_mixer },
9179 .init_verbs = { alc885_imac24_init_verbs },
9180 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9181 .dac_nids = alc882_dac_nids,
9182 .dig_out_nid = ALC882_DIGOUT_NID,
9183 .dig_in_nid = ALC882_DIGIN_NID,
9184 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9185 .channel_mode = alc882_ch_modes,
9186 .input_mux = &alc882_capture_source,
9187 .unsol_event = alc_automute_amp_unsol_event,
9188 .setup = alc885_imac24_setup,
9189 .init_hook = alc885_imac24_init_hook,
9192 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9193 .init_verbs = { alc885_imac91_init_verbs,
9194 alc880_gpio1_init_verbs },
9195 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9196 .dac_nids = alc882_dac_nids,
9197 .channel_mode = alc885_mbp_4ch_modes,
9198 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9199 .input_mux = &alc882_capture_source,
9200 .dig_out_nid = ALC882_DIGOUT_NID,
9201 .dig_in_nid = ALC882_DIGIN_NID,
9202 .unsol_event = alc885_imac91_unsol_event,
9203 .init_hook = alc885_imac91_automute,
9206 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9207 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9208 alc880_gpio3_init_verbs, alc882_targa_verbs},
9209 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9210 .dac_nids = alc882_dac_nids,
9211 .dig_out_nid = ALC882_DIGOUT_NID,
9212 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9213 .adc_nids = alc882_adc_nids,
9214 .capsrc_nids = alc882_capsrc_nids,
9215 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9216 .channel_mode = alc882_3ST_6ch_modes,
9218 .input_mux = &alc882_capture_source,
9219 .unsol_event = alc882_targa_unsol_event,
9220 .setup = alc882_targa_setup,
9221 .init_hook = alc882_targa_automute,
9223 [ALC882_ASUS_A7J] = {
9224 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9225 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9226 alc882_asus_a7j_verbs},
9227 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9228 .dac_nids = alc882_dac_nids,
9229 .dig_out_nid = ALC882_DIGOUT_NID,
9230 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9231 .adc_nids = alc882_adc_nids,
9232 .capsrc_nids = alc882_capsrc_nids,
9233 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9234 .channel_mode = alc882_3ST_6ch_modes,
9236 .input_mux = &alc882_capture_source,
9238 [ALC882_ASUS_A7M] = {
9239 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9240 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9241 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9242 alc882_asus_a7m_verbs },
9243 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9244 .dac_nids = alc882_dac_nids,
9245 .dig_out_nid = ALC882_DIGOUT_NID,
9246 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9247 .channel_mode = alc880_threestack_modes,
9249 .input_mux = &alc882_capture_source,
9251 [ALC883_3ST_2ch_DIG] = {
9252 .mixers = { alc883_3ST_2ch_mixer },
9253 .init_verbs = { alc883_init_verbs },
9254 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9255 .dac_nids = alc883_dac_nids,
9256 .dig_out_nid = ALC883_DIGOUT_NID,
9257 .dig_in_nid = ALC883_DIGIN_NID,
9258 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9259 .channel_mode = alc883_3ST_2ch_modes,
9260 .input_mux = &alc883_capture_source,
9262 [ALC883_3ST_6ch_DIG] = {
9263 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9264 .init_verbs = { alc883_init_verbs },
9265 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9266 .dac_nids = alc883_dac_nids,
9267 .dig_out_nid = ALC883_DIGOUT_NID,
9268 .dig_in_nid = ALC883_DIGIN_NID,
9269 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9270 .channel_mode = alc883_3ST_6ch_modes,
9272 .input_mux = &alc883_capture_source,
9274 [ALC883_3ST_6ch] = {
9275 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9276 .init_verbs = { alc883_init_verbs },
9277 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9278 .dac_nids = alc883_dac_nids,
9279 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9280 .channel_mode = alc883_3ST_6ch_modes,
9282 .input_mux = &alc883_capture_source,
9284 [ALC883_3ST_6ch_INTEL] = {
9285 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9286 .init_verbs = { alc883_init_verbs },
9287 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9288 .dac_nids = alc883_dac_nids,
9289 .dig_out_nid = ALC883_DIGOUT_NID,
9290 .dig_in_nid = ALC883_DIGIN_NID,
9291 .slave_dig_outs = alc883_slave_dig_outs,
9292 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9293 .channel_mode = alc883_3ST_6ch_intel_modes,
9295 .input_mux = &alc883_3stack_6ch_intel,
9298 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9299 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9300 alc_hp15_unsol_verbs },
9301 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9302 .dac_nids = alc883_dac_nids,
9303 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9304 .adc_nids = alc889_adc_nids,
9305 .dig_out_nid = ALC883_DIGOUT_NID,
9306 .dig_in_nid = ALC883_DIGIN_NID,
9307 .slave_dig_outs = alc883_slave_dig_outs,
9308 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9309 .channel_mode = alc889_8ch_intel_modes,
9310 .capsrc_nids = alc889_capsrc_nids,
9311 .input_mux = &alc889_capture_source,
9312 .setup = alc889_automute_setup,
9313 .init_hook = alc_automute_amp,
9314 .unsol_event = alc_automute_amp_unsol_event,
9318 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9319 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9320 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9321 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9322 .dac_nids = alc883_dac_nids,
9323 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9324 .adc_nids = alc889_adc_nids,
9325 .dig_out_nid = ALC883_DIGOUT_NID,
9326 .dig_in_nid = ALC883_DIGIN_NID,
9327 .slave_dig_outs = alc883_slave_dig_outs,
9328 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9329 .channel_mode = alc889_8ch_intel_modes,
9330 .capsrc_nids = alc889_capsrc_nids,
9331 .input_mux = &alc889_capture_source,
9332 .setup = alc889_automute_setup,
9333 .init_hook = alc889_intel_init_hook,
9334 .unsol_event = alc_automute_amp_unsol_event,
9337 [ALC883_6ST_DIG] = {
9338 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9339 .init_verbs = { alc883_init_verbs },
9340 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9341 .dac_nids = alc883_dac_nids,
9342 .dig_out_nid = ALC883_DIGOUT_NID,
9343 .dig_in_nid = ALC883_DIGIN_NID,
9344 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9345 .channel_mode = alc883_sixstack_modes,
9346 .input_mux = &alc883_capture_source,
9348 [ALC883_TARGA_DIG] = {
9349 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9350 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9351 alc883_targa_verbs},
9352 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9353 .dac_nids = alc883_dac_nids,
9354 .dig_out_nid = ALC883_DIGOUT_NID,
9355 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9356 .channel_mode = alc883_3ST_6ch_modes,
9358 .input_mux = &alc883_capture_source,
9359 .unsol_event = alc883_targa_unsol_event,
9360 .setup = alc882_targa_setup,
9361 .init_hook = alc882_targa_automute,
9363 [ALC883_TARGA_2ch_DIG] = {
9364 .mixers = { alc883_targa_2ch_mixer},
9365 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9366 alc883_targa_verbs},
9367 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9368 .dac_nids = alc883_dac_nids,
9369 .adc_nids = alc883_adc_nids_alt,
9370 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9371 .dig_out_nid = ALC883_DIGOUT_NID,
9372 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9373 .channel_mode = alc883_3ST_2ch_modes,
9374 .input_mux = &alc883_capture_source,
9375 .unsol_event = alc883_targa_unsol_event,
9376 .setup = alc882_targa_setup,
9377 .init_hook = alc882_targa_automute,
9379 [ALC883_TARGA_8ch_DIG] = {
9380 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9381 alc883_chmode_mixer },
9382 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9383 alc883_targa_verbs },
9384 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9385 .dac_nids = alc883_dac_nids,
9386 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9387 .adc_nids = alc883_adc_nids_rev,
9388 .capsrc_nids = alc883_capsrc_nids_rev,
9389 .dig_out_nid = ALC883_DIGOUT_NID,
9390 .dig_in_nid = ALC883_DIGIN_NID,
9391 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9392 .channel_mode = alc883_4ST_8ch_modes,
9394 .input_mux = &alc883_capture_source,
9395 .unsol_event = alc883_targa_unsol_event,
9396 .setup = alc882_targa_setup,
9397 .init_hook = alc882_targa_automute,
9400 .mixers = { alc883_base_mixer },
9401 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9402 * and the headphone jack. Turn this on and rely on the
9403 * standard mute methods whenever the user wants to turn
9404 * these outputs off.
9406 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9407 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9408 .dac_nids = alc883_dac_nids,
9409 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9410 .channel_mode = alc883_3ST_2ch_modes,
9411 .input_mux = &alc883_capture_source,
9413 [ALC883_ACER_ASPIRE] = {
9414 .mixers = { alc883_acer_aspire_mixer },
9415 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9416 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9417 .dac_nids = alc883_dac_nids,
9418 .dig_out_nid = ALC883_DIGOUT_NID,
9419 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9420 .channel_mode = alc883_3ST_2ch_modes,
9421 .input_mux = &alc883_capture_source,
9422 .unsol_event = alc_automute_amp_unsol_event,
9423 .setup = alc883_acer_aspire_setup,
9424 .init_hook = alc_automute_amp,
9426 [ALC888_ACER_ASPIRE_4930G] = {
9427 .mixers = { alc888_base_mixer,
9428 alc883_chmode_mixer },
9429 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9430 alc888_acer_aspire_4930g_verbs },
9431 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9432 .dac_nids = alc883_dac_nids,
9433 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9434 .adc_nids = alc883_adc_nids_rev,
9435 .capsrc_nids = alc883_capsrc_nids_rev,
9436 .dig_out_nid = ALC883_DIGOUT_NID,
9437 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9438 .channel_mode = alc883_3ST_6ch_modes,
9441 ARRAY_SIZE(alc888_2_capture_sources),
9442 .input_mux = alc888_2_capture_sources,
9443 .unsol_event = alc_automute_amp_unsol_event,
9444 .setup = alc888_acer_aspire_4930g_setup,
9445 .init_hook = alc_automute_amp,
9447 [ALC888_ACER_ASPIRE_6530G] = {
9448 .mixers = { alc888_acer_aspire_6530_mixer },
9449 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9450 alc888_acer_aspire_6530g_verbs },
9451 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9452 .dac_nids = alc883_dac_nids,
9453 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9454 .adc_nids = alc883_adc_nids_rev,
9455 .capsrc_nids = alc883_capsrc_nids_rev,
9456 .dig_out_nid = ALC883_DIGOUT_NID,
9457 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9458 .channel_mode = alc883_3ST_2ch_modes,
9460 ARRAY_SIZE(alc888_2_capture_sources),
9461 .input_mux = alc888_acer_aspire_6530_sources,
9462 .unsol_event = alc_automute_amp_unsol_event,
9463 .setup = alc888_acer_aspire_6530g_setup,
9464 .init_hook = alc_automute_amp,
9466 [ALC888_ACER_ASPIRE_8930G] = {
9467 .mixers = { alc888_base_mixer,
9468 alc883_chmode_mixer },
9469 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9470 alc889_acer_aspire_8930g_verbs },
9471 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9472 .dac_nids = alc883_dac_nids,
9473 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9474 .adc_nids = alc889_adc_nids,
9475 .capsrc_nids = alc889_capsrc_nids,
9476 .dig_out_nid = ALC883_DIGOUT_NID,
9477 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9478 .channel_mode = alc883_3ST_6ch_modes,
9480 .const_channel_count = 6,
9482 ARRAY_SIZE(alc889_capture_sources),
9483 .input_mux = alc889_capture_sources,
9484 .unsol_event = alc_automute_amp_unsol_event,
9485 .setup = alc889_acer_aspire_8930g_setup,
9486 .init_hook = alc_automute_amp,
9488 [ALC888_ACER_ASPIRE_7730G] = {
9489 .mixers = { alc883_3ST_6ch_mixer,
9490 alc883_chmode_mixer },
9491 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9492 alc888_acer_aspire_7730G_verbs },
9493 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9494 .dac_nids = alc883_dac_nids,
9495 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9496 .adc_nids = alc883_adc_nids_rev,
9497 .capsrc_nids = alc883_capsrc_nids_rev,
9498 .dig_out_nid = ALC883_DIGOUT_NID,
9499 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9500 .channel_mode = alc883_3ST_6ch_modes,
9502 .const_channel_count = 6,
9503 .input_mux = &alc883_capture_source,
9504 .unsol_event = alc_automute_amp_unsol_event,
9505 .setup = alc888_acer_aspire_6530g_setup,
9506 .init_hook = alc_automute_amp,
9509 .mixers = { alc883_fivestack_mixer,
9510 alc883_chmode_mixer },
9511 .init_verbs = { alc883_init_verbs,
9512 alc883_medion_eapd_verbs },
9513 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9514 .dac_nids = alc883_dac_nids,
9515 .adc_nids = alc883_adc_nids_alt,
9516 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9517 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9518 .channel_mode = alc883_sixstack_modes,
9519 .input_mux = &alc883_capture_source,
9521 [ALC883_MEDION_MD2] = {
9522 .mixers = { alc883_medion_md2_mixer},
9523 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9524 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9525 .dac_nids = alc883_dac_nids,
9526 .dig_out_nid = ALC883_DIGOUT_NID,
9527 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9528 .channel_mode = alc883_3ST_2ch_modes,
9529 .input_mux = &alc883_capture_source,
9530 .unsol_event = alc_automute_amp_unsol_event,
9531 .setup = alc883_medion_md2_setup,
9532 .init_hook = alc_automute_amp,
9534 [ALC883_LAPTOP_EAPD] = {
9535 .mixers = { alc883_base_mixer },
9536 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9537 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9538 .dac_nids = alc883_dac_nids,
9539 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9540 .channel_mode = alc883_3ST_2ch_modes,
9541 .input_mux = &alc883_capture_source,
9543 [ALC883_CLEVO_M540R] = {
9544 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9545 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9546 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9547 .dac_nids = alc883_dac_nids,
9548 .dig_out_nid = ALC883_DIGOUT_NID,
9549 .dig_in_nid = ALC883_DIGIN_NID,
9550 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9551 .channel_mode = alc883_3ST_6ch_clevo_modes,
9553 .input_mux = &alc883_capture_source,
9554 /* This machine has the hardware HP auto-muting, thus
9555 * we need no software mute via unsol event
9558 [ALC883_CLEVO_M720] = {
9559 .mixers = { alc883_clevo_m720_mixer },
9560 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9561 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9562 .dac_nids = alc883_dac_nids,
9563 .dig_out_nid = ALC883_DIGOUT_NID,
9564 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9565 .channel_mode = alc883_3ST_2ch_modes,
9566 .input_mux = &alc883_capture_source,
9567 .unsol_event = alc883_clevo_m720_unsol_event,
9568 .setup = alc883_clevo_m720_setup,
9569 .init_hook = alc883_clevo_m720_init_hook,
9571 [ALC883_LENOVO_101E_2ch] = {
9572 .mixers = { alc883_lenovo_101e_2ch_mixer},
9573 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9574 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9575 .dac_nids = alc883_dac_nids,
9576 .adc_nids = alc883_adc_nids_alt,
9577 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9578 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9579 .channel_mode = alc883_3ST_2ch_modes,
9580 .input_mux = &alc883_lenovo_101e_capture_source,
9581 .unsol_event = alc883_lenovo_101e_unsol_event,
9582 .init_hook = alc883_lenovo_101e_all_automute,
9584 [ALC883_LENOVO_NB0763] = {
9585 .mixers = { alc883_lenovo_nb0763_mixer },
9586 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9587 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9588 .dac_nids = alc883_dac_nids,
9589 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9590 .channel_mode = alc883_3ST_2ch_modes,
9592 .input_mux = &alc883_lenovo_nb0763_capture_source,
9593 .unsol_event = alc_automute_amp_unsol_event,
9594 .setup = alc883_medion_md2_setup,
9595 .init_hook = alc_automute_amp,
9597 [ALC888_LENOVO_MS7195_DIG] = {
9598 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9599 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9600 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9601 .dac_nids = alc883_dac_nids,
9602 .dig_out_nid = ALC883_DIGOUT_NID,
9603 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9604 .channel_mode = alc883_3ST_6ch_modes,
9606 .input_mux = &alc883_capture_source,
9607 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9608 .init_hook = alc888_lenovo_ms7195_front_automute,
9610 [ALC883_HAIER_W66] = {
9611 .mixers = { alc883_targa_2ch_mixer},
9612 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9613 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9614 .dac_nids = alc883_dac_nids,
9615 .dig_out_nid = ALC883_DIGOUT_NID,
9616 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9617 .channel_mode = alc883_3ST_2ch_modes,
9618 .input_mux = &alc883_capture_source,
9619 .unsol_event = alc_automute_amp_unsol_event,
9620 .setup = alc883_haier_w66_setup,
9621 .init_hook = alc_automute_amp,
9624 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9625 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9626 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9627 .dac_nids = alc883_dac_nids,
9628 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9629 .channel_mode = alc888_3st_hp_modes,
9631 .input_mux = &alc883_capture_source,
9632 .unsol_event = alc_automute_amp_unsol_event,
9633 .setup = alc888_3st_hp_setup,
9634 .init_hook = alc_automute_amp,
9636 [ALC888_6ST_DELL] = {
9637 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9638 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9639 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9640 .dac_nids = alc883_dac_nids,
9641 .dig_out_nid = ALC883_DIGOUT_NID,
9642 .dig_in_nid = ALC883_DIGIN_NID,
9643 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9644 .channel_mode = alc883_sixstack_modes,
9645 .input_mux = &alc883_capture_source,
9646 .unsol_event = alc_automute_amp_unsol_event,
9647 .setup = alc888_6st_dell_setup,
9648 .init_hook = alc_automute_amp,
9651 .mixers = { alc883_mitac_mixer },
9652 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9653 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9654 .dac_nids = alc883_dac_nids,
9655 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9656 .channel_mode = alc883_3ST_2ch_modes,
9657 .input_mux = &alc883_capture_source,
9658 .unsol_event = alc_automute_amp_unsol_event,
9659 .setup = alc883_mitac_setup,
9660 .init_hook = alc_automute_amp,
9662 [ALC883_FUJITSU_PI2515] = {
9663 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9664 .init_verbs = { alc883_init_verbs,
9665 alc883_2ch_fujitsu_pi2515_verbs},
9666 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9667 .dac_nids = alc883_dac_nids,
9668 .dig_out_nid = ALC883_DIGOUT_NID,
9669 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9670 .channel_mode = alc883_3ST_2ch_modes,
9671 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9672 .unsol_event = alc_automute_amp_unsol_event,
9673 .setup = alc883_2ch_fujitsu_pi2515_setup,
9674 .init_hook = alc_automute_amp,
9676 [ALC888_FUJITSU_XA3530] = {
9677 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9678 .init_verbs = { alc883_init_verbs,
9679 alc888_fujitsu_xa3530_verbs },
9680 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9681 .dac_nids = alc883_dac_nids,
9682 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9683 .adc_nids = alc883_adc_nids_rev,
9684 .capsrc_nids = alc883_capsrc_nids_rev,
9685 .dig_out_nid = ALC883_DIGOUT_NID,
9686 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9687 .channel_mode = alc888_4ST_8ch_intel_modes,
9689 ARRAY_SIZE(alc888_2_capture_sources),
9690 .input_mux = alc888_2_capture_sources,
9691 .unsol_event = alc_automute_amp_unsol_event,
9692 .setup = alc888_fujitsu_xa3530_setup,
9693 .init_hook = alc_automute_amp,
9695 [ALC888_LENOVO_SKY] = {
9696 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9697 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9698 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9699 .dac_nids = alc883_dac_nids,
9700 .dig_out_nid = ALC883_DIGOUT_NID,
9701 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9702 .channel_mode = alc883_sixstack_modes,
9704 .input_mux = &alc883_lenovo_sky_capture_source,
9705 .unsol_event = alc_automute_amp_unsol_event,
9706 .setup = alc888_lenovo_sky_setup,
9707 .init_hook = alc_automute_amp,
9709 [ALC888_ASUS_M90V] = {
9710 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9711 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9712 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9713 .dac_nids = alc883_dac_nids,
9714 .dig_out_nid = ALC883_DIGOUT_NID,
9715 .dig_in_nid = ALC883_DIGIN_NID,
9716 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9717 .channel_mode = alc883_3ST_6ch_modes,
9719 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9720 .unsol_event = alc_sku_unsol_event,
9721 .setup = alc883_mode2_setup,
9722 .init_hook = alc_inithook,
9724 [ALC888_ASUS_EEE1601] = {
9725 .mixers = { alc883_asus_eee1601_mixer },
9726 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9727 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9728 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9729 .dac_nids = alc883_dac_nids,
9730 .dig_out_nid = ALC883_DIGOUT_NID,
9731 .dig_in_nid = ALC883_DIGIN_NID,
9732 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9733 .channel_mode = alc883_3ST_2ch_modes,
9735 .input_mux = &alc883_asus_eee1601_capture_source,
9736 .unsol_event = alc_sku_unsol_event,
9737 .init_hook = alc883_eee1601_inithook,
9739 [ALC1200_ASUS_P5Q] = {
9740 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9741 .init_verbs = { alc883_init_verbs },
9742 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9743 .dac_nids = alc883_dac_nids,
9744 .dig_out_nid = ALC1200_DIGOUT_NID,
9745 .dig_in_nid = ALC883_DIGIN_NID,
9746 .slave_dig_outs = alc1200_slave_dig_outs,
9747 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9748 .channel_mode = alc883_sixstack_modes,
9749 .input_mux = &alc883_capture_source,
9752 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9753 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9754 alc880_gpio1_init_verbs },
9755 .adc_nids = alc883_adc_nids,
9756 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9757 .dac_nids = alc883_dac_nids,
9758 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9759 .channel_mode = alc889A_mb31_6ch_modes,
9760 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9761 .input_mux = &alc889A_mb31_capture_source,
9762 .dig_out_nid = ALC883_DIGOUT_NID,
9763 .unsol_event = alc889A_mb31_unsol_event,
9764 .init_hook = alc889A_mb31_automute,
9766 [ALC883_SONY_VAIO_TT] = {
9767 .mixers = { alc883_vaiott_mixer },
9768 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9769 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9770 .dac_nids = alc883_dac_nids,
9771 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9772 .channel_mode = alc883_3ST_2ch_modes,
9773 .input_mux = &alc883_capture_source,
9774 .unsol_event = alc_automute_amp_unsol_event,
9775 .setup = alc883_vaiott_setup,
9776 .init_hook = alc_automute_amp,
9785 PINFIX_ABIT_AW9D_MAX
9788 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9789 { 0x15, 0x01080104 }, /* side */
9790 { 0x16, 0x01011012 }, /* rear */
9791 { 0x17, 0x01016011 }, /* clfe */
9795 static const struct alc_fixup alc882_fixups[] = {
9796 [PINFIX_ABIT_AW9D_MAX] = {
9797 .pins = alc882_abit_aw9d_pinfix
9801 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9802 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9807 * BIOS auto configuration
9809 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9810 const struct auto_pin_cfg *cfg)
9812 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9815 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9816 hda_nid_t nid, int pin_type,
9820 struct alc_spec *spec = codec->spec;
9823 alc_set_pin_output(codec, nid, pin_type);
9824 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9827 idx = spec->multiout.dac_nids[dac_idx] - 2;
9828 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9832 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9834 struct alc_spec *spec = codec->spec;
9837 for (i = 0; i <= HDA_SIDE; i++) {
9838 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9839 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9841 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9846 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9848 struct alc_spec *spec = codec->spec;
9851 pin = spec->autocfg.hp_pins[0];
9852 if (pin) /* connect to front */
9854 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9855 pin = spec->autocfg.speaker_pins[0];
9857 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9860 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9862 struct alc_spec *spec = codec->spec;
9865 for (i = 0; i < AUTO_PIN_LAST; i++) {
9866 hda_nid_t nid = spec->autocfg.input_pins[i];
9869 alc_set_input_pin(codec, nid, i);
9870 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9871 snd_hda_codec_write(codec, nid, 0,
9872 AC_VERB_SET_AMP_GAIN_MUTE,
9877 static void alc882_auto_init_input_src(struct hda_codec *codec)
9879 struct alc_spec *spec = codec->spec;
9882 for (c = 0; c < spec->num_adc_nids; c++) {
9883 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9884 hda_nid_t nid = spec->capsrc_nids[c];
9885 unsigned int mux_idx;
9886 const struct hda_input_mux *imux;
9887 int conns, mute, idx, item;
9889 conns = snd_hda_get_connections(codec, nid, conn_list,
9890 ARRAY_SIZE(conn_list));
9893 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9894 imux = &spec->input_mux[mux_idx];
9895 for (idx = 0; idx < conns; idx++) {
9896 /* if the current connection is the selected one,
9897 * unmute it as default - otherwise mute it
9899 mute = AMP_IN_MUTE(idx);
9900 for (item = 0; item < imux->num_items; item++) {
9901 if (imux->items[item].index == idx) {
9902 if (spec->cur_mux[c] == item)
9903 mute = AMP_IN_UNMUTE(idx);
9907 /* check if we have a selector or mixer
9908 * we could check for the widget type instead, but
9909 * just check for Amp-In presence (in case of mixer
9910 * without amp-in there is something wrong, this
9911 * function shouldn't be used or capsrc nid is wrong)
9913 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9914 snd_hda_codec_write(codec, nid, 0,
9915 AC_VERB_SET_AMP_GAIN_MUTE,
9917 else if (mute != AMP_IN_MUTE(idx))
9918 snd_hda_codec_write(codec, nid, 0,
9919 AC_VERB_SET_CONNECT_SEL,
9925 /* add mic boosts if needed */
9926 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9928 struct alc_spec *spec = codec->spec;
9932 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9933 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9934 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9936 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9940 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9941 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9942 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9944 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9951 /* almost identical with ALC880 parser... */
9952 static int alc882_parse_auto_config(struct hda_codec *codec)
9954 struct alc_spec *spec = codec->spec;
9955 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9958 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9962 if (!spec->autocfg.line_outs)
9963 return 0; /* can't find valid BIOS pin config */
9965 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9968 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9971 err = alc880_auto_create_extra_out(spec,
9972 spec->autocfg.speaker_pins[0],
9976 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9980 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9984 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9986 /* check multiple SPDIF-out (for recent codecs) */
9987 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9989 err = snd_hda_get_connections(codec,
9990 spec->autocfg.dig_out_pins[i],
9995 spec->multiout.dig_out_nid = dig_nid;
9997 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9998 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10000 spec->slave_dig_outs[i - 1] = dig_nid;
10003 if (spec->autocfg.dig_in_pin)
10004 spec->dig_in_nid = ALC880_DIGIN_NID;
10006 if (spec->kctls.list)
10007 add_mixer(spec, spec->kctls.list);
10009 add_verb(spec, alc883_auto_init_verbs);
10010 /* if ADC 0x07 is available, initialize it, too */
10011 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10012 add_verb(spec, alc882_adc1_init_verbs);
10014 spec->num_mux_defs = 1;
10015 spec->input_mux = &spec->private_imux[0];
10017 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
10019 err = alc_auto_add_mic_boost(codec);
10023 return 1; /* config found */
10026 /* additional initialization for auto-configuration model */
10027 static void alc882_auto_init(struct hda_codec *codec)
10029 struct alc_spec *spec = codec->spec;
10030 alc882_auto_init_multi_out(codec);
10031 alc882_auto_init_hp_out(codec);
10032 alc882_auto_init_analog_input(codec);
10033 alc882_auto_init_input_src(codec);
10034 if (spec->unsol_event)
10035 alc_inithook(codec);
10038 static int patch_alc882(struct hda_codec *codec)
10040 struct alc_spec *spec;
10041 int err, board_config;
10043 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10047 codec->spec = spec;
10049 switch (codec->vendor_id) {
10054 /* ALC883 and variants */
10055 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10059 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10063 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10064 board_config = snd_hda_check_board_codec_sid_config(codec,
10065 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10067 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10068 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10070 board_config = ALC882_AUTO;
10073 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10075 if (board_config == ALC882_AUTO) {
10076 /* automatic parse from the BIOS config */
10077 err = alc882_parse_auto_config(codec);
10083 "hda_codec: Cannot set up configuration "
10084 "from BIOS. Using base mode...\n");
10085 board_config = ALC882_3ST_DIG;
10089 err = snd_hda_attach_beep_device(codec, 0x1);
10095 if (board_config != ALC882_AUTO)
10096 setup_preset(codec, &alc882_presets[board_config]);
10098 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10099 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10100 /* FIXME: setup DAC5 */
10101 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10102 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10104 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10105 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10107 if (codec->vendor_id == 0x10ec0888)
10108 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10110 if (!spec->adc_nids && spec->input_mux) {
10112 spec->num_adc_nids = 0;
10113 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10114 const struct hda_input_mux *imux = spec->input_mux;
10116 hda_nid_t items[16];
10117 hda_nid_t nid = alc882_adc_nids[i];
10118 unsigned int wcap = get_wcaps(codec, nid);
10120 wcap = get_wcaps_type(wcap);
10121 if (wcap != AC_WID_AUD_IN)
10123 spec->private_adc_nids[spec->num_adc_nids] = nid;
10124 err = snd_hda_get_connections(codec, nid, &cap, 1);
10127 err = snd_hda_get_connections(codec, cap, items,
10128 ARRAY_SIZE(items));
10131 for (j = 0; j < imux->num_items; j++)
10132 if (imux->items[j].index >= err)
10134 if (j < imux->num_items)
10136 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10137 spec->num_adc_nids++;
10139 spec->adc_nids = spec->private_adc_nids;
10140 spec->capsrc_nids = spec->private_capsrc_nids;
10143 set_capture_mixer(codec);
10144 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10146 spec->vmaster_nid = 0x0c;
10148 codec->patch_ops = alc_patch_ops;
10149 if (board_config == ALC882_AUTO)
10150 spec->init_hook = alc882_auto_init;
10151 #ifdef CONFIG_SND_HDA_POWER_SAVE
10152 if (!spec->loopback.amplist)
10153 spec->loopback.amplist = alc882_loopbacks;
10155 codec->proc_widget_hook = print_realtek_coef;
10165 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10166 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10168 #define alc262_dac_nids alc260_dac_nids
10169 #define alc262_adc_nids alc882_adc_nids
10170 #define alc262_adc_nids_alt alc882_adc_nids_alt
10171 #define alc262_capsrc_nids alc882_capsrc_nids
10172 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10174 #define alc262_modes alc260_modes
10175 #define alc262_capture_source alc882_capture_source
10177 static hda_nid_t alc262_dmic_adc_nids[1] = {
10182 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10184 static struct snd_kcontrol_new alc262_base_mixer[] = {
10185 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10186 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10187 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10188 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10189 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10190 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10191 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10192 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10193 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10194 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10195 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10196 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10197 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10198 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10199 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10200 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10204 /* update HP, line and mono-out pins according to the master switch */
10205 static void alc262_hp_master_update(struct hda_codec *codec)
10207 struct alc_spec *spec = codec->spec;
10208 int val = spec->master_sw;
10210 /* HP & line-out */
10211 snd_hda_codec_write_cache(codec, 0x1b, 0,
10212 AC_VERB_SET_PIN_WIDGET_CONTROL,
10214 snd_hda_codec_write_cache(codec, 0x15, 0,
10215 AC_VERB_SET_PIN_WIDGET_CONTROL,
10217 /* mono (speaker) depending on the HP jack sense */
10218 val = val && !spec->jack_present;
10219 snd_hda_codec_write_cache(codec, 0x16, 0,
10220 AC_VERB_SET_PIN_WIDGET_CONTROL,
10221 val ? PIN_OUT : 0);
10224 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10226 struct alc_spec *spec = codec->spec;
10228 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10229 alc262_hp_master_update(codec);
10232 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10234 if ((res >> 26) != ALC880_HP_EVENT)
10236 alc262_hp_bpc_automute(codec);
10239 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10241 struct alc_spec *spec = codec->spec;
10243 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10244 alc262_hp_master_update(codec);
10247 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10250 if ((res >> 26) != ALC880_HP_EVENT)
10252 alc262_hp_wildwest_automute(codec);
10255 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10257 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10258 struct snd_ctl_elem_value *ucontrol)
10260 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10261 struct alc_spec *spec = codec->spec;
10262 int val = !!*ucontrol->value.integer.value;
10264 if (val == spec->master_sw)
10266 spec->master_sw = val;
10267 alc262_hp_master_update(codec);
10271 #define ALC262_HP_MASTER_SWITCH \
10273 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10274 .name = "Master Playback Switch", \
10275 .info = snd_ctl_boolean_mono_info, \
10276 .get = alc262_hp_master_sw_get, \
10277 .put = alc262_hp_master_sw_put, \
10280 .iface = NID_MAPPING, \
10281 .name = "Master Playback Switch", \
10282 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10286 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10287 ALC262_HP_MASTER_SWITCH,
10288 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10289 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10290 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10291 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10293 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10296 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10297 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10298 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10299 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10300 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10301 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10302 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10303 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10304 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10305 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10306 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10310 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10311 ALC262_HP_MASTER_SWITCH,
10312 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10313 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10314 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10315 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10316 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10318 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10320 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10321 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10322 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10323 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10324 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10325 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10326 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10330 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10331 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10332 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10333 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10337 /* mute/unmute internal speaker according to the hp jack and mute state */
10338 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10340 struct alc_spec *spec = codec->spec;
10342 spec->autocfg.hp_pins[0] = 0x15;
10343 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10346 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10347 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10348 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10349 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10350 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10352 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10353 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10357 static struct hda_verb alc262_hp_t5735_verbs[] = {
10358 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10359 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10361 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10365 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10366 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10367 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10368 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10369 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10370 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10371 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10375 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10376 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10377 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10378 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10379 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10380 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10381 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10382 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10383 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10384 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10389 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10396 /* bind hp and internal speaker mute (with plug check) as master switch */
10397 static void alc262_hippo_master_update(struct hda_codec *codec)
10399 struct alc_spec *spec = codec->spec;
10400 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10401 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10402 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10406 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10407 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10408 HDA_AMP_MUTE, mute);
10409 /* mute internal speaker per jack sense */
10410 if (spec->jack_present)
10411 mute = HDA_AMP_MUTE;
10413 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10414 HDA_AMP_MUTE, mute);
10415 if (speaker_nid && speaker_nid != line_nid)
10416 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10417 HDA_AMP_MUTE, mute);
10420 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10422 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10423 struct snd_ctl_elem_value *ucontrol)
10425 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10426 struct alc_spec *spec = codec->spec;
10427 int val = !!*ucontrol->value.integer.value;
10429 if (val == spec->master_sw)
10431 spec->master_sw = val;
10432 alc262_hippo_master_update(codec);
10436 #define ALC262_HIPPO_MASTER_SWITCH \
10438 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10439 .name = "Master Playback Switch", \
10440 .info = snd_ctl_boolean_mono_info, \
10441 .get = alc262_hippo_master_sw_get, \
10442 .put = alc262_hippo_master_sw_put, \
10445 .iface = NID_MAPPING, \
10446 .name = "Master Playback Switch", \
10447 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10448 (SUBDEV_SPEAKER(0) << 16), \
10451 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10452 ALC262_HIPPO_MASTER_SWITCH,
10453 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10454 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10455 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10456 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10457 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10458 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10459 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10460 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10461 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10462 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10463 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10464 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10468 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10469 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10470 ALC262_HIPPO_MASTER_SWITCH,
10471 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10472 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10473 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10474 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10475 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10476 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10477 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10478 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10479 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10480 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10484 /* mute/unmute internal speaker according to the hp jack and mute state */
10485 static void alc262_hippo_automute(struct hda_codec *codec)
10487 struct alc_spec *spec = codec->spec;
10488 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10490 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10491 alc262_hippo_master_update(codec);
10494 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10496 if ((res >> 26) != ALC880_HP_EVENT)
10498 alc262_hippo_automute(codec);
10501 static void alc262_hippo_setup(struct hda_codec *codec)
10503 struct alc_spec *spec = codec->spec;
10505 spec->autocfg.hp_pins[0] = 0x15;
10506 spec->autocfg.speaker_pins[0] = 0x14;
10509 static void alc262_hippo1_setup(struct hda_codec *codec)
10511 struct alc_spec *spec = codec->spec;
10513 spec->autocfg.hp_pins[0] = 0x1b;
10514 spec->autocfg.speaker_pins[0] = 0x14;
10518 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10519 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10520 ALC262_HIPPO_MASTER_SWITCH,
10521 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10522 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10523 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10524 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10528 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10529 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10530 ALC262_HIPPO_MASTER_SWITCH,
10531 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10532 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10533 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10534 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10535 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10539 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10540 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10541 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10542 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10543 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10544 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10545 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10546 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10547 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10548 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10549 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10550 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10551 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10555 static struct hda_verb alc262_tyan_verbs[] = {
10556 /* Headphone automute */
10557 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10558 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10559 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10561 /* P11 AUX_IN, white 4-pin connector */
10562 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10563 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10564 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10565 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10570 /* unsolicited event for HP jack sensing */
10571 static void alc262_tyan_setup(struct hda_codec *codec)
10573 struct alc_spec *spec = codec->spec;
10575 spec->autocfg.hp_pins[0] = 0x1b;
10576 spec->autocfg.speaker_pins[0] = 0x15;
10580 #define alc262_capture_mixer alc882_capture_mixer
10581 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10584 * generic initialization of ADC, input mixers and output mixers
10586 static struct hda_verb alc262_init_verbs[] = {
10588 * Unmute ADC0-2 and set the default input to mic-in
10590 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10591 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10592 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10593 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10594 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10595 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10597 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10599 * Note: PASD motherboards uses the Line In 2 as the input for
10600 * front panel mic (mic 2)
10602 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10603 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10604 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10605 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10606 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10607 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10610 * Set up output mixers (0x0c - 0x0e)
10612 /* set vol=0 to output mixers */
10613 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10614 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10615 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10616 /* set up input amps for analog loopback */
10617 /* Amp Indices: DAC = 0, mixer = 1 */
10618 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10619 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10620 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10621 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10622 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10623 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10625 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10626 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10627 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10628 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10629 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10630 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10632 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10633 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10634 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10635 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10636 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10638 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10639 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10641 /* FIXME: use matrix-type input source selection */
10642 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10643 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10644 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10645 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10646 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10647 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10649 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10650 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10651 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10657 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10662 static struct hda_verb alc262_eapd_verbs[] = {
10663 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10664 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10668 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10669 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10670 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10671 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10673 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10674 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10678 static struct hda_verb alc262_sony_unsol_verbs[] = {
10679 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10680 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10681 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10683 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10684 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10688 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10689 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10690 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10691 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10692 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10693 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10697 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10698 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10699 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10700 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10701 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10702 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10703 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10704 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10705 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10709 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10711 struct alc_spec *spec = codec->spec;
10713 spec->autocfg.hp_pins[0] = 0x15;
10714 spec->autocfg.speaker_pins[0] = 0x14;
10715 spec->ext_mic.pin = 0x18;
10716 spec->ext_mic.mux_idx = 0;
10717 spec->int_mic.pin = 0x12;
10718 spec->int_mic.mux_idx = 9;
10719 spec->auto_mic = 1;
10725 * 0x16 = internal speaker
10726 * 0x18 = external mic
10729 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10730 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10731 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10733 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10734 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10735 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10737 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10738 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10742 static struct hda_verb alc262_nec_verbs[] = {
10743 /* Unmute Speaker */
10744 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10747 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10748 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10750 /* External mic to headphone */
10751 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10752 /* External mic to speaker */
10753 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10759 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10760 * 0x1b = port replicator headphone out
10763 #define ALC_HP_EVENT 0x37
10765 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10766 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10767 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10768 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10769 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10773 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10774 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10775 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10779 static struct hda_input_mux alc262_fujitsu_capture_source = {
10783 { "Int Mic", 0x1 },
10788 static struct hda_input_mux alc262_HP_capture_source = {
10792 { "Front Mic", 0x1 },
10799 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10803 { "Front Mic", 0x2 },
10809 /* mute/unmute internal speaker according to the hp jacks and mute state */
10810 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10812 struct alc_spec *spec = codec->spec;
10815 if (force || !spec->sense_updated) {
10816 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10817 snd_hda_jack_detect(codec, 0x1b);
10818 spec->sense_updated = 1;
10820 /* unmute internal speaker only if both HPs are unplugged and
10821 * master switch is on
10823 if (spec->jack_present)
10824 mute = HDA_AMP_MUTE;
10826 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10827 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10828 HDA_AMP_MUTE, mute);
10831 /* unsolicited event for HP jack sensing */
10832 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10835 if ((res >> 26) != ALC_HP_EVENT)
10837 alc262_fujitsu_automute(codec, 1);
10840 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10842 alc262_fujitsu_automute(codec, 1);
10845 /* bind volumes of both NID 0x0c and 0x0d */
10846 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10847 .ops = &snd_hda_bind_vol,
10849 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10850 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10855 /* mute/unmute internal speaker according to the hp jack and mute state */
10856 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10858 struct alc_spec *spec = codec->spec;
10861 if (force || !spec->sense_updated) {
10862 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10863 spec->sense_updated = 1;
10865 if (spec->jack_present) {
10866 /* mute internal speaker */
10867 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10868 HDA_AMP_MUTE, HDA_AMP_MUTE);
10869 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10870 HDA_AMP_MUTE, HDA_AMP_MUTE);
10872 /* unmute internal speaker if necessary */
10873 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10874 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10875 HDA_AMP_MUTE, mute);
10876 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10877 HDA_AMP_MUTE, mute);
10881 /* unsolicited event for HP jack sensing */
10882 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10885 if ((res >> 26) != ALC_HP_EVENT)
10887 alc262_lenovo_3000_automute(codec, 1);
10890 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10891 int dir, int idx, long *valp)
10895 for (i = 0; i < 2; i++, valp++)
10896 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10898 *valp ? 0 : HDA_AMP_MUTE);
10902 /* bind hp and internal speaker mute (with plug check) */
10903 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10904 struct snd_ctl_elem_value *ucontrol)
10906 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10907 long *valp = ucontrol->value.integer.value;
10910 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10911 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10913 alc262_fujitsu_automute(codec, 0);
10917 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10918 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10920 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10921 .name = "Master Playback Switch",
10922 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
10923 .info = snd_hda_mixer_amp_switch_info,
10924 .get = snd_hda_mixer_amp_switch_get,
10925 .put = alc262_fujitsu_master_sw_put,
10926 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10929 .iface = NID_MAPPING,
10930 .name = "Master Playback Switch",
10931 .private_value = 0x1b,
10933 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10934 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10935 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10936 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10937 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10938 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10939 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10940 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10944 /* bind hp and internal speaker mute (with plug check) */
10945 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10946 struct snd_ctl_elem_value *ucontrol)
10948 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10949 long *valp = ucontrol->value.integer.value;
10952 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10954 alc262_lenovo_3000_automute(codec, 0);
10958 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10959 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10961 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10962 .name = "Master Playback Switch",
10963 .subdevice = HDA_SUBDEV_NID_FLAG | 0x1b,
10964 .info = snd_hda_mixer_amp_switch_info,
10965 .get = snd_hda_mixer_amp_switch_get,
10966 .put = alc262_lenovo_3000_master_sw_put,
10967 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10969 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10970 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10971 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10972 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10973 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10974 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10975 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10976 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10980 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10981 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10982 ALC262_HIPPO_MASTER_SWITCH,
10983 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10985 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10986 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10987 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10988 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10992 /* additional init verbs for Benq laptops */
10993 static struct hda_verb alc262_EAPD_verbs[] = {
10994 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10995 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10999 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11000 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11001 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11003 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11004 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11008 /* Samsung Q1 Ultra Vista model setup */
11009 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11010 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11011 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11013 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11014 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11015 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11019 static struct hda_verb alc262_ultra_verbs[] = {
11021 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11025 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11026 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11027 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11028 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11030 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11031 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11032 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11033 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11034 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11036 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11038 /* ADC, choose mic */
11039 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11040 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11041 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11042 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11043 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11044 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11045 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11046 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11047 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11048 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11052 /* mute/unmute internal speaker according to the hp jack and mute state */
11053 static void alc262_ultra_automute(struct hda_codec *codec)
11055 struct alc_spec *spec = codec->spec;
11059 /* auto-mute only when HP is used as HP */
11060 if (!spec->cur_mux[0]) {
11061 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11062 if (spec->jack_present)
11063 mute = HDA_AMP_MUTE;
11065 /* mute/unmute internal speaker */
11066 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11067 HDA_AMP_MUTE, mute);
11068 /* mute/unmute HP */
11069 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11070 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11073 /* unsolicited event for HP jack sensing */
11074 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11077 if ((res >> 26) != ALC880_HP_EVENT)
11079 alc262_ultra_automute(codec);
11082 static struct hda_input_mux alc262_ultra_capture_source = {
11086 { "Headphone", 0x7 },
11090 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11091 struct snd_ctl_elem_value *ucontrol)
11093 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11094 struct alc_spec *spec = codec->spec;
11097 ret = alc_mux_enum_put(kcontrol, ucontrol);
11100 /* reprogram the HP pin as mic or HP according to the input source */
11101 snd_hda_codec_write_cache(codec, 0x15, 0,
11102 AC_VERB_SET_PIN_WIDGET_CONTROL,
11103 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11104 alc262_ultra_automute(codec); /* mute/unmute HP */
11108 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11109 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11110 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11112 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11113 .name = "Capture Source",
11114 .info = alc_mux_enum_info,
11115 .get = alc_mux_enum_get,
11116 .put = alc262_ultra_mux_enum_put,
11119 .iface = NID_MAPPING,
11120 .name = "Capture Source",
11121 .private_value = 0x15,
11126 /* We use two mixers depending on the output pin; 0x16 is a mono output
11127 * and thus it's bound with a different mixer.
11128 * This function returns which mixer amp should be used.
11130 static int alc262_check_volbit(hda_nid_t nid)
11134 else if (nid == 0x16)
11140 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11141 const char *pfx, int *vbits)
11146 vbit = alc262_check_volbit(nid);
11149 if (*vbits & vbit) /* a volume control for this mixer already there */
11153 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11155 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11156 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11159 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11167 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11169 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11170 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11173 /* add playback controls from the parsed DAC table */
11174 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11175 const struct auto_pin_cfg *cfg)
11181 spec->multiout.num_dacs = 1; /* only use one dac */
11182 spec->multiout.dac_nids = spec->private_dac_nids;
11183 spec->multiout.dac_nids[0] = 2;
11185 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11187 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11191 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11194 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11197 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11201 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11202 alc262_check_volbit(cfg->speaker_pins[0]) |
11203 alc262_check_volbit(cfg->hp_pins[0]);
11204 if (vbits == 1 || vbits == 2)
11205 pfx = "Master"; /* only one mixer is used */
11206 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11211 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11214 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11218 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11225 #define alc262_auto_create_input_ctls \
11226 alc880_auto_create_input_ctls
11229 * generic initialization of ADC, input mixers and output mixers
11231 static struct hda_verb alc262_volume_init_verbs[] = {
11233 * Unmute ADC0-2 and set the default input to mic-in
11235 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11236 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11237 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11238 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11239 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11240 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11242 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11244 * Note: PASD motherboards uses the Line In 2 as the input for
11245 * front panel mic (mic 2)
11247 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11248 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11249 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11255 * Set up output mixers (0x0c - 0x0f)
11257 /* set vol=0 to output mixers */
11258 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11259 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11260 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11262 /* set up input amps for analog loopback */
11263 /* Amp Indices: DAC = 0, mixer = 1 */
11264 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11265 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11266 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11267 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11268 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11269 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11271 /* FIXME: use matrix-type input source selection */
11272 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11273 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11274 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11275 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11279 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11280 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11284 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11285 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11292 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11294 * Unmute ADC0-2 and set the default input to mic-in
11296 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11297 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11298 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11299 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11300 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11301 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11303 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11305 * Note: PASD motherboards uses the Line In 2 as the input for
11306 * front panel mic (mic 2)
11308 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11309 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11310 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11311 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11312 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11313 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11314 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11315 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11318 * Set up output mixers (0x0c - 0x0e)
11320 /* set vol=0 to output mixers */
11321 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11322 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11323 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11325 /* set up input amps for analog loopback */
11326 /* Amp Indices: DAC = 0, mixer = 1 */
11327 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11328 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11329 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11330 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11331 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11332 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11334 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11335 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11336 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11338 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11339 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11341 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11342 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11344 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11345 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11346 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11347 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11348 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11350 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11351 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11352 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11353 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11354 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11355 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11358 /* FIXME: use matrix-type input source selection */
11359 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11360 /* Input mixer1: only unmute Mic */
11361 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11362 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11365 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11369 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11371 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11372 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11373 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11374 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11379 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11381 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11387 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11388 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11389 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11391 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11396 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11398 * Unmute ADC0-2 and set the default input to mic-in
11400 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11401 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11402 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11403 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11404 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11405 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11407 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11409 * Note: PASD motherboards uses the Line In 2 as the input for front
11410 * panel mic (mic 2)
11412 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11413 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11414 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11415 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11417 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11420 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11422 * Set up output mixers (0x0c - 0x0e)
11424 /* set vol=0 to output mixers */
11425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11426 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11427 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11429 /* set up input amps for analog loopback */
11430 /* Amp Indices: DAC = 0, mixer = 1 */
11431 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11432 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11433 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11434 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11435 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11436 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11439 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11440 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11441 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11442 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11443 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11444 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11445 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11447 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11450 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11451 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11453 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11454 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11455 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11456 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11457 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11458 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11460 /* FIXME: use matrix-type input source selection */
11461 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11462 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11463 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11464 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11465 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11466 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11467 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11468 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11469 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11471 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11472 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11473 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11474 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11475 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11476 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11477 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11479 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11480 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11484 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11485 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11487 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11492 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11494 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11495 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11496 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11498 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11499 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11500 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11501 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11503 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11504 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11505 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11510 #ifdef CONFIG_SND_HDA_POWER_SAVE
11511 #define alc262_loopbacks alc880_loopbacks
11514 /* pcm configuration: identical with ALC880 */
11515 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11516 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11517 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11518 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11521 * BIOS auto configuration
11523 static int alc262_parse_auto_config(struct hda_codec *codec)
11525 struct alc_spec *spec = codec->spec;
11527 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11529 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11533 if (!spec->autocfg.line_outs) {
11534 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11535 spec->multiout.max_channels = 2;
11536 spec->no_analog = 1;
11539 return 0; /* can't find valid BIOS pin config */
11541 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11544 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11548 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11551 if (spec->autocfg.dig_outs) {
11552 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11553 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11555 if (spec->autocfg.dig_in_pin)
11556 spec->dig_in_nid = ALC262_DIGIN_NID;
11558 if (spec->kctls.list)
11559 add_mixer(spec, spec->kctls.list);
11561 add_verb(spec, alc262_volume_init_verbs);
11562 spec->num_mux_defs = 1;
11563 spec->input_mux = &spec->private_imux[0];
11565 err = alc_auto_add_mic_boost(codec);
11569 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11574 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11575 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11576 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11577 #define alc262_auto_init_input_src alc882_auto_init_input_src
11580 /* init callback for auto-configuration model -- overriding the default init */
11581 static void alc262_auto_init(struct hda_codec *codec)
11583 struct alc_spec *spec = codec->spec;
11584 alc262_auto_init_multi_out(codec);
11585 alc262_auto_init_hp_out(codec);
11586 alc262_auto_init_analog_input(codec);
11587 alc262_auto_init_input_src(codec);
11588 if (spec->unsol_event)
11589 alc_inithook(codec);
11593 * configuration and preset
11595 static const char *alc262_models[ALC262_MODEL_LAST] = {
11596 [ALC262_BASIC] = "basic",
11597 [ALC262_HIPPO] = "hippo",
11598 [ALC262_HIPPO_1] = "hippo_1",
11599 [ALC262_FUJITSU] = "fujitsu",
11600 [ALC262_HP_BPC] = "hp-bpc",
11601 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11602 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11603 [ALC262_HP_RP5700] = "hp-rp5700",
11604 [ALC262_BENQ_ED8] = "benq",
11605 [ALC262_BENQ_T31] = "benq-t31",
11606 [ALC262_SONY_ASSAMD] = "sony-assamd",
11607 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11608 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11609 [ALC262_ULTRA] = "ultra",
11610 [ALC262_LENOVO_3000] = "lenovo-3000",
11611 [ALC262_NEC] = "nec",
11612 [ALC262_TYAN] = "tyan",
11613 [ALC262_AUTO] = "auto",
11616 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11617 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11618 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11619 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11621 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11623 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11625 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11626 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11627 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11628 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11629 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11630 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11631 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11632 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11633 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11634 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11635 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11636 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11637 ALC262_HP_TC_T5735),
11638 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11639 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11640 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11641 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11642 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11643 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11644 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11645 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11646 #if 0 /* disable the quirk since model=auto works better in recent versions */
11647 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11648 ALC262_SONY_ASSAMD),
11650 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11651 ALC262_TOSHIBA_RX1),
11652 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11653 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11654 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11655 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11656 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11658 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11659 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11660 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11661 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11662 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11666 static struct alc_config_preset alc262_presets[] = {
11668 .mixers = { alc262_base_mixer },
11669 .init_verbs = { alc262_init_verbs },
11670 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11671 .dac_nids = alc262_dac_nids,
11673 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11674 .channel_mode = alc262_modes,
11675 .input_mux = &alc262_capture_source,
11678 .mixers = { alc262_hippo_mixer },
11679 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11680 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11681 .dac_nids = alc262_dac_nids,
11683 .dig_out_nid = ALC262_DIGOUT_NID,
11684 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11685 .channel_mode = alc262_modes,
11686 .input_mux = &alc262_capture_source,
11687 .unsol_event = alc262_hippo_unsol_event,
11688 .setup = alc262_hippo_setup,
11689 .init_hook = alc262_hippo_automute,
11691 [ALC262_HIPPO_1] = {
11692 .mixers = { alc262_hippo1_mixer },
11693 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11694 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11695 .dac_nids = alc262_dac_nids,
11697 .dig_out_nid = ALC262_DIGOUT_NID,
11698 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11699 .channel_mode = alc262_modes,
11700 .input_mux = &alc262_capture_source,
11701 .unsol_event = alc262_hippo_unsol_event,
11702 .setup = alc262_hippo1_setup,
11703 .init_hook = alc262_hippo_automute,
11705 [ALC262_FUJITSU] = {
11706 .mixers = { alc262_fujitsu_mixer },
11707 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11708 alc262_fujitsu_unsol_verbs },
11709 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11710 .dac_nids = alc262_dac_nids,
11712 .dig_out_nid = ALC262_DIGOUT_NID,
11713 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11714 .channel_mode = alc262_modes,
11715 .input_mux = &alc262_fujitsu_capture_source,
11716 .unsol_event = alc262_fujitsu_unsol_event,
11717 .init_hook = alc262_fujitsu_init_hook,
11719 [ALC262_HP_BPC] = {
11720 .mixers = { alc262_HP_BPC_mixer },
11721 .init_verbs = { alc262_HP_BPC_init_verbs },
11722 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11723 .dac_nids = alc262_dac_nids,
11725 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11726 .channel_mode = alc262_modes,
11727 .input_mux = &alc262_HP_capture_source,
11728 .unsol_event = alc262_hp_bpc_unsol_event,
11729 .init_hook = alc262_hp_bpc_automute,
11731 [ALC262_HP_BPC_D7000_WF] = {
11732 .mixers = { alc262_HP_BPC_WildWest_mixer },
11733 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11734 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11735 .dac_nids = alc262_dac_nids,
11737 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11738 .channel_mode = alc262_modes,
11739 .input_mux = &alc262_HP_D7000_capture_source,
11740 .unsol_event = alc262_hp_wildwest_unsol_event,
11741 .init_hook = alc262_hp_wildwest_automute,
11743 [ALC262_HP_BPC_D7000_WL] = {
11744 .mixers = { alc262_HP_BPC_WildWest_mixer,
11745 alc262_HP_BPC_WildWest_option_mixer },
11746 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11747 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11748 .dac_nids = alc262_dac_nids,
11750 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11751 .channel_mode = alc262_modes,
11752 .input_mux = &alc262_HP_D7000_capture_source,
11753 .unsol_event = alc262_hp_wildwest_unsol_event,
11754 .init_hook = alc262_hp_wildwest_automute,
11756 [ALC262_HP_TC_T5735] = {
11757 .mixers = { alc262_hp_t5735_mixer },
11758 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11759 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11760 .dac_nids = alc262_dac_nids,
11762 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11763 .channel_mode = alc262_modes,
11764 .input_mux = &alc262_capture_source,
11765 .unsol_event = alc_automute_amp_unsol_event,
11766 .setup = alc262_hp_t5735_setup,
11767 .init_hook = alc_automute_amp,
11769 [ALC262_HP_RP5700] = {
11770 .mixers = { alc262_hp_rp5700_mixer },
11771 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11772 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11773 .dac_nids = alc262_dac_nids,
11774 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11775 .channel_mode = alc262_modes,
11776 .input_mux = &alc262_hp_rp5700_capture_source,
11778 [ALC262_BENQ_ED8] = {
11779 .mixers = { alc262_base_mixer },
11780 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11781 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11782 .dac_nids = alc262_dac_nids,
11784 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11785 .channel_mode = alc262_modes,
11786 .input_mux = &alc262_capture_source,
11788 [ALC262_SONY_ASSAMD] = {
11789 .mixers = { alc262_sony_mixer },
11790 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11791 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11792 .dac_nids = alc262_dac_nids,
11794 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11795 .channel_mode = alc262_modes,
11796 .input_mux = &alc262_capture_source,
11797 .unsol_event = alc262_hippo_unsol_event,
11798 .setup = alc262_hippo_setup,
11799 .init_hook = alc262_hippo_automute,
11801 [ALC262_BENQ_T31] = {
11802 .mixers = { alc262_benq_t31_mixer },
11803 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11804 alc_hp15_unsol_verbs },
11805 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11806 .dac_nids = alc262_dac_nids,
11808 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11809 .channel_mode = alc262_modes,
11810 .input_mux = &alc262_capture_source,
11811 .unsol_event = alc262_hippo_unsol_event,
11812 .setup = alc262_hippo_setup,
11813 .init_hook = alc262_hippo_automute,
11816 .mixers = { alc262_ultra_mixer },
11817 .cap_mixer = alc262_ultra_capture_mixer,
11818 .init_verbs = { alc262_ultra_verbs },
11819 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11820 .dac_nids = alc262_dac_nids,
11821 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11822 .channel_mode = alc262_modes,
11823 .input_mux = &alc262_ultra_capture_source,
11824 .adc_nids = alc262_adc_nids, /* ADC0 */
11825 .capsrc_nids = alc262_capsrc_nids,
11826 .num_adc_nids = 1, /* single ADC */
11827 .unsol_event = alc262_ultra_unsol_event,
11828 .init_hook = alc262_ultra_automute,
11830 [ALC262_LENOVO_3000] = {
11831 .mixers = { alc262_lenovo_3000_mixer },
11832 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11833 alc262_lenovo_3000_unsol_verbs },
11834 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11835 .dac_nids = alc262_dac_nids,
11837 .dig_out_nid = ALC262_DIGOUT_NID,
11838 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11839 .channel_mode = alc262_modes,
11840 .input_mux = &alc262_fujitsu_capture_source,
11841 .unsol_event = alc262_lenovo_3000_unsol_event,
11844 .mixers = { alc262_nec_mixer },
11845 .init_verbs = { alc262_nec_verbs },
11846 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11847 .dac_nids = alc262_dac_nids,
11849 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11850 .channel_mode = alc262_modes,
11851 .input_mux = &alc262_capture_source,
11853 [ALC262_TOSHIBA_S06] = {
11854 .mixers = { alc262_toshiba_s06_mixer },
11855 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11856 alc262_eapd_verbs },
11857 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11858 .capsrc_nids = alc262_dmic_capsrc_nids,
11859 .dac_nids = alc262_dac_nids,
11860 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11861 .num_adc_nids = 1, /* single ADC */
11862 .dig_out_nid = ALC262_DIGOUT_NID,
11863 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11864 .channel_mode = alc262_modes,
11865 .unsol_event = alc_sku_unsol_event,
11866 .setup = alc262_toshiba_s06_setup,
11867 .init_hook = alc_inithook,
11869 [ALC262_TOSHIBA_RX1] = {
11870 .mixers = { alc262_toshiba_rx1_mixer },
11871 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11872 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11873 .dac_nids = alc262_dac_nids,
11875 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11876 .channel_mode = alc262_modes,
11877 .input_mux = &alc262_capture_source,
11878 .unsol_event = alc262_hippo_unsol_event,
11879 .setup = alc262_hippo_setup,
11880 .init_hook = alc262_hippo_automute,
11883 .mixers = { alc262_tyan_mixer },
11884 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11885 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11886 .dac_nids = alc262_dac_nids,
11888 .dig_out_nid = ALC262_DIGOUT_NID,
11889 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11890 .channel_mode = alc262_modes,
11891 .input_mux = &alc262_capture_source,
11892 .unsol_event = alc_automute_amp_unsol_event,
11893 .setup = alc262_tyan_setup,
11894 .init_hook = alc_automute_amp,
11898 static int patch_alc262(struct hda_codec *codec)
11900 struct alc_spec *spec;
11904 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11908 codec->spec = spec;
11910 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11915 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11916 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11917 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11918 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11922 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11924 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11928 if (board_config < 0) {
11929 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11931 board_config = ALC262_AUTO;
11934 if (board_config == ALC262_AUTO) {
11935 /* automatic parse from the BIOS config */
11936 err = alc262_parse_auto_config(codec);
11942 "hda_codec: Cannot set up configuration "
11943 "from BIOS. Using base mode...\n");
11944 board_config = ALC262_BASIC;
11948 if (!spec->no_analog) {
11949 err = snd_hda_attach_beep_device(codec, 0x1);
11956 if (board_config != ALC262_AUTO)
11957 setup_preset(codec, &alc262_presets[board_config]);
11959 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11960 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11962 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11963 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11965 if (!spec->adc_nids && spec->input_mux) {
11967 /* check whether the digital-mic has to be supported */
11968 for (i = 0; i < spec->input_mux->num_items; i++) {
11969 if (spec->input_mux->items[i].index >= 9)
11972 if (i < spec->input_mux->num_items) {
11973 /* use only ADC0 */
11974 spec->adc_nids = alc262_dmic_adc_nids;
11975 spec->num_adc_nids = 1;
11976 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11978 /* all analog inputs */
11979 /* check whether NID 0x07 is valid */
11980 unsigned int wcap = get_wcaps(codec, 0x07);
11983 wcap = get_wcaps_type(wcap);
11984 if (wcap != AC_WID_AUD_IN) {
11985 spec->adc_nids = alc262_adc_nids_alt;
11986 spec->num_adc_nids =
11987 ARRAY_SIZE(alc262_adc_nids_alt);
11988 spec->capsrc_nids = alc262_capsrc_nids_alt;
11990 spec->adc_nids = alc262_adc_nids;
11991 spec->num_adc_nids =
11992 ARRAY_SIZE(alc262_adc_nids);
11993 spec->capsrc_nids = alc262_capsrc_nids;
11997 if (!spec->cap_mixer && !spec->no_analog)
11998 set_capture_mixer(codec);
11999 if (!spec->no_analog)
12000 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12002 spec->vmaster_nid = 0x0c;
12004 codec->patch_ops = alc_patch_ops;
12005 if (board_config == ALC262_AUTO)
12006 spec->init_hook = alc262_auto_init;
12007 #ifdef CONFIG_SND_HDA_POWER_SAVE
12008 if (!spec->loopback.amplist)
12009 spec->loopback.amplist = alc262_loopbacks;
12011 codec->proc_widget_hook = print_realtek_coef;
12017 * ALC268 channel source setting (2 channel)
12019 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12020 #define alc268_modes alc260_modes
12022 static hda_nid_t alc268_dac_nids[2] = {
12027 static hda_nid_t alc268_adc_nids[2] = {
12032 static hda_nid_t alc268_adc_nids_alt[1] = {
12037 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12039 static struct snd_kcontrol_new alc268_base_mixer[] = {
12040 /* output mixer control */
12041 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12042 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12043 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12044 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12045 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12046 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12047 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12051 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12052 /* output mixer control */
12053 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12054 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12055 ALC262_HIPPO_MASTER_SWITCH,
12056 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12057 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12058 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12062 /* bind Beep switches of both NID 0x0f and 0x10 */
12063 static struct hda_bind_ctls alc268_bind_beep_sw = {
12064 .ops = &snd_hda_bind_sw,
12066 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12067 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12072 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12073 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12074 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12078 static struct hda_verb alc268_eapd_verbs[] = {
12079 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12080 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12084 /* Toshiba specific */
12085 static struct hda_verb alc268_toshiba_verbs[] = {
12086 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12090 /* Acer specific */
12091 /* bind volumes of both NID 0x02 and 0x03 */
12092 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12093 .ops = &snd_hda_bind_vol,
12095 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12096 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12101 /* mute/unmute internal speaker according to the hp jack and mute state */
12102 static void alc268_acer_automute(struct hda_codec *codec, int force)
12104 struct alc_spec *spec = codec->spec;
12107 if (force || !spec->sense_updated) {
12108 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12109 spec->sense_updated = 1;
12111 if (spec->jack_present)
12112 mute = HDA_AMP_MUTE; /* mute internal speaker */
12113 else /* unmute internal speaker if necessary */
12114 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12115 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12116 HDA_AMP_MUTE, mute);
12120 /* bind hp and internal speaker mute (with plug check) */
12121 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12122 struct snd_ctl_elem_value *ucontrol)
12124 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12125 long *valp = ucontrol->value.integer.value;
12128 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12130 alc268_acer_automute(codec, 0);
12134 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12135 /* output mixer control */
12136 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12138 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12139 .name = "Master Playback Switch",
12140 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
12141 .info = snd_hda_mixer_amp_switch_info,
12142 .get = snd_hda_mixer_amp_switch_get,
12143 .put = alc268_acer_master_sw_put,
12144 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12146 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12150 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12151 /* output mixer control */
12152 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12154 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12155 .name = "Master Playback Switch",
12156 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
12157 .info = snd_hda_mixer_amp_switch_info,
12158 .get = snd_hda_mixer_amp_switch_get,
12159 .put = alc268_acer_master_sw_put,
12160 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12162 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12163 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12164 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12168 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12169 /* output mixer control */
12170 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12172 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12173 .name = "Master Playback Switch",
12174 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
12175 .info = snd_hda_mixer_amp_switch_info,
12176 .get = snd_hda_mixer_amp_switch_get,
12177 .put = alc268_acer_master_sw_put,
12178 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12180 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12181 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12185 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12186 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12187 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12188 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12189 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12190 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12191 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12195 static struct hda_verb alc268_acer_verbs[] = {
12196 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12197 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12198 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12199 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12200 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12201 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12202 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12206 /* unsolicited event for HP jack sensing */
12207 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12208 #define alc268_toshiba_setup alc262_hippo_setup
12209 #define alc268_toshiba_automute alc262_hippo_automute
12211 static void alc268_acer_unsol_event(struct hda_codec *codec,
12214 if ((res >> 26) != ALC880_HP_EVENT)
12216 alc268_acer_automute(codec, 1);
12219 static void alc268_acer_init_hook(struct hda_codec *codec)
12221 alc268_acer_automute(codec, 1);
12224 /* toggle speaker-output according to the hp-jack state */
12225 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12227 unsigned int present;
12228 unsigned char bits;
12230 present = snd_hda_jack_detect(codec, 0x15);
12231 bits = present ? AMP_IN_MUTE(0) : 0;
12232 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12233 AMP_IN_MUTE(0), bits);
12234 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12235 AMP_IN_MUTE(0), bits);
12238 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12241 switch (res >> 26) {
12242 case ALC880_HP_EVENT:
12243 alc268_aspire_one_speaker_automute(codec);
12245 case ALC880_MIC_EVENT:
12246 alc_mic_automute(codec);
12251 static void alc268_acer_lc_setup(struct hda_codec *codec)
12253 struct alc_spec *spec = codec->spec;
12254 spec->ext_mic.pin = 0x18;
12255 spec->ext_mic.mux_idx = 0;
12256 spec->int_mic.pin = 0x12;
12257 spec->int_mic.mux_idx = 6;
12258 spec->auto_mic = 1;
12261 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12263 alc268_aspire_one_speaker_automute(codec);
12264 alc_mic_automute(codec);
12267 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12268 /* output mixer control */
12269 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12270 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12271 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12272 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12273 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12274 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12278 static struct hda_verb alc268_dell_verbs[] = {
12279 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12280 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12281 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12282 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12286 /* mute/unmute internal speaker according to the hp jack and mute state */
12287 static void alc268_dell_setup(struct hda_codec *codec)
12289 struct alc_spec *spec = codec->spec;
12291 spec->autocfg.hp_pins[0] = 0x15;
12292 spec->autocfg.speaker_pins[0] = 0x14;
12293 spec->ext_mic.pin = 0x18;
12294 spec->ext_mic.mux_idx = 0;
12295 spec->int_mic.pin = 0x19;
12296 spec->int_mic.mux_idx = 1;
12297 spec->auto_mic = 1;
12300 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12301 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12302 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12303 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12304 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12305 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12306 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12307 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12308 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12312 static struct hda_verb alc267_quanta_il1_verbs[] = {
12313 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12314 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12318 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12320 struct alc_spec *spec = codec->spec;
12321 spec->autocfg.hp_pins[0] = 0x15;
12322 spec->autocfg.speaker_pins[0] = 0x14;
12323 spec->ext_mic.pin = 0x18;
12324 spec->ext_mic.mux_idx = 0;
12325 spec->int_mic.pin = 0x19;
12326 spec->int_mic.mux_idx = 1;
12327 spec->auto_mic = 1;
12331 * generic initialization of ADC, input mixers and output mixers
12333 static struct hda_verb alc268_base_init_verbs[] = {
12334 /* Unmute DAC0-1 and set vol = 0 */
12335 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12336 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12339 * Set up output mixers (0x0c - 0x0e)
12341 /* set vol=0 to output mixers */
12342 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12343 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12345 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12346 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12348 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12349 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12350 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12351 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12352 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12353 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12354 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12355 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12357 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12358 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12359 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12360 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12361 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12363 /* set PCBEEP vol = 0, mute connections */
12364 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12365 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12366 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12368 /* Unmute Selector 23h,24h and set the default input to mic-in */
12370 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12371 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12372 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12379 * generic initialization of ADC, input mixers and output mixers
12381 static struct hda_verb alc268_volume_init_verbs[] = {
12382 /* set output DAC */
12383 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12384 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12386 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12387 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12388 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12389 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12390 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12392 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12393 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12394 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12396 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12397 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12399 /* set PCBEEP vol = 0, mute connections */
12400 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12401 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12402 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12407 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12408 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12409 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12413 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12414 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12415 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12420 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12421 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12422 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12423 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12424 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12429 static struct hda_input_mux alc268_capture_source = {
12433 { "Front Mic", 0x1 },
12439 static struct hda_input_mux alc268_acer_capture_source = {
12443 { "Internal Mic", 0x1 },
12448 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12452 { "Internal Mic", 0x6 },
12457 #ifdef CONFIG_SND_DEBUG
12458 static struct snd_kcontrol_new alc268_test_mixer[] = {
12459 /* Volume widgets */
12460 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12461 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12462 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12463 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12464 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12465 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12466 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12467 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12468 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12469 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12470 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12471 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12472 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12473 /* The below appears problematic on some hardwares */
12474 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12475 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12476 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12477 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12478 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12480 /* Modes for retasking pin widgets */
12481 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12482 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12483 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12484 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12486 /* Controls for GPIO pins, assuming they are configured as outputs */
12487 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12488 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12489 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12490 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12492 /* Switches to allow the digital SPDIF output pin to be enabled.
12493 * The ALC268 does not have an SPDIF input.
12495 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12497 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12498 * this output to turn on an external amplifier.
12500 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12501 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12507 /* create input playback/capture controls for the given pin */
12508 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12509 const char *ctlname, int idx)
12525 if (spec->multiout.dac_nids[0] != dac &&
12526 spec->multiout.dac_nids[1] != dac) {
12527 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12528 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12532 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12536 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12537 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12539 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12540 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12546 /* add playback controls from the parsed DAC table */
12547 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12548 const struct auto_pin_cfg *cfg)
12553 spec->multiout.dac_nids = spec->private_dac_nids;
12555 nid = cfg->line_out_pins[0];
12558 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12562 err = alc268_new_analog_output(spec, nid, name, 0);
12567 nid = cfg->speaker_pins[0];
12569 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12570 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12574 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12578 nid = cfg->hp_pins[0];
12580 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12585 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12587 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12588 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12595 /* create playback/capture controls for input pins */
12596 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12597 const struct auto_pin_cfg *cfg)
12599 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12602 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12603 hda_nid_t nid, int pin_type)
12607 alc_set_pin_output(codec, nid, pin_type);
12608 if (nid == 0x14 || nid == 0x16)
12612 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12615 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12617 struct alc_spec *spec = codec->spec;
12618 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12620 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12621 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12625 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12627 struct alc_spec *spec = codec->spec;
12630 pin = spec->autocfg.hp_pins[0];
12632 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12633 pin = spec->autocfg.speaker_pins[0];
12635 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12638 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12640 struct alc_spec *spec = codec->spec;
12641 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12642 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12643 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12644 unsigned int dac_vol1, dac_vol2;
12646 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12647 snd_hda_codec_write(codec, speaker_nid, 0,
12648 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12649 /* mute mixer inputs from 0x1d */
12650 snd_hda_codec_write(codec, 0x0f, 0,
12651 AC_VERB_SET_AMP_GAIN_MUTE,
12653 snd_hda_codec_write(codec, 0x10, 0,
12654 AC_VERB_SET_AMP_GAIN_MUTE,
12657 /* unmute mixer inputs from 0x1d */
12658 snd_hda_codec_write(codec, 0x0f, 0,
12659 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12660 snd_hda_codec_write(codec, 0x10, 0,
12661 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12664 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12665 if (line_nid == 0x14)
12666 dac_vol2 = AMP_OUT_ZERO;
12667 else if (line_nid == 0x15)
12668 dac_vol1 = AMP_OUT_ZERO;
12669 if (hp_nid == 0x14)
12670 dac_vol2 = AMP_OUT_ZERO;
12671 else if (hp_nid == 0x15)
12672 dac_vol1 = AMP_OUT_ZERO;
12673 if (line_nid != 0x16 || hp_nid != 0x16 ||
12674 spec->autocfg.line_out_pins[1] != 0x16 ||
12675 spec->autocfg.line_out_pins[2] != 0x16)
12676 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12678 snd_hda_codec_write(codec, 0x02, 0,
12679 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12680 snd_hda_codec_write(codec, 0x03, 0,
12681 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12684 /* pcm configuration: identical with ALC880 */
12685 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12686 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12687 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12688 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12691 * BIOS auto configuration
12693 static int alc268_parse_auto_config(struct hda_codec *codec)
12695 struct alc_spec *spec = codec->spec;
12697 static hda_nid_t alc268_ignore[] = { 0 };
12699 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12703 if (!spec->autocfg.line_outs) {
12704 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12705 spec->multiout.max_channels = 2;
12706 spec->no_analog = 1;
12709 return 0; /* can't find valid BIOS pin config */
12711 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12714 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12718 spec->multiout.max_channels = 2;
12721 /* digital only support output */
12722 if (spec->autocfg.dig_outs) {
12723 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12724 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12726 if (spec->kctls.list)
12727 add_mixer(spec, spec->kctls.list);
12729 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12730 add_mixer(spec, alc268_beep_mixer);
12732 add_verb(spec, alc268_volume_init_verbs);
12733 spec->num_mux_defs = 2;
12734 spec->input_mux = &spec->private_imux[0];
12736 err = alc_auto_add_mic_boost(codec);
12740 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12745 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12747 /* init callback for auto-configuration model -- overriding the default init */
12748 static void alc268_auto_init(struct hda_codec *codec)
12750 struct alc_spec *spec = codec->spec;
12751 alc268_auto_init_multi_out(codec);
12752 alc268_auto_init_hp_out(codec);
12753 alc268_auto_init_mono_speaker_out(codec);
12754 alc268_auto_init_analog_input(codec);
12755 if (spec->unsol_event)
12756 alc_inithook(codec);
12760 * configuration and preset
12762 static const char *alc268_models[ALC268_MODEL_LAST] = {
12763 [ALC267_QUANTA_IL1] = "quanta-il1",
12764 [ALC268_3ST] = "3stack",
12765 [ALC268_TOSHIBA] = "toshiba",
12766 [ALC268_ACER] = "acer",
12767 [ALC268_ACER_DMIC] = "acer-dmic",
12768 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12769 [ALC268_DELL] = "dell",
12770 [ALC268_ZEPTO] = "zepto",
12771 #ifdef CONFIG_SND_DEBUG
12772 [ALC268_TEST] = "test",
12774 [ALC268_AUTO] = "auto",
12777 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12778 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12779 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12780 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12781 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12782 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12783 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12784 ALC268_ACER_ASPIRE_ONE),
12785 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12786 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12787 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12788 /* almost compatible with toshiba but with optional digital outs;
12789 * auto-probing seems working fine
12791 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12793 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12794 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12795 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12796 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12797 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12798 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12802 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12803 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12804 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12805 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12806 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12811 static struct alc_config_preset alc268_presets[] = {
12812 [ALC267_QUANTA_IL1] = {
12813 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12814 alc268_capture_nosrc_mixer },
12815 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12816 alc267_quanta_il1_verbs },
12817 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12818 .dac_nids = alc268_dac_nids,
12819 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12820 .adc_nids = alc268_adc_nids_alt,
12822 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12823 .channel_mode = alc268_modes,
12824 .unsol_event = alc_sku_unsol_event,
12825 .setup = alc267_quanta_il1_setup,
12826 .init_hook = alc_inithook,
12829 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12830 alc268_beep_mixer },
12831 .init_verbs = { alc268_base_init_verbs },
12832 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12833 .dac_nids = alc268_dac_nids,
12834 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12835 .adc_nids = alc268_adc_nids_alt,
12836 .capsrc_nids = alc268_capsrc_nids,
12838 .dig_out_nid = ALC268_DIGOUT_NID,
12839 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12840 .channel_mode = alc268_modes,
12841 .input_mux = &alc268_capture_source,
12843 [ALC268_TOSHIBA] = {
12844 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12845 alc268_beep_mixer },
12846 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12847 alc268_toshiba_verbs },
12848 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12849 .dac_nids = alc268_dac_nids,
12850 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12851 .adc_nids = alc268_adc_nids_alt,
12852 .capsrc_nids = alc268_capsrc_nids,
12854 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12855 .channel_mode = alc268_modes,
12856 .input_mux = &alc268_capture_source,
12857 .unsol_event = alc268_toshiba_unsol_event,
12858 .setup = alc268_toshiba_setup,
12859 .init_hook = alc268_toshiba_automute,
12862 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12863 alc268_beep_mixer },
12864 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12865 alc268_acer_verbs },
12866 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12867 .dac_nids = alc268_dac_nids,
12868 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12869 .adc_nids = alc268_adc_nids_alt,
12870 .capsrc_nids = alc268_capsrc_nids,
12872 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12873 .channel_mode = alc268_modes,
12874 .input_mux = &alc268_acer_capture_source,
12875 .unsol_event = alc268_acer_unsol_event,
12876 .init_hook = alc268_acer_init_hook,
12878 [ALC268_ACER_DMIC] = {
12879 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12880 alc268_beep_mixer },
12881 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12882 alc268_acer_verbs },
12883 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12884 .dac_nids = alc268_dac_nids,
12885 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12886 .adc_nids = alc268_adc_nids_alt,
12887 .capsrc_nids = alc268_capsrc_nids,
12889 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12890 .channel_mode = alc268_modes,
12891 .input_mux = &alc268_acer_dmic_capture_source,
12892 .unsol_event = alc268_acer_unsol_event,
12893 .init_hook = alc268_acer_init_hook,
12895 [ALC268_ACER_ASPIRE_ONE] = {
12896 .mixers = { alc268_acer_aspire_one_mixer,
12898 alc268_capture_nosrc_mixer },
12899 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12900 alc268_acer_aspire_one_verbs },
12901 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12902 .dac_nids = alc268_dac_nids,
12903 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12904 .adc_nids = alc268_adc_nids_alt,
12905 .capsrc_nids = alc268_capsrc_nids,
12907 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12908 .channel_mode = alc268_modes,
12909 .unsol_event = alc268_acer_lc_unsol_event,
12910 .setup = alc268_acer_lc_setup,
12911 .init_hook = alc268_acer_lc_init_hook,
12914 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12915 alc268_capture_nosrc_mixer },
12916 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12917 alc268_dell_verbs },
12918 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12919 .dac_nids = alc268_dac_nids,
12920 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12921 .adc_nids = alc268_adc_nids_alt,
12922 .capsrc_nids = alc268_capsrc_nids,
12924 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12925 .channel_mode = alc268_modes,
12926 .unsol_event = alc_sku_unsol_event,
12927 .setup = alc268_dell_setup,
12928 .init_hook = alc_inithook,
12931 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12932 alc268_beep_mixer },
12933 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12934 alc268_toshiba_verbs },
12935 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12936 .dac_nids = alc268_dac_nids,
12937 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12938 .adc_nids = alc268_adc_nids_alt,
12939 .capsrc_nids = alc268_capsrc_nids,
12941 .dig_out_nid = ALC268_DIGOUT_NID,
12942 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12943 .channel_mode = alc268_modes,
12944 .input_mux = &alc268_capture_source,
12945 .setup = alc268_toshiba_setup,
12946 .init_hook = alc268_toshiba_automute,
12948 #ifdef CONFIG_SND_DEBUG
12950 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12951 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12952 alc268_volume_init_verbs },
12953 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12954 .dac_nids = alc268_dac_nids,
12955 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12956 .adc_nids = alc268_adc_nids_alt,
12957 .capsrc_nids = alc268_capsrc_nids,
12959 .dig_out_nid = ALC268_DIGOUT_NID,
12960 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12961 .channel_mode = alc268_modes,
12962 .input_mux = &alc268_capture_source,
12967 static int patch_alc268(struct hda_codec *codec)
12969 struct alc_spec *spec;
12971 int i, has_beep, err;
12973 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12977 codec->spec = spec;
12979 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12983 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12984 board_config = snd_hda_check_board_codec_sid_config(codec,
12985 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12987 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12988 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12990 board_config = ALC268_AUTO;
12993 if (board_config == ALC268_AUTO) {
12994 /* automatic parse from the BIOS config */
12995 err = alc268_parse_auto_config(codec);
13001 "hda_codec: Cannot set up configuration "
13002 "from BIOS. Using base mode...\n");
13003 board_config = ALC268_3ST;
13007 if (board_config != ALC268_AUTO)
13008 setup_preset(codec, &alc268_presets[board_config]);
13010 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13011 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13012 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13014 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13017 for (i = 0; i < spec->num_mixers; i++) {
13018 if (spec->mixers[i] == alc268_beep_mixer) {
13025 err = snd_hda_attach_beep_device(codec, 0x1);
13030 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13031 /* override the amp caps for beep generator */
13032 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13033 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13034 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13035 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13036 (0 << AC_AMPCAP_MUTE_SHIFT));
13039 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13040 /* check whether NID 0x07 is valid */
13041 unsigned int wcap = get_wcaps(codec, 0x07);
13044 spec->capsrc_nids = alc268_capsrc_nids;
13046 wcap = get_wcaps_type(wcap);
13047 if (spec->auto_mic ||
13048 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13049 spec->adc_nids = alc268_adc_nids_alt;
13050 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13051 if (spec->auto_mic)
13052 fixup_automic_adc(codec);
13053 if (spec->auto_mic || spec->input_mux->num_items == 1)
13054 add_mixer(spec, alc268_capture_nosrc_mixer);
13056 add_mixer(spec, alc268_capture_alt_mixer);
13058 spec->adc_nids = alc268_adc_nids;
13059 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13060 add_mixer(spec, alc268_capture_mixer);
13062 /* set default input source */
13063 for (i = 0; i < spec->num_adc_nids; i++)
13064 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13065 0, AC_VERB_SET_CONNECT_SEL,
13066 i < spec->num_mux_defs ?
13067 spec->input_mux[i].items[0].index :
13068 spec->input_mux->items[0].index);
13071 spec->vmaster_nid = 0x02;
13073 codec->patch_ops = alc_patch_ops;
13074 if (board_config == ALC268_AUTO)
13075 spec->init_hook = alc268_auto_init;
13077 codec->proc_widget_hook = print_realtek_coef;
13083 * ALC269 channel source setting (2 channel)
13085 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13087 #define alc269_dac_nids alc260_dac_nids
13089 static hda_nid_t alc269_adc_nids[1] = {
13094 static hda_nid_t alc269_capsrc_nids[1] = {
13098 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13102 #define alc269_modes alc260_modes
13103 #define alc269_capture_source alc880_lg_lw_capture_source
13105 static struct snd_kcontrol_new alc269_base_mixer[] = {
13106 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13107 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13108 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13109 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13111 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13112 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13113 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13114 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13115 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13116 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13117 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13121 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13122 /* output mixer control */
13123 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13125 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13126 .name = "Master Playback Switch",
13127 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
13128 .info = snd_hda_mixer_amp_switch_info,
13129 .get = snd_hda_mixer_amp_switch_get,
13130 .put = alc268_acer_master_sw_put,
13131 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13135 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13136 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13137 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13138 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13142 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13143 /* output mixer control */
13144 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13146 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13147 .name = "Master Playback Switch",
13148 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
13149 .info = snd_hda_mixer_amp_switch_info,
13150 .get = snd_hda_mixer_amp_switch_get,
13151 .put = alc268_acer_master_sw_put,
13152 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13154 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13155 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13156 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13157 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13158 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13159 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13160 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13161 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13162 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13166 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13167 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13168 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13169 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13170 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13174 /* capture mixer elements */
13175 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13176 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13177 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13178 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13183 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13185 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13186 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13187 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13188 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13189 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13190 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13191 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13195 static struct hda_verb alc269_lifebook_verbs[] = {
13196 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13197 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13198 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13199 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13200 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13201 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13202 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13203 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13204 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13205 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13209 /* toggle speaker-output according to the hp-jack state */
13210 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13212 unsigned int present;
13213 unsigned char bits;
13215 present = snd_hda_jack_detect(codec, 0x15);
13216 bits = present ? AMP_IN_MUTE(0) : 0;
13217 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13218 AMP_IN_MUTE(0), bits);
13219 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13220 AMP_IN_MUTE(0), bits);
13222 snd_hda_codec_write(codec, 0x20, 0,
13223 AC_VERB_SET_COEF_INDEX, 0x0c);
13224 snd_hda_codec_write(codec, 0x20, 0,
13225 AC_VERB_SET_PROC_COEF, 0x680);
13227 snd_hda_codec_write(codec, 0x20, 0,
13228 AC_VERB_SET_COEF_INDEX, 0x0c);
13229 snd_hda_codec_write(codec, 0x20, 0,
13230 AC_VERB_SET_PROC_COEF, 0x480);
13233 /* toggle speaker-output according to the hp-jacks state */
13234 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13236 unsigned int present;
13237 unsigned char bits;
13239 /* Check laptop headphone socket */
13240 present = snd_hda_jack_detect(codec, 0x15);
13242 /* Check port replicator headphone socket */
13243 present |= snd_hda_jack_detect(codec, 0x1a);
13245 bits = present ? AMP_IN_MUTE(0) : 0;
13246 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13247 AMP_IN_MUTE(0), bits);
13248 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13249 AMP_IN_MUTE(0), bits);
13251 snd_hda_codec_write(codec, 0x20, 0,
13252 AC_VERB_SET_COEF_INDEX, 0x0c);
13253 snd_hda_codec_write(codec, 0x20, 0,
13254 AC_VERB_SET_PROC_COEF, 0x680);
13256 snd_hda_codec_write(codec, 0x20, 0,
13257 AC_VERB_SET_COEF_INDEX, 0x0c);
13258 snd_hda_codec_write(codec, 0x20, 0,
13259 AC_VERB_SET_PROC_COEF, 0x480);
13262 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13264 unsigned int present_laptop;
13265 unsigned int present_dock;
13267 present_laptop = snd_hda_jack_detect(codec, 0x18);
13268 present_dock = snd_hda_jack_detect(codec, 0x1b);
13270 /* Laptop mic port overrides dock mic port, design decision */
13272 snd_hda_codec_write(codec, 0x23, 0,
13273 AC_VERB_SET_CONNECT_SEL, 0x3);
13274 if (present_laptop)
13275 snd_hda_codec_write(codec, 0x23, 0,
13276 AC_VERB_SET_CONNECT_SEL, 0x0);
13277 if (!present_dock && !present_laptop)
13278 snd_hda_codec_write(codec, 0x23, 0,
13279 AC_VERB_SET_CONNECT_SEL, 0x1);
13282 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13285 switch (res >> 26) {
13286 case ALC880_HP_EVENT:
13287 alc269_quanta_fl1_speaker_automute(codec);
13289 case ALC880_MIC_EVENT:
13290 alc_mic_automute(codec);
13295 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13298 if ((res >> 26) == ALC880_HP_EVENT)
13299 alc269_lifebook_speaker_automute(codec);
13300 if ((res >> 26) == ALC880_MIC_EVENT)
13301 alc269_lifebook_mic_autoswitch(codec);
13304 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13306 struct alc_spec *spec = codec->spec;
13307 spec->ext_mic.pin = 0x18;
13308 spec->ext_mic.mux_idx = 0;
13309 spec->int_mic.pin = 0x19;
13310 spec->int_mic.mux_idx = 1;
13311 spec->auto_mic = 1;
13314 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13316 alc269_quanta_fl1_speaker_automute(codec);
13317 alc_mic_automute(codec);
13320 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13322 alc269_lifebook_speaker_automute(codec);
13323 alc269_lifebook_mic_autoswitch(codec);
13326 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13327 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13328 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13329 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13330 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13331 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13332 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13333 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13337 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13338 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13339 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13340 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13341 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13342 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13343 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13347 /* toggle speaker-output according to the hp-jack state */
13348 static void alc269_speaker_automute(struct hda_codec *codec)
13350 unsigned int present;
13351 unsigned char bits;
13353 present = snd_hda_jack_detect(codec, 0x15);
13354 bits = present ? AMP_IN_MUTE(0) : 0;
13355 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13356 AMP_IN_MUTE(0), bits);
13357 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13358 AMP_IN_MUTE(0), bits);
13361 /* unsolicited event for HP jack sensing */
13362 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13365 switch (res >> 26) {
13366 case ALC880_HP_EVENT:
13367 alc269_speaker_automute(codec);
13369 case ALC880_MIC_EVENT:
13370 alc_mic_automute(codec);
13375 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13377 struct alc_spec *spec = codec->spec;
13378 spec->ext_mic.pin = 0x18;
13379 spec->ext_mic.mux_idx = 0;
13380 spec->int_mic.pin = 0x12;
13381 spec->int_mic.mux_idx = 5;
13382 spec->auto_mic = 1;
13385 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13387 struct alc_spec *spec = codec->spec;
13388 spec->ext_mic.pin = 0x18;
13389 spec->ext_mic.mux_idx = 0;
13390 spec->int_mic.pin = 0x19;
13391 spec->int_mic.mux_idx = 1;
13392 spec->auto_mic = 1;
13395 static void alc269_eeepc_inithook(struct hda_codec *codec)
13397 alc269_speaker_automute(codec);
13398 alc_mic_automute(codec);
13402 * generic initialization of ADC, input mixers and output mixers
13404 static struct hda_verb alc269_init_verbs[] = {
13406 * Unmute ADC0 and set the default input to mic-in
13408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13410 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13411 * analog-loopback mixer widget
13412 * Note: PASD motherboards uses the Line In 2 as the input for
13413 * front panel mic (mic 2)
13415 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13417 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13420 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13423 * Set up output mixers (0x0c - 0x0e)
13425 /* set vol=0 to output mixers */
13426 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13427 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13429 /* set up input amps for analog loopback */
13430 /* Amp Indices: DAC = 0, mixer = 1 */
13431 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13432 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13433 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13434 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13435 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13436 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13438 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13439 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13440 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13441 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13442 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13443 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13444 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13446 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13447 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13448 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13449 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13450 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13451 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13452 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13454 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13455 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13457 /* FIXME: use matrix-type input source selection */
13458 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13459 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13460 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13461 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13462 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13463 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13466 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13467 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13471 #define alc269_auto_create_multi_out_ctls \
13472 alc268_auto_create_multi_out_ctls
13473 #define alc269_auto_create_input_ctls \
13474 alc268_auto_create_input_ctls
13476 #ifdef CONFIG_SND_HDA_POWER_SAVE
13477 #define alc269_loopbacks alc880_loopbacks
13480 /* pcm configuration: identical with ALC880 */
13481 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13482 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13483 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13484 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13486 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13490 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13491 /* NID is set in alc_build_pcms */
13493 .open = alc880_playback_pcm_open,
13494 .prepare = alc880_playback_pcm_prepare,
13495 .cleanup = alc880_playback_pcm_cleanup
13499 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13503 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13504 /* NID is set in alc_build_pcms */
13508 * BIOS auto configuration
13510 static int alc269_parse_auto_config(struct hda_codec *codec)
13512 struct alc_spec *spec = codec->spec;
13514 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13516 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13521 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13524 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13528 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13530 if (spec->autocfg.dig_outs)
13531 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13533 if (spec->kctls.list)
13534 add_mixer(spec, spec->kctls.list);
13536 add_verb(spec, alc269_init_verbs);
13537 spec->num_mux_defs = 1;
13538 spec->input_mux = &spec->private_imux[0];
13539 /* set default input source */
13540 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13541 0, AC_VERB_SET_CONNECT_SEL,
13542 spec->input_mux->items[0].index);
13544 err = alc_auto_add_mic_boost(codec);
13548 if (!spec->cap_mixer && !spec->no_analog)
13549 set_capture_mixer(codec);
13551 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13556 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13557 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13558 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13561 /* init callback for auto-configuration model -- overriding the default init */
13562 static void alc269_auto_init(struct hda_codec *codec)
13564 struct alc_spec *spec = codec->spec;
13565 alc269_auto_init_multi_out(codec);
13566 alc269_auto_init_hp_out(codec);
13567 alc269_auto_init_analog_input(codec);
13568 if (spec->unsol_event)
13569 alc_inithook(codec);
13573 * configuration and preset
13575 static const char *alc269_models[ALC269_MODEL_LAST] = {
13576 [ALC269_BASIC] = "basic",
13577 [ALC269_QUANTA_FL1] = "quanta",
13578 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13579 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13580 [ALC269_FUJITSU] = "fujitsu",
13581 [ALC269_LIFEBOOK] = "lifebook",
13582 [ALC269_AUTO] = "auto",
13585 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13586 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13587 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13588 ALC269_ASUS_EEEPC_P703),
13589 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13590 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13591 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13592 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13593 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13594 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13595 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13596 ALC269_ASUS_EEEPC_P901),
13597 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13598 ALC269_ASUS_EEEPC_P901),
13599 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13600 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13601 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13605 static struct alc_config_preset alc269_presets[] = {
13607 .mixers = { alc269_base_mixer },
13608 .init_verbs = { alc269_init_verbs },
13609 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13610 .dac_nids = alc269_dac_nids,
13612 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13613 .channel_mode = alc269_modes,
13614 .input_mux = &alc269_capture_source,
13616 [ALC269_QUANTA_FL1] = {
13617 .mixers = { alc269_quanta_fl1_mixer },
13618 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13619 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13620 .dac_nids = alc269_dac_nids,
13622 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13623 .channel_mode = alc269_modes,
13624 .input_mux = &alc269_capture_source,
13625 .unsol_event = alc269_quanta_fl1_unsol_event,
13626 .setup = alc269_quanta_fl1_setup,
13627 .init_hook = alc269_quanta_fl1_init_hook,
13629 [ALC269_ASUS_EEEPC_P703] = {
13630 .mixers = { alc269_eeepc_mixer },
13631 .cap_mixer = alc269_epc_capture_mixer,
13632 .init_verbs = { alc269_init_verbs,
13633 alc269_eeepc_amic_init_verbs },
13634 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13635 .dac_nids = alc269_dac_nids,
13637 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13638 .channel_mode = alc269_modes,
13639 .unsol_event = alc269_eeepc_unsol_event,
13640 .setup = alc269_eeepc_amic_setup,
13641 .init_hook = alc269_eeepc_inithook,
13643 [ALC269_ASUS_EEEPC_P901] = {
13644 .mixers = { alc269_eeepc_mixer },
13645 .cap_mixer = alc269_epc_capture_mixer,
13646 .init_verbs = { alc269_init_verbs,
13647 alc269_eeepc_dmic_init_verbs },
13648 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13649 .dac_nids = alc269_dac_nids,
13651 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13652 .channel_mode = alc269_modes,
13653 .unsol_event = alc269_eeepc_unsol_event,
13654 .setup = alc269_eeepc_dmic_setup,
13655 .init_hook = alc269_eeepc_inithook,
13657 [ALC269_FUJITSU] = {
13658 .mixers = { alc269_fujitsu_mixer },
13659 .cap_mixer = alc269_epc_capture_mixer,
13660 .init_verbs = { alc269_init_verbs,
13661 alc269_eeepc_dmic_init_verbs },
13662 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13663 .dac_nids = alc269_dac_nids,
13665 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13666 .channel_mode = alc269_modes,
13667 .unsol_event = alc269_eeepc_unsol_event,
13668 .setup = alc269_eeepc_dmic_setup,
13669 .init_hook = alc269_eeepc_inithook,
13671 [ALC269_LIFEBOOK] = {
13672 .mixers = { alc269_lifebook_mixer },
13673 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13674 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13675 .dac_nids = alc269_dac_nids,
13677 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13678 .channel_mode = alc269_modes,
13679 .input_mux = &alc269_capture_source,
13680 .unsol_event = alc269_lifebook_unsol_event,
13681 .init_hook = alc269_lifebook_init_hook,
13685 static int patch_alc269(struct hda_codec *codec)
13687 struct alc_spec *spec;
13691 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13695 codec->spec = spec;
13697 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13699 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13700 kfree(codec->chip_name);
13701 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13702 if (!codec->chip_name) {
13708 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13712 if (board_config < 0) {
13713 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13715 board_config = ALC269_AUTO;
13718 if (board_config == ALC269_AUTO) {
13719 /* automatic parse from the BIOS config */
13720 err = alc269_parse_auto_config(codec);
13726 "hda_codec: Cannot set up configuration "
13727 "from BIOS. Using base mode...\n");
13728 board_config = ALC269_BASIC;
13732 err = snd_hda_attach_beep_device(codec, 0x1);
13738 if (board_config != ALC269_AUTO)
13739 setup_preset(codec, &alc269_presets[board_config]);
13741 if (codec->subsystem_id == 0x17aa3bf8) {
13742 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13743 * fix the sample rate of analog I/O to 44.1kHz
13745 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13746 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13748 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13749 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13751 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13752 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13754 spec->adc_nids = alc269_adc_nids;
13755 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13756 spec->capsrc_nids = alc269_capsrc_nids;
13757 if (!spec->cap_mixer)
13758 set_capture_mixer(codec);
13759 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13761 spec->vmaster_nid = 0x02;
13763 codec->patch_ops = alc_patch_ops;
13764 if (board_config == ALC269_AUTO)
13765 spec->init_hook = alc269_auto_init;
13766 #ifdef CONFIG_SND_HDA_POWER_SAVE
13767 if (!spec->loopback.amplist)
13768 spec->loopback.amplist = alc269_loopbacks;
13770 codec->proc_widget_hook = print_realtek_coef;
13776 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13780 * set the path ways for 2 channel output
13781 * need to set the codec line out and mic 1 pin widgets to inputs
13783 static struct hda_verb alc861_threestack_ch2_init[] = {
13784 /* set pin widget 1Ah (line in) for input */
13785 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13786 /* set pin widget 18h (mic1/2) for input, for mic also enable
13789 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13791 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13793 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13794 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13800 * need to set the codec line out and mic 1 pin widgets to outputs
13802 static struct hda_verb alc861_threestack_ch6_init[] = {
13803 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13804 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13805 /* set pin widget 18h (mic1) for output (CLFE)*/
13806 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13808 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13809 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13811 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13813 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13814 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13819 static struct hda_channel_mode alc861_threestack_modes[2] = {
13820 { 2, alc861_threestack_ch2_init },
13821 { 6, alc861_threestack_ch6_init },
13823 /* Set mic1 as input and unmute the mixer */
13824 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13825 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13826 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13829 /* Set mic1 as output and mute mixer */
13830 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13831 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13832 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13836 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13837 { 2, alc861_uniwill_m31_ch2_init },
13838 { 4, alc861_uniwill_m31_ch4_init },
13841 /* Set mic1 and line-in as input and unmute the mixer */
13842 static struct hda_verb alc861_asus_ch2_init[] = {
13843 /* set pin widget 1Ah (line in) for input */
13844 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13845 /* set pin widget 18h (mic1/2) for input, for mic also enable
13848 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13850 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13852 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13853 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13857 /* Set mic1 nad line-in as output and mute mixer */
13858 static struct hda_verb alc861_asus_ch6_init[] = {
13859 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13860 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13861 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13862 /* set pin widget 18h (mic1) for output (CLFE)*/
13863 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13864 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13865 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13866 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13868 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13870 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13871 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13876 static struct hda_channel_mode alc861_asus_modes[2] = {
13877 { 2, alc861_asus_ch2_init },
13878 { 6, alc861_asus_ch6_init },
13883 static struct snd_kcontrol_new alc861_base_mixer[] = {
13884 /* output mixer control */
13885 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13886 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13887 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13888 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13889 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13891 /*Input mixer control */
13892 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13893 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13894 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13895 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13896 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13897 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13898 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13899 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13900 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13901 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13906 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13907 /* output mixer control */
13908 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13909 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13910 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13911 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13912 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13914 /* Input mixer control */
13915 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13916 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13917 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13918 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13919 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13920 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13921 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13922 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13923 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13924 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13927 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13928 .name = "Channel Mode",
13929 .info = alc_ch_mode_info,
13930 .get = alc_ch_mode_get,
13931 .put = alc_ch_mode_put,
13932 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13937 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13938 /* output mixer control */
13939 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13940 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13941 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13946 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13947 /* output mixer control */
13948 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13949 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13950 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13951 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13952 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13954 /* Input mixer control */
13955 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13956 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13957 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13958 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13959 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13960 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13961 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13962 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13963 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13964 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13967 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13968 .name = "Channel Mode",
13969 .info = alc_ch_mode_info,
13970 .get = alc_ch_mode_get,
13971 .put = alc_ch_mode_put,
13972 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13977 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13978 /* output mixer control */
13979 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13980 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13981 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13982 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13983 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13985 /* Input mixer control */
13986 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13987 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13988 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13989 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13990 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13991 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13993 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13994 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13995 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13998 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13999 .name = "Channel Mode",
14000 .info = alc_ch_mode_info,
14001 .get = alc_ch_mode_get,
14002 .put = alc_ch_mode_put,
14003 .private_value = ARRAY_SIZE(alc861_asus_modes),
14008 /* additional mixer */
14009 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14010 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14011 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14016 * generic initialization of ADC, input mixers and output mixers
14018 static struct hda_verb alc861_base_init_verbs[] = {
14020 * Unmute ADC0 and set the default input to mic-in
14022 /* port-A for surround (rear panel) */
14023 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14024 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14025 /* port-B for mic-in (rear panel) with vref */
14026 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14027 /* port-C for line-in (rear panel) */
14028 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14029 /* port-D for Front */
14030 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14031 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14032 /* port-E for HP out (front panel) */
14033 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14034 /* route front PCM to HP */
14035 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14036 /* port-F for mic-in (front panel) with vref */
14037 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14038 /* port-G for CLFE (rear panel) */
14039 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14040 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14041 /* port-H for side (rear panel) */
14042 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14043 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14045 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14046 /* route front mic to ADC1*/
14047 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14048 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14050 /* Unmute DAC0~3 & spdif out*/
14051 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14052 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14053 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14054 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14055 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14057 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14058 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14059 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14060 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14061 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14063 /* Unmute Stereo Mixer 15 */
14064 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14066 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14069 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14070 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14071 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14072 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14073 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14074 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14075 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14076 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14077 /* hp used DAC 3 (Front) */
14078 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14079 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14084 static struct hda_verb alc861_threestack_init_verbs[] = {
14086 * Unmute ADC0 and set the default input to mic-in
14088 /* port-A for surround (rear panel) */
14089 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14090 /* port-B for mic-in (rear panel) with vref */
14091 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14092 /* port-C for line-in (rear panel) */
14093 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14094 /* port-D for Front */
14095 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14096 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14097 /* port-E for HP out (front panel) */
14098 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14099 /* route front PCM to HP */
14100 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14101 /* port-F for mic-in (front panel) with vref */
14102 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14103 /* port-G for CLFE (rear panel) */
14104 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14105 /* port-H for side (rear panel) */
14106 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14108 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14109 /* route front mic to ADC1*/
14110 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14111 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14112 /* Unmute DAC0~3 & spdif out*/
14113 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14114 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14115 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14116 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14119 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14120 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14121 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14122 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14123 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14125 /* Unmute Stereo Mixer 15 */
14126 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14127 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14128 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14129 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14131 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14132 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14133 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14134 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14135 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14136 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14137 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14138 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14139 /* hp used DAC 3 (Front) */
14140 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14141 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14145 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14147 * Unmute ADC0 and set the default input to mic-in
14149 /* port-A for surround (rear panel) */
14150 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14151 /* port-B for mic-in (rear panel) with vref */
14152 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14153 /* port-C for line-in (rear panel) */
14154 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14155 /* port-D for Front */
14156 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14157 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14158 /* port-E for HP out (front panel) */
14159 /* this has to be set to VREF80 */
14160 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14161 /* route front PCM to HP */
14162 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14163 /* port-F for mic-in (front panel) with vref */
14164 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14165 /* port-G for CLFE (rear panel) */
14166 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14167 /* port-H for side (rear panel) */
14168 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14170 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14171 /* route front mic to ADC1*/
14172 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14173 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14174 /* Unmute DAC0~3 & spdif out*/
14175 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14176 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14177 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14178 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14179 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14181 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14182 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14183 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14184 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14185 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14187 /* Unmute Stereo Mixer 15 */
14188 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14189 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14190 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14191 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14193 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14194 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14195 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14196 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14197 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14198 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14199 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14200 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14201 /* hp used DAC 3 (Front) */
14202 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14203 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14207 static struct hda_verb alc861_asus_init_verbs[] = {
14209 * Unmute ADC0 and set the default input to mic-in
14211 /* port-A for surround (rear panel)
14212 * according to codec#0 this is the HP jack
14214 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14215 /* route front PCM to HP */
14216 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14217 /* port-B for mic-in (rear panel) with vref */
14218 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14219 /* port-C for line-in (rear panel) */
14220 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14221 /* port-D for Front */
14222 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14223 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14224 /* port-E for HP out (front panel) */
14225 /* this has to be set to VREF80 */
14226 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14227 /* route front PCM to HP */
14228 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14229 /* port-F for mic-in (front panel) with vref */
14230 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14231 /* port-G for CLFE (rear panel) */
14232 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14233 /* port-H for side (rear panel) */
14234 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14236 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14237 /* route front mic to ADC1*/
14238 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14239 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14240 /* Unmute DAC0~3 & spdif out*/
14241 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14242 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14243 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14244 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14245 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14246 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14247 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14248 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14249 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14250 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14252 /* Unmute Stereo Mixer 15 */
14253 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14254 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14255 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14256 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14258 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14259 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14260 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14261 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14262 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14263 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14264 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14265 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14266 /* hp used DAC 3 (Front) */
14267 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14268 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14272 /* additional init verbs for ASUS laptops */
14273 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14274 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14275 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14280 * generic initialization of ADC, input mixers and output mixers
14282 static struct hda_verb alc861_auto_init_verbs[] = {
14284 * Unmute ADC0 and set the default input to mic-in
14286 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14287 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14289 /* Unmute DAC0~3 & spdif out*/
14290 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14291 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14292 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14293 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14294 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14296 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14297 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14298 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14299 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14300 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14302 /* Unmute Stereo Mixer 15 */
14303 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14304 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14305 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14306 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14308 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14309 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14310 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14311 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14312 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14313 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14314 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14315 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14317 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14318 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14319 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14320 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14321 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14322 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14323 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14324 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14326 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14331 static struct hda_verb alc861_toshiba_init_verbs[] = {
14332 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14337 /* toggle speaker-output according to the hp-jack state */
14338 static void alc861_toshiba_automute(struct hda_codec *codec)
14340 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14342 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14343 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14344 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14345 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14348 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14351 if ((res >> 26) == ALC880_HP_EVENT)
14352 alc861_toshiba_automute(codec);
14355 /* pcm configuration: identical with ALC880 */
14356 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14357 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14358 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14359 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14362 #define ALC861_DIGOUT_NID 0x07
14364 static struct hda_channel_mode alc861_8ch_modes[1] = {
14368 static hda_nid_t alc861_dac_nids[4] = {
14369 /* front, surround, clfe, side */
14370 0x03, 0x06, 0x05, 0x04
14373 static hda_nid_t alc660_dac_nids[3] = {
14374 /* front, clfe, surround */
14378 static hda_nid_t alc861_adc_nids[1] = {
14383 static struct hda_input_mux alc861_capture_source = {
14387 { "Front Mic", 0x3 },
14394 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14396 struct alc_spec *spec = codec->spec;
14397 hda_nid_t mix, srcs[5];
14400 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14402 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14405 for (i = 0; i < num; i++) {
14407 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14408 if (type != AC_WID_AUD_OUT)
14410 for (j = 0; j < spec->multiout.num_dacs; j++)
14411 if (spec->multiout.dac_nids[j] == srcs[i])
14413 if (j >= spec->multiout.num_dacs)
14419 /* fill in the dac_nids table from the parsed pin configuration */
14420 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14421 const struct auto_pin_cfg *cfg)
14423 struct alc_spec *spec = codec->spec;
14425 hda_nid_t nid, dac;
14427 spec->multiout.dac_nids = spec->private_dac_nids;
14428 for (i = 0; i < cfg->line_outs; i++) {
14429 nid = cfg->line_out_pins[i];
14430 dac = alc861_look_for_dac(codec, nid);
14433 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14438 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14439 hda_nid_t nid, unsigned int chs)
14441 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14442 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14445 /* add playback controls from the parsed DAC table */
14446 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14447 const struct auto_pin_cfg *cfg)
14449 struct alc_spec *spec = codec->spec;
14450 static const char *chname[4] = {
14451 "Front", "Surround", NULL /*CLFE*/, "Side"
14456 if (cfg->line_outs == 1) {
14457 const char *pfx = NULL;
14460 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14463 nid = spec->multiout.dac_nids[0];
14464 return alc861_create_out_sw(codec, pfx, nid, 3);
14468 for (i = 0; i < cfg->line_outs; i++) {
14469 nid = spec->multiout.dac_nids[i];
14474 err = alc861_create_out_sw(codec, "Center", nid, 1);
14477 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14481 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14489 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14491 struct alc_spec *spec = codec->spec;
14498 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14499 nid = alc861_look_for_dac(codec, pin);
14501 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14504 spec->multiout.hp_nid = nid;
14510 /* create playback/capture controls for input pins */
14511 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14512 const struct auto_pin_cfg *cfg)
14514 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14517 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14519 int pin_type, hda_nid_t dac)
14521 hda_nid_t mix, srcs[5];
14524 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14526 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14528 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14530 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14533 for (i = 0; i < num; i++) {
14535 if (srcs[i] == dac || srcs[i] == 0x15)
14536 mute = AMP_IN_UNMUTE(i);
14538 mute = AMP_IN_MUTE(i);
14539 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14544 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14546 struct alc_spec *spec = codec->spec;
14549 for (i = 0; i < spec->autocfg.line_outs; i++) {
14550 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14551 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14553 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14554 spec->multiout.dac_nids[i]);
14558 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14560 struct alc_spec *spec = codec->spec;
14562 if (spec->autocfg.hp_outs)
14563 alc861_auto_set_output_and_unmute(codec,
14564 spec->autocfg.hp_pins[0],
14566 spec->multiout.hp_nid);
14567 if (spec->autocfg.speaker_outs)
14568 alc861_auto_set_output_and_unmute(codec,
14569 spec->autocfg.speaker_pins[0],
14571 spec->multiout.dac_nids[0]);
14574 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14576 struct alc_spec *spec = codec->spec;
14579 for (i = 0; i < AUTO_PIN_LAST; i++) {
14580 hda_nid_t nid = spec->autocfg.input_pins[i];
14581 if (nid >= 0x0c && nid <= 0x11)
14582 alc_set_input_pin(codec, nid, i);
14586 /* parse the BIOS configuration and set up the alc_spec */
14587 /* return 1 if successful, 0 if the proper config is not found,
14588 * or a negative error code
14590 static int alc861_parse_auto_config(struct hda_codec *codec)
14592 struct alc_spec *spec = codec->spec;
14594 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14596 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14600 if (!spec->autocfg.line_outs)
14601 return 0; /* can't find valid BIOS pin config */
14603 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14606 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14609 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14612 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14616 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14618 if (spec->autocfg.dig_outs)
14619 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14621 if (spec->kctls.list)
14622 add_mixer(spec, spec->kctls.list);
14624 add_verb(spec, alc861_auto_init_verbs);
14626 spec->num_mux_defs = 1;
14627 spec->input_mux = &spec->private_imux[0];
14629 spec->adc_nids = alc861_adc_nids;
14630 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14631 set_capture_mixer(codec);
14633 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14638 /* additional initialization for auto-configuration model */
14639 static void alc861_auto_init(struct hda_codec *codec)
14641 struct alc_spec *spec = codec->spec;
14642 alc861_auto_init_multi_out(codec);
14643 alc861_auto_init_hp_out(codec);
14644 alc861_auto_init_analog_input(codec);
14645 if (spec->unsol_event)
14646 alc_inithook(codec);
14649 #ifdef CONFIG_SND_HDA_POWER_SAVE
14650 static struct hda_amp_list alc861_loopbacks[] = {
14651 { 0x15, HDA_INPUT, 0 },
14652 { 0x15, HDA_INPUT, 1 },
14653 { 0x15, HDA_INPUT, 2 },
14654 { 0x15, HDA_INPUT, 3 },
14661 * configuration and preset
14663 static const char *alc861_models[ALC861_MODEL_LAST] = {
14664 [ALC861_3ST] = "3stack",
14665 [ALC660_3ST] = "3stack-660",
14666 [ALC861_3ST_DIG] = "3stack-dig",
14667 [ALC861_6ST_DIG] = "6stack-dig",
14668 [ALC861_UNIWILL_M31] = "uniwill-m31",
14669 [ALC861_TOSHIBA] = "toshiba",
14670 [ALC861_ASUS] = "asus",
14671 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14672 [ALC861_AUTO] = "auto",
14675 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14676 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14677 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14678 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14679 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14680 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14681 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14682 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14683 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14684 * Any other models that need this preset?
14686 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14687 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14688 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14689 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14690 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14691 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14692 /* FIXME: the below seems conflict */
14693 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14694 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14695 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14699 static struct alc_config_preset alc861_presets[] = {
14701 .mixers = { alc861_3ST_mixer },
14702 .init_verbs = { alc861_threestack_init_verbs },
14703 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14704 .dac_nids = alc861_dac_nids,
14705 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14706 .channel_mode = alc861_threestack_modes,
14708 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14709 .adc_nids = alc861_adc_nids,
14710 .input_mux = &alc861_capture_source,
14712 [ALC861_3ST_DIG] = {
14713 .mixers = { alc861_base_mixer },
14714 .init_verbs = { alc861_threestack_init_verbs },
14715 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14716 .dac_nids = alc861_dac_nids,
14717 .dig_out_nid = ALC861_DIGOUT_NID,
14718 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14719 .channel_mode = alc861_threestack_modes,
14721 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14722 .adc_nids = alc861_adc_nids,
14723 .input_mux = &alc861_capture_source,
14725 [ALC861_6ST_DIG] = {
14726 .mixers = { alc861_base_mixer },
14727 .init_verbs = { alc861_base_init_verbs },
14728 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14729 .dac_nids = alc861_dac_nids,
14730 .dig_out_nid = ALC861_DIGOUT_NID,
14731 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14732 .channel_mode = alc861_8ch_modes,
14733 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14734 .adc_nids = alc861_adc_nids,
14735 .input_mux = &alc861_capture_source,
14738 .mixers = { alc861_3ST_mixer },
14739 .init_verbs = { alc861_threestack_init_verbs },
14740 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14741 .dac_nids = alc660_dac_nids,
14742 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14743 .channel_mode = alc861_threestack_modes,
14745 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14746 .adc_nids = alc861_adc_nids,
14747 .input_mux = &alc861_capture_source,
14749 [ALC861_UNIWILL_M31] = {
14750 .mixers = { alc861_uniwill_m31_mixer },
14751 .init_verbs = { alc861_uniwill_m31_init_verbs },
14752 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14753 .dac_nids = alc861_dac_nids,
14754 .dig_out_nid = ALC861_DIGOUT_NID,
14755 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14756 .channel_mode = alc861_uniwill_m31_modes,
14758 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14759 .adc_nids = alc861_adc_nids,
14760 .input_mux = &alc861_capture_source,
14762 [ALC861_TOSHIBA] = {
14763 .mixers = { alc861_toshiba_mixer },
14764 .init_verbs = { alc861_base_init_verbs,
14765 alc861_toshiba_init_verbs },
14766 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14767 .dac_nids = alc861_dac_nids,
14768 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14769 .channel_mode = alc883_3ST_2ch_modes,
14770 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14771 .adc_nids = alc861_adc_nids,
14772 .input_mux = &alc861_capture_source,
14773 .unsol_event = alc861_toshiba_unsol_event,
14774 .init_hook = alc861_toshiba_automute,
14777 .mixers = { alc861_asus_mixer },
14778 .init_verbs = { alc861_asus_init_verbs },
14779 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14780 .dac_nids = alc861_dac_nids,
14781 .dig_out_nid = ALC861_DIGOUT_NID,
14782 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14783 .channel_mode = alc861_asus_modes,
14786 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14787 .adc_nids = alc861_adc_nids,
14788 .input_mux = &alc861_capture_source,
14790 [ALC861_ASUS_LAPTOP] = {
14791 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14792 .init_verbs = { alc861_asus_init_verbs,
14793 alc861_asus_laptop_init_verbs },
14794 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14795 .dac_nids = alc861_dac_nids,
14796 .dig_out_nid = ALC861_DIGOUT_NID,
14797 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14798 .channel_mode = alc883_3ST_2ch_modes,
14800 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14801 .adc_nids = alc861_adc_nids,
14802 .input_mux = &alc861_capture_source,
14806 /* Pin config fixes */
14808 PINFIX_FSC_AMILO_PI1505,
14811 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14812 { 0x0b, 0x0221101f }, /* HP */
14813 { 0x0f, 0x90170310 }, /* speaker */
14817 static const struct alc_fixup alc861_fixups[] = {
14818 [PINFIX_FSC_AMILO_PI1505] = {
14819 .pins = alc861_fsc_amilo_pi1505_pinfix
14823 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14824 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14828 static int patch_alc861(struct hda_codec *codec)
14830 struct alc_spec *spec;
14834 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14838 codec->spec = spec;
14840 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14844 if (board_config < 0) {
14845 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14847 board_config = ALC861_AUTO;
14850 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14852 if (board_config == ALC861_AUTO) {
14853 /* automatic parse from the BIOS config */
14854 err = alc861_parse_auto_config(codec);
14860 "hda_codec: Cannot set up configuration "
14861 "from BIOS. Using base mode...\n");
14862 board_config = ALC861_3ST_DIG;
14866 err = snd_hda_attach_beep_device(codec, 0x23);
14872 if (board_config != ALC861_AUTO)
14873 setup_preset(codec, &alc861_presets[board_config]);
14875 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14876 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14878 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14879 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14881 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14883 spec->vmaster_nid = 0x03;
14885 codec->patch_ops = alc_patch_ops;
14886 if (board_config == ALC861_AUTO)
14887 spec->init_hook = alc861_auto_init;
14888 #ifdef CONFIG_SND_HDA_POWER_SAVE
14889 if (!spec->loopback.amplist)
14890 spec->loopback.amplist = alc861_loopbacks;
14892 codec->proc_widget_hook = print_realtek_coef;
14898 * ALC861-VD support
14902 * In addition, an independent DAC
14904 #define ALC861VD_DIGOUT_NID 0x06
14906 static hda_nid_t alc861vd_dac_nids[4] = {
14907 /* front, surr, clfe, side surr */
14908 0x02, 0x03, 0x04, 0x05
14911 /* dac_nids for ALC660vd are in a different order - according to
14912 * Realtek's driver.
14913 * This should probably result in a different mixer for 6stack models
14914 * of ALC660vd codecs, but for now there is only 3stack mixer
14915 * - and it is the same as in 861vd.
14916 * adc_nids in ALC660vd are (is) the same as in 861vd
14918 static hda_nid_t alc660vd_dac_nids[3] = {
14919 /* front, rear, clfe, rear_surr */
14923 static hda_nid_t alc861vd_adc_nids[1] = {
14928 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14931 /* FIXME: should be a matrix-type input source selection */
14932 static struct hda_input_mux alc861vd_capture_source = {
14936 { "Front Mic", 0x1 },
14942 static struct hda_input_mux alc861vd_dallas_capture_source = {
14945 { "Ext Mic", 0x0 },
14946 { "Int Mic", 0x1 },
14950 static struct hda_input_mux alc861vd_hp_capture_source = {
14953 { "Front Mic", 0x0 },
14954 { "ATAPI Mic", 0x1 },
14961 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14968 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14969 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14970 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14971 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14972 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14979 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14980 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14981 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14982 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14983 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14987 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14988 { 6, alc861vd_6stack_ch6_init },
14989 { 8, alc861vd_6stack_ch8_init },
14992 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14994 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14995 .name = "Channel Mode",
14996 .info = alc_ch_mode_info,
14997 .get = alc_ch_mode_get,
14998 .put = alc_ch_mode_put,
15003 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15004 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15006 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15007 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15008 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15010 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15011 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15013 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15015 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15017 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15018 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15020 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15021 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15023 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15025 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15026 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15027 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15029 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15030 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15031 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15033 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15034 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15036 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15037 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15042 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15043 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15044 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15046 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15048 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15049 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15050 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15052 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15053 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15054 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15056 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15057 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15059 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15060 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15065 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15066 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15067 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15068 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15070 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15072 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15073 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15074 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15076 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15077 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15078 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15080 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15081 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15086 /* Pin assignment: Speaker=0x14, HP = 0x15,
15087 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15089 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15090 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15091 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15092 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15093 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15094 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15095 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15096 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15097 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15098 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15099 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15103 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15104 * Front Mic=0x18, ATAPI Mic = 0x19,
15106 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15107 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15108 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15109 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15110 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15111 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15112 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15113 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15114 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15120 * generic initialization of ADC, input mixers and output mixers
15122 static struct hda_verb alc861vd_volume_init_verbs[] = {
15124 * Unmute ADC0 and set the default input to mic-in
15126 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15127 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15129 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15130 * the analog-loopback mixer widget
15132 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15137 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15139 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15140 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15141 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15142 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15143 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15146 * Set up output mixers (0x02 - 0x05)
15148 /* set vol=0 to output mixers */
15149 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15150 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15151 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15152 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15154 /* set up input amps for analog loopback */
15155 /* Amp Indices: DAC = 0, mixer = 1 */
15156 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15157 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15158 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15159 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15160 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15161 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15162 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15163 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15169 * 3-stack pin configuration:
15170 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15172 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15174 * Set pin mode and muting
15176 /* set front pin widgets 0x14 for output */
15177 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15178 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15179 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15181 /* Mic (rear) pin: input vref at 80% */
15182 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15183 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15184 /* Front Mic pin: input vref at 80% */
15185 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15186 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15187 /* Line In pin: input */
15188 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15189 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15190 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15191 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15192 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15193 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15194 /* CD pin widget for input */
15195 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15201 * 6-stack pin configuration:
15203 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15205 * Set pin mode and muting
15207 /* set front pin widgets 0x14 for output */
15208 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15209 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15210 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15212 /* Rear Pin: output 1 (0x0d) */
15213 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15214 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15215 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15216 /* CLFE Pin: output 2 (0x0e) */
15217 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15218 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15219 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15220 /* Side Pin: output 3 (0x0f) */
15221 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15222 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15223 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15225 /* Mic (rear) pin: input vref at 80% */
15226 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15227 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15228 /* Front Mic pin: input vref at 80% */
15229 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15230 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15231 /* Line In pin: input */
15232 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15233 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15234 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15235 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15236 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15237 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15238 /* CD pin widget for input */
15239 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15244 static struct hda_verb alc861vd_eapd_verbs[] = {
15245 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15249 static struct hda_verb alc660vd_eapd_verbs[] = {
15250 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15251 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15255 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15256 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15258 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15259 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15260 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15264 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15266 unsigned int present;
15267 unsigned char bits;
15269 present = snd_hda_jack_detect(codec, 0x18);
15270 bits = present ? HDA_AMP_MUTE : 0;
15272 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15273 HDA_AMP_MUTE, bits);
15276 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15278 struct alc_spec *spec = codec->spec;
15279 spec->autocfg.hp_pins[0] = 0x1b;
15280 spec->autocfg.speaker_pins[0] = 0x14;
15283 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15285 alc_automute_amp(codec);
15286 alc861vd_lenovo_mic_automute(codec);
15289 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15292 switch (res >> 26) {
15293 case ALC880_MIC_EVENT:
15294 alc861vd_lenovo_mic_automute(codec);
15297 alc_automute_amp_unsol_event(codec, res);
15302 static struct hda_verb alc861vd_dallas_verbs[] = {
15303 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15304 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15305 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15306 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15311 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15313 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15314 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15315 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15317 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15318 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15319 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15320 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15321 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15322 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15323 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15324 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15326 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15327 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15328 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15329 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15330 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15331 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15332 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15333 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15335 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15336 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15337 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15338 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15340 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15341 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15342 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15347 /* toggle speaker-output according to the hp-jack state */
15348 static void alc861vd_dallas_setup(struct hda_codec *codec)
15350 struct alc_spec *spec = codec->spec;
15352 spec->autocfg.hp_pins[0] = 0x15;
15353 spec->autocfg.speaker_pins[0] = 0x14;
15356 #ifdef CONFIG_SND_HDA_POWER_SAVE
15357 #define alc861vd_loopbacks alc880_loopbacks
15360 /* pcm configuration: identical with ALC880 */
15361 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15362 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15363 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15364 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15367 * configuration and preset
15369 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15370 [ALC660VD_3ST] = "3stack-660",
15371 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15372 [ALC660VD_ASUS_V1S] = "asus-v1s",
15373 [ALC861VD_3ST] = "3stack",
15374 [ALC861VD_3ST_DIG] = "3stack-digout",
15375 [ALC861VD_6ST_DIG] = "6stack-digout",
15376 [ALC861VD_LENOVO] = "lenovo",
15377 [ALC861VD_DALLAS] = "dallas",
15378 [ALC861VD_HP] = "hp",
15379 [ALC861VD_AUTO] = "auto",
15382 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15383 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15384 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15385 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15386 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15387 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15388 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15389 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15390 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15391 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15392 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15393 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15394 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15395 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15396 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15397 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15401 static struct alc_config_preset alc861vd_presets[] = {
15403 .mixers = { alc861vd_3st_mixer },
15404 .init_verbs = { alc861vd_volume_init_verbs,
15405 alc861vd_3stack_init_verbs },
15406 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15407 .dac_nids = alc660vd_dac_nids,
15408 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15409 .channel_mode = alc861vd_3stack_2ch_modes,
15410 .input_mux = &alc861vd_capture_source,
15412 [ALC660VD_3ST_DIG] = {
15413 .mixers = { alc861vd_3st_mixer },
15414 .init_verbs = { alc861vd_volume_init_verbs,
15415 alc861vd_3stack_init_verbs },
15416 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15417 .dac_nids = alc660vd_dac_nids,
15418 .dig_out_nid = ALC861VD_DIGOUT_NID,
15419 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15420 .channel_mode = alc861vd_3stack_2ch_modes,
15421 .input_mux = &alc861vd_capture_source,
15424 .mixers = { alc861vd_3st_mixer },
15425 .init_verbs = { alc861vd_volume_init_verbs,
15426 alc861vd_3stack_init_verbs },
15427 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15428 .dac_nids = alc861vd_dac_nids,
15429 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15430 .channel_mode = alc861vd_3stack_2ch_modes,
15431 .input_mux = &alc861vd_capture_source,
15433 [ALC861VD_3ST_DIG] = {
15434 .mixers = { alc861vd_3st_mixer },
15435 .init_verbs = { alc861vd_volume_init_verbs,
15436 alc861vd_3stack_init_verbs },
15437 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15438 .dac_nids = alc861vd_dac_nids,
15439 .dig_out_nid = ALC861VD_DIGOUT_NID,
15440 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15441 .channel_mode = alc861vd_3stack_2ch_modes,
15442 .input_mux = &alc861vd_capture_source,
15444 [ALC861VD_6ST_DIG] = {
15445 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15446 .init_verbs = { alc861vd_volume_init_verbs,
15447 alc861vd_6stack_init_verbs },
15448 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15449 .dac_nids = alc861vd_dac_nids,
15450 .dig_out_nid = ALC861VD_DIGOUT_NID,
15451 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15452 .channel_mode = alc861vd_6stack_modes,
15453 .input_mux = &alc861vd_capture_source,
15455 [ALC861VD_LENOVO] = {
15456 .mixers = { alc861vd_lenovo_mixer },
15457 .init_verbs = { alc861vd_volume_init_verbs,
15458 alc861vd_3stack_init_verbs,
15459 alc861vd_eapd_verbs,
15460 alc861vd_lenovo_unsol_verbs },
15461 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15462 .dac_nids = alc660vd_dac_nids,
15463 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15464 .channel_mode = alc861vd_3stack_2ch_modes,
15465 .input_mux = &alc861vd_capture_source,
15466 .unsol_event = alc861vd_lenovo_unsol_event,
15467 .setup = alc861vd_lenovo_setup,
15468 .init_hook = alc861vd_lenovo_init_hook,
15470 [ALC861VD_DALLAS] = {
15471 .mixers = { alc861vd_dallas_mixer },
15472 .init_verbs = { alc861vd_dallas_verbs },
15473 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15474 .dac_nids = alc861vd_dac_nids,
15475 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15476 .channel_mode = alc861vd_3stack_2ch_modes,
15477 .input_mux = &alc861vd_dallas_capture_source,
15478 .unsol_event = alc_automute_amp_unsol_event,
15479 .setup = alc861vd_dallas_setup,
15480 .init_hook = alc_automute_amp,
15483 .mixers = { alc861vd_hp_mixer },
15484 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15485 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15486 .dac_nids = alc861vd_dac_nids,
15487 .dig_out_nid = ALC861VD_DIGOUT_NID,
15488 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15489 .channel_mode = alc861vd_3stack_2ch_modes,
15490 .input_mux = &alc861vd_hp_capture_source,
15491 .unsol_event = alc_automute_amp_unsol_event,
15492 .setup = alc861vd_dallas_setup,
15493 .init_hook = alc_automute_amp,
15495 [ALC660VD_ASUS_V1S] = {
15496 .mixers = { alc861vd_lenovo_mixer },
15497 .init_verbs = { alc861vd_volume_init_verbs,
15498 alc861vd_3stack_init_verbs,
15499 alc861vd_eapd_verbs,
15500 alc861vd_lenovo_unsol_verbs },
15501 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15502 .dac_nids = alc660vd_dac_nids,
15503 .dig_out_nid = ALC861VD_DIGOUT_NID,
15504 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15505 .channel_mode = alc861vd_3stack_2ch_modes,
15506 .input_mux = &alc861vd_capture_source,
15507 .unsol_event = alc861vd_lenovo_unsol_event,
15508 .setup = alc861vd_lenovo_setup,
15509 .init_hook = alc861vd_lenovo_init_hook,
15514 * BIOS auto configuration
15516 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15517 const struct auto_pin_cfg *cfg)
15519 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15523 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15524 hda_nid_t nid, int pin_type, int dac_idx)
15526 alc_set_pin_output(codec, nid, pin_type);
15529 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15531 struct alc_spec *spec = codec->spec;
15534 for (i = 0; i <= HDA_SIDE; i++) {
15535 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15536 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15538 alc861vd_auto_set_output_and_unmute(codec, nid,
15544 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15546 struct alc_spec *spec = codec->spec;
15549 pin = spec->autocfg.hp_pins[0];
15550 if (pin) /* connect to front and use dac 0 */
15551 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15552 pin = spec->autocfg.speaker_pins[0];
15554 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15557 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15559 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15561 struct alc_spec *spec = codec->spec;
15564 for (i = 0; i < AUTO_PIN_LAST; i++) {
15565 hda_nid_t nid = spec->autocfg.input_pins[i];
15566 if (alc_is_input_pin(codec, nid)) {
15567 alc_set_input_pin(codec, nid, i);
15568 if (nid != ALC861VD_PIN_CD_NID &&
15569 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15570 snd_hda_codec_write(codec, nid, 0,
15571 AC_VERB_SET_AMP_GAIN_MUTE,
15577 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15579 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15580 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15582 /* add playback controls from the parsed DAC table */
15583 /* Based on ALC880 version. But ALC861VD has separate,
15584 * different NIDs for mute/unmute switch and volume control */
15585 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15586 const struct auto_pin_cfg *cfg)
15588 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15589 hda_nid_t nid_v, nid_s;
15592 for (i = 0; i < cfg->line_outs; i++) {
15593 if (!spec->multiout.dac_nids[i])
15595 nid_v = alc861vd_idx_to_mixer_vol(
15597 spec->multiout.dac_nids[i]));
15598 nid_s = alc861vd_idx_to_mixer_switch(
15600 spec->multiout.dac_nids[i]));
15604 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15606 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15610 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15612 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15616 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15618 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15622 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15624 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15630 if (cfg->line_outs == 1 &&
15631 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15638 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15639 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15643 if (cfg->line_outs == 1 &&
15644 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15646 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15647 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15656 /* add playback controls for speaker and HP outputs */
15657 /* Based on ALC880 version. But ALC861VD has separate,
15658 * different NIDs for mute/unmute switch and volume control */
15659 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15660 hda_nid_t pin, const char *pfx)
15662 hda_nid_t nid_v, nid_s;
15668 if (alc880_is_fixed_pin(pin)) {
15669 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15670 /* specify the DAC as the extra output */
15671 if (!spec->multiout.hp_nid)
15672 spec->multiout.hp_nid = nid_v;
15674 spec->multiout.extra_out_nid[0] = nid_v;
15675 /* control HP volume/switch on the output mixer amp */
15676 nid_v = alc861vd_idx_to_mixer_vol(
15677 alc880_fixed_pin_idx(pin));
15678 nid_s = alc861vd_idx_to_mixer_switch(
15679 alc880_fixed_pin_idx(pin));
15681 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15682 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15685 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15686 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15689 } else if (alc880_is_multi_pin(pin)) {
15690 /* set manual connection */
15691 /* we have only a switch on HP-out PIN */
15692 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15693 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15700 /* parse the BIOS configuration and set up the alc_spec
15701 * return 1 if successful, 0 if the proper config is not found,
15702 * or a negative error code
15703 * Based on ALC880 version - had to change it to override
15704 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15705 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15707 struct alc_spec *spec = codec->spec;
15709 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15711 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15715 if (!spec->autocfg.line_outs)
15716 return 0; /* can't find valid BIOS pin config */
15718 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15721 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15724 err = alc861vd_auto_create_extra_out(spec,
15725 spec->autocfg.speaker_pins[0],
15729 err = alc861vd_auto_create_extra_out(spec,
15730 spec->autocfg.hp_pins[0],
15734 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15738 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15740 if (spec->autocfg.dig_outs)
15741 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15743 if (spec->kctls.list)
15744 add_mixer(spec, spec->kctls.list);
15746 add_verb(spec, alc861vd_volume_init_verbs);
15748 spec->num_mux_defs = 1;
15749 spec->input_mux = &spec->private_imux[0];
15751 err = alc_auto_add_mic_boost(codec);
15755 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15760 /* additional initialization for auto-configuration model */
15761 static void alc861vd_auto_init(struct hda_codec *codec)
15763 struct alc_spec *spec = codec->spec;
15764 alc861vd_auto_init_multi_out(codec);
15765 alc861vd_auto_init_hp_out(codec);
15766 alc861vd_auto_init_analog_input(codec);
15767 alc861vd_auto_init_input_src(codec);
15768 if (spec->unsol_event)
15769 alc_inithook(codec);
15773 ALC660VD_FIX_ASUS_GPIO1
15777 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15778 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15779 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15780 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15784 static const struct alc_fixup alc861vd_fixups[] = {
15785 [ALC660VD_FIX_ASUS_GPIO1] = {
15786 .verbs = alc660vd_fix_asus_gpio1_verbs,
15790 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15791 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15795 static int patch_alc861vd(struct hda_codec *codec)
15797 struct alc_spec *spec;
15798 int err, board_config;
15800 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15804 codec->spec = spec;
15806 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15810 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15811 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15813 board_config = ALC861VD_AUTO;
15816 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15818 if (board_config == ALC861VD_AUTO) {
15819 /* automatic parse from the BIOS config */
15820 err = alc861vd_parse_auto_config(codec);
15826 "hda_codec: Cannot set up configuration "
15827 "from BIOS. Using base mode...\n");
15828 board_config = ALC861VD_3ST;
15832 err = snd_hda_attach_beep_device(codec, 0x23);
15838 if (board_config != ALC861VD_AUTO)
15839 setup_preset(codec, &alc861vd_presets[board_config]);
15841 if (codec->vendor_id == 0x10ec0660) {
15842 /* always turn on EAPD */
15843 add_verb(spec, alc660vd_eapd_verbs);
15846 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15847 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15849 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15850 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15852 if (!spec->adc_nids) {
15853 spec->adc_nids = alc861vd_adc_nids;
15854 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15856 if (!spec->capsrc_nids)
15857 spec->capsrc_nids = alc861vd_capsrc_nids;
15859 set_capture_mixer(codec);
15860 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15862 spec->vmaster_nid = 0x02;
15864 codec->patch_ops = alc_patch_ops;
15866 if (board_config == ALC861VD_AUTO)
15867 spec->init_hook = alc861vd_auto_init;
15868 #ifdef CONFIG_SND_HDA_POWER_SAVE
15869 if (!spec->loopback.amplist)
15870 spec->loopback.amplist = alc861vd_loopbacks;
15872 codec->proc_widget_hook = print_realtek_coef;
15880 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15881 * configuration. Each pin widget can choose any input DACs and a mixer.
15882 * Each ADC is connected from a mixer of all inputs. This makes possible
15883 * 6-channel independent captures.
15885 * In addition, an independent DAC for the multi-playback (not used in this
15888 #define ALC662_DIGOUT_NID 0x06
15889 #define ALC662_DIGIN_NID 0x0a
15891 static hda_nid_t alc662_dac_nids[4] = {
15892 /* front, rear, clfe, rear_surr */
15896 static hda_nid_t alc272_dac_nids[2] = {
15900 static hda_nid_t alc662_adc_nids[2] = {
15905 static hda_nid_t alc272_adc_nids[1] = {
15910 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15911 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15915 /* FIXME: should be a matrix-type input source selection */
15916 static struct hda_input_mux alc662_capture_source = {
15920 { "Front Mic", 0x1 },
15926 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15934 static struct hda_input_mux alc663_capture_source = {
15938 { "Front Mic", 0x1 },
15943 #if 0 /* set to 1 for testing other input sources below */
15944 static struct hda_input_mux alc272_nc10_capture_source = {
15947 { "Autoselect Mic", 0x0 },
15948 { "Internal Mic", 0x1 },
15949 { "In-0x02", 0x2 },
15950 { "In-0x03", 0x3 },
15951 { "In-0x04", 0x4 },
15952 { "In-0x05", 0x5 },
15953 { "In-0x06", 0x6 },
15954 { "In-0x07", 0x7 },
15955 { "In-0x08", 0x8 },
15956 { "In-0x09", 0x9 },
15957 { "In-0x0a", 0x0a },
15958 { "In-0x0b", 0x0b },
15959 { "In-0x0c", 0x0c },
15960 { "In-0x0d", 0x0d },
15961 { "In-0x0e", 0x0e },
15962 { "In-0x0f", 0x0f },
15970 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15977 static struct hda_verb alc662_3ST_ch2_init[] = {
15978 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15979 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15980 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15981 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15988 static struct hda_verb alc662_3ST_ch6_init[] = {
15989 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15990 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15991 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15992 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15993 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15994 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15998 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15999 { 2, alc662_3ST_ch2_init },
16000 { 6, alc662_3ST_ch6_init },
16006 static struct hda_verb alc662_sixstack_ch6_init[] = {
16007 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16008 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16009 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16016 static struct hda_verb alc662_sixstack_ch8_init[] = {
16017 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16018 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16019 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16023 static struct hda_channel_mode alc662_5stack_modes[2] = {
16024 { 2, alc662_sixstack_ch6_init },
16025 { 6, alc662_sixstack_ch8_init },
16028 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16029 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16032 static struct snd_kcontrol_new alc662_base_mixer[] = {
16033 /* output mixer control */
16034 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16035 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16036 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16037 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16038 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16039 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16040 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16041 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16042 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16044 /*Input mixer control */
16045 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16046 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16047 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16048 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16049 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16050 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16051 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16052 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16056 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16057 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16058 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16059 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16060 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16061 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16062 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16063 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16064 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16065 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16066 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16067 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16071 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16072 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16073 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16074 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16075 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16076 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16077 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16078 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16079 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16080 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16081 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16082 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16083 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16084 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16085 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16086 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16087 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16088 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16092 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16093 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16094 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16095 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16096 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16097 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16098 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16099 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16100 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16101 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16105 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16106 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16107 ALC262_HIPPO_MASTER_SWITCH,
16109 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16110 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16111 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16113 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16114 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16115 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16119 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16120 ALC262_HIPPO_MASTER_SWITCH,
16121 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16122 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16123 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16124 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16125 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16126 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16127 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16129 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16133 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16134 .ops = &snd_hda_bind_vol,
16136 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16137 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16142 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16143 .ops = &snd_hda_bind_sw,
16145 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16146 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16151 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16152 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16153 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16154 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16155 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16159 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16160 .ops = &snd_hda_bind_sw,
16162 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16163 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16164 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16169 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16170 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16171 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16174 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16175 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16180 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16181 .ops = &snd_hda_bind_sw,
16183 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16184 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16185 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16190 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16191 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16192 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16193 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16194 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16195 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16196 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16200 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16201 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16202 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16203 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16204 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16205 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16206 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16207 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16211 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16212 .ops = &snd_hda_bind_vol,
16214 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16215 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16220 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16221 .ops = &snd_hda_bind_sw,
16223 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16224 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16229 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16230 HDA_BIND_VOL("Master Playback Volume",
16231 &alc663_asus_two_bind_master_vol),
16232 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16233 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16234 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16236 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16240 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16241 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16242 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16243 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16244 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16245 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16246 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16250 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16251 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16252 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16253 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16254 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16255 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16257 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16258 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16259 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16260 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16264 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16265 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16266 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16267 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16269 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16270 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16271 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16272 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16273 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16274 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16278 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16280 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16281 .name = "Channel Mode",
16282 .info = alc_ch_mode_info,
16283 .get = alc_ch_mode_get,
16284 .put = alc_ch_mode_put,
16289 static struct hda_verb alc662_init_verbs[] = {
16290 /* ADC: mute amp left and right */
16291 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16292 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16293 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16296 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16297 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16298 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16299 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16303 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16304 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16305 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16306 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16308 /* Front Pin: output 0 (0x0c) */
16309 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16310 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16312 /* Rear Pin: output 1 (0x0d) */
16313 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16314 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16316 /* CLFE Pin: output 2 (0x0e) */
16317 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16318 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16320 /* Mic (rear) pin: input vref at 80% */
16321 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16322 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16323 /* Front Mic pin: input vref at 80% */
16324 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16325 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16326 /* Line In pin: input */
16327 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16328 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16329 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16330 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16331 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16332 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16333 /* CD pin widget for input */
16334 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16336 /* FIXME: use matrix-type input source selection */
16337 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16339 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16340 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16342 /* always trun on EAPD */
16343 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16344 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16349 static struct hda_verb alc662_sue_init_verbs[] = {
16350 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16351 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16355 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16356 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16357 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16361 /* Set Unsolicited Event*/
16362 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16363 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16364 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16369 * generic initialization of ADC, input mixers and output mixers
16371 static struct hda_verb alc662_auto_init_verbs[] = {
16373 * Unmute ADC and set the default input to mic-in
16375 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16376 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16378 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16380 * Note: PASD motherboards uses the Line In 2 as the input for front
16381 * panel mic (mic 2)
16383 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16384 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16385 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16386 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16387 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16388 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16391 * Set up output mixers (0x0c - 0x0f)
16393 /* set vol=0 to output mixers */
16394 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16395 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16396 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16398 /* set up input amps for analog loopback */
16399 /* Amp Indices: DAC = 0, mixer = 1 */
16400 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16401 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16402 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16403 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16404 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16405 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16408 /* FIXME: use matrix-type input source selection */
16409 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16412 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16416 /* additional verbs for ALC663 */
16417 static struct hda_verb alc663_auto_init_verbs[] = {
16418 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16419 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16423 static struct hda_verb alc663_m51va_init_verbs[] = {
16424 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16425 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16426 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16427 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16428 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16429 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16430 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16431 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16432 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16436 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16437 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16438 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16439 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16440 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16441 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16442 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16443 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16447 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16448 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16449 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16450 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16451 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16452 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16453 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16454 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16455 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16459 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16460 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16461 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16462 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16463 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16464 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16465 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16466 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16470 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16471 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16472 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16473 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16474 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16476 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16477 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16478 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16479 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16480 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16481 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16482 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16486 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16487 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16488 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16489 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16490 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16491 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16492 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16493 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16494 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16495 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16496 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16497 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16498 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16502 static struct hda_verb alc663_g71v_init_verbs[] = {
16503 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16504 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16505 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16507 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16508 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16509 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16511 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16512 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16513 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16517 static struct hda_verb alc663_g50v_init_verbs[] = {
16518 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16519 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16520 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16522 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16523 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16527 static struct hda_verb alc662_ecs_init_verbs[] = {
16528 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16529 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16530 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16531 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16535 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16536 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16537 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16538 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16539 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16540 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16541 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16542 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16543 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16544 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16545 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16546 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16550 static struct hda_verb alc272_dell_init_verbs[] = {
16551 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16552 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16553 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16554 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16555 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16556 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16557 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16558 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16559 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16560 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16561 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16565 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16566 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16567 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16571 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16572 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16573 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16577 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16579 unsigned int present;
16580 unsigned char bits;
16582 present = snd_hda_jack_detect(codec, 0x14);
16583 bits = present ? HDA_AMP_MUTE : 0;
16585 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16586 HDA_AMP_MUTE, bits);
16589 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16591 unsigned int present;
16592 unsigned char bits;
16594 present = snd_hda_jack_detect(codec, 0x1b);
16595 bits = present ? HDA_AMP_MUTE : 0;
16597 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16598 HDA_AMP_MUTE, bits);
16599 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16600 HDA_AMP_MUTE, bits);
16603 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16606 if ((res >> 26) == ALC880_HP_EVENT)
16607 alc662_lenovo_101e_all_automute(codec);
16608 if ((res >> 26) == ALC880_FRONT_EVENT)
16609 alc662_lenovo_101e_ispeaker_automute(codec);
16612 /* unsolicited event for HP jack sensing */
16613 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16616 if ((res >> 26) == ALC880_MIC_EVENT)
16617 alc_mic_automute(codec);
16619 alc262_hippo_unsol_event(codec, res);
16622 static void alc662_eeepc_setup(struct hda_codec *codec)
16624 struct alc_spec *spec = codec->spec;
16626 alc262_hippo1_setup(codec);
16627 spec->ext_mic.pin = 0x18;
16628 spec->ext_mic.mux_idx = 0;
16629 spec->int_mic.pin = 0x19;
16630 spec->int_mic.mux_idx = 1;
16631 spec->auto_mic = 1;
16634 static void alc662_eeepc_inithook(struct hda_codec *codec)
16636 alc262_hippo_automute(codec);
16637 alc_mic_automute(codec);
16640 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16642 struct alc_spec *spec = codec->spec;
16644 spec->autocfg.hp_pins[0] = 0x14;
16645 spec->autocfg.speaker_pins[0] = 0x1b;
16648 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16650 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16652 unsigned int present;
16653 unsigned char bits;
16655 present = snd_hda_jack_detect(codec, 0x21);
16656 bits = present ? HDA_AMP_MUTE : 0;
16657 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16658 AMP_IN_MUTE(0), bits);
16659 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16660 AMP_IN_MUTE(0), bits);
16663 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16665 unsigned int present;
16666 unsigned char bits;
16668 present = snd_hda_jack_detect(codec, 0x21);
16669 bits = present ? HDA_AMP_MUTE : 0;
16670 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16671 AMP_IN_MUTE(0), bits);
16672 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16673 AMP_IN_MUTE(0), bits);
16674 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16675 AMP_IN_MUTE(0), bits);
16676 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16677 AMP_IN_MUTE(0), bits);
16680 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16682 unsigned int present;
16683 unsigned char bits;
16685 present = snd_hda_jack_detect(codec, 0x15);
16686 bits = present ? HDA_AMP_MUTE : 0;
16687 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16688 AMP_IN_MUTE(0), bits);
16689 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16690 AMP_IN_MUTE(0), bits);
16691 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16692 AMP_IN_MUTE(0), bits);
16693 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16694 AMP_IN_MUTE(0), bits);
16697 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16699 unsigned int present;
16700 unsigned char bits;
16702 present = snd_hda_jack_detect(codec, 0x1b);
16703 bits = present ? 0 : PIN_OUT;
16704 snd_hda_codec_write(codec, 0x14, 0,
16705 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16708 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16710 unsigned int present1, present2;
16712 present1 = snd_hda_jack_detect(codec, 0x21);
16713 present2 = snd_hda_jack_detect(codec, 0x15);
16715 if (present1 || present2) {
16716 snd_hda_codec_write_cache(codec, 0x14, 0,
16717 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16719 snd_hda_codec_write_cache(codec, 0x14, 0,
16720 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16724 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16726 unsigned int present1, present2;
16728 present1 = snd_hda_jack_detect(codec, 0x1b);
16729 present2 = snd_hda_jack_detect(codec, 0x15);
16731 if (present1 || present2) {
16732 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16733 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16734 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16735 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16737 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16738 AMP_IN_MUTE(0), 0);
16739 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16740 AMP_IN_MUTE(0), 0);
16744 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16747 switch (res >> 26) {
16748 case ALC880_HP_EVENT:
16749 alc663_m51va_speaker_automute(codec);
16751 case ALC880_MIC_EVENT:
16752 alc_mic_automute(codec);
16757 static void alc663_m51va_setup(struct hda_codec *codec)
16759 struct alc_spec *spec = codec->spec;
16760 spec->ext_mic.pin = 0x18;
16761 spec->ext_mic.mux_idx = 0;
16762 spec->int_mic.pin = 0x12;
16763 spec->int_mic.mux_idx = 1;
16764 spec->auto_mic = 1;
16767 static void alc663_m51va_inithook(struct hda_codec *codec)
16769 alc663_m51va_speaker_automute(codec);
16770 alc_mic_automute(codec);
16773 /* ***************** Mode1 ******************************/
16774 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16775 #define alc663_mode1_setup alc663_m51va_setup
16776 #define alc663_mode1_inithook alc663_m51va_inithook
16778 /* ***************** Mode2 ******************************/
16779 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16782 switch (res >> 26) {
16783 case ALC880_HP_EVENT:
16784 alc662_f5z_speaker_automute(codec);
16786 case ALC880_MIC_EVENT:
16787 alc_mic_automute(codec);
16792 #define alc662_mode2_setup alc663_m51va_setup
16794 static void alc662_mode2_inithook(struct hda_codec *codec)
16796 alc662_f5z_speaker_automute(codec);
16797 alc_mic_automute(codec);
16799 /* ***************** Mode3 ******************************/
16800 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16803 switch (res >> 26) {
16804 case ALC880_HP_EVENT:
16805 alc663_two_hp_m1_speaker_automute(codec);
16807 case ALC880_MIC_EVENT:
16808 alc_mic_automute(codec);
16813 #define alc663_mode3_setup alc663_m51va_setup
16815 static void alc663_mode3_inithook(struct hda_codec *codec)
16817 alc663_two_hp_m1_speaker_automute(codec);
16818 alc_mic_automute(codec);
16820 /* ***************** Mode4 ******************************/
16821 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16824 switch (res >> 26) {
16825 case ALC880_HP_EVENT:
16826 alc663_21jd_two_speaker_automute(codec);
16828 case ALC880_MIC_EVENT:
16829 alc_mic_automute(codec);
16834 #define alc663_mode4_setup alc663_m51va_setup
16836 static void alc663_mode4_inithook(struct hda_codec *codec)
16838 alc663_21jd_two_speaker_automute(codec);
16839 alc_mic_automute(codec);
16841 /* ***************** Mode5 ******************************/
16842 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16845 switch (res >> 26) {
16846 case ALC880_HP_EVENT:
16847 alc663_15jd_two_speaker_automute(codec);
16849 case ALC880_MIC_EVENT:
16850 alc_mic_automute(codec);
16855 #define alc663_mode5_setup alc663_m51va_setup
16857 static void alc663_mode5_inithook(struct hda_codec *codec)
16859 alc663_15jd_two_speaker_automute(codec);
16860 alc_mic_automute(codec);
16862 /* ***************** Mode6 ******************************/
16863 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16866 switch (res >> 26) {
16867 case ALC880_HP_EVENT:
16868 alc663_two_hp_m2_speaker_automute(codec);
16870 case ALC880_MIC_EVENT:
16871 alc_mic_automute(codec);
16876 #define alc663_mode6_setup alc663_m51va_setup
16878 static void alc663_mode6_inithook(struct hda_codec *codec)
16880 alc663_two_hp_m2_speaker_automute(codec);
16881 alc_mic_automute(codec);
16884 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16886 unsigned int present;
16887 unsigned char bits;
16889 present = snd_hda_jack_detect(codec, 0x21);
16890 bits = present ? HDA_AMP_MUTE : 0;
16891 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16892 HDA_AMP_MUTE, bits);
16893 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16894 HDA_AMP_MUTE, bits);
16897 static void alc663_g71v_front_automute(struct hda_codec *codec)
16899 unsigned int present;
16900 unsigned char bits;
16902 present = snd_hda_jack_detect(codec, 0x15);
16903 bits = present ? HDA_AMP_MUTE : 0;
16904 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16905 HDA_AMP_MUTE, bits);
16908 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16911 switch (res >> 26) {
16912 case ALC880_HP_EVENT:
16913 alc663_g71v_hp_automute(codec);
16915 case ALC880_FRONT_EVENT:
16916 alc663_g71v_front_automute(codec);
16918 case ALC880_MIC_EVENT:
16919 alc_mic_automute(codec);
16924 #define alc663_g71v_setup alc663_m51va_setup
16926 static void alc663_g71v_inithook(struct hda_codec *codec)
16928 alc663_g71v_front_automute(codec);
16929 alc663_g71v_hp_automute(codec);
16930 alc_mic_automute(codec);
16933 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16936 switch (res >> 26) {
16937 case ALC880_HP_EVENT:
16938 alc663_m51va_speaker_automute(codec);
16940 case ALC880_MIC_EVENT:
16941 alc_mic_automute(codec);
16946 #define alc663_g50v_setup alc663_m51va_setup
16948 static void alc663_g50v_inithook(struct hda_codec *codec)
16950 alc663_m51va_speaker_automute(codec);
16951 alc_mic_automute(codec);
16954 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16955 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16956 ALC262_HIPPO_MASTER_SWITCH,
16958 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16959 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16960 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16962 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16963 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16964 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16968 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16969 /* Master Playback automatically created from Speaker and Headphone */
16970 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16971 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16972 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16973 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16975 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16976 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16977 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16979 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16980 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16981 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16985 #ifdef CONFIG_SND_HDA_POWER_SAVE
16986 #define alc662_loopbacks alc880_loopbacks
16990 /* pcm configuration: identical with ALC880 */
16991 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16992 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16993 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16994 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16997 * configuration and preset
16999 static const char *alc662_models[ALC662_MODEL_LAST] = {
17000 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17001 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17002 [ALC662_3ST_6ch] = "3stack-6ch",
17003 [ALC662_5ST_DIG] = "6stack-dig",
17004 [ALC662_LENOVO_101E] = "lenovo-101e",
17005 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17006 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17007 [ALC662_ECS] = "ecs",
17008 [ALC663_ASUS_M51VA] = "m51va",
17009 [ALC663_ASUS_G71V] = "g71v",
17010 [ALC663_ASUS_H13] = "h13",
17011 [ALC663_ASUS_G50V] = "g50v",
17012 [ALC663_ASUS_MODE1] = "asus-mode1",
17013 [ALC662_ASUS_MODE2] = "asus-mode2",
17014 [ALC663_ASUS_MODE3] = "asus-mode3",
17015 [ALC663_ASUS_MODE4] = "asus-mode4",
17016 [ALC663_ASUS_MODE5] = "asus-mode5",
17017 [ALC663_ASUS_MODE6] = "asus-mode6",
17018 [ALC272_DELL] = "dell",
17019 [ALC272_DELL_ZM1] = "dell-zm1",
17020 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17021 [ALC662_AUTO] = "auto",
17024 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17025 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17026 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17027 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17028 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17029 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17030 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17031 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17032 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17033 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17034 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17035 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17036 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17037 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17038 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17039 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17040 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17041 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17042 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17043 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17044 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17045 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17046 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17047 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17048 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17049 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17050 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17051 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17052 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17053 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17054 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17055 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17056 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17057 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17058 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17059 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17060 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17061 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17062 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17063 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17064 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17065 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17066 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17067 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17068 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17069 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17070 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17071 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17072 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17073 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17074 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17075 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17076 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17077 ALC662_3ST_6ch_DIG),
17078 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
17079 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17080 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17081 ALC662_3ST_6ch_DIG),
17082 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17083 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17084 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17085 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17086 ALC662_3ST_6ch_DIG),
17087 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17089 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17093 static struct alc_config_preset alc662_presets[] = {
17094 [ALC662_3ST_2ch_DIG] = {
17095 .mixers = { alc662_3ST_2ch_mixer },
17096 .init_verbs = { alc662_init_verbs },
17097 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17098 .dac_nids = alc662_dac_nids,
17099 .dig_out_nid = ALC662_DIGOUT_NID,
17100 .dig_in_nid = ALC662_DIGIN_NID,
17101 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17102 .channel_mode = alc662_3ST_2ch_modes,
17103 .input_mux = &alc662_capture_source,
17105 [ALC662_3ST_6ch_DIG] = {
17106 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17107 .init_verbs = { alc662_init_verbs },
17108 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17109 .dac_nids = alc662_dac_nids,
17110 .dig_out_nid = ALC662_DIGOUT_NID,
17111 .dig_in_nid = ALC662_DIGIN_NID,
17112 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17113 .channel_mode = alc662_3ST_6ch_modes,
17115 .input_mux = &alc662_capture_source,
17117 [ALC662_3ST_6ch] = {
17118 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17119 .init_verbs = { alc662_init_verbs },
17120 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17121 .dac_nids = alc662_dac_nids,
17122 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17123 .channel_mode = alc662_3ST_6ch_modes,
17125 .input_mux = &alc662_capture_source,
17127 [ALC662_5ST_DIG] = {
17128 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17129 .init_verbs = { alc662_init_verbs },
17130 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17131 .dac_nids = alc662_dac_nids,
17132 .dig_out_nid = ALC662_DIGOUT_NID,
17133 .dig_in_nid = ALC662_DIGIN_NID,
17134 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17135 .channel_mode = alc662_5stack_modes,
17136 .input_mux = &alc662_capture_source,
17138 [ALC662_LENOVO_101E] = {
17139 .mixers = { alc662_lenovo_101e_mixer },
17140 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17141 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17142 .dac_nids = alc662_dac_nids,
17143 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17144 .channel_mode = alc662_3ST_2ch_modes,
17145 .input_mux = &alc662_lenovo_101e_capture_source,
17146 .unsol_event = alc662_lenovo_101e_unsol_event,
17147 .init_hook = alc662_lenovo_101e_all_automute,
17149 [ALC662_ASUS_EEEPC_P701] = {
17150 .mixers = { alc662_eeepc_p701_mixer },
17151 .init_verbs = { alc662_init_verbs,
17152 alc662_eeepc_sue_init_verbs },
17153 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17154 .dac_nids = alc662_dac_nids,
17155 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17156 .channel_mode = alc662_3ST_2ch_modes,
17157 .unsol_event = alc662_eeepc_unsol_event,
17158 .setup = alc662_eeepc_setup,
17159 .init_hook = alc662_eeepc_inithook,
17161 [ALC662_ASUS_EEEPC_EP20] = {
17162 .mixers = { alc662_eeepc_ep20_mixer,
17163 alc662_chmode_mixer },
17164 .init_verbs = { alc662_init_verbs,
17165 alc662_eeepc_ep20_sue_init_verbs },
17166 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17167 .dac_nids = alc662_dac_nids,
17168 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17169 .channel_mode = alc662_3ST_6ch_modes,
17170 .input_mux = &alc662_lenovo_101e_capture_source,
17171 .unsol_event = alc662_eeepc_unsol_event,
17172 .setup = alc662_eeepc_ep20_setup,
17173 .init_hook = alc662_eeepc_ep20_inithook,
17176 .mixers = { alc662_ecs_mixer },
17177 .init_verbs = { alc662_init_verbs,
17178 alc662_ecs_init_verbs },
17179 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17180 .dac_nids = alc662_dac_nids,
17181 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17182 .channel_mode = alc662_3ST_2ch_modes,
17183 .unsol_event = alc662_eeepc_unsol_event,
17184 .setup = alc662_eeepc_setup,
17185 .init_hook = alc662_eeepc_inithook,
17187 [ALC663_ASUS_M51VA] = {
17188 .mixers = { alc663_m51va_mixer },
17189 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17190 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17191 .dac_nids = alc662_dac_nids,
17192 .dig_out_nid = ALC662_DIGOUT_NID,
17193 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17194 .channel_mode = alc662_3ST_2ch_modes,
17195 .unsol_event = alc663_m51va_unsol_event,
17196 .setup = alc663_m51va_setup,
17197 .init_hook = alc663_m51va_inithook,
17199 [ALC663_ASUS_G71V] = {
17200 .mixers = { alc663_g71v_mixer },
17201 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17202 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17203 .dac_nids = alc662_dac_nids,
17204 .dig_out_nid = ALC662_DIGOUT_NID,
17205 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17206 .channel_mode = alc662_3ST_2ch_modes,
17207 .unsol_event = alc663_g71v_unsol_event,
17208 .setup = alc663_g71v_setup,
17209 .init_hook = alc663_g71v_inithook,
17211 [ALC663_ASUS_H13] = {
17212 .mixers = { alc663_m51va_mixer },
17213 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17214 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17215 .dac_nids = alc662_dac_nids,
17216 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17217 .channel_mode = alc662_3ST_2ch_modes,
17218 .unsol_event = alc663_m51va_unsol_event,
17219 .init_hook = alc663_m51va_inithook,
17221 [ALC663_ASUS_G50V] = {
17222 .mixers = { alc663_g50v_mixer },
17223 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17224 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17225 .dac_nids = alc662_dac_nids,
17226 .dig_out_nid = ALC662_DIGOUT_NID,
17227 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17228 .channel_mode = alc662_3ST_6ch_modes,
17229 .input_mux = &alc663_capture_source,
17230 .unsol_event = alc663_g50v_unsol_event,
17231 .setup = alc663_g50v_setup,
17232 .init_hook = alc663_g50v_inithook,
17234 [ALC663_ASUS_MODE1] = {
17235 .mixers = { alc663_m51va_mixer },
17236 .cap_mixer = alc662_auto_capture_mixer,
17237 .init_verbs = { alc662_init_verbs,
17238 alc663_21jd_amic_init_verbs },
17239 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17241 .dac_nids = alc662_dac_nids,
17242 .dig_out_nid = ALC662_DIGOUT_NID,
17243 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17244 .channel_mode = alc662_3ST_2ch_modes,
17245 .unsol_event = alc663_mode1_unsol_event,
17246 .setup = alc663_mode1_setup,
17247 .init_hook = alc663_mode1_inithook,
17249 [ALC662_ASUS_MODE2] = {
17250 .mixers = { alc662_1bjd_mixer },
17251 .cap_mixer = alc662_auto_capture_mixer,
17252 .init_verbs = { alc662_init_verbs,
17253 alc662_1bjd_amic_init_verbs },
17254 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17255 .dac_nids = alc662_dac_nids,
17256 .dig_out_nid = ALC662_DIGOUT_NID,
17257 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17258 .channel_mode = alc662_3ST_2ch_modes,
17259 .unsol_event = alc662_mode2_unsol_event,
17260 .setup = alc662_mode2_setup,
17261 .init_hook = alc662_mode2_inithook,
17263 [ALC663_ASUS_MODE3] = {
17264 .mixers = { alc663_two_hp_m1_mixer },
17265 .cap_mixer = alc662_auto_capture_mixer,
17266 .init_verbs = { alc662_init_verbs,
17267 alc663_two_hp_amic_m1_init_verbs },
17268 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17270 .dac_nids = alc662_dac_nids,
17271 .dig_out_nid = ALC662_DIGOUT_NID,
17272 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17273 .channel_mode = alc662_3ST_2ch_modes,
17274 .unsol_event = alc663_mode3_unsol_event,
17275 .setup = alc663_mode3_setup,
17276 .init_hook = alc663_mode3_inithook,
17278 [ALC663_ASUS_MODE4] = {
17279 .mixers = { alc663_asus_21jd_clfe_mixer },
17280 .cap_mixer = alc662_auto_capture_mixer,
17281 .init_verbs = { alc662_init_verbs,
17282 alc663_21jd_amic_init_verbs},
17283 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17285 .dac_nids = alc662_dac_nids,
17286 .dig_out_nid = ALC662_DIGOUT_NID,
17287 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17288 .channel_mode = alc662_3ST_2ch_modes,
17289 .unsol_event = alc663_mode4_unsol_event,
17290 .setup = alc663_mode4_setup,
17291 .init_hook = alc663_mode4_inithook,
17293 [ALC663_ASUS_MODE5] = {
17294 .mixers = { alc663_asus_15jd_clfe_mixer },
17295 .cap_mixer = alc662_auto_capture_mixer,
17296 .init_verbs = { alc662_init_verbs,
17297 alc663_15jd_amic_init_verbs },
17298 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17300 .dac_nids = alc662_dac_nids,
17301 .dig_out_nid = ALC662_DIGOUT_NID,
17302 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17303 .channel_mode = alc662_3ST_2ch_modes,
17304 .unsol_event = alc663_mode5_unsol_event,
17305 .setup = alc663_mode5_setup,
17306 .init_hook = alc663_mode5_inithook,
17308 [ALC663_ASUS_MODE6] = {
17309 .mixers = { alc663_two_hp_m2_mixer },
17310 .cap_mixer = alc662_auto_capture_mixer,
17311 .init_verbs = { alc662_init_verbs,
17312 alc663_two_hp_amic_m2_init_verbs },
17313 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17315 .dac_nids = alc662_dac_nids,
17316 .dig_out_nid = ALC662_DIGOUT_NID,
17317 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17318 .channel_mode = alc662_3ST_2ch_modes,
17319 .unsol_event = alc663_mode6_unsol_event,
17320 .setup = alc663_mode6_setup,
17321 .init_hook = alc663_mode6_inithook,
17324 .mixers = { alc663_m51va_mixer },
17325 .cap_mixer = alc272_auto_capture_mixer,
17326 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17327 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17328 .dac_nids = alc662_dac_nids,
17329 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17330 .adc_nids = alc272_adc_nids,
17331 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17332 .capsrc_nids = alc272_capsrc_nids,
17333 .channel_mode = alc662_3ST_2ch_modes,
17334 .unsol_event = alc663_m51va_unsol_event,
17335 .setup = alc663_m51va_setup,
17336 .init_hook = alc663_m51va_inithook,
17338 [ALC272_DELL_ZM1] = {
17339 .mixers = { alc663_m51va_mixer },
17340 .cap_mixer = alc662_auto_capture_mixer,
17341 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17342 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17343 .dac_nids = alc662_dac_nids,
17344 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17345 .adc_nids = alc662_adc_nids,
17347 .capsrc_nids = alc662_capsrc_nids,
17348 .channel_mode = alc662_3ST_2ch_modes,
17349 .unsol_event = alc663_m51va_unsol_event,
17350 .setup = alc663_m51va_setup,
17351 .init_hook = alc663_m51va_inithook,
17353 [ALC272_SAMSUNG_NC10] = {
17354 .mixers = { alc272_nc10_mixer },
17355 .init_verbs = { alc662_init_verbs,
17356 alc663_21jd_amic_init_verbs },
17357 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17358 .dac_nids = alc272_dac_nids,
17359 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17360 .channel_mode = alc662_3ST_2ch_modes,
17361 /*.input_mux = &alc272_nc10_capture_source,*/
17362 .unsol_event = alc663_mode4_unsol_event,
17363 .setup = alc663_mode4_setup,
17364 .init_hook = alc663_mode4_inithook,
17370 * BIOS auto configuration
17373 /* convert from MIX nid to DAC */
17374 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17378 else if (nid >= 0x0c && nid <= 0x0e)
17379 return nid - 0x0c + 0x02;
17384 /* get MIX nid connected to the given pin targeted to DAC */
17385 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17391 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17392 for (i = 0; i < num; i++) {
17393 if (alc662_mix_to_dac(mix[i]) == dac)
17399 /* look for an empty DAC slot */
17400 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17402 struct alc_spec *spec = codec->spec;
17406 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17409 for (i = 0; i < num; i++) {
17410 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17413 for (j = 0; j < spec->multiout.num_dacs; j++)
17414 if (spec->multiout.dac_nids[j] == nid)
17416 if (j >= spec->multiout.num_dacs)
17422 /* fill in the dac_nids table from the parsed pin configuration */
17423 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17424 const struct auto_pin_cfg *cfg)
17426 struct alc_spec *spec = codec->spec;
17430 spec->multiout.dac_nids = spec->private_dac_nids;
17431 for (i = 0; i < cfg->line_outs; i++) {
17432 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17435 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17440 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17441 hda_nid_t nid, unsigned int chs)
17443 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17444 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17447 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17448 hda_nid_t nid, unsigned int chs)
17450 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17451 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17454 #define alc662_add_stereo_vol(spec, pfx, nid) \
17455 alc662_add_vol_ctl(spec, pfx, nid, 3)
17456 #define alc662_add_stereo_sw(spec, pfx, nid) \
17457 alc662_add_sw_ctl(spec, pfx, nid, 3)
17459 /* add playback controls from the parsed DAC table */
17460 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17461 const struct auto_pin_cfg *cfg)
17463 struct alc_spec *spec = codec->spec;
17464 static const char *chname[4] = {
17465 "Front", "Surround", NULL /*CLFE*/, "Side"
17467 hda_nid_t nid, mix;
17470 for (i = 0; i < cfg->line_outs; i++) {
17471 nid = spec->multiout.dac_nids[i];
17474 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17479 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17482 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17485 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17488 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17493 if (cfg->line_outs == 1 &&
17494 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17501 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17504 if (cfg->line_outs == 1 &&
17505 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17507 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17515 /* add playback controls for speaker and HP outputs */
17516 /* return DAC nid if any new DAC is assigned */
17517 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17520 struct alc_spec *spec = codec->spec;
17521 hda_nid_t nid, mix;
17526 nid = alc662_look_for_dac(codec, pin);
17528 /* the corresponding DAC is already occupied */
17529 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17530 return 0; /* no way */
17531 /* create a switch only */
17532 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17533 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17536 mix = alc662_dac_to_mix(codec, pin, nid);
17539 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17542 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17548 /* create playback/capture controls for input pins */
17549 #define alc662_auto_create_input_ctls \
17550 alc882_auto_create_input_ctls
17552 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17553 hda_nid_t nid, int pin_type,
17559 alc_set_pin_output(codec, nid, pin_type);
17560 /* need the manual connection? */
17561 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17564 for (i = 0; i < num; i++) {
17565 if (alc662_mix_to_dac(srcs[i]) != dac)
17567 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17572 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17574 struct alc_spec *spec = codec->spec;
17575 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17578 for (i = 0; i <= HDA_SIDE; i++) {
17579 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17581 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17582 spec->multiout.dac_nids[i]);
17586 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17588 struct alc_spec *spec = codec->spec;
17591 pin = spec->autocfg.hp_pins[0];
17593 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17594 spec->multiout.hp_nid);
17595 pin = spec->autocfg.speaker_pins[0];
17597 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17598 spec->multiout.extra_out_nid[0]);
17601 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17603 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17605 struct alc_spec *spec = codec->spec;
17608 for (i = 0; i < AUTO_PIN_LAST; i++) {
17609 hda_nid_t nid = spec->autocfg.input_pins[i];
17610 if (alc_is_input_pin(codec, nid)) {
17611 alc_set_input_pin(codec, nid, i);
17612 if (nid != ALC662_PIN_CD_NID &&
17613 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17614 snd_hda_codec_write(codec, nid, 0,
17615 AC_VERB_SET_AMP_GAIN_MUTE,
17621 #define alc662_auto_init_input_src alc882_auto_init_input_src
17623 static int alc662_parse_auto_config(struct hda_codec *codec)
17625 struct alc_spec *spec = codec->spec;
17627 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17629 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17633 if (!spec->autocfg.line_outs)
17634 return 0; /* can't find valid BIOS pin config */
17636 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17639 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17642 err = alc662_auto_create_extra_out(codec,
17643 spec->autocfg.speaker_pins[0],
17648 spec->multiout.extra_out_nid[0] = err;
17649 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17654 spec->multiout.hp_nid = err;
17655 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17659 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17661 if (spec->autocfg.dig_outs)
17662 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17664 if (spec->kctls.list)
17665 add_mixer(spec, spec->kctls.list);
17667 spec->num_mux_defs = 1;
17668 spec->input_mux = &spec->private_imux[0];
17670 add_verb(spec, alc662_auto_init_verbs);
17671 if (codec->vendor_id == 0x10ec0663)
17672 add_verb(spec, alc663_auto_init_verbs);
17674 err = alc_auto_add_mic_boost(codec);
17678 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17683 /* additional initialization for auto-configuration model */
17684 static void alc662_auto_init(struct hda_codec *codec)
17686 struct alc_spec *spec = codec->spec;
17687 alc662_auto_init_multi_out(codec);
17688 alc662_auto_init_hp_out(codec);
17689 alc662_auto_init_analog_input(codec);
17690 alc662_auto_init_input_src(codec);
17691 if (spec->unsol_event)
17692 alc_inithook(codec);
17695 static int patch_alc662(struct hda_codec *codec)
17697 struct alc_spec *spec;
17698 int err, board_config;
17700 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17704 codec->spec = spec;
17706 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17708 if (alc_read_coef_idx(codec, 0)==0x8020){
17709 kfree(codec->chip_name);
17710 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
17711 if (!codec->chip_name) {
17717 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17720 if (board_config < 0) {
17721 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17723 board_config = ALC662_AUTO;
17726 if (board_config == ALC662_AUTO) {
17727 /* automatic parse from the BIOS config */
17728 err = alc662_parse_auto_config(codec);
17734 "hda_codec: Cannot set up configuration "
17735 "from BIOS. Using base mode...\n");
17736 board_config = ALC662_3ST_2ch_DIG;
17740 err = snd_hda_attach_beep_device(codec, 0x1);
17746 if (board_config != ALC662_AUTO)
17747 setup_preset(codec, &alc662_presets[board_config]);
17749 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17750 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17752 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17753 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17755 if (!spec->adc_nids) {
17756 spec->adc_nids = alc662_adc_nids;
17757 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17759 if (!spec->capsrc_nids)
17760 spec->capsrc_nids = alc662_capsrc_nids;
17762 if (!spec->cap_mixer)
17763 set_capture_mixer(codec);
17764 if (codec->vendor_id == 0x10ec0662)
17765 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17767 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17769 spec->vmaster_nid = 0x02;
17771 codec->patch_ops = alc_patch_ops;
17772 if (board_config == ALC662_AUTO)
17773 spec->init_hook = alc662_auto_init;
17774 #ifdef CONFIG_SND_HDA_POWER_SAVE
17775 if (!spec->loopback.amplist)
17776 spec->loopback.amplist = alc662_loopbacks;
17778 codec->proc_widget_hook = print_realtek_coef;
17783 static int patch_alc888(struct hda_codec *codec)
17785 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
17786 kfree(codec->chip_name);
17787 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
17788 if (!codec->chip_name) {
17792 return patch_alc662(codec);
17794 return patch_alc882(codec);
17800 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17801 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17802 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17803 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17804 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17805 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17806 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17807 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17808 .patch = patch_alc861 },
17809 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17810 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17811 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17812 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17813 .patch = patch_alc882 },
17814 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17815 .patch = patch_alc662 },
17816 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17817 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17818 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17819 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17820 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17821 .patch = patch_alc882 },
17822 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17823 .patch = patch_alc882 },
17824 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17825 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17826 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17827 .patch = patch_alc882 },
17828 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
17829 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17830 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
17831 {} /* terminator */
17834 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17836 MODULE_LICENSE("GPL");
17837 MODULE_DESCRIPTION("Realtek HD-audio codec");
17839 static struct hda_codec_preset_list realtek_list = {
17840 .preset = snd_hda_preset_realtek,
17841 .owner = THIS_MODULE,
17844 static int __init patch_realtek_init(void)
17846 return snd_hda_add_codec_preset(&realtek_list);
17849 static void __exit patch_realtek_exit(void)
17851 snd_hda_delete_codec_preset(&realtek_list);
17854 module_init(patch_realtek_init)
17855 module_exit(patch_realtek_exit)