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 */
141 ALC269_MODEL_LAST /* last tag */
158 /* ALC861-VD models */
180 ALC662_ASUS_EEEPC_P701,
181 ALC662_ASUS_EEEPC_EP20,
223 ALC883_TARGA_2ch_DIG,
224 ALC883_TARGA_8ch_DIG,
227 ALC888_ACER_ASPIRE_4930G,
228 ALC888_ACER_ASPIRE_6530G,
229 ALC888_ACER_ASPIRE_8930G,
230 ALC888_ACER_ASPIRE_7730G,
233 ALC883_MEDION_WIM2160,
235 ALC883_LENOVO_101E_2ch,
236 ALC883_LENOVO_NB0763,
237 ALC888_LENOVO_MS7195_DIG,
245 ALC883_FUJITSU_PI2515,
246 ALC888_FUJITSU_XA3530,
247 ALC883_3ST_6ch_INTEL,
260 #define GPIO_MASK 0x03
262 /* extra amp-initialization sequence types */
271 struct alc_mic_route {
273 unsigned char mux_idx;
274 unsigned char amix_idx;
277 #define MUX_IDX_UNDEF ((unsigned char)-1)
279 struct alc_customize_define {
280 unsigned int sku_cfg;
281 unsigned char port_connectivity;
282 unsigned char check_sum;
283 unsigned char customization;
284 unsigned char external_amp;
285 unsigned int enable_pcbeep:1;
286 unsigned int platform_type:1;
288 unsigned int override:1;
292 /* codec parameterization */
293 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
294 unsigned int num_mixers;
295 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
296 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
298 const struct hda_verb *init_verbs[10]; /* initialization verbs
302 unsigned int num_init_verbs;
304 char stream_name_analog[32]; /* analog PCM stream */
305 struct hda_pcm_stream *stream_analog_playback;
306 struct hda_pcm_stream *stream_analog_capture;
307 struct hda_pcm_stream *stream_analog_alt_playback;
308 struct hda_pcm_stream *stream_analog_alt_capture;
310 char stream_name_digital[32]; /* digital PCM stream */
311 struct hda_pcm_stream *stream_digital_playback;
312 struct hda_pcm_stream *stream_digital_capture;
315 struct hda_multi_out multiout; /* playback set-up
316 * max_channels, dacs must be set
317 * dig_out_nid and hp_nid are optional
319 hda_nid_t alt_dac_nid;
320 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
324 unsigned int num_adc_nids;
326 hda_nid_t *capsrc_nids;
327 hda_nid_t dig_in_nid; /* digital-in NID; optional */
330 unsigned int num_mux_defs;
331 const struct hda_input_mux *input_mux;
332 unsigned int cur_mux[3];
333 struct alc_mic_route ext_mic;
334 struct alc_mic_route int_mic;
337 const struct hda_channel_mode *channel_mode;
338 int num_channel_mode;
340 int const_channel_count;
341 int ext_channel_count;
343 /* PCM information */
344 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
346 /* dynamic controls, init_verbs and input_mux */
347 struct auto_pin_cfg autocfg;
348 struct alc_customize_define cdefine;
349 struct snd_array kctls;
350 struct hda_input_mux private_imux[3];
351 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
352 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
353 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
356 void (*init_hook)(struct hda_codec *codec);
357 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
358 #ifdef CONFIG_SND_HDA_POWER_SAVE
359 void (*power_hook)(struct hda_codec *codec);
362 /* for pin sensing */
363 unsigned int sense_updated: 1;
364 unsigned int jack_present: 1;
365 unsigned int master_sw: 1;
366 unsigned int auto_mic:1;
369 unsigned int no_analog :1; /* digital I/O only */
372 /* for virtual master */
373 hda_nid_t vmaster_nid;
374 #ifdef CONFIG_SND_HDA_POWER_SAVE
375 struct hda_loopback_check loopback;
380 unsigned int pll_coef_idx, pll_coef_bit;
384 * configuration template - to be copied to the spec instance
386 struct alc_config_preset {
387 struct snd_kcontrol_new *mixers[5]; /* should be identical size
390 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
391 const struct hda_verb *init_verbs[5];
392 unsigned int num_dacs;
394 hda_nid_t dig_out_nid; /* optional */
395 hda_nid_t hp_nid; /* optional */
396 hda_nid_t *slave_dig_outs;
397 unsigned int num_adc_nids;
399 hda_nid_t *capsrc_nids;
400 hda_nid_t dig_in_nid;
401 unsigned int num_channel_mode;
402 const struct hda_channel_mode *channel_mode;
404 int const_channel_count;
405 unsigned int num_mux_defs;
406 const struct hda_input_mux *input_mux;
407 void (*unsol_event)(struct hda_codec *, unsigned int);
408 void (*setup)(struct hda_codec *);
409 void (*init_hook)(struct hda_codec *);
410 #ifdef CONFIG_SND_HDA_POWER_SAVE
411 struct hda_amp_list *loopbacks;
412 void (*power_hook)(struct hda_codec *codec);
420 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
421 struct snd_ctl_elem_info *uinfo)
423 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
424 struct alc_spec *spec = codec->spec;
425 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
426 if (mux_idx >= spec->num_mux_defs)
428 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
430 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
433 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
434 struct snd_ctl_elem_value *ucontrol)
436 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
437 struct alc_spec *spec = codec->spec;
438 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
440 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
444 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
445 struct snd_ctl_elem_value *ucontrol)
447 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
448 struct alc_spec *spec = codec->spec;
449 const struct hda_input_mux *imux;
450 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
451 unsigned int mux_idx;
452 hda_nid_t nid = spec->capsrc_nids ?
453 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
456 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
457 imux = &spec->input_mux[mux_idx];
458 if (!imux->num_items && mux_idx > 0)
459 imux = &spec->input_mux[0];
461 type = get_wcaps_type(get_wcaps(codec, nid));
462 if (type == AC_WID_AUD_MIX) {
463 /* Matrix-mixer style (e.g. ALC882) */
464 unsigned int *cur_val = &spec->cur_mux[adc_idx];
467 idx = ucontrol->value.enumerated.item[0];
468 if (idx >= imux->num_items)
469 idx = imux->num_items - 1;
472 for (i = 0; i < imux->num_items; i++) {
473 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
474 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
475 imux->items[i].index,
481 /* MUX style (e.g. ALC880) */
482 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
483 &spec->cur_mux[adc_idx]);
488 * channel mode setting
490 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
491 struct snd_ctl_elem_info *uinfo)
493 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
494 struct alc_spec *spec = codec->spec;
495 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
496 spec->num_channel_mode);
499 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
500 struct snd_ctl_elem_value *ucontrol)
502 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
503 struct alc_spec *spec = codec->spec;
504 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
505 spec->num_channel_mode,
506 spec->ext_channel_count);
509 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
510 struct snd_ctl_elem_value *ucontrol)
512 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
513 struct alc_spec *spec = codec->spec;
514 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
515 spec->num_channel_mode,
516 &spec->ext_channel_count);
517 if (err >= 0 && !spec->const_channel_count) {
518 spec->multiout.max_channels = spec->ext_channel_count;
519 if (spec->need_dac_fix)
520 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
526 * Control the mode of pin widget settings via the mixer. "pc" is used
527 * instead of "%" to avoid consequences of accidently treating the % as
528 * being part of a format specifier. Maximum allowed length of a value is
529 * 63 characters plus NULL terminator.
531 * Note: some retasking pin complexes seem to ignore requests for input
532 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
533 * are requested. Therefore order this list so that this behaviour will not
534 * cause problems when mixer clients move through the enum sequentially.
535 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
538 static char *alc_pin_mode_names[] = {
539 "Mic 50pc bias", "Mic 80pc bias",
540 "Line in", "Line out", "Headphone out",
542 static unsigned char alc_pin_mode_values[] = {
543 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
545 /* The control can present all 5 options, or it can limit the options based
546 * in the pin being assumed to be exclusively an input or an output pin. In
547 * addition, "input" pins may or may not process the mic bias option
548 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
549 * accept requests for bias as of chip versions up to March 2006) and/or
550 * wiring in the computer.
552 #define ALC_PIN_DIR_IN 0x00
553 #define ALC_PIN_DIR_OUT 0x01
554 #define ALC_PIN_DIR_INOUT 0x02
555 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
556 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
558 /* Info about the pin modes supported by the different pin direction modes.
559 * For each direction the minimum and maximum values are given.
561 static signed char alc_pin_mode_dir_info[5][2] = {
562 { 0, 2 }, /* ALC_PIN_DIR_IN */
563 { 3, 4 }, /* ALC_PIN_DIR_OUT */
564 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
565 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
566 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
568 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
569 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
570 #define alc_pin_mode_n_items(_dir) \
571 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
573 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
574 struct snd_ctl_elem_info *uinfo)
576 unsigned int item_num = uinfo->value.enumerated.item;
577 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
579 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
581 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
583 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
584 item_num = alc_pin_mode_min(dir);
585 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
589 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
590 struct snd_ctl_elem_value *ucontrol)
593 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
594 hda_nid_t nid = kcontrol->private_value & 0xffff;
595 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
596 long *valp = ucontrol->value.integer.value;
597 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
598 AC_VERB_GET_PIN_WIDGET_CONTROL,
601 /* Find enumerated value for current pinctl setting */
602 i = alc_pin_mode_min(dir);
603 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
605 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
609 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
610 struct snd_ctl_elem_value *ucontrol)
613 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
614 hda_nid_t nid = kcontrol->private_value & 0xffff;
615 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
616 long val = *ucontrol->value.integer.value;
617 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
618 AC_VERB_GET_PIN_WIDGET_CONTROL,
621 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
622 val = alc_pin_mode_min(dir);
624 change = pinctl != alc_pin_mode_values[val];
626 /* Set pin mode to that requested */
627 snd_hda_codec_write_cache(codec, nid, 0,
628 AC_VERB_SET_PIN_WIDGET_CONTROL,
629 alc_pin_mode_values[val]);
631 /* Also enable the retasking pin's input/output as required
632 * for the requested pin mode. Enum values of 2 or less are
635 * Dynamically switching the input/output buffers probably
636 * reduces noise slightly (particularly on input) so we'll
637 * do it. However, having both input and output buffers
638 * enabled simultaneously doesn't seem to be problematic if
639 * this turns out to be necessary in the future.
642 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
643 HDA_AMP_MUTE, HDA_AMP_MUTE);
644 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
647 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
648 HDA_AMP_MUTE, HDA_AMP_MUTE);
649 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
656 #define ALC_PIN_MODE(xname, nid, dir) \
657 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
658 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
659 .info = alc_pin_mode_info, \
660 .get = alc_pin_mode_get, \
661 .put = alc_pin_mode_put, \
662 .private_value = nid | (dir<<16) }
664 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
665 * together using a mask with more than one bit set. This control is
666 * currently used only by the ALC260 test model. At this stage they are not
667 * needed for any "production" models.
669 #ifdef CONFIG_SND_DEBUG
670 #define alc_gpio_data_info snd_ctl_boolean_mono_info
672 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
673 struct snd_ctl_elem_value *ucontrol)
675 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
676 hda_nid_t nid = kcontrol->private_value & 0xffff;
677 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
678 long *valp = ucontrol->value.integer.value;
679 unsigned int val = snd_hda_codec_read(codec, nid, 0,
680 AC_VERB_GET_GPIO_DATA, 0x00);
682 *valp = (val & mask) != 0;
685 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
686 struct snd_ctl_elem_value *ucontrol)
689 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
690 hda_nid_t nid = kcontrol->private_value & 0xffff;
691 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
692 long val = *ucontrol->value.integer.value;
693 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
694 AC_VERB_GET_GPIO_DATA,
697 /* Set/unset the masked GPIO bit(s) as needed */
698 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
703 snd_hda_codec_write_cache(codec, nid, 0,
704 AC_VERB_SET_GPIO_DATA, gpio_data);
708 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
709 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
710 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
711 .info = alc_gpio_data_info, \
712 .get = alc_gpio_data_get, \
713 .put = alc_gpio_data_put, \
714 .private_value = nid | (mask<<16) }
715 #endif /* CONFIG_SND_DEBUG */
717 /* A switch control to allow the enabling of the digital IO pins on the
718 * ALC260. This is incredibly simplistic; the intention of this control is
719 * to provide something in the test model allowing digital outputs to be
720 * identified if present. If models are found which can utilise these
721 * outputs a more complete mixer control can be devised for those models if
724 #ifdef CONFIG_SND_DEBUG
725 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
727 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
728 struct snd_ctl_elem_value *ucontrol)
730 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
731 hda_nid_t nid = kcontrol->private_value & 0xffff;
732 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
733 long *valp = ucontrol->value.integer.value;
734 unsigned int val = snd_hda_codec_read(codec, nid, 0,
735 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
737 *valp = (val & mask) != 0;
740 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
741 struct snd_ctl_elem_value *ucontrol)
744 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
745 hda_nid_t nid = kcontrol->private_value & 0xffff;
746 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
747 long val = *ucontrol->value.integer.value;
748 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
749 AC_VERB_GET_DIGI_CONVERT_1,
752 /* Set/unset the masked control bit(s) as needed */
753 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
758 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
763 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
764 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
765 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
766 .info = alc_spdif_ctrl_info, \
767 .get = alc_spdif_ctrl_get, \
768 .put = alc_spdif_ctrl_put, \
769 .private_value = nid | (mask<<16) }
770 #endif /* CONFIG_SND_DEBUG */
772 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
773 * Again, this is only used in the ALC26x test models to help identify when
774 * the EAPD line must be asserted for features to work.
776 #ifdef CONFIG_SND_DEBUG
777 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
779 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
780 struct snd_ctl_elem_value *ucontrol)
782 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
783 hda_nid_t nid = kcontrol->private_value & 0xffff;
784 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
785 long *valp = ucontrol->value.integer.value;
786 unsigned int val = snd_hda_codec_read(codec, nid, 0,
787 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
789 *valp = (val & mask) != 0;
793 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
794 struct snd_ctl_elem_value *ucontrol)
797 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
798 hda_nid_t nid = kcontrol->private_value & 0xffff;
799 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
800 long val = *ucontrol->value.integer.value;
801 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
802 AC_VERB_GET_EAPD_BTLENABLE,
805 /* Set/unset the masked control bit(s) as needed */
806 change = (!val ? 0 : mask) != (ctrl_data & mask);
811 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
817 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
818 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
819 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
820 .info = alc_eapd_ctrl_info, \
821 .get = alc_eapd_ctrl_get, \
822 .put = alc_eapd_ctrl_put, \
823 .private_value = nid | (mask<<16) }
824 #endif /* CONFIG_SND_DEBUG */
827 * set up the input pin config (depending on the given auto-pin type)
829 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
832 unsigned int val = PIN_IN;
834 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
836 pincap = snd_hda_query_pin_caps(codec, nid);
837 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
838 if (pincap & AC_PINCAP_VREF_80)
840 else if (pincap & AC_PINCAP_VREF_50)
842 else if (pincap & AC_PINCAP_VREF_100)
844 else if (pincap & AC_PINCAP_VREF_GRD)
847 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
852 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
854 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
856 spec->mixers[spec->num_mixers++] = mix;
859 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
861 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
863 spec->init_verbs[spec->num_init_verbs++] = verb;
867 * set up from the preset table
869 static void setup_preset(struct hda_codec *codec,
870 const struct alc_config_preset *preset)
872 struct alc_spec *spec = codec->spec;
875 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
876 add_mixer(spec, preset->mixers[i]);
877 spec->cap_mixer = preset->cap_mixer;
878 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
880 add_verb(spec, preset->init_verbs[i]);
882 spec->channel_mode = preset->channel_mode;
883 spec->num_channel_mode = preset->num_channel_mode;
884 spec->need_dac_fix = preset->need_dac_fix;
885 spec->const_channel_count = preset->const_channel_count;
887 if (preset->const_channel_count)
888 spec->multiout.max_channels = preset->const_channel_count;
890 spec->multiout.max_channels = spec->channel_mode[0].channels;
891 spec->ext_channel_count = spec->channel_mode[0].channels;
893 spec->multiout.num_dacs = preset->num_dacs;
894 spec->multiout.dac_nids = preset->dac_nids;
895 spec->multiout.dig_out_nid = preset->dig_out_nid;
896 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
897 spec->multiout.hp_nid = preset->hp_nid;
899 spec->num_mux_defs = preset->num_mux_defs;
900 if (!spec->num_mux_defs)
901 spec->num_mux_defs = 1;
902 spec->input_mux = preset->input_mux;
904 spec->num_adc_nids = preset->num_adc_nids;
905 spec->adc_nids = preset->adc_nids;
906 spec->capsrc_nids = preset->capsrc_nids;
907 spec->dig_in_nid = preset->dig_in_nid;
909 spec->unsol_event = preset->unsol_event;
910 spec->init_hook = preset->init_hook;
911 #ifdef CONFIG_SND_HDA_POWER_SAVE
912 spec->power_hook = preset->power_hook;
913 spec->loopback.amplist = preset->loopbacks;
917 preset->setup(codec);
920 /* Enable GPIO mask and set output */
921 static struct hda_verb alc_gpio1_init_verbs[] = {
922 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
923 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
924 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
928 static struct hda_verb alc_gpio2_init_verbs[] = {
929 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
930 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
931 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
935 static struct hda_verb alc_gpio3_init_verbs[] = {
936 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
937 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
938 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
943 * Fix hardware PLL issue
944 * On some codecs, the analog PLL gating control must be off while
945 * the default value is 1.
947 static void alc_fix_pll(struct hda_codec *codec)
949 struct alc_spec *spec = codec->spec;
954 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
956 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
957 AC_VERB_GET_PROC_COEF, 0);
958 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
960 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
961 val & ~(1 << spec->pll_coef_bit));
964 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
965 unsigned int coef_idx, unsigned int coef_bit)
967 struct alc_spec *spec = codec->spec;
969 spec->pll_coef_idx = coef_idx;
970 spec->pll_coef_bit = coef_bit;
974 static void alc_automute_pin(struct hda_codec *codec)
976 struct alc_spec *spec = codec->spec;
977 unsigned int nid = spec->autocfg.hp_pins[0];
982 spec->jack_present = snd_hda_jack_detect(codec, nid);
983 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
984 nid = spec->autocfg.speaker_pins[i];
987 snd_hda_codec_write(codec, nid, 0,
988 AC_VERB_SET_PIN_WIDGET_CONTROL,
989 spec->jack_present ? 0 : PIN_OUT);
993 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
996 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
999 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1000 for (i = 0; i < nums; i++)
1006 static void alc_mic_automute(struct hda_codec *codec)
1008 struct alc_spec *spec = codec->spec;
1009 struct alc_mic_route *dead, *alive;
1010 unsigned int present, type;
1013 if (!spec->auto_mic)
1015 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1017 if (snd_BUG_ON(!spec->adc_nids))
1020 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1022 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1024 alive = &spec->ext_mic;
1025 dead = &spec->int_mic;
1027 alive = &spec->int_mic;
1028 dead = &spec->ext_mic;
1031 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1032 if (type == AC_WID_AUD_MIX) {
1033 /* Matrix-mixer style (e.g. ALC882) */
1034 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1037 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1039 HDA_AMP_MUTE, HDA_AMP_MUTE);
1041 /* MUX style (e.g. ALC880) */
1042 snd_hda_codec_write_cache(codec, cap_nid, 0,
1043 AC_VERB_SET_CONNECT_SEL,
1047 /* FIXME: analog mixer */
1050 /* unsolicited event for HP jack sensing */
1051 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1053 if (codec->vendor_id == 0x10ec0880)
1058 case ALC880_HP_EVENT:
1059 alc_automute_pin(codec);
1061 case ALC880_MIC_EVENT:
1062 alc_mic_automute(codec);
1067 static void alc_inithook(struct hda_codec *codec)
1069 alc_automute_pin(codec);
1070 alc_mic_automute(codec);
1073 /* additional initialization for ALC888 variants */
1074 static void alc888_coef_init(struct hda_codec *codec)
1078 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1079 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1080 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1081 if ((tmp & 0xf0) == 0x20)
1083 snd_hda_codec_read(codec, 0x20, 0,
1084 AC_VERB_SET_PROC_COEF, 0x830);
1087 snd_hda_codec_read(codec, 0x20, 0,
1088 AC_VERB_SET_PROC_COEF, 0x3030);
1091 static void alc889_coef_init(struct hda_codec *codec)
1095 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1096 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1097 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1098 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1101 /* turn on/off EAPD control (only if available) */
1102 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1104 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1106 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1107 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1111 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1116 case ALC_INIT_GPIO1:
1117 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1119 case ALC_INIT_GPIO2:
1120 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1122 case ALC_INIT_GPIO3:
1123 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1125 case ALC_INIT_DEFAULT:
1126 switch (codec->vendor_id) {
1128 set_eapd(codec, 0x0f, 1);
1129 set_eapd(codec, 0x10, 1);
1142 set_eapd(codec, 0x14, 1);
1143 set_eapd(codec, 0x15, 1);
1146 switch (codec->vendor_id) {
1148 snd_hda_codec_write(codec, 0x1a, 0,
1149 AC_VERB_SET_COEF_INDEX, 7);
1150 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1151 AC_VERB_GET_PROC_COEF, 0);
1152 snd_hda_codec_write(codec, 0x1a, 0,
1153 AC_VERB_SET_COEF_INDEX, 7);
1154 snd_hda_codec_write(codec, 0x1a, 0,
1155 AC_VERB_SET_PROC_COEF,
1165 alc889_coef_init(codec);
1168 alc888_coef_init(codec);
1170 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1173 snd_hda_codec_write(codec, 0x20, 0,
1174 AC_VERB_SET_COEF_INDEX, 7);
1175 tmp = snd_hda_codec_read(codec, 0x20, 0,
1176 AC_VERB_GET_PROC_COEF, 0);
1177 snd_hda_codec_write(codec, 0x20, 0,
1178 AC_VERB_SET_COEF_INDEX, 7);
1179 snd_hda_codec_write(codec, 0x20, 0,
1180 AC_VERB_SET_PROC_COEF,
1189 static void alc_init_auto_hp(struct hda_codec *codec)
1191 struct alc_spec *spec = codec->spec;
1193 if (!spec->autocfg.hp_pins[0])
1196 if (!spec->autocfg.speaker_pins[0]) {
1197 if (spec->autocfg.line_out_pins[0] &&
1198 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1199 spec->autocfg.speaker_pins[0] =
1200 spec->autocfg.line_out_pins[0];
1205 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1206 spec->autocfg.hp_pins[0]);
1207 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1208 AC_VERB_SET_UNSOLICITED_ENABLE,
1209 AC_USRSP_EN | ALC880_HP_EVENT);
1210 spec->unsol_event = alc_sku_unsol_event;
1213 static void alc_init_auto_mic(struct hda_codec *codec)
1215 struct alc_spec *spec = codec->spec;
1216 struct auto_pin_cfg *cfg = &spec->autocfg;
1217 hda_nid_t fixed, ext;
1220 /* there must be only two mic inputs exclusively */
1221 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1222 if (cfg->input_pins[i])
1226 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1227 hda_nid_t nid = cfg->input_pins[i];
1228 unsigned int defcfg;
1231 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1232 switch (get_defcfg_connect(defcfg)) {
1233 case AC_JACK_PORT_FIXED:
1235 return; /* already occupied */
1238 case AC_JACK_PORT_COMPLEX:
1240 return; /* already occupied */
1244 return; /* invalid entry */
1249 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1250 return; /* no unsol support */
1251 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1253 spec->ext_mic.pin = ext;
1254 spec->int_mic.pin = fixed;
1255 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1256 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1258 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1259 AC_VERB_SET_UNSOLICITED_ENABLE,
1260 AC_USRSP_EN | ALC880_MIC_EVENT);
1261 spec->unsol_event = alc_sku_unsol_event;
1264 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1266 unsigned int ass, tmp, i;
1268 struct alc_spec *spec = codec->spec;
1270 ass = codec->subsystem_id & 0xffff;
1271 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1275 if (codec->vendor_id == 0x10ec0260)
1277 ass = snd_hda_codec_get_pincfg(codec, nid);
1280 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1281 codec->chip_name, ass);
1287 for (i = 1; i < 16; i++) {
1291 if (((ass >> 16) & 0xf) != tmp)
1294 spec->cdefine.port_connectivity = ass >> 30;
1295 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1296 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1297 spec->cdefine.customization = ass >> 8;
1299 spec->cdefine.sku_cfg = ass;
1300 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1301 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1302 spec->cdefine.swap = (ass & 0x2) >> 1;
1303 spec->cdefine.override = ass & 0x1;
1305 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1306 nid, spec->cdefine.sku_cfg);
1307 snd_printd("SKU: port_connectivity=0x%x\n",
1308 spec->cdefine.port_connectivity);
1309 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1310 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1311 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1312 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1313 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1314 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1315 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1320 /* check subsystem ID and set up device-specific initialization;
1321 * return 1 if initialized, 0 if invalid SSID
1323 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1324 * 31 ~ 16 : Manufacture ID
1326 * 7 ~ 0 : Assembly ID
1327 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1329 static int alc_subsystem_id(struct hda_codec *codec,
1330 hda_nid_t porta, hda_nid_t porte,
1331 hda_nid_t portd, hda_nid_t porti)
1333 unsigned int ass, tmp, i;
1335 struct alc_spec *spec = codec->spec;
1337 ass = codec->subsystem_id & 0xffff;
1338 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1341 /* invalid SSID, check the special NID pin defcfg instead */
1343 * 31~30 : port connectivity
1346 * 19~16 : Check sum (15:1)
1351 if (codec->vendor_id == 0x10ec0260)
1353 ass = snd_hda_codec_get_pincfg(codec, nid);
1354 snd_printd("realtek: No valid SSID, "
1355 "checking pincfg 0x%08x for NID 0x%x\n",
1359 if ((ass >> 30) != 1) /* no physical connection */
1364 for (i = 1; i < 16; i++) {
1368 if (((ass >> 16) & 0xf) != tmp)
1371 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1372 ass & 0xffff, codec->vendor_id);
1376 * 2 : 0 --> Desktop, 1 --> Laptop
1377 * 3~5 : External Amplifier control
1380 tmp = (ass & 0x38) >> 3; /* external Amp control */
1383 spec->init_amp = ALC_INIT_GPIO1;
1386 spec->init_amp = ALC_INIT_GPIO2;
1389 spec->init_amp = ALC_INIT_GPIO3;
1392 spec->init_amp = ALC_INIT_DEFAULT;
1396 /* is laptop or Desktop and enable the function "Mute internal speaker
1397 * when the external headphone out jack is plugged"
1399 if (!(ass & 0x8000))
1402 * 10~8 : Jack location
1403 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1405 * 15 : 1 --> enable the function "Mute internal speaker
1406 * when the external headphone out jack is plugged"
1408 if (!spec->autocfg.hp_pins[0]) {
1410 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1421 for (i = 0; i < spec->autocfg.line_outs; i++)
1422 if (spec->autocfg.line_out_pins[i] == nid)
1424 spec->autocfg.hp_pins[0] = nid;
1427 alc_init_auto_hp(codec);
1428 alc_init_auto_mic(codec);
1432 static void alc_ssid_check(struct hda_codec *codec,
1433 hda_nid_t porta, hda_nid_t porte,
1434 hda_nid_t portd, hda_nid_t porti)
1436 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1437 struct alc_spec *spec = codec->spec;
1438 snd_printd("realtek: "
1439 "Enable default setup for auto mode as fallback\n");
1440 spec->init_amp = ALC_INIT_DEFAULT;
1441 alc_init_auto_hp(codec);
1442 alc_init_auto_mic(codec);
1447 * Fix-up pin default configurations and add default verbs
1456 const struct alc_pincfg *pins;
1457 const struct hda_verb *verbs;
1460 static void alc_pick_fixup(struct hda_codec *codec,
1461 const struct snd_pci_quirk *quirk,
1462 const struct alc_fixup *fix,
1465 const struct alc_pincfg *cfg;
1467 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1470 fix += quirk->value;
1472 if (pre_init && cfg) {
1473 #ifdef CONFIG_SND_DEBUG_VERBOSE
1474 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1475 codec->chip_name, quirk->name);
1477 for (; cfg->nid; cfg++)
1478 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1480 if (!pre_init && fix->verbs) {
1481 #ifdef CONFIG_SND_DEBUG_VERBOSE
1482 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1483 codec->chip_name, quirk->name);
1485 add_verb(codec->spec, fix->verbs);
1489 static int alc_read_coef_idx(struct hda_codec *codec,
1490 unsigned int coef_idx)
1493 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1495 val = snd_hda_codec_read(codec, 0x20, 0,
1496 AC_VERB_GET_PROC_COEF, 0);
1507 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1508 /* Mic-in jack as mic in */
1509 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1510 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1511 /* Line-in jack as Line in */
1512 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1513 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1514 /* Line-Out as Front */
1515 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1522 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1523 /* Mic-in jack as mic in */
1524 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1525 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1526 /* Line-in jack as Surround */
1527 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1528 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1529 /* Line-Out as Front */
1530 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1537 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1538 /* Mic-in jack as CLFE */
1539 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1540 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1541 /* Line-in jack as Surround */
1542 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1543 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1544 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1545 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1552 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1553 /* Mic-in jack as CLFE */
1554 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1555 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1556 /* Line-in jack as Surround */
1557 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1558 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1559 /* Line-Out as Side */
1560 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1564 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1565 { 2, alc888_4ST_ch2_intel_init },
1566 { 4, alc888_4ST_ch4_intel_init },
1567 { 6, alc888_4ST_ch6_intel_init },
1568 { 8, alc888_4ST_ch8_intel_init },
1572 * ALC888 Fujitsu Siemens Amillo xa3530
1575 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1576 /* Front Mic: set to PIN_IN (empty by default) */
1577 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1578 /* Connect Internal HP to Front */
1579 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1580 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1581 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1582 /* Connect Bass HP to Front */
1583 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1584 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1585 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1586 /* Connect Line-Out side jack (SPDIF) to Side */
1587 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1588 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1589 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1590 /* Connect Mic jack to CLFE */
1591 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1592 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1593 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1594 /* Connect Line-in jack to Surround */
1595 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1596 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1597 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1598 /* Connect HP out jack to Front */
1599 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1600 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1601 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1602 /* Enable unsolicited event for HP jack and Line-out jack */
1603 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1604 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1608 static void alc_automute_amp(struct hda_codec *codec)
1610 struct alc_spec *spec = codec->spec;
1615 spec->jack_present = 0;
1616 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1617 nid = spec->autocfg.hp_pins[i];
1620 if (snd_hda_jack_detect(codec, nid)) {
1621 spec->jack_present = 1;
1626 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1627 /* Toggle internal speakers muting */
1628 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1629 nid = spec->autocfg.speaker_pins[i];
1632 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1633 HDA_AMP_MUTE, mute);
1637 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1640 if (codec->vendor_id == 0x10ec0880)
1644 if (res == ALC880_HP_EVENT)
1645 alc_automute_amp(codec);
1648 static void alc889_automute_setup(struct hda_codec *codec)
1650 struct alc_spec *spec = codec->spec;
1652 spec->autocfg.hp_pins[0] = 0x15;
1653 spec->autocfg.speaker_pins[0] = 0x14;
1654 spec->autocfg.speaker_pins[1] = 0x16;
1655 spec->autocfg.speaker_pins[2] = 0x17;
1656 spec->autocfg.speaker_pins[3] = 0x19;
1657 spec->autocfg.speaker_pins[4] = 0x1a;
1660 static void alc889_intel_init_hook(struct hda_codec *codec)
1662 alc889_coef_init(codec);
1663 alc_automute_amp(codec);
1666 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1668 struct alc_spec *spec = codec->spec;
1670 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1671 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1672 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1673 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1677 * ALC888 Acer Aspire 4930G model
1680 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1681 /* Front Mic: set to PIN_IN (empty by default) */
1682 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1683 /* Unselect Front Mic by default in input mixer 3 */
1684 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1685 /* Enable unsolicited event for HP jack */
1686 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1687 /* Connect Internal HP to front */
1688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1689 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1690 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1691 /* Connect HP out to front */
1692 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1693 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1694 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1699 * ALC888 Acer Aspire 6530G model
1702 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1703 /* Route to built-in subwoofer as well as speakers */
1704 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1705 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1706 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1707 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1708 /* Bias voltage on for external mic port */
1709 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1710 /* Front Mic: set to PIN_IN (empty by default) */
1711 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1712 /* Unselect Front Mic by default in input mixer 3 */
1713 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1714 /* Enable unsolicited event for HP jack */
1715 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1716 /* Enable speaker output */
1717 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1718 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1719 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1720 /* Enable headphone output */
1721 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1722 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1723 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1724 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1729 * ALC889 Acer Aspire 8930G model
1732 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1733 /* Front Mic: set to PIN_IN (empty by default) */
1734 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1735 /* Unselect Front Mic by default in input mixer 3 */
1736 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1737 /* Enable unsolicited event for HP jack */
1738 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1739 /* Connect Internal Front to Front */
1740 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1741 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1742 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1743 /* Connect Internal Rear to Rear */
1744 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1745 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1746 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1747 /* Connect Internal CLFE to CLFE */
1748 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1749 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1750 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1751 /* Connect HP out to Front */
1752 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1753 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1754 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1755 /* Enable all DACs */
1756 /* DAC DISABLE/MUTE 1? */
1757 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1758 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1759 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1760 /* DAC DISABLE/MUTE 2? */
1761 /* some bit here disables the other DACs. Init=0x4900 */
1762 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1763 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1765 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1766 * which makes the stereo useless. However, either the mic or the ALC889
1767 * makes the signal become a difference/sum signal instead of standard
1768 * stereo, which is annoying. So instead we flip this bit which makes the
1769 * codec replicate the sum signal to both channels, turning it into a
1772 /* DMIC_CONTROL? Init value = 0x0001 */
1773 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1774 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1778 static struct hda_input_mux alc888_2_capture_sources[2] = {
1779 /* Front mic only available on one ADC */
1786 { "Front Mic", 0xb },
1799 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1800 /* Interal mic only available on one ADC */
1807 { "Input Mix", 0xa },
1817 { "Input Mix", 0xa },
1822 static struct hda_input_mux alc889_capture_sources[3] = {
1823 /* Digital mic only available on first "ADC" */
1830 { "Front Mic", 0xb },
1831 { "Input Mix", 0xa },
1840 { "Input Mix", 0xa },
1849 { "Input Mix", 0xa },
1854 static struct snd_kcontrol_new alc888_base_mixer[] = {
1855 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1856 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1857 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1858 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1859 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1861 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1862 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1863 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1864 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1865 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1866 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1867 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1868 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1869 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1870 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1871 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1872 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1876 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1877 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1878 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1879 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1880 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1881 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1883 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1884 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1885 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1886 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1887 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1888 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1889 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1890 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1895 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1897 struct alc_spec *spec = codec->spec;
1899 spec->autocfg.hp_pins[0] = 0x15;
1900 spec->autocfg.speaker_pins[0] = 0x14;
1901 spec->autocfg.speaker_pins[1] = 0x16;
1902 spec->autocfg.speaker_pins[2] = 0x17;
1905 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1907 struct alc_spec *spec = codec->spec;
1909 spec->autocfg.hp_pins[0] = 0x15;
1910 spec->autocfg.speaker_pins[0] = 0x14;
1911 spec->autocfg.speaker_pins[1] = 0x16;
1912 spec->autocfg.speaker_pins[2] = 0x17;
1915 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1917 struct alc_spec *spec = codec->spec;
1919 spec->autocfg.hp_pins[0] = 0x15;
1920 spec->autocfg.speaker_pins[0] = 0x14;
1921 spec->autocfg.speaker_pins[1] = 0x16;
1922 spec->autocfg.speaker_pins[2] = 0x1b;
1926 * ALC880 3-stack model
1928 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1929 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1930 * F-Mic = 0x1b, HP = 0x19
1933 static hda_nid_t alc880_dac_nids[4] = {
1934 /* front, rear, clfe, rear_surr */
1935 0x02, 0x05, 0x04, 0x03
1938 static hda_nid_t alc880_adc_nids[3] = {
1943 /* The datasheet says the node 0x07 is connected from inputs,
1944 * but it shows zero connection in the real implementation on some devices.
1945 * Note: this is a 915GAV bug, fixed on 915GLV
1947 static hda_nid_t alc880_adc_nids_alt[2] = {
1952 #define ALC880_DIGOUT_NID 0x06
1953 #define ALC880_DIGIN_NID 0x0a
1955 static struct hda_input_mux alc880_capture_source = {
1959 { "Front Mic", 0x3 },
1965 /* channel source setting (2/6 channel selection for 3-stack) */
1967 static struct hda_verb alc880_threestack_ch2_init[] = {
1968 /* set line-in to input, mute it */
1969 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1970 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1971 /* set mic-in to input vref 80%, mute it */
1972 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1973 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1978 static struct hda_verb alc880_threestack_ch6_init[] = {
1979 /* set line-in to output, unmute it */
1980 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1981 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1982 /* set mic-in to output, unmute it */
1983 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1984 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1988 static struct hda_channel_mode alc880_threestack_modes[2] = {
1989 { 2, alc880_threestack_ch2_init },
1990 { 6, alc880_threestack_ch6_init },
1993 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1994 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1995 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1996 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1997 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1998 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1999 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2000 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2001 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2002 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2003 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2004 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2005 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2006 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2007 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2008 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2009 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2010 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2012 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2013 .name = "Channel Mode",
2014 .info = alc_ch_mode_info,
2015 .get = alc_ch_mode_get,
2016 .put = alc_ch_mode_put,
2021 /* capture mixer elements */
2022 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2023 struct snd_ctl_elem_info *uinfo)
2025 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2026 struct alc_spec *spec = codec->spec;
2029 mutex_lock(&codec->control_mutex);
2030 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2032 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2033 mutex_unlock(&codec->control_mutex);
2037 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2038 unsigned int size, unsigned int __user *tlv)
2040 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2041 struct alc_spec *spec = codec->spec;
2044 mutex_lock(&codec->control_mutex);
2045 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2047 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2048 mutex_unlock(&codec->control_mutex);
2052 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2053 struct snd_ctl_elem_value *ucontrol);
2055 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2056 struct snd_ctl_elem_value *ucontrol,
2059 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2060 struct alc_spec *spec = codec->spec;
2061 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2064 mutex_lock(&codec->control_mutex);
2065 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2067 err = func(kcontrol, ucontrol);
2068 mutex_unlock(&codec->control_mutex);
2072 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2073 struct snd_ctl_elem_value *ucontrol)
2075 return alc_cap_getput_caller(kcontrol, ucontrol,
2076 snd_hda_mixer_amp_volume_get);
2079 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2080 struct snd_ctl_elem_value *ucontrol)
2082 return alc_cap_getput_caller(kcontrol, ucontrol,
2083 snd_hda_mixer_amp_volume_put);
2086 /* capture mixer elements */
2087 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2089 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2090 struct snd_ctl_elem_value *ucontrol)
2092 return alc_cap_getput_caller(kcontrol, ucontrol,
2093 snd_hda_mixer_amp_switch_get);
2096 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2097 struct snd_ctl_elem_value *ucontrol)
2099 return alc_cap_getput_caller(kcontrol, ucontrol,
2100 snd_hda_mixer_amp_switch_put);
2103 #define _DEFINE_CAPMIX(num) \
2105 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2106 .name = "Capture Switch", \
2107 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2109 .info = alc_cap_sw_info, \
2110 .get = alc_cap_sw_get, \
2111 .put = alc_cap_sw_put, \
2114 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2115 .name = "Capture Volume", \
2116 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2117 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2118 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2120 .info = alc_cap_vol_info, \
2121 .get = alc_cap_vol_get, \
2122 .put = alc_cap_vol_put, \
2123 .tlv = { .c = alc_cap_vol_tlv }, \
2126 #define _DEFINE_CAPSRC(num) \
2128 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2129 /* .name = "Capture Source", */ \
2130 .name = "Input Source", \
2132 .info = alc_mux_enum_info, \
2133 .get = alc_mux_enum_get, \
2134 .put = alc_mux_enum_put, \
2137 #define DEFINE_CAPMIX(num) \
2138 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2139 _DEFINE_CAPMIX(num), \
2140 _DEFINE_CAPSRC(num), \
2144 #define DEFINE_CAPMIX_NOSRC(num) \
2145 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2146 _DEFINE_CAPMIX(num), \
2150 /* up to three ADCs */
2154 DEFINE_CAPMIX_NOSRC(1);
2155 DEFINE_CAPMIX_NOSRC(2);
2156 DEFINE_CAPMIX_NOSRC(3);
2159 * ALC880 5-stack model
2161 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2163 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2164 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2167 /* additional mixers to alc880_three_stack_mixer */
2168 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2169 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2170 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2174 /* channel source setting (6/8 channel selection for 5-stack) */
2176 static struct hda_verb alc880_fivestack_ch6_init[] = {
2177 /* set line-in to input, mute it */
2178 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2179 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2184 static struct hda_verb alc880_fivestack_ch8_init[] = {
2185 /* set line-in to output, unmute it */
2186 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2187 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2191 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2192 { 6, alc880_fivestack_ch6_init },
2193 { 8, alc880_fivestack_ch8_init },
2198 * ALC880 6-stack model
2200 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2201 * Side = 0x05 (0x0f)
2202 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2203 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2206 static hda_nid_t alc880_6st_dac_nids[4] = {
2207 /* front, rear, clfe, rear_surr */
2208 0x02, 0x03, 0x04, 0x05
2211 static struct hda_input_mux alc880_6stack_capture_source = {
2215 { "Front Mic", 0x1 },
2221 /* fixed 8-channels */
2222 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2226 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2227 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2228 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2229 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2230 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2231 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2232 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2233 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2234 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2235 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2236 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2237 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2238 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2239 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2240 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2241 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2242 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2243 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2244 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2246 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2247 .name = "Channel Mode",
2248 .info = alc_ch_mode_info,
2249 .get = alc_ch_mode_get,
2250 .put = alc_ch_mode_put,
2259 * W810 has rear IO for:
2262 * Center/LFE (DAC 04)
2265 * The system also has a pair of internal speakers, and a headphone jack.
2266 * These are both connected to Line2 on the codec, hence to DAC 02.
2268 * There is a variable resistor to control the speaker or headphone
2269 * volume. This is a hardware-only device without a software API.
2271 * Plugging headphones in will disable the internal speakers. This is
2272 * implemented in hardware, not via the driver using jack sense. In
2273 * a similar fashion, plugging into the rear socket marked "front" will
2274 * disable both the speakers and headphones.
2276 * For input, there's a microphone jack, and an "audio in" jack.
2277 * These may not do anything useful with this driver yet, because I
2278 * haven't setup any initialization verbs for these yet...
2281 static hda_nid_t alc880_w810_dac_nids[3] = {
2282 /* front, rear/surround, clfe */
2286 /* fixed 6 channels */
2287 static struct hda_channel_mode alc880_w810_modes[1] = {
2291 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2292 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2293 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2294 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2295 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2296 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2297 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2298 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2299 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2300 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2301 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2309 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2310 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2314 static hda_nid_t alc880_z71v_dac_nids[1] = {
2317 #define ALC880_Z71V_HP_DAC 0x03
2319 /* fixed 2 channels */
2320 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2324 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2325 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2326 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2327 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2328 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2329 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2330 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2332 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2338 * ALC880 F1734 model
2340 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2341 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2344 static hda_nid_t alc880_f1734_dac_nids[1] = {
2347 #define ALC880_F1734_HP_DAC 0x02
2349 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2350 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2351 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2352 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2353 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2354 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2355 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2356 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2357 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2361 static struct hda_input_mux alc880_f1734_capture_source = {
2373 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2374 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2375 * Mic = 0x18, Line = 0x1a
2378 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2379 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2381 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2382 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2383 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2384 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2385 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2386 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2387 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2388 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2389 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2390 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2391 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2392 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2393 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2394 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2395 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2397 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2398 .name = "Channel Mode",
2399 .info = alc_ch_mode_info,
2400 .get = alc_ch_mode_get,
2401 .put = alc_ch_mode_put,
2407 * ALC880 ASUS W1V model
2409 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2410 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2411 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2414 /* additional mixers to alc880_asus_mixer */
2415 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2416 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2417 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2422 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2423 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2424 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2425 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2426 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2427 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2429 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2430 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2431 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2436 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2437 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2438 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2439 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2440 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2441 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2442 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2443 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2444 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2445 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2446 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2447 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2448 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2449 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2450 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2451 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2452 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2454 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2455 .name = "Channel Mode",
2456 .info = alc_ch_mode_info,
2457 .get = alc_ch_mode_get,
2458 .put = alc_ch_mode_put,
2463 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2464 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2465 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2466 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2467 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2468 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2469 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2470 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2471 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2472 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2473 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2477 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2478 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2479 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2480 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2481 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2482 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2483 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2488 * virtual master controls
2492 * slave controls for virtual master
2494 static const char *alc_slave_vols[] = {
2495 "Front Playback Volume",
2496 "Surround Playback Volume",
2497 "Center Playback Volume",
2498 "LFE Playback Volume",
2499 "Side Playback Volume",
2500 "Headphone Playback Volume",
2501 "Speaker Playback Volume",
2502 "Mono Playback Volume",
2503 "Line-Out Playback Volume",
2504 "PCM Playback Volume",
2508 static const char *alc_slave_sws[] = {
2509 "Front Playback Switch",
2510 "Surround Playback Switch",
2511 "Center Playback Switch",
2512 "LFE Playback Switch",
2513 "Side Playback Switch",
2514 "Headphone Playback Switch",
2515 "Speaker Playback Switch",
2516 "Mono Playback Switch",
2517 "IEC958 Playback Switch",
2518 "Line-Out Playback Switch",
2519 "PCM Playback Switch",
2524 * build control elements
2527 #define NID_MAPPING (-1)
2529 #define SUBDEV_SPEAKER_ (0 << 6)
2530 #define SUBDEV_HP_ (1 << 6)
2531 #define SUBDEV_LINE_ (2 << 6)
2532 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2533 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2534 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2536 static void alc_free_kctls(struct hda_codec *codec);
2538 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2539 /* additional beep mixers; the actual parameters are overwritten at build */
2540 static struct snd_kcontrol_new alc_beep_mixer[] = {
2541 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2542 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2547 static int alc_build_controls(struct hda_codec *codec)
2549 struct alc_spec *spec = codec->spec;
2550 struct snd_kcontrol *kctl;
2551 struct snd_kcontrol_new *knew;
2556 for (i = 0; i < spec->num_mixers; i++) {
2557 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2561 if (spec->cap_mixer) {
2562 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2566 if (spec->multiout.dig_out_nid) {
2567 err = snd_hda_create_spdif_out_ctls(codec,
2568 spec->multiout.dig_out_nid);
2571 if (!spec->no_analog) {
2572 err = snd_hda_create_spdif_share_sw(codec,
2576 spec->multiout.share_spdif = 1;
2579 if (spec->dig_in_nid) {
2580 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2585 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2586 /* create beep controls if needed */
2587 if (spec->beep_amp) {
2588 struct snd_kcontrol_new *knew;
2589 for (knew = alc_beep_mixer; knew->name; knew++) {
2590 struct snd_kcontrol *kctl;
2591 kctl = snd_ctl_new1(knew, codec);
2594 kctl->private_value = spec->beep_amp;
2595 err = snd_hda_ctl_add(codec, 0, kctl);
2602 /* if we have no master control, let's create it */
2603 if (!spec->no_analog &&
2604 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2605 unsigned int vmaster_tlv[4];
2606 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2607 HDA_OUTPUT, vmaster_tlv);
2608 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2609 vmaster_tlv, alc_slave_vols);
2613 if (!spec->no_analog &&
2614 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2615 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2616 NULL, alc_slave_sws);
2621 /* assign Capture Source enums to NID */
2622 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2624 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2625 for (i = 0; kctl && i < kctl->count; i++) {
2626 hda_nid_t *nids = spec->capsrc_nids;
2628 nids = spec->adc_nids;
2629 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2633 if (spec->cap_mixer) {
2634 const char *kname = kctl ? kctl->id.name : NULL;
2635 for (knew = spec->cap_mixer; knew->name; knew++) {
2636 if (kname && strcmp(knew->name, kname) == 0)
2638 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2639 for (i = 0; kctl && i < kctl->count; i++) {
2640 err = snd_hda_add_nid(codec, kctl, i,
2648 /* other nid->control mapping */
2649 for (i = 0; i < spec->num_mixers; i++) {
2650 for (knew = spec->mixers[i]; knew->name; knew++) {
2651 if (knew->iface != NID_MAPPING)
2653 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2656 u = knew->subdevice;
2657 for (j = 0; j < 4; j++, u >>= 8) {
2662 case SUBDEV_SPEAKER_:
2663 nid = spec->autocfg.speaker_pins[nid];
2666 nid = spec->autocfg.line_out_pins[nid];
2669 nid = spec->autocfg.hp_pins[nid];
2674 err = snd_hda_add_nid(codec, kctl, 0, nid);
2678 u = knew->private_value;
2679 for (j = 0; j < 4; j++, u >>= 8) {
2683 err = snd_hda_add_nid(codec, kctl, 0, nid);
2690 alc_free_kctls(codec); /* no longer needed */
2697 * initialize the codec volumes, etc
2701 * generic initialization of ADC, input mixers and output mixers
2703 static struct hda_verb alc880_volume_init_verbs[] = {
2705 * Unmute ADC0-2 and set the default input to mic-in
2707 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2708 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2709 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2710 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2711 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2712 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2714 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2716 * Note: PASD motherboards uses the Line In 2 as the input for front
2719 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2720 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2721 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2722 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2729 * Set up output mixers (0x0c - 0x0f)
2731 /* set vol=0 to output mixers */
2732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2733 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2734 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2735 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2736 /* set up input amps for analog loopback */
2737 /* Amp Indices: DAC = 0, mixer = 1 */
2738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2739 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2740 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2741 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2742 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2743 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2744 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2745 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2751 * 3-stack pin configuration:
2752 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2754 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2756 * preset connection lists of input pins
2757 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2759 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2760 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2761 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2764 * Set pin mode and muting
2766 /* set front pin widgets 0x14 for output */
2767 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2768 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2769 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2770 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2771 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2772 /* Mic2 (as headphone out) for HP output */
2773 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2774 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2775 /* Line In pin widget for input */
2776 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2777 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2778 /* Line2 (as front mic) pin widget for input and vref at 80% */
2779 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2780 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2781 /* CD pin widget for input */
2782 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2788 * 5-stack pin configuration:
2789 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2790 * line-in/side = 0x1a, f-mic = 0x1b
2792 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2794 * preset connection lists of input pins
2795 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2797 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2798 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2801 * Set pin mode and muting
2803 /* set pin widgets 0x14-0x17 for output */
2804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2805 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2806 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2807 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2808 /* unmute pins for output (no gain on this amp) */
2809 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2810 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2811 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2812 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2814 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2815 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2816 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2817 /* Mic2 (as headphone out) for HP output */
2818 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2819 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2820 /* Line In pin widget for input */
2821 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2822 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2823 /* Line2 (as front mic) pin widget for input and vref at 80% */
2824 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2825 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2826 /* CD pin widget for input */
2827 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2833 * W810 pin configuration:
2834 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2836 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2837 /* hphone/speaker input selector: front DAC */
2838 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2841 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2842 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2843 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2844 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2845 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2847 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2848 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2854 * Z71V pin configuration:
2855 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2857 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2858 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2859 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2860 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2861 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2863 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2864 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2865 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2866 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2872 * 6-stack pin configuration:
2873 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2874 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2876 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2877 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2879 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2880 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2881 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2882 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2883 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2884 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2885 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2886 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2888 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2889 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2890 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2891 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2892 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2893 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2894 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2895 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2896 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2902 * Uniwill pin configuration:
2903 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2906 static struct hda_verb alc880_uniwill_init_verbs[] = {
2907 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2909 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2910 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2911 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2912 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2913 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2914 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2915 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2916 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2917 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2918 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2919 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2920 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2921 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2922 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2924 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2925 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2926 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2927 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2928 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2929 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2930 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2931 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2932 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2934 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2935 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2942 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2944 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2945 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2947 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2948 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2949 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2950 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2951 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2952 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2953 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2954 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2955 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2956 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2957 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2958 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2960 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2961 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2962 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2963 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2964 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2965 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
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},
2973 static struct hda_verb alc880_beep_init_verbs[] = {
2974 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2978 /* auto-toggle front mic */
2979 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2981 unsigned int present;
2984 present = snd_hda_jack_detect(codec, 0x18);
2985 bits = present ? HDA_AMP_MUTE : 0;
2986 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2989 static void alc880_uniwill_setup(struct hda_codec *codec)
2991 struct alc_spec *spec = codec->spec;
2993 spec->autocfg.hp_pins[0] = 0x14;
2994 spec->autocfg.speaker_pins[0] = 0x15;
2995 spec->autocfg.speaker_pins[0] = 0x16;
2998 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3000 alc_automute_amp(codec);
3001 alc880_uniwill_mic_automute(codec);
3004 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3007 /* Looks like the unsol event is incompatible with the standard
3008 * definition. 4bit tag is placed at 28 bit!
3010 switch (res >> 28) {
3011 case ALC880_MIC_EVENT:
3012 alc880_uniwill_mic_automute(codec);
3015 alc_automute_amp_unsol_event(codec, res);
3020 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3022 struct alc_spec *spec = codec->spec;
3024 spec->autocfg.hp_pins[0] = 0x14;
3025 spec->autocfg.speaker_pins[0] = 0x15;
3028 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3030 unsigned int present;
3032 present = snd_hda_codec_read(codec, 0x21, 0,
3033 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3034 present &= HDA_AMP_VOLMASK;
3035 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3036 HDA_AMP_VOLMASK, present);
3037 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3038 HDA_AMP_VOLMASK, present);
3041 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3044 /* Looks like the unsol event is incompatible with the standard
3045 * definition. 4bit tag is placed at 28 bit!
3047 if ((res >> 28) == ALC880_DCVOL_EVENT)
3048 alc880_uniwill_p53_dcvol_automute(codec);
3050 alc_automute_amp_unsol_event(codec, res);
3054 * F1734 pin configuration:
3055 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3057 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3058 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3059 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3060 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3061 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3062 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3064 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3065 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3066 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3069 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3070 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3071 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3072 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3073 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3074 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3075 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3076 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3077 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3079 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3080 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3086 * ASUS pin configuration:
3087 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3089 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3090 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3091 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3092 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3093 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3095 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3096 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3097 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3098 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3099 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3100 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3101 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3102 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3104 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3105 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3106 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3107 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3108 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3109 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3110 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3111 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3112 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3117 /* Enable GPIO mask and set output */
3118 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3119 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3120 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3122 /* Clevo m520g init */
3123 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3124 /* headphone output */
3125 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3127 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3128 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3130 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3131 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3133 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3134 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3135 /* Mic1 (rear panel) */
3136 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3137 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3138 /* Mic2 (front panel) */
3139 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3140 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3142 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3143 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3144 /* change to EAPD mode */
3145 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3146 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3151 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3152 /* change to EAPD mode */
3153 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3154 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3156 /* Headphone output */
3157 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3159 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3160 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3162 /* Line In pin widget for input */
3163 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3164 /* CD pin widget for input */
3165 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3166 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3167 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3169 /* change to EAPD mode */
3170 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3171 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3177 * LG m1 express dual
3180 * Rear Line-In/Out (blue): 0x14
3181 * Build-in Mic-In: 0x15
3183 * HP-Out (green): 0x1b
3184 * Mic-In/Out (red): 0x19
3188 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3189 static hda_nid_t alc880_lg_dac_nids[3] = {
3193 /* seems analog CD is not working */
3194 static struct hda_input_mux alc880_lg_capture_source = {
3199 { "Internal Mic", 0x6 },
3203 /* 2,4,6 channel modes */
3204 static struct hda_verb alc880_lg_ch2_init[] = {
3205 /* set line-in and mic-in to input */
3206 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3207 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3211 static struct hda_verb alc880_lg_ch4_init[] = {
3212 /* set line-in to out and mic-in to input */
3213 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3214 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3218 static struct hda_verb alc880_lg_ch6_init[] = {
3219 /* set line-in and mic-in to output */
3220 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3221 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3225 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3226 { 2, alc880_lg_ch2_init },
3227 { 4, alc880_lg_ch4_init },
3228 { 6, alc880_lg_ch6_init },
3231 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3232 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3233 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3234 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3235 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3236 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3237 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3238 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3239 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3240 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3241 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3242 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3243 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3244 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3245 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3247 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3248 .name = "Channel Mode",
3249 .info = alc_ch_mode_info,
3250 .get = alc_ch_mode_get,
3251 .put = alc_ch_mode_put,
3256 static struct hda_verb alc880_lg_init_verbs[] = {
3257 /* set capture source to mic-in */
3258 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3259 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3260 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3261 /* mute all amp mixer inputs */
3262 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3263 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3264 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3265 /* line-in to input */
3266 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3267 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3269 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3270 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3272 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3273 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3274 /* mic-in to input */
3275 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3276 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3277 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3279 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3280 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3281 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3283 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3287 /* toggle speaker-output according to the hp-jack state */
3288 static void alc880_lg_setup(struct hda_codec *codec)
3290 struct alc_spec *spec = codec->spec;
3292 spec->autocfg.hp_pins[0] = 0x1b;
3293 spec->autocfg.speaker_pins[0] = 0x17;
3302 * Built-in Mic-In: 0x19
3308 static struct hda_input_mux alc880_lg_lw_capture_source = {
3312 { "Internal Mic", 0x1 },
3317 #define alc880_lg_lw_modes alc880_threestack_modes
3319 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3320 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3321 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3322 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3323 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3324 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3325 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3326 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3327 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3328 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3329 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3330 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3331 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3332 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3333 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3335 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3336 .name = "Channel Mode",
3337 .info = alc_ch_mode_info,
3338 .get = alc_ch_mode_get,
3339 .put = alc_ch_mode_put,
3344 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3345 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3346 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3347 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3349 /* set capture source to mic-in */
3350 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3351 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3352 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3353 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3355 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3356 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3358 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3359 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3360 /* mic-in to input */
3361 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3362 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3364 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3365 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3367 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3371 /* toggle speaker-output according to the hp-jack state */
3372 static void alc880_lg_lw_setup(struct hda_codec *codec)
3374 struct alc_spec *spec = codec->spec;
3376 spec->autocfg.hp_pins[0] = 0x1b;
3377 spec->autocfg.speaker_pins[0] = 0x14;
3380 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3381 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3382 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3383 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3384 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3385 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3386 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3390 static struct hda_input_mux alc880_medion_rim_capture_source = {
3394 { "Internal Mic", 0x1 },
3398 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3399 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3401 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3402 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3404 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3405 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3406 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3407 /* Mic2 (as headphone out) for HP output */
3408 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3409 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3410 /* Internal Speaker */
3411 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3412 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3414 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3415 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3417 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3421 /* toggle speaker-output according to the hp-jack state */
3422 static void alc880_medion_rim_automute(struct hda_codec *codec)
3424 struct alc_spec *spec = codec->spec;
3425 alc_automute_amp(codec);
3427 if (spec->jack_present)
3428 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3430 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3433 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3436 /* Looks like the unsol event is incompatible with the standard
3437 * definition. 4bit tag is placed at 28 bit!
3439 if ((res >> 28) == ALC880_HP_EVENT)
3440 alc880_medion_rim_automute(codec);
3443 static void alc880_medion_rim_setup(struct hda_codec *codec)
3445 struct alc_spec *spec = codec->spec;
3447 spec->autocfg.hp_pins[0] = 0x14;
3448 spec->autocfg.speaker_pins[0] = 0x1b;
3451 #ifdef CONFIG_SND_HDA_POWER_SAVE
3452 static struct hda_amp_list alc880_loopbacks[] = {
3453 { 0x0b, HDA_INPUT, 0 },
3454 { 0x0b, HDA_INPUT, 1 },
3455 { 0x0b, HDA_INPUT, 2 },
3456 { 0x0b, HDA_INPUT, 3 },
3457 { 0x0b, HDA_INPUT, 4 },
3461 static struct hda_amp_list alc880_lg_loopbacks[] = {
3462 { 0x0b, HDA_INPUT, 1 },
3463 { 0x0b, HDA_INPUT, 6 },
3464 { 0x0b, HDA_INPUT, 7 },
3473 static int alc_init(struct hda_codec *codec)
3475 struct alc_spec *spec = codec->spec;
3479 alc_auto_init_amp(codec, spec->init_amp);
3481 for (i = 0; i < spec->num_init_verbs; i++)
3482 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3484 if (spec->init_hook)
3485 spec->init_hook(codec);
3487 #ifdef CONFIG_SND_HDA_POWER_SAVE
3488 if (codec->patch_ops.check_power_status)
3489 codec->patch_ops.check_power_status(codec, 0x01);
3494 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3496 struct alc_spec *spec = codec->spec;
3498 if (spec->unsol_event)
3499 spec->unsol_event(codec, res);
3502 #ifdef CONFIG_SND_HDA_POWER_SAVE
3503 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3505 struct alc_spec *spec = codec->spec;
3506 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3511 * Analog playback callbacks
3513 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3514 struct hda_codec *codec,
3515 struct snd_pcm_substream *substream)
3517 struct alc_spec *spec = codec->spec;
3518 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3522 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3523 struct hda_codec *codec,
3524 unsigned int stream_tag,
3525 unsigned int format,
3526 struct snd_pcm_substream *substream)
3528 struct alc_spec *spec = codec->spec;
3529 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3530 stream_tag, format, substream);
3533 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3534 struct hda_codec *codec,
3535 struct snd_pcm_substream *substream)
3537 struct alc_spec *spec = codec->spec;
3538 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3544 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3545 struct hda_codec *codec,
3546 struct snd_pcm_substream *substream)
3548 struct alc_spec *spec = codec->spec;
3549 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3552 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3553 struct hda_codec *codec,
3554 unsigned int stream_tag,
3555 unsigned int format,
3556 struct snd_pcm_substream *substream)
3558 struct alc_spec *spec = codec->spec;
3559 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3560 stream_tag, format, substream);
3563 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3564 struct hda_codec *codec,
3565 struct snd_pcm_substream *substream)
3567 struct alc_spec *spec = codec->spec;
3568 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3571 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3572 struct hda_codec *codec,
3573 struct snd_pcm_substream *substream)
3575 struct alc_spec *spec = codec->spec;
3576 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3582 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3583 struct hda_codec *codec,
3584 unsigned int stream_tag,
3585 unsigned int format,
3586 struct snd_pcm_substream *substream)
3588 struct alc_spec *spec = codec->spec;
3590 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3591 stream_tag, 0, format);
3595 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3596 struct hda_codec *codec,
3597 struct snd_pcm_substream *substream)
3599 struct alc_spec *spec = codec->spec;
3601 snd_hda_codec_cleanup_stream(codec,
3602 spec->adc_nids[substream->number + 1]);
3609 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3613 /* NID is set in alc_build_pcms */
3615 .open = alc880_playback_pcm_open,
3616 .prepare = alc880_playback_pcm_prepare,
3617 .cleanup = alc880_playback_pcm_cleanup
3621 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3625 /* NID is set in alc_build_pcms */
3628 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3632 /* NID is set in alc_build_pcms */
3635 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3636 .substreams = 2, /* can be overridden */
3639 /* NID is set in alc_build_pcms */
3641 .prepare = alc880_alt_capture_pcm_prepare,
3642 .cleanup = alc880_alt_capture_pcm_cleanup
3646 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3650 /* NID is set in alc_build_pcms */
3652 .open = alc880_dig_playback_pcm_open,
3653 .close = alc880_dig_playback_pcm_close,
3654 .prepare = alc880_dig_playback_pcm_prepare,
3655 .cleanup = alc880_dig_playback_pcm_cleanup
3659 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3663 /* NID is set in alc_build_pcms */
3666 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3667 static struct hda_pcm_stream alc_pcm_null_stream = {
3673 static int alc_build_pcms(struct hda_codec *codec)
3675 struct alc_spec *spec = codec->spec;
3676 struct hda_pcm *info = spec->pcm_rec;
3679 codec->num_pcms = 1;
3680 codec->pcm_info = info;
3682 if (spec->no_analog)
3685 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3686 "%s Analog", codec->chip_name);
3687 info->name = spec->stream_name_analog;
3689 if (spec->stream_analog_playback) {
3690 if (snd_BUG_ON(!spec->multiout.dac_nids))
3692 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3693 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3695 if (spec->stream_analog_capture) {
3696 if (snd_BUG_ON(!spec->adc_nids))
3698 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3699 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3702 if (spec->channel_mode) {
3703 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3704 for (i = 0; i < spec->num_channel_mode; i++) {
3705 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3706 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3712 /* SPDIF for stream index #1 */
3713 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3714 snprintf(spec->stream_name_digital,
3715 sizeof(spec->stream_name_digital),
3716 "%s Digital", codec->chip_name);
3717 codec->num_pcms = 2;
3718 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3719 info = spec->pcm_rec + 1;
3720 info->name = spec->stream_name_digital;
3721 if (spec->dig_out_type)
3722 info->pcm_type = spec->dig_out_type;
3724 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3725 if (spec->multiout.dig_out_nid &&
3726 spec->stream_digital_playback) {
3727 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3728 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3730 if (spec->dig_in_nid &&
3731 spec->stream_digital_capture) {
3732 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3733 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3735 /* FIXME: do we need this for all Realtek codec models? */
3736 codec->spdif_status_reset = 1;
3739 if (spec->no_analog)
3742 /* If the use of more than one ADC is requested for the current
3743 * model, configure a second analog capture-only PCM.
3745 /* Additional Analaog capture for index #2 */
3746 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3747 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3748 codec->num_pcms = 3;
3749 info = spec->pcm_rec + 2;
3750 info->name = spec->stream_name_analog;
3751 if (spec->alt_dac_nid) {
3752 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3753 *spec->stream_analog_alt_playback;
3754 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3757 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3758 alc_pcm_null_stream;
3759 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3761 if (spec->num_adc_nids > 1) {
3762 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3763 *spec->stream_analog_alt_capture;
3764 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3766 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3767 spec->num_adc_nids - 1;
3769 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3770 alc_pcm_null_stream;
3771 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3778 static inline void alc_shutup(struct hda_codec *codec)
3780 snd_hda_shutup_pins(codec);
3783 static void alc_free_kctls(struct hda_codec *codec)
3785 struct alc_spec *spec = codec->spec;
3787 if (spec->kctls.list) {
3788 struct snd_kcontrol_new *kctl = spec->kctls.list;
3790 for (i = 0; i < spec->kctls.used; i++)
3791 kfree(kctl[i].name);
3793 snd_array_free(&spec->kctls);
3796 static void alc_free(struct hda_codec *codec)
3798 struct alc_spec *spec = codec->spec;
3804 alc_free_kctls(codec);
3806 snd_hda_detach_beep_device(codec);
3809 #ifdef CONFIG_SND_HDA_POWER_SAVE
3810 static void alc_power_eapd(struct hda_codec *codec)
3812 /* We currently only handle front, HP */
3813 switch (codec->vendor_id) {
3815 set_eapd(codec, 0x0f, 0);
3816 set_eapd(codec, 0x10, 0);
3829 set_eapd(codec, 0x14, 0);
3830 set_eapd(codec, 0x15, 0);
3835 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3837 struct alc_spec *spec = codec->spec;
3839 if (spec && spec->power_hook)
3840 spec->power_hook(codec);
3845 #ifdef SND_HDA_NEEDS_RESUME
3846 static int alc_resume(struct hda_codec *codec)
3848 codec->patch_ops.init(codec);
3849 snd_hda_codec_resume_amp(codec);
3850 snd_hda_codec_resume_cache(codec);
3851 #ifdef CONFIG_SND_HDA_POWER_SAVE
3852 if (codec->patch_ops.check_power_status)
3853 codec->patch_ops.check_power_status(codec, 0x01);
3861 static struct hda_codec_ops alc_patch_ops = {
3862 .build_controls = alc_build_controls,
3863 .build_pcms = alc_build_pcms,
3866 .unsol_event = alc_unsol_event,
3867 #ifdef SND_HDA_NEEDS_RESUME
3868 .resume = alc_resume,
3870 #ifdef CONFIG_SND_HDA_POWER_SAVE
3871 .suspend = alc_suspend,
3872 .check_power_status = alc_check_power_status,
3874 .reboot_notify = alc_shutup,
3877 /* replace the codec chip_name with the given string */
3878 static int alc_codec_rename(struct hda_codec *codec, const char *name)
3880 kfree(codec->chip_name);
3881 codec->chip_name = kstrdup(name, GFP_KERNEL);
3882 if (!codec->chip_name) {
3890 * Test configuration for debugging
3892 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3895 #ifdef CONFIG_SND_DEBUG
3896 static hda_nid_t alc880_test_dac_nids[4] = {
3897 0x02, 0x03, 0x04, 0x05
3900 static struct hda_input_mux alc880_test_capture_source = {
3909 { "Surround", 0x6 },
3913 static struct hda_channel_mode alc880_test_modes[4] = {
3920 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3921 struct snd_ctl_elem_info *uinfo)
3923 static char *texts[] = {
3924 "N/A", "Line Out", "HP Out",
3925 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3927 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3929 uinfo->value.enumerated.items = 8;
3930 if (uinfo->value.enumerated.item >= 8)
3931 uinfo->value.enumerated.item = 7;
3932 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3936 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3937 struct snd_ctl_elem_value *ucontrol)
3939 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3940 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3941 unsigned int pin_ctl, item = 0;
3943 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3944 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3945 if (pin_ctl & AC_PINCTL_OUT_EN) {
3946 if (pin_ctl & AC_PINCTL_HP_EN)
3950 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3951 switch (pin_ctl & AC_PINCTL_VREFEN) {
3952 case AC_PINCTL_VREF_HIZ: item = 3; break;
3953 case AC_PINCTL_VREF_50: item = 4; break;
3954 case AC_PINCTL_VREF_GRD: item = 5; break;
3955 case AC_PINCTL_VREF_80: item = 6; break;
3956 case AC_PINCTL_VREF_100: item = 7; break;
3959 ucontrol->value.enumerated.item[0] = item;
3963 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3964 struct snd_ctl_elem_value *ucontrol)
3966 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3967 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3968 static unsigned int ctls[] = {
3969 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3970 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3971 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3972 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3973 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3974 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3976 unsigned int old_ctl, new_ctl;
3978 old_ctl = snd_hda_codec_read(codec, nid, 0,
3979 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3980 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3981 if (old_ctl != new_ctl) {
3983 snd_hda_codec_write_cache(codec, nid, 0,
3984 AC_VERB_SET_PIN_WIDGET_CONTROL,
3986 val = ucontrol->value.enumerated.item[0] >= 3 ?
3988 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3995 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3996 struct snd_ctl_elem_info *uinfo)
3998 static char *texts[] = {
3999 "Front", "Surround", "CLFE", "Side"
4001 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4003 uinfo->value.enumerated.items = 4;
4004 if (uinfo->value.enumerated.item >= 4)
4005 uinfo->value.enumerated.item = 3;
4006 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4010 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4011 struct snd_ctl_elem_value *ucontrol)
4013 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4014 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4017 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4018 ucontrol->value.enumerated.item[0] = sel & 3;
4022 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4023 struct snd_ctl_elem_value *ucontrol)
4025 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4026 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4029 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4030 if (ucontrol->value.enumerated.item[0] != sel) {
4031 sel = ucontrol->value.enumerated.item[0] & 3;
4032 snd_hda_codec_write_cache(codec, nid, 0,
4033 AC_VERB_SET_CONNECT_SEL, sel);
4039 #define PIN_CTL_TEST(xname,nid) { \
4040 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4042 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4043 .info = alc_test_pin_ctl_info, \
4044 .get = alc_test_pin_ctl_get, \
4045 .put = alc_test_pin_ctl_put, \
4046 .private_value = nid \
4049 #define PIN_SRC_TEST(xname,nid) { \
4050 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4052 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4053 .info = alc_test_pin_src_info, \
4054 .get = alc_test_pin_src_get, \
4055 .put = alc_test_pin_src_put, \
4056 .private_value = nid \
4059 static struct snd_kcontrol_new alc880_test_mixer[] = {
4060 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4061 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4062 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4063 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4064 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4065 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4066 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4067 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4068 PIN_CTL_TEST("Front Pin Mode", 0x14),
4069 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4070 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4071 PIN_CTL_TEST("Side Pin Mode", 0x17),
4072 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4073 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4074 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4075 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4076 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4077 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4078 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4079 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4080 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4081 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4082 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4083 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4084 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4085 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4086 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4087 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4088 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4089 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4091 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4092 .name = "Channel Mode",
4093 .info = alc_ch_mode_info,
4094 .get = alc_ch_mode_get,
4095 .put = alc_ch_mode_put,
4100 static struct hda_verb alc880_test_init_verbs[] = {
4101 /* Unmute inputs of 0x0c - 0x0f */
4102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4103 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4104 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4105 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4106 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4107 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4108 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4109 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4110 /* Vol output for 0x0c-0x0f */
4111 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4112 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4113 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4114 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4115 /* Set output pins 0x14-0x17 */
4116 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4117 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4118 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4119 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4120 /* Unmute output pins 0x14-0x17 */
4121 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4122 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4123 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4124 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4125 /* Set input pins 0x18-0x1c */
4126 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4127 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4128 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4129 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4130 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4131 /* Mute input pins 0x18-0x1b */
4132 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4133 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4134 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4135 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4137 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4138 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4139 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4140 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4141 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4142 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4143 /* Analog input/passthru */
4144 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4145 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4146 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4147 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4148 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4156 static const char *alc880_models[ALC880_MODEL_LAST] = {
4157 [ALC880_3ST] = "3stack",
4158 [ALC880_TCL_S700] = "tcl",
4159 [ALC880_3ST_DIG] = "3stack-digout",
4160 [ALC880_CLEVO] = "clevo",
4161 [ALC880_5ST] = "5stack",
4162 [ALC880_5ST_DIG] = "5stack-digout",
4163 [ALC880_W810] = "w810",
4164 [ALC880_Z71V] = "z71v",
4165 [ALC880_6ST] = "6stack",
4166 [ALC880_6ST_DIG] = "6stack-digout",
4167 [ALC880_ASUS] = "asus",
4168 [ALC880_ASUS_W1V] = "asus-w1v",
4169 [ALC880_ASUS_DIG] = "asus-dig",
4170 [ALC880_ASUS_DIG2] = "asus-dig2",
4171 [ALC880_UNIWILL_DIG] = "uniwill",
4172 [ALC880_UNIWILL_P53] = "uniwill-p53",
4173 [ALC880_FUJITSU] = "fujitsu",
4174 [ALC880_F1734] = "F1734",
4176 [ALC880_LG_LW] = "lg-lw",
4177 [ALC880_MEDION_RIM] = "medion",
4178 #ifdef CONFIG_SND_DEBUG
4179 [ALC880_TEST] = "test",
4181 [ALC880_AUTO] = "auto",
4184 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4185 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4186 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4187 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4188 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4189 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4190 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4191 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4192 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4193 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4194 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4195 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4196 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4197 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4198 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4199 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4200 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4201 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4202 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4203 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4204 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4205 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4206 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4207 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4208 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4209 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4210 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4211 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4212 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4213 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4214 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4215 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4216 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4217 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4218 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4219 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4220 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4221 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4222 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4223 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4224 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4225 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4226 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4227 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4228 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4229 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4230 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4231 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4232 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4233 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4234 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4235 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4236 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4237 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4238 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4239 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4240 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4241 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4242 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4243 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4244 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4245 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4246 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4247 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4248 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4249 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4250 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4251 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4252 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4254 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4255 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4256 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4261 * ALC880 codec presets
4263 static struct alc_config_preset alc880_presets[] = {
4265 .mixers = { alc880_three_stack_mixer },
4266 .init_verbs = { alc880_volume_init_verbs,
4267 alc880_pin_3stack_init_verbs },
4268 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4269 .dac_nids = alc880_dac_nids,
4270 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4271 .channel_mode = alc880_threestack_modes,
4273 .input_mux = &alc880_capture_source,
4275 [ALC880_3ST_DIG] = {
4276 .mixers = { alc880_three_stack_mixer },
4277 .init_verbs = { alc880_volume_init_verbs,
4278 alc880_pin_3stack_init_verbs },
4279 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4280 .dac_nids = alc880_dac_nids,
4281 .dig_out_nid = ALC880_DIGOUT_NID,
4282 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4283 .channel_mode = alc880_threestack_modes,
4285 .input_mux = &alc880_capture_source,
4287 [ALC880_TCL_S700] = {
4288 .mixers = { alc880_tcl_s700_mixer },
4289 .init_verbs = { alc880_volume_init_verbs,
4290 alc880_pin_tcl_S700_init_verbs,
4291 alc880_gpio2_init_verbs },
4292 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4293 .dac_nids = alc880_dac_nids,
4294 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4295 .num_adc_nids = 1, /* single ADC */
4297 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4298 .channel_mode = alc880_2_jack_modes,
4299 .input_mux = &alc880_capture_source,
4302 .mixers = { alc880_three_stack_mixer,
4303 alc880_five_stack_mixer},
4304 .init_verbs = { alc880_volume_init_verbs,
4305 alc880_pin_5stack_init_verbs },
4306 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4307 .dac_nids = alc880_dac_nids,
4308 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4309 .channel_mode = alc880_fivestack_modes,
4310 .input_mux = &alc880_capture_source,
4312 [ALC880_5ST_DIG] = {
4313 .mixers = { alc880_three_stack_mixer,
4314 alc880_five_stack_mixer },
4315 .init_verbs = { alc880_volume_init_verbs,
4316 alc880_pin_5stack_init_verbs },
4317 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4318 .dac_nids = alc880_dac_nids,
4319 .dig_out_nid = ALC880_DIGOUT_NID,
4320 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4321 .channel_mode = alc880_fivestack_modes,
4322 .input_mux = &alc880_capture_source,
4325 .mixers = { alc880_six_stack_mixer },
4326 .init_verbs = { alc880_volume_init_verbs,
4327 alc880_pin_6stack_init_verbs },
4328 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4329 .dac_nids = alc880_6st_dac_nids,
4330 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4331 .channel_mode = alc880_sixstack_modes,
4332 .input_mux = &alc880_6stack_capture_source,
4334 [ALC880_6ST_DIG] = {
4335 .mixers = { alc880_six_stack_mixer },
4336 .init_verbs = { alc880_volume_init_verbs,
4337 alc880_pin_6stack_init_verbs },
4338 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4339 .dac_nids = alc880_6st_dac_nids,
4340 .dig_out_nid = ALC880_DIGOUT_NID,
4341 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4342 .channel_mode = alc880_sixstack_modes,
4343 .input_mux = &alc880_6stack_capture_source,
4346 .mixers = { alc880_w810_base_mixer },
4347 .init_verbs = { alc880_volume_init_verbs,
4348 alc880_pin_w810_init_verbs,
4349 alc880_gpio2_init_verbs },
4350 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4351 .dac_nids = alc880_w810_dac_nids,
4352 .dig_out_nid = ALC880_DIGOUT_NID,
4353 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4354 .channel_mode = alc880_w810_modes,
4355 .input_mux = &alc880_capture_source,
4358 .mixers = { alc880_z71v_mixer },
4359 .init_verbs = { alc880_volume_init_verbs,
4360 alc880_pin_z71v_init_verbs },
4361 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4362 .dac_nids = alc880_z71v_dac_nids,
4363 .dig_out_nid = ALC880_DIGOUT_NID,
4365 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4366 .channel_mode = alc880_2_jack_modes,
4367 .input_mux = &alc880_capture_source,
4370 .mixers = { alc880_f1734_mixer },
4371 .init_verbs = { alc880_volume_init_verbs,
4372 alc880_pin_f1734_init_verbs },
4373 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4374 .dac_nids = alc880_f1734_dac_nids,
4376 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4377 .channel_mode = alc880_2_jack_modes,
4378 .input_mux = &alc880_f1734_capture_source,
4379 .unsol_event = alc880_uniwill_p53_unsol_event,
4380 .setup = alc880_uniwill_p53_setup,
4381 .init_hook = alc_automute_amp,
4384 .mixers = { alc880_asus_mixer },
4385 .init_verbs = { alc880_volume_init_verbs,
4386 alc880_pin_asus_init_verbs,
4387 alc880_gpio1_init_verbs },
4388 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4389 .dac_nids = alc880_asus_dac_nids,
4390 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4391 .channel_mode = alc880_asus_modes,
4393 .input_mux = &alc880_capture_source,
4395 [ALC880_ASUS_DIG] = {
4396 .mixers = { alc880_asus_mixer },
4397 .init_verbs = { alc880_volume_init_verbs,
4398 alc880_pin_asus_init_verbs,
4399 alc880_gpio1_init_verbs },
4400 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4401 .dac_nids = alc880_asus_dac_nids,
4402 .dig_out_nid = ALC880_DIGOUT_NID,
4403 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4404 .channel_mode = alc880_asus_modes,
4406 .input_mux = &alc880_capture_source,
4408 [ALC880_ASUS_DIG2] = {
4409 .mixers = { alc880_asus_mixer },
4410 .init_verbs = { alc880_volume_init_verbs,
4411 alc880_pin_asus_init_verbs,
4412 alc880_gpio2_init_verbs }, /* use GPIO2 */
4413 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4414 .dac_nids = alc880_asus_dac_nids,
4415 .dig_out_nid = ALC880_DIGOUT_NID,
4416 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4417 .channel_mode = alc880_asus_modes,
4419 .input_mux = &alc880_capture_source,
4421 [ALC880_ASUS_W1V] = {
4422 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4423 .init_verbs = { alc880_volume_init_verbs,
4424 alc880_pin_asus_init_verbs,
4425 alc880_gpio1_init_verbs },
4426 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4427 .dac_nids = alc880_asus_dac_nids,
4428 .dig_out_nid = ALC880_DIGOUT_NID,
4429 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4430 .channel_mode = alc880_asus_modes,
4432 .input_mux = &alc880_capture_source,
4434 [ALC880_UNIWILL_DIG] = {
4435 .mixers = { alc880_asus_mixer },
4436 .init_verbs = { alc880_volume_init_verbs,
4437 alc880_pin_asus_init_verbs },
4438 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4439 .dac_nids = alc880_asus_dac_nids,
4440 .dig_out_nid = ALC880_DIGOUT_NID,
4441 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4442 .channel_mode = alc880_asus_modes,
4444 .input_mux = &alc880_capture_source,
4446 [ALC880_UNIWILL] = {
4447 .mixers = { alc880_uniwill_mixer },
4448 .init_verbs = { alc880_volume_init_verbs,
4449 alc880_uniwill_init_verbs },
4450 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4451 .dac_nids = alc880_asus_dac_nids,
4452 .dig_out_nid = ALC880_DIGOUT_NID,
4453 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4454 .channel_mode = alc880_threestack_modes,
4456 .input_mux = &alc880_capture_source,
4457 .unsol_event = alc880_uniwill_unsol_event,
4458 .setup = alc880_uniwill_setup,
4459 .init_hook = alc880_uniwill_init_hook,
4461 [ALC880_UNIWILL_P53] = {
4462 .mixers = { alc880_uniwill_p53_mixer },
4463 .init_verbs = { alc880_volume_init_verbs,
4464 alc880_uniwill_p53_init_verbs },
4465 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4466 .dac_nids = alc880_asus_dac_nids,
4467 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4468 .channel_mode = alc880_threestack_modes,
4469 .input_mux = &alc880_capture_source,
4470 .unsol_event = alc880_uniwill_p53_unsol_event,
4471 .setup = alc880_uniwill_p53_setup,
4472 .init_hook = alc_automute_amp,
4474 [ALC880_FUJITSU] = {
4475 .mixers = { alc880_fujitsu_mixer },
4476 .init_verbs = { alc880_volume_init_verbs,
4477 alc880_uniwill_p53_init_verbs,
4478 alc880_beep_init_verbs },
4479 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4480 .dac_nids = alc880_dac_nids,
4481 .dig_out_nid = ALC880_DIGOUT_NID,
4482 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4483 .channel_mode = alc880_2_jack_modes,
4484 .input_mux = &alc880_capture_source,
4485 .unsol_event = alc880_uniwill_p53_unsol_event,
4486 .setup = alc880_uniwill_p53_setup,
4487 .init_hook = alc_automute_amp,
4490 .mixers = { alc880_three_stack_mixer },
4491 .init_verbs = { alc880_volume_init_verbs,
4492 alc880_pin_clevo_init_verbs },
4493 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4494 .dac_nids = alc880_dac_nids,
4496 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4497 .channel_mode = alc880_threestack_modes,
4499 .input_mux = &alc880_capture_source,
4502 .mixers = { alc880_lg_mixer },
4503 .init_verbs = { alc880_volume_init_verbs,
4504 alc880_lg_init_verbs },
4505 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4506 .dac_nids = alc880_lg_dac_nids,
4507 .dig_out_nid = ALC880_DIGOUT_NID,
4508 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4509 .channel_mode = alc880_lg_ch_modes,
4511 .input_mux = &alc880_lg_capture_source,
4512 .unsol_event = alc_automute_amp_unsol_event,
4513 .setup = alc880_lg_setup,
4514 .init_hook = alc_automute_amp,
4515 #ifdef CONFIG_SND_HDA_POWER_SAVE
4516 .loopbacks = alc880_lg_loopbacks,
4520 .mixers = { alc880_lg_lw_mixer },
4521 .init_verbs = { alc880_volume_init_verbs,
4522 alc880_lg_lw_init_verbs },
4523 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4524 .dac_nids = alc880_dac_nids,
4525 .dig_out_nid = ALC880_DIGOUT_NID,
4526 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4527 .channel_mode = alc880_lg_lw_modes,
4528 .input_mux = &alc880_lg_lw_capture_source,
4529 .unsol_event = alc_automute_amp_unsol_event,
4530 .setup = alc880_lg_lw_setup,
4531 .init_hook = alc_automute_amp,
4533 [ALC880_MEDION_RIM] = {
4534 .mixers = { alc880_medion_rim_mixer },
4535 .init_verbs = { alc880_volume_init_verbs,
4536 alc880_medion_rim_init_verbs,
4537 alc_gpio2_init_verbs },
4538 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4539 .dac_nids = alc880_dac_nids,
4540 .dig_out_nid = ALC880_DIGOUT_NID,
4541 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4542 .channel_mode = alc880_2_jack_modes,
4543 .input_mux = &alc880_medion_rim_capture_source,
4544 .unsol_event = alc880_medion_rim_unsol_event,
4545 .setup = alc880_medion_rim_setup,
4546 .init_hook = alc880_medion_rim_automute,
4548 #ifdef CONFIG_SND_DEBUG
4550 .mixers = { alc880_test_mixer },
4551 .init_verbs = { alc880_test_init_verbs },
4552 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4553 .dac_nids = alc880_test_dac_nids,
4554 .dig_out_nid = ALC880_DIGOUT_NID,
4555 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4556 .channel_mode = alc880_test_modes,
4557 .input_mux = &alc880_test_capture_source,
4563 * Automatic parse of I/O pins from the BIOS configuration
4568 ALC_CTL_WIDGET_MUTE,
4571 static struct snd_kcontrol_new alc880_control_templates[] = {
4572 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4573 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4574 HDA_BIND_MUTE(NULL, 0, 0, 0),
4577 /* add dynamic controls */
4578 static int add_control(struct alc_spec *spec, int type, const char *name,
4581 struct snd_kcontrol_new *knew;
4583 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4584 knew = snd_array_new(&spec->kctls);
4587 *knew = alc880_control_templates[type];
4588 knew->name = kstrdup(name, GFP_KERNEL);
4591 if (get_amp_nid_(val))
4592 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4593 knew->private_value = val;
4597 static int add_control_with_pfx(struct alc_spec *spec, int type,
4598 const char *pfx, const char *dir,
4599 const char *sfx, unsigned long val)
4602 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4603 return add_control(spec, type, name, val);
4606 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4607 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4608 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4609 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4611 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4612 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4613 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4614 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4615 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4616 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4617 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4618 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4619 #define ALC880_PIN_CD_NID 0x1c
4621 /* fill in the dac_nids table from the parsed pin configuration */
4622 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4623 const struct auto_pin_cfg *cfg)
4629 memset(assigned, 0, sizeof(assigned));
4630 spec->multiout.dac_nids = spec->private_dac_nids;
4632 /* check the pins hardwired to audio widget */
4633 for (i = 0; i < cfg->line_outs; i++) {
4634 nid = cfg->line_out_pins[i];
4635 if (alc880_is_fixed_pin(nid)) {
4636 int idx = alc880_fixed_pin_idx(nid);
4637 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4641 /* left pins can be connect to any audio widget */
4642 for (i = 0; i < cfg->line_outs; i++) {
4643 nid = cfg->line_out_pins[i];
4644 if (alc880_is_fixed_pin(nid))
4646 /* search for an empty channel */
4647 for (j = 0; j < cfg->line_outs; j++) {
4649 spec->multiout.dac_nids[i] =
4650 alc880_idx_to_dac(j);
4656 spec->multiout.num_dacs = cfg->line_outs;
4660 /* add playback controls from the parsed DAC table */
4661 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4662 const struct auto_pin_cfg *cfg)
4664 static const char *chname[4] = {
4665 "Front", "Surround", NULL /*CLFE*/, "Side"
4670 for (i = 0; i < cfg->line_outs; i++) {
4671 if (!spec->multiout.dac_nids[i])
4673 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4676 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4678 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4682 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4684 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4688 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4690 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4694 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4696 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4702 if (cfg->line_outs == 1 &&
4703 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4707 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4708 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4712 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4713 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4722 /* add playback controls for speaker and HP outputs */
4723 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4732 if (alc880_is_fixed_pin(pin)) {
4733 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4734 /* specify the DAC as the extra output */
4735 if (!spec->multiout.hp_nid)
4736 spec->multiout.hp_nid = nid;
4738 spec->multiout.extra_out_nid[0] = nid;
4739 /* control HP volume/switch on the output mixer amp */
4740 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4741 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4742 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4745 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4746 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4749 } else if (alc880_is_multi_pin(pin)) {
4750 /* set manual connection */
4751 /* we have only a switch on HP-out PIN */
4752 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4753 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4760 /* create input playback/capture controls for the given pin */
4761 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4762 const char *ctlname,
4763 int idx, hda_nid_t mix_nid)
4767 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4768 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4771 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4772 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4778 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4780 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4781 return (pincap & AC_PINCAP_IN) != 0;
4784 /* create playback/capture controls for input pins */
4785 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4786 const struct auto_pin_cfg *cfg,
4788 hda_nid_t cap1, hda_nid_t cap2)
4790 struct alc_spec *spec = codec->spec;
4791 struct hda_input_mux *imux = &spec->private_imux[0];
4794 for (i = 0; i < AUTO_PIN_LAST; i++) {
4797 pin = cfg->input_pins[i];
4798 if (!alc_is_input_pin(codec, pin))
4802 idx = get_connection_index(codec, mixer, pin);
4804 err = new_analog_input(spec, pin,
4805 auto_pin_cfg_labels[i],
4814 idx = get_connection_index(codec, cap1, pin);
4815 if (idx < 0 && cap2)
4816 idx = get_connection_index(codec, cap2, pin);
4818 imux->items[imux->num_items].label =
4819 auto_pin_cfg_labels[i];
4820 imux->items[imux->num_items].index = idx;
4827 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4828 const struct auto_pin_cfg *cfg)
4830 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4833 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4834 unsigned int pin_type)
4836 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4839 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4843 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4844 hda_nid_t nid, int pin_type,
4847 alc_set_pin_output(codec, nid, pin_type);
4848 /* need the manual connection? */
4849 if (alc880_is_multi_pin(nid)) {
4850 struct alc_spec *spec = codec->spec;
4851 int idx = alc880_multi_pin_idx(nid);
4852 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4853 AC_VERB_SET_CONNECT_SEL,
4854 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4858 static int get_pin_type(int line_out_type)
4860 if (line_out_type == AUTO_PIN_HP_OUT)
4866 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4868 struct alc_spec *spec = codec->spec;
4871 for (i = 0; i < spec->autocfg.line_outs; i++) {
4872 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4873 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4874 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4878 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4880 struct alc_spec *spec = codec->spec;
4883 pin = spec->autocfg.speaker_pins[0];
4884 if (pin) /* connect to front */
4885 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4886 pin = spec->autocfg.hp_pins[0];
4887 if (pin) /* connect to front */
4888 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4891 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4893 struct alc_spec *spec = codec->spec;
4896 for (i = 0; i < AUTO_PIN_LAST; i++) {
4897 hda_nid_t nid = spec->autocfg.input_pins[i];
4898 if (alc_is_input_pin(codec, nid)) {
4899 alc_set_input_pin(codec, nid, i);
4900 if (nid != ALC880_PIN_CD_NID &&
4901 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4902 snd_hda_codec_write(codec, nid, 0,
4903 AC_VERB_SET_AMP_GAIN_MUTE,
4909 static void alc880_auto_init_input_src(struct hda_codec *codec)
4911 struct alc_spec *spec = codec->spec;
4914 for (c = 0; c < spec->num_adc_nids; c++) {
4915 unsigned int mux_idx;
4916 const struct hda_input_mux *imux;
4917 mux_idx = c >= spec->num_mux_defs ? 0 : c;
4918 imux = &spec->input_mux[mux_idx];
4919 if (!imux->num_items && mux_idx > 0)
4920 imux = &spec->input_mux[0];
4922 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
4923 AC_VERB_SET_CONNECT_SEL,
4924 imux->items[0].index);
4928 /* parse the BIOS configuration and set up the alc_spec */
4929 /* return 1 if successful, 0 if the proper config is not found,
4930 * or a negative error code
4932 static int alc880_parse_auto_config(struct hda_codec *codec)
4934 struct alc_spec *spec = codec->spec;
4936 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4938 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4942 if (!spec->autocfg.line_outs)
4943 return 0; /* can't find valid BIOS pin config */
4945 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4948 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4951 err = alc880_auto_create_extra_out(spec,
4952 spec->autocfg.speaker_pins[0],
4956 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4960 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4964 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4966 /* check multiple SPDIF-out (for recent codecs) */
4967 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4969 err = snd_hda_get_connections(codec,
4970 spec->autocfg.dig_out_pins[i],
4975 spec->multiout.dig_out_nid = dig_nid;
4977 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4978 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4980 spec->slave_dig_outs[i - 1] = dig_nid;
4983 if (spec->autocfg.dig_in_pin)
4984 spec->dig_in_nid = ALC880_DIGIN_NID;
4986 if (spec->kctls.list)
4987 add_mixer(spec, spec->kctls.list);
4989 add_verb(spec, alc880_volume_init_verbs);
4991 spec->num_mux_defs = 1;
4992 spec->input_mux = &spec->private_imux[0];
4994 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
4999 /* additional initialization for auto-configuration model */
5000 static void alc880_auto_init(struct hda_codec *codec)
5002 struct alc_spec *spec = codec->spec;
5003 alc880_auto_init_multi_out(codec);
5004 alc880_auto_init_extra_out(codec);
5005 alc880_auto_init_analog_input(codec);
5006 alc880_auto_init_input_src(codec);
5007 if (spec->unsol_event)
5008 alc_inithook(codec);
5011 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5012 * one of two digital mic pins, e.g. on ALC272
5014 static void fixup_automic_adc(struct hda_codec *codec)
5016 struct alc_spec *spec = codec->spec;
5019 for (i = 0; i < spec->num_adc_nids; i++) {
5020 hda_nid_t cap = spec->capsrc_nids ?
5021 spec->capsrc_nids[i] : spec->adc_nids[i];
5024 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5027 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5030 spec->int_mic.mux_idx = iidx;
5031 spec->ext_mic.mux_idx = eidx;
5032 if (spec->capsrc_nids)
5033 spec->capsrc_nids += i;
5034 spec->adc_nids += i;
5035 spec->num_adc_nids = 1;
5038 snd_printd(KERN_INFO "hda_codec: %s: "
5039 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5040 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5041 spec->auto_mic = 0; /* disable auto-mic to be sure */
5044 /* choose the ADC/MUX containing the input pin and initialize the setup */
5045 static void fixup_single_adc(struct hda_codec *codec)
5047 struct alc_spec *spec = codec->spec;
5051 /* search for the input pin; there must be only one */
5052 for (i = 0; i < AUTO_PIN_LAST; i++) {
5053 if (spec->autocfg.input_pins[i]) {
5054 pin = spec->autocfg.input_pins[i];
5061 /* set the default connection to that pin */
5062 for (i = 0; i < spec->num_adc_nids; i++) {
5063 hda_nid_t cap = spec->capsrc_nids ?
5064 spec->capsrc_nids[i] : spec->adc_nids[i];
5067 idx = get_connection_index(codec, cap, pin);
5070 /* use only this ADC */
5071 if (spec->capsrc_nids)
5072 spec->capsrc_nids += i;
5073 spec->adc_nids += i;
5074 spec->num_adc_nids = 1;
5075 /* select or unmute this route */
5076 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5077 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5080 snd_hda_codec_write_cache(codec, cap, 0,
5081 AC_VERB_SET_CONNECT_SEL, idx);
5087 static void set_capture_mixer(struct hda_codec *codec)
5089 struct alc_spec *spec = codec->spec;
5090 static struct snd_kcontrol_new *caps[2][3] = {
5091 { alc_capture_mixer_nosrc1,
5092 alc_capture_mixer_nosrc2,
5093 alc_capture_mixer_nosrc3 },
5094 { alc_capture_mixer1,
5096 alc_capture_mixer3 },
5098 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5101 fixup_automic_adc(codec);
5102 else if (spec->input_mux) {
5103 if (spec->input_mux->num_items > 1)
5105 else if (spec->input_mux->num_items == 1)
5106 fixup_single_adc(codec);
5108 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
5112 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5113 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5116 struct alc_spec *spec = codec->spec;
5118 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5120 for (n = 0; n < num_nids; n++) {
5122 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5126 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5129 nconns = snd_hda_get_connections(codec, cap, conn,
5133 nconns = snd_hda_get_connections(codec, cap, conn,
5138 if (!fallback_adc) {
5142 for (i = 0; i < AUTO_PIN_LAST; i++) {
5143 hda_nid_t nid = spec->autocfg.input_pins[i];
5146 for (j = 0; j < nconns; j++) {
5153 if (i >= AUTO_PIN_LAST) {
5154 int num_adcs = spec->num_adc_nids;
5155 spec->private_adc_nids[num_adcs] = adc;
5156 spec->private_capsrc_nids[num_adcs] = cap;
5157 spec->num_adc_nids++;
5158 spec->adc_nids = spec->private_adc_nids;
5160 spec->capsrc_nids = spec->private_capsrc_nids;
5163 if (!spec->num_adc_nids) {
5164 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5165 " using fallback 0x%x\n",
5166 codec->chip_name, fallback_adc);
5167 spec->private_adc_nids[0] = fallback_adc;
5168 spec->adc_nids = spec->private_adc_nids;
5169 if (fallback_adc != fallback_cap) {
5170 spec->private_capsrc_nids[0] = fallback_cap;
5171 spec->capsrc_nids = spec->private_adc_nids;
5176 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5177 #define set_beep_amp(spec, nid, idx, dir) \
5178 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5180 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5184 * OK, here we have finally the patch for ALC880
5187 static int patch_alc880(struct hda_codec *codec)
5189 struct alc_spec *spec;
5193 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5199 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5202 if (board_config < 0) {
5203 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5205 board_config = ALC880_AUTO;
5208 if (board_config == ALC880_AUTO) {
5209 /* automatic parse from the BIOS config */
5210 err = alc880_parse_auto_config(codec);
5216 "hda_codec: Cannot set up configuration "
5217 "from BIOS. Using 3-stack mode...\n");
5218 board_config = ALC880_3ST;
5222 err = snd_hda_attach_beep_device(codec, 0x1);
5228 if (board_config != ALC880_AUTO)
5229 setup_preset(codec, &alc880_presets[board_config]);
5231 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5232 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5233 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5235 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5236 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5238 if (!spec->adc_nids && spec->input_mux) {
5239 /* check whether NID 0x07 is valid */
5240 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5242 wcap = get_wcaps_type(wcap);
5243 if (wcap != AC_WID_AUD_IN) {
5244 spec->adc_nids = alc880_adc_nids_alt;
5245 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5247 spec->adc_nids = alc880_adc_nids;
5248 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5251 set_capture_mixer(codec);
5252 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5254 spec->vmaster_nid = 0x0c;
5256 codec->patch_ops = alc_patch_ops;
5257 if (board_config == ALC880_AUTO)
5258 spec->init_hook = alc880_auto_init;
5259 #ifdef CONFIG_SND_HDA_POWER_SAVE
5260 if (!spec->loopback.amplist)
5261 spec->loopback.amplist = alc880_loopbacks;
5272 static hda_nid_t alc260_dac_nids[1] = {
5277 static hda_nid_t alc260_adc_nids[1] = {
5282 static hda_nid_t alc260_adc_nids_alt[1] = {
5287 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5288 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5290 static hda_nid_t alc260_dual_adc_nids[2] = {
5295 #define ALC260_DIGOUT_NID 0x03
5296 #define ALC260_DIGIN_NID 0x06
5298 static struct hda_input_mux alc260_capture_source = {
5302 { "Front Mic", 0x1 },
5308 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5309 * headphone jack and the internal CD lines since these are the only pins at
5310 * which audio can appear. For flexibility, also allow the option of
5311 * recording the mixer output on the second ADC (ADC0 doesn't have a
5312 * connection to the mixer output).
5314 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5318 { "Mic/Line", 0x0 },
5320 { "Headphone", 0x2 },
5326 { "Mic/Line", 0x0 },
5328 { "Headphone", 0x2 },
5335 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5336 * the Fujitsu S702x, but jacks are marked differently.
5338 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5345 { "Headphone", 0x5 },
5354 { "Headphone", 0x6 },
5360 /* Maxdata Favorit 100XS */
5361 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5365 { "Line/Mic", 0x0 },
5372 { "Line/Mic", 0x0 },
5380 * This is just place-holder, so there's something for alc_build_pcms to look
5381 * at when it calculates the maximum number of channels. ALC260 has no mixer
5382 * element which allows changing the channel mode, so the verb list is
5385 static struct hda_channel_mode alc260_modes[1] = {
5390 /* Mixer combinations
5392 * basic: base_output + input + pc_beep + capture
5393 * HP: base_output + input + capture_alt
5394 * HP_3013: hp_3013 + input + capture
5395 * fujitsu: fujitsu + capture
5396 * acer: acer + capture
5399 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5400 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5401 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5402 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5403 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5404 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5405 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5409 static struct snd_kcontrol_new alc260_input_mixer[] = {
5410 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5411 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5412 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5413 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5414 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5415 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5416 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5417 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5421 /* update HP, line and mono out pins according to the master switch */
5422 static void alc260_hp_master_update(struct hda_codec *codec,
5423 hda_nid_t hp, hda_nid_t line,
5426 struct alc_spec *spec = codec->spec;
5427 unsigned int val = spec->master_sw ? PIN_HP : 0;
5428 /* change HP and line-out pins */
5429 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5431 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5433 /* mono (speaker) depending on the HP jack sense */
5434 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5435 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5439 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5440 struct snd_ctl_elem_value *ucontrol)
5442 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5443 struct alc_spec *spec = codec->spec;
5444 *ucontrol->value.integer.value = spec->master_sw;
5448 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5449 struct snd_ctl_elem_value *ucontrol)
5451 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5452 struct alc_spec *spec = codec->spec;
5453 int val = !!*ucontrol->value.integer.value;
5454 hda_nid_t hp, line, mono;
5456 if (val == spec->master_sw)
5458 spec->master_sw = val;
5459 hp = (kcontrol->private_value >> 16) & 0xff;
5460 line = (kcontrol->private_value >> 8) & 0xff;
5461 mono = kcontrol->private_value & 0xff;
5462 alc260_hp_master_update(codec, hp, line, mono);
5466 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5468 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5469 .name = "Master Playback Switch",
5470 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5471 .info = snd_ctl_boolean_mono_info,
5472 .get = alc260_hp_master_sw_get,
5473 .put = alc260_hp_master_sw_put,
5474 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5476 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5477 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5478 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5479 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5480 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5482 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5486 static struct hda_verb alc260_hp_unsol_verbs[] = {
5487 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5491 static void alc260_hp_automute(struct hda_codec *codec)
5493 struct alc_spec *spec = codec->spec;
5495 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5496 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5499 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5501 if ((res >> 26) == ALC880_HP_EVENT)
5502 alc260_hp_automute(codec);
5505 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5507 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5508 .name = "Master Playback Switch",
5509 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5510 .info = snd_ctl_boolean_mono_info,
5511 .get = alc260_hp_master_sw_get,
5512 .put = alc260_hp_master_sw_put,
5513 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5515 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5516 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5517 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5518 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5519 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5520 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5521 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5522 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5526 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5527 .ops = &snd_hda_bind_vol,
5529 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5530 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5531 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5536 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5537 .ops = &snd_hda_bind_sw,
5539 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5540 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5545 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5546 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5547 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5548 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5549 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5553 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5554 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5558 static void alc260_hp_3013_automute(struct hda_codec *codec)
5560 struct alc_spec *spec = codec->spec;
5562 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5563 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5566 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5569 if ((res >> 26) == ALC880_HP_EVENT)
5570 alc260_hp_3013_automute(codec);
5573 static void alc260_hp_3012_automute(struct hda_codec *codec)
5575 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5577 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5579 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5581 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5585 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5588 if ((res >> 26) == ALC880_HP_EVENT)
5589 alc260_hp_3012_automute(codec);
5592 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5593 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5595 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5596 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5597 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5598 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5599 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5600 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5601 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5602 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5603 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5604 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5605 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5609 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5610 * versions of the ALC260 don't act on requests to enable mic bias from NID
5611 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5612 * datasheet doesn't mention this restriction. At this stage it's not clear
5613 * whether this behaviour is intentional or is a hardware bug in chip
5614 * revisions available in early 2006. Therefore for now allow the
5615 * "Headphone Jack Mode" control to span all choices, but if it turns out
5616 * that the lack of mic bias for this NID is intentional we could change the
5617 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5619 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5620 * don't appear to make the mic bias available from the "line" jack, even
5621 * though the NID used for this jack (0x14) can supply it. The theory is
5622 * that perhaps Acer have included blocking capacitors between the ALC260
5623 * and the output jack. If this turns out to be the case for all such
5624 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5625 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5627 * The C20x Tablet series have a mono internal speaker which is controlled
5628 * via the chip's Mono sum widget and pin complex, so include the necessary
5629 * controls for such models. On models without a "mono speaker" the control
5630 * won't do anything.
5632 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5633 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5634 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5635 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5636 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5638 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5640 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5641 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5643 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5644 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5645 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5646 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5647 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5651 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5653 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5654 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5655 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5656 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5657 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5658 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5659 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5663 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5664 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5666 static struct snd_kcontrol_new alc260_will_mixer[] = {
5667 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5668 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5670 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5671 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5672 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5673 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5674 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5675 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5676 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5680 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5681 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5683 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5684 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5685 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5686 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5687 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5688 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5689 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5690 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5691 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5692 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5693 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5698 * initialization verbs
5700 static struct hda_verb alc260_init_verbs[] = {
5701 /* Line In pin widget for input */
5702 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5703 /* CD pin widget for input */
5704 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5705 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5706 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5707 /* Mic2 (front panel) pin widget for input and vref at 80% */
5708 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5709 /* LINE-2 is used for line-out in rear */
5710 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5711 /* select line-out */
5712 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5714 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5716 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5718 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5719 /* mute capture amp left and right */
5720 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5721 /* set connection select to line in (default select for this ADC) */
5722 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5723 /* mute capture amp left and right */
5724 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5725 /* set connection select to line in (default select for this ADC) */
5726 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5727 /* set vol=0 Line-Out mixer amp left and right */
5728 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5729 /* unmute pin widget amp left and right (no gain on this amp) */
5730 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5731 /* set vol=0 HP mixer amp left and right */
5732 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5733 /* unmute pin widget amp left and right (no gain on this amp) */
5734 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5735 /* set vol=0 Mono mixer amp left and right */
5736 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5737 /* unmute pin widget amp left and right (no gain on this amp) */
5738 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5739 /* unmute LINE-2 out pin */
5740 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5741 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5744 /* mute analog inputs */
5745 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5746 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5747 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5749 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5750 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5751 /* mute Front out path */
5752 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5753 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5754 /* mute Headphone out path */
5755 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5756 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5757 /* mute Mono out path */
5758 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5759 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5763 #if 0 /* should be identical with alc260_init_verbs? */
5764 static struct hda_verb alc260_hp_init_verbs[] = {
5765 /* Headphone and output */
5766 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5768 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5769 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5770 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5771 /* Mic2 (front panel) pin widget for input and vref at 80% */
5772 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5773 /* Line In pin widget for input */
5774 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5775 /* Line-2 pin widget for output */
5776 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5777 /* CD pin widget for input */
5778 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5779 /* unmute amp left and right */
5780 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5781 /* set connection select to line in (default select for this ADC) */
5782 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5783 /* unmute Line-Out mixer amp left and right (volume = 0) */
5784 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5785 /* mute pin widget amp left and right (no gain on this amp) */
5786 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5787 /* unmute HP mixer amp left and right (volume = 0) */
5788 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5789 /* mute pin widget amp left and right (no gain on this amp) */
5790 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5791 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5794 /* mute analog inputs */
5795 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5796 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5797 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5798 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5799 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5800 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5801 /* Unmute Front out path */
5802 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5803 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5804 /* Unmute Headphone out path */
5805 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5806 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5807 /* Unmute Mono out path */
5808 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5809 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5814 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5815 /* Line out and output */
5816 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5818 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5819 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5820 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5821 /* Mic2 (front panel) pin widget for input and vref at 80% */
5822 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5823 /* Line In pin widget for input */
5824 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5825 /* Headphone pin widget for output */
5826 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5827 /* CD pin widget for input */
5828 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5829 /* unmute amp left and right */
5830 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5831 /* set connection select to line in (default select for this ADC) */
5832 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5833 /* unmute Line-Out mixer amp left and right (volume = 0) */
5834 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5835 /* mute pin widget amp left and right (no gain on this amp) */
5836 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5837 /* unmute HP mixer amp left and right (volume = 0) */
5838 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5839 /* mute pin widget amp left and right (no gain on this amp) */
5840 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5841 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5844 /* mute analog inputs */
5845 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5846 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5847 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5848 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5849 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5850 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5851 /* Unmute Front out path */
5852 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5853 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5854 /* Unmute Headphone out path */
5855 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5856 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5857 /* Unmute Mono out path */
5858 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5859 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5863 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5864 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5865 * audio = 0x16, internal speaker = 0x10.
5867 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5868 /* Disable all GPIOs */
5869 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5870 /* Internal speaker is connected to headphone pin */
5871 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5872 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5874 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5875 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5876 /* Ensure all other unused pins are disabled and muted. */
5877 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5878 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5879 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5880 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5881 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5882 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5883 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5884 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5886 /* Disable digital (SPDIF) pins */
5887 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5888 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5890 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5891 * when acting as an output.
5893 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5895 /* Start with output sum widgets muted and their output gains at min */
5896 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5897 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5898 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5899 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5900 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5901 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5902 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5903 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5904 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5906 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5907 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5908 /* Unmute Line1 pin widget output buffer since it starts as an output.
5909 * If the pin mode is changed by the user the pin mode control will
5910 * take care of enabling the pin's input/output buffers as needed.
5911 * Therefore there's no need to enable the input buffer at this
5914 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5915 /* Unmute input buffer of pin widget used for Line-in (no equiv
5918 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5920 /* Mute capture amp left and right */
5921 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5922 /* Set ADC connection select to match default mixer setting - line
5925 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5927 /* Do the same for the second ADC: mute capture input amp and
5928 * set ADC connection to line in (on mic1 pin)
5930 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5931 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5933 /* Mute all inputs to mixer widget (even unconnected ones) */
5934 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5935 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5936 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5937 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5938 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5946 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5947 * similar laptops (adapted from Fujitsu init verbs).
5949 static struct hda_verb alc260_acer_init_verbs[] = {
5950 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5951 * the headphone jack. Turn this on and rely on the standard mute
5952 * methods whenever the user wants to turn these outputs off.
5954 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5955 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5956 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5957 /* Internal speaker/Headphone jack is connected to Line-out pin */
5958 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5959 /* Internal microphone/Mic jack is connected to Mic1 pin */
5960 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5961 /* Line In jack is connected to Line1 pin */
5962 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5963 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5964 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5965 /* Ensure all other unused pins are disabled and muted. */
5966 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5967 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5968 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5969 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5970 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5971 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5972 /* Disable digital (SPDIF) pins */
5973 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5974 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5976 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5977 * bus when acting as outputs.
5979 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5980 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5982 /* Start with output sum widgets muted and their output gains at min */
5983 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5984 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5985 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5986 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5987 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5988 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5989 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5990 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5991 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5993 /* Unmute Line-out pin widget amp left and right
5994 * (no equiv mixer ctrl)
5996 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5997 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5998 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5999 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6000 * inputs. If the pin mode is changed by the user the pin mode control
6001 * will take care of enabling the pin's input/output buffers as needed.
6002 * Therefore there's no need to enable the input buffer at this
6005 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6006 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6008 /* Mute capture amp left and right */
6009 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6010 /* Set ADC connection select to match default mixer setting - mic
6013 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6015 /* Do similar with the second ADC: mute capture input amp and
6016 * set ADC connection to mic to match ALSA's default state.
6018 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6019 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6021 /* Mute all inputs to mixer widget (even unconnected ones) */
6022 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6023 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6024 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6025 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6026 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6028 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6029 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6034 /* Initialisation sequence for Maxdata Favorit 100XS
6035 * (adapted from Acer init verbs).
6037 static struct hda_verb alc260_favorit100_init_verbs[] = {
6038 /* GPIO 0 enables the output jack.
6039 * Turn this on and rely on the standard mute
6040 * methods whenever the user wants to turn these outputs off.
6042 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6043 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6044 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6045 /* Line/Mic input jack is connected to Mic1 pin */
6046 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6047 /* Ensure all other unused pins are disabled and muted. */
6048 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6049 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6050 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6051 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6052 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6053 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6054 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6055 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6056 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6058 /* Disable digital (SPDIF) pins */
6059 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6060 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6062 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6063 * bus when acting as outputs.
6065 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6066 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6068 /* Start with output sum widgets muted and their output gains at min */
6069 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6070 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6071 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6072 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6073 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6074 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6075 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6076 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6077 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6079 /* Unmute Line-out pin widget amp left and right
6080 * (no equiv mixer ctrl)
6082 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6083 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6084 * inputs. If the pin mode is changed by the user the pin mode control
6085 * will take care of enabling the pin's input/output buffers as needed.
6086 * Therefore there's no need to enable the input buffer at this
6089 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6091 /* Mute capture amp left and right */
6092 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6093 /* Set ADC connection select to match default mixer setting - mic
6096 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6098 /* Do similar with the second ADC: mute capture input amp and
6099 * set ADC connection to mic to match ALSA's default state.
6101 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6102 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6104 /* Mute all inputs to mixer widget (even unconnected ones) */
6105 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6106 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6110 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6117 static struct hda_verb alc260_will_verbs[] = {
6118 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6119 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6120 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6121 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6122 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6123 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6127 static struct hda_verb alc260_replacer_672v_verbs[] = {
6128 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6129 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6130 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6132 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6133 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6134 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6136 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6140 /* toggle speaker-output according to the hp-jack state */
6141 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6143 unsigned int present;
6145 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6146 present = snd_hda_jack_detect(codec, 0x0f);
6148 snd_hda_codec_write_cache(codec, 0x01, 0,
6149 AC_VERB_SET_GPIO_DATA, 1);
6150 snd_hda_codec_write_cache(codec, 0x0f, 0,
6151 AC_VERB_SET_PIN_WIDGET_CONTROL,
6154 snd_hda_codec_write_cache(codec, 0x01, 0,
6155 AC_VERB_SET_GPIO_DATA, 0);
6156 snd_hda_codec_write_cache(codec, 0x0f, 0,
6157 AC_VERB_SET_PIN_WIDGET_CONTROL,
6162 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6165 if ((res >> 26) == ALC880_HP_EVENT)
6166 alc260_replacer_672v_automute(codec);
6169 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6170 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6171 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6172 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6173 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6174 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6175 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6176 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6177 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6178 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6179 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6183 /* Test configuration for debugging, modelled after the ALC880 test
6186 #ifdef CONFIG_SND_DEBUG
6187 static hda_nid_t alc260_test_dac_nids[1] = {
6190 static hda_nid_t alc260_test_adc_nids[2] = {
6193 /* For testing the ALC260, each input MUX needs its own definition since
6194 * the signal assignments are different. This assumes that the first ADC
6197 static struct hda_input_mux alc260_test_capture_sources[2] = {
6201 { "MIC1 pin", 0x0 },
6202 { "MIC2 pin", 0x1 },
6203 { "LINE1 pin", 0x2 },
6204 { "LINE2 pin", 0x3 },
6206 { "LINE-OUT pin", 0x5 },
6207 { "HP-OUT pin", 0x6 },
6213 { "MIC1 pin", 0x0 },
6214 { "MIC2 pin", 0x1 },
6215 { "LINE1 pin", 0x2 },
6216 { "LINE2 pin", 0x3 },
6219 { "LINE-OUT pin", 0x6 },
6220 { "HP-OUT pin", 0x7 },
6224 static struct snd_kcontrol_new alc260_test_mixer[] = {
6225 /* Output driver widgets */
6226 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6227 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6228 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6229 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6230 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6231 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6233 /* Modes for retasking pin widgets
6234 * Note: the ALC260 doesn't seem to act on requests to enable mic
6235 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6236 * mention this restriction. At this stage it's not clear whether
6237 * this behaviour is intentional or is a hardware bug in chip
6238 * revisions available at least up until early 2006. Therefore for
6239 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6240 * choices, but if it turns out that the lack of mic bias for these
6241 * NIDs is intentional we could change their modes from
6242 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6244 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6245 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6246 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6247 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6248 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6249 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6251 /* Loopback mixer controls */
6252 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6253 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6254 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6255 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6256 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6257 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6258 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6259 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6260 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6261 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6262 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6263 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6264 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6265 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6267 /* Controls for GPIO pins, assuming they are configured as outputs */
6268 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6269 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6270 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6271 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6273 /* Switches to allow the digital IO pins to be enabled. The datasheet
6274 * is ambigious as to which NID is which; testing on laptops which
6275 * make this output available should provide clarification.
6277 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6278 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6280 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6281 * this output to turn on an external amplifier.
6283 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6284 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6288 static struct hda_verb alc260_test_init_verbs[] = {
6289 /* Enable all GPIOs as outputs with an initial value of 0 */
6290 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6291 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6292 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6294 /* Enable retasking pins as output, initially without power amp */
6295 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6296 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6297 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6298 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6299 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6300 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6302 /* Disable digital (SPDIF) pins initially, but users can enable
6303 * them via a mixer switch. In the case of SPDIF-out, this initverb
6304 * payload also sets the generation to 0, output to be in "consumer"
6305 * PCM format, copyright asserted, no pre-emphasis and no validity
6308 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6309 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6311 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6312 * OUT1 sum bus when acting as an output.
6314 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6315 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6316 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6317 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6319 /* Start with output sum widgets muted and their output gains at min */
6320 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6321 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6322 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6323 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6324 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6325 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6326 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6327 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6328 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6330 /* Unmute retasking pin widget output buffers since the default
6331 * state appears to be output. As the pin mode is changed by the
6332 * user the pin mode control will take care of enabling the pin's
6333 * input/output buffers as needed.
6335 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6336 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6337 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6338 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6339 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6340 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6341 /* Also unmute the mono-out pin widget */
6342 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6344 /* Mute capture amp left and right */
6345 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6346 /* Set ADC connection select to match default mixer setting (mic1
6349 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6351 /* Do the same for the second ADC: mute capture input amp and
6352 * set ADC connection to mic1 pin
6354 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6355 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6357 /* Mute all inputs to mixer widget (even unconnected ones) */
6358 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6359 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6360 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6361 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6362 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6363 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6364 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6365 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6371 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6372 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6374 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6375 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6378 * for BIOS auto-configuration
6381 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6382 const char *pfx, int *vol_bits)
6385 unsigned long vol_val, sw_val;
6388 if (nid >= 0x0f && nid < 0x11) {
6389 nid_vol = nid - 0x7;
6390 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6391 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6392 } else if (nid == 0x11) {
6393 nid_vol = nid - 0x7;
6394 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6395 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6396 } else if (nid >= 0x12 && nid <= 0x15) {
6398 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6399 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6403 if (!(*vol_bits & (1 << nid_vol))) {
6404 /* first control for the volume widget */
6405 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6408 *vol_bits |= (1 << nid_vol);
6410 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6416 /* add playback controls from the parsed DAC table */
6417 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6418 const struct auto_pin_cfg *cfg)
6424 spec->multiout.num_dacs = 1;
6425 spec->multiout.dac_nids = spec->private_dac_nids;
6426 spec->multiout.dac_nids[0] = 0x02;
6428 nid = cfg->line_out_pins[0];
6431 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6433 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6437 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6442 nid = cfg->speaker_pins[0];
6444 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6449 nid = cfg->hp_pins[0];
6451 err = alc260_add_playback_controls(spec, nid, "Headphone",
6459 /* create playback/capture controls for input pins */
6460 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6461 const struct auto_pin_cfg *cfg)
6463 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6466 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6467 hda_nid_t nid, int pin_type,
6470 alc_set_pin_output(codec, nid, pin_type);
6471 /* need the manual connection? */
6473 int idx = nid - 0x12;
6474 snd_hda_codec_write(codec, idx + 0x0b, 0,
6475 AC_VERB_SET_CONNECT_SEL, sel_idx);
6479 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6481 struct alc_spec *spec = codec->spec;
6484 nid = spec->autocfg.line_out_pins[0];
6486 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6487 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6490 nid = spec->autocfg.speaker_pins[0];
6492 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6494 nid = spec->autocfg.hp_pins[0];
6496 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6499 #define ALC260_PIN_CD_NID 0x16
6500 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6502 struct alc_spec *spec = codec->spec;
6505 for (i = 0; i < AUTO_PIN_LAST; i++) {
6506 hda_nid_t nid = spec->autocfg.input_pins[i];
6508 alc_set_input_pin(codec, nid, i);
6509 if (nid != ALC260_PIN_CD_NID &&
6510 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6511 snd_hda_codec_write(codec, nid, 0,
6512 AC_VERB_SET_AMP_GAIN_MUTE,
6518 #define alc260_auto_init_input_src alc880_auto_init_input_src
6521 * generic initialization of ADC, input mixers and output mixers
6523 static struct hda_verb alc260_volume_init_verbs[] = {
6525 * Unmute ADC0-1 and set the default input to mic-in
6527 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6528 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6529 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6530 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6532 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6534 * Note: PASD motherboards uses the Line In 2 as the input for
6535 * front panel mic (mic 2)
6537 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6538 /* mute analog inputs */
6539 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6540 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6541 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6542 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6546 * Set up output mixers (0x08 - 0x0a)
6548 /* set vol=0 to output mixers */
6549 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6550 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6551 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6552 /* set up input amps for analog loopback */
6553 /* Amp Indices: DAC = 0, mixer = 1 */
6554 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6555 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6556 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6557 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6558 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6559 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6564 static int alc260_parse_auto_config(struct hda_codec *codec)
6566 struct alc_spec *spec = codec->spec;
6568 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6570 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6574 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6577 if (!spec->kctls.list)
6578 return 0; /* can't find valid BIOS pin config */
6579 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6583 spec->multiout.max_channels = 2;
6585 if (spec->autocfg.dig_outs)
6586 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6587 if (spec->kctls.list)
6588 add_mixer(spec, spec->kctls.list);
6590 add_verb(spec, alc260_volume_init_verbs);
6592 spec->num_mux_defs = 1;
6593 spec->input_mux = &spec->private_imux[0];
6595 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6600 /* additional initialization for auto-configuration model */
6601 static void alc260_auto_init(struct hda_codec *codec)
6603 struct alc_spec *spec = codec->spec;
6604 alc260_auto_init_multi_out(codec);
6605 alc260_auto_init_analog_input(codec);
6606 alc260_auto_init_input_src(codec);
6607 if (spec->unsol_event)
6608 alc_inithook(codec);
6611 #ifdef CONFIG_SND_HDA_POWER_SAVE
6612 static struct hda_amp_list alc260_loopbacks[] = {
6613 { 0x07, HDA_INPUT, 0 },
6614 { 0x07, HDA_INPUT, 1 },
6615 { 0x07, HDA_INPUT, 2 },
6616 { 0x07, HDA_INPUT, 3 },
6617 { 0x07, HDA_INPUT, 4 },
6623 * ALC260 configurations
6625 static const char *alc260_models[ALC260_MODEL_LAST] = {
6626 [ALC260_BASIC] = "basic",
6628 [ALC260_HP_3013] = "hp-3013",
6629 [ALC260_HP_DC7600] = "hp-dc7600",
6630 [ALC260_FUJITSU_S702X] = "fujitsu",
6631 [ALC260_ACER] = "acer",
6632 [ALC260_WILL] = "will",
6633 [ALC260_REPLACER_672V] = "replacer",
6634 [ALC260_FAVORIT100] = "favorit100",
6635 #ifdef CONFIG_SND_DEBUG
6636 [ALC260_TEST] = "test",
6638 [ALC260_AUTO] = "auto",
6641 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6642 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6643 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6644 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6645 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6646 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6647 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6648 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6649 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6650 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6651 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6652 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6653 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6654 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6655 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6656 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6657 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6658 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6659 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6660 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6661 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6665 static struct alc_config_preset alc260_presets[] = {
6667 .mixers = { alc260_base_output_mixer,
6668 alc260_input_mixer },
6669 .init_verbs = { alc260_init_verbs },
6670 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6671 .dac_nids = alc260_dac_nids,
6672 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6673 .adc_nids = alc260_dual_adc_nids,
6674 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6675 .channel_mode = alc260_modes,
6676 .input_mux = &alc260_capture_source,
6679 .mixers = { alc260_hp_output_mixer,
6680 alc260_input_mixer },
6681 .init_verbs = { alc260_init_verbs,
6682 alc260_hp_unsol_verbs },
6683 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6684 .dac_nids = alc260_dac_nids,
6685 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6686 .adc_nids = alc260_adc_nids_alt,
6687 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6688 .channel_mode = alc260_modes,
6689 .input_mux = &alc260_capture_source,
6690 .unsol_event = alc260_hp_unsol_event,
6691 .init_hook = alc260_hp_automute,
6693 [ALC260_HP_DC7600] = {
6694 .mixers = { alc260_hp_dc7600_mixer,
6695 alc260_input_mixer },
6696 .init_verbs = { alc260_init_verbs,
6697 alc260_hp_dc7600_verbs },
6698 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6699 .dac_nids = alc260_dac_nids,
6700 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6701 .adc_nids = alc260_adc_nids_alt,
6702 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6703 .channel_mode = alc260_modes,
6704 .input_mux = &alc260_capture_source,
6705 .unsol_event = alc260_hp_3012_unsol_event,
6706 .init_hook = alc260_hp_3012_automute,
6708 [ALC260_HP_3013] = {
6709 .mixers = { alc260_hp_3013_mixer,
6710 alc260_input_mixer },
6711 .init_verbs = { alc260_hp_3013_init_verbs,
6712 alc260_hp_3013_unsol_verbs },
6713 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6714 .dac_nids = alc260_dac_nids,
6715 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6716 .adc_nids = alc260_adc_nids_alt,
6717 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6718 .channel_mode = alc260_modes,
6719 .input_mux = &alc260_capture_source,
6720 .unsol_event = alc260_hp_3013_unsol_event,
6721 .init_hook = alc260_hp_3013_automute,
6723 [ALC260_FUJITSU_S702X] = {
6724 .mixers = { alc260_fujitsu_mixer },
6725 .init_verbs = { alc260_fujitsu_init_verbs },
6726 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6727 .dac_nids = alc260_dac_nids,
6728 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6729 .adc_nids = alc260_dual_adc_nids,
6730 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6731 .channel_mode = alc260_modes,
6732 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6733 .input_mux = alc260_fujitsu_capture_sources,
6736 .mixers = { alc260_acer_mixer },
6737 .init_verbs = { alc260_acer_init_verbs },
6738 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6739 .dac_nids = alc260_dac_nids,
6740 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6741 .adc_nids = alc260_dual_adc_nids,
6742 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6743 .channel_mode = alc260_modes,
6744 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6745 .input_mux = alc260_acer_capture_sources,
6747 [ALC260_FAVORIT100] = {
6748 .mixers = { alc260_favorit100_mixer },
6749 .init_verbs = { alc260_favorit100_init_verbs },
6750 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6751 .dac_nids = alc260_dac_nids,
6752 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6753 .adc_nids = alc260_dual_adc_nids,
6754 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6755 .channel_mode = alc260_modes,
6756 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6757 .input_mux = alc260_favorit100_capture_sources,
6760 .mixers = { alc260_will_mixer },
6761 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6762 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6763 .dac_nids = alc260_dac_nids,
6764 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6765 .adc_nids = alc260_adc_nids,
6766 .dig_out_nid = ALC260_DIGOUT_NID,
6767 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6768 .channel_mode = alc260_modes,
6769 .input_mux = &alc260_capture_source,
6771 [ALC260_REPLACER_672V] = {
6772 .mixers = { alc260_replacer_672v_mixer },
6773 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6774 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6775 .dac_nids = alc260_dac_nids,
6776 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6777 .adc_nids = alc260_adc_nids,
6778 .dig_out_nid = ALC260_DIGOUT_NID,
6779 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6780 .channel_mode = alc260_modes,
6781 .input_mux = &alc260_capture_source,
6782 .unsol_event = alc260_replacer_672v_unsol_event,
6783 .init_hook = alc260_replacer_672v_automute,
6785 #ifdef CONFIG_SND_DEBUG
6787 .mixers = { alc260_test_mixer },
6788 .init_verbs = { alc260_test_init_verbs },
6789 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6790 .dac_nids = alc260_test_dac_nids,
6791 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6792 .adc_nids = alc260_test_adc_nids,
6793 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6794 .channel_mode = alc260_modes,
6795 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6796 .input_mux = alc260_test_capture_sources,
6801 static int patch_alc260(struct hda_codec *codec)
6803 struct alc_spec *spec;
6804 int err, board_config;
6806 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6812 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6815 if (board_config < 0) {
6816 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6818 board_config = ALC260_AUTO;
6821 if (board_config == ALC260_AUTO) {
6822 /* automatic parse from the BIOS config */
6823 err = alc260_parse_auto_config(codec);
6829 "hda_codec: Cannot set up configuration "
6830 "from BIOS. Using base mode...\n");
6831 board_config = ALC260_BASIC;
6835 err = snd_hda_attach_beep_device(codec, 0x1);
6841 if (board_config != ALC260_AUTO)
6842 setup_preset(codec, &alc260_presets[board_config]);
6844 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6845 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6847 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6848 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6850 if (!spec->adc_nids && spec->input_mux) {
6851 /* check whether NID 0x04 is valid */
6852 unsigned int wcap = get_wcaps(codec, 0x04);
6853 wcap = get_wcaps_type(wcap);
6855 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6856 spec->adc_nids = alc260_adc_nids_alt;
6857 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6859 spec->adc_nids = alc260_adc_nids;
6860 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6863 set_capture_mixer(codec);
6864 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6866 spec->vmaster_nid = 0x08;
6868 codec->patch_ops = alc_patch_ops;
6869 if (board_config == ALC260_AUTO)
6870 spec->init_hook = alc260_auto_init;
6871 #ifdef CONFIG_SND_HDA_POWER_SAVE
6872 if (!spec->loopback.amplist)
6873 spec->loopback.amplist = alc260_loopbacks;
6881 * ALC882/883/885/888/889 support
6883 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6884 * configuration. Each pin widget can choose any input DACs and a mixer.
6885 * Each ADC is connected from a mixer of all inputs. This makes possible
6886 * 6-channel independent captures.
6888 * In addition, an independent DAC for the multi-playback (not used in this
6891 #define ALC882_DIGOUT_NID 0x06
6892 #define ALC882_DIGIN_NID 0x0a
6893 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6894 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6895 #define ALC1200_DIGOUT_NID 0x10
6898 static struct hda_channel_mode alc882_ch_modes[1] = {
6903 static hda_nid_t alc882_dac_nids[4] = {
6904 /* front, rear, clfe, rear_surr */
6905 0x02, 0x03, 0x04, 0x05
6907 #define alc883_dac_nids alc882_dac_nids
6910 #define alc882_adc_nids alc880_adc_nids
6911 #define alc882_adc_nids_alt alc880_adc_nids_alt
6912 #define alc883_adc_nids alc882_adc_nids_alt
6913 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6914 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6915 #define alc889_adc_nids alc880_adc_nids
6917 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6918 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6919 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6920 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6921 #define alc889_capsrc_nids alc882_capsrc_nids
6924 /* FIXME: should be a matrix-type input source selection */
6926 static struct hda_input_mux alc882_capture_source = {
6930 { "Front Mic", 0x1 },
6936 #define alc883_capture_source alc882_capture_source
6938 static struct hda_input_mux alc889_capture_source = {
6941 { "Front Mic", 0x0 },
6947 static struct hda_input_mux mb5_capture_source = {
6956 static struct hda_input_mux macmini3_capture_source = {
6964 static struct hda_input_mux alc883_3stack_6ch_intel = {
6968 { "Front Mic", 0x0 },
6974 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6982 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6992 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7000 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7004 { "Front Mic", 0x1 },
7009 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7017 static struct hda_input_mux alc889A_mb31_capture_source = {
7021 /* Front Mic (0x01) unused */
7023 /* Line 2 (0x03) unused */
7024 /* CD (0x04) unused? */
7028 static struct hda_input_mux alc889A_imac91_capture_source = {
7032 { "Line", 0x2 }, /* Not sure! */
7039 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7046 static struct hda_verb alc882_3ST_ch2_init[] = {
7047 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7048 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7049 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7050 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7057 static struct hda_verb alc882_3ST_ch4_init[] = {
7058 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7059 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7060 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7061 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7062 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7069 static struct hda_verb alc882_3ST_ch6_init[] = {
7070 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7071 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7072 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7073 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7074 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7075 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7079 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7080 { 2, alc882_3ST_ch2_init },
7081 { 4, alc882_3ST_ch4_init },
7082 { 6, alc882_3ST_ch6_init },
7085 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7090 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7091 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7092 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7093 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7094 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7095 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7102 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7103 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7104 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7105 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7106 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7107 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7108 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7115 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7116 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7117 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7118 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7119 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7120 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7121 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7122 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7126 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7127 { 2, alc883_3ST_ch2_clevo_init },
7128 { 4, alc883_3ST_ch4_clevo_init },
7129 { 6, alc883_3ST_ch6_clevo_init },
7136 static struct hda_verb alc882_sixstack_ch6_init[] = {
7137 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7138 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7139 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7140 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7147 static struct hda_verb alc882_sixstack_ch8_init[] = {
7148 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7149 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7150 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7151 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7155 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7156 { 6, alc882_sixstack_ch6_init },
7157 { 8, alc882_sixstack_ch8_init },
7161 /* Macbook Air 2,1 */
7163 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7168 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7174 static struct hda_verb alc885_mbp_ch2_init[] = {
7175 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7176 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7177 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7184 static struct hda_verb alc885_mbp_ch4_init[] = {
7185 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7186 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7187 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7188 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7189 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7193 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7194 { 2, alc885_mbp_ch2_init },
7195 { 4, alc885_mbp_ch4_init },
7200 * Speakers/Woofer/HP = Front
7203 static struct hda_verb alc885_mb5_ch2_init[] = {
7204 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7205 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7211 * Speakers/HP = Front
7215 static struct hda_verb alc885_mb5_ch6_init[] = {
7216 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7217 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7218 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7222 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7223 { 2, alc885_mb5_ch2_init },
7224 { 6, alc885_mb5_ch6_init },
7227 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7232 static struct hda_verb alc883_4ST_ch2_init[] = {
7233 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7234 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7235 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7236 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7237 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7238 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7245 static struct hda_verb alc883_4ST_ch4_init[] = {
7246 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7247 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7248 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7249 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7250 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7251 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7252 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7259 static struct hda_verb alc883_4ST_ch6_init[] = {
7260 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7261 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7262 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7263 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7264 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7265 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7266 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7267 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7274 static struct hda_verb alc883_4ST_ch8_init[] = {
7275 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7276 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7277 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7278 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7279 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7280 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7281 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7282 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7283 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7287 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7288 { 2, alc883_4ST_ch2_init },
7289 { 4, alc883_4ST_ch4_init },
7290 { 6, alc883_4ST_ch6_init },
7291 { 8, alc883_4ST_ch8_init },
7298 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7299 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7300 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7301 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7302 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7309 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7310 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7311 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7312 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7313 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7314 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7321 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7322 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7323 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7324 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7325 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7326 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7327 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7331 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7332 { 2, alc883_3ST_ch2_intel_init },
7333 { 4, alc883_3ST_ch4_intel_init },
7334 { 6, alc883_3ST_ch6_intel_init },
7340 static struct hda_verb alc889_ch2_intel_init[] = {
7341 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7342 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7343 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7344 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7345 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7346 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7353 static struct hda_verb alc889_ch6_intel_init[] = {
7354 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7355 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7356 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7357 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7358 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7359 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7366 static struct hda_verb alc889_ch8_intel_init[] = {
7367 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7368 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7369 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7370 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7371 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7372 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7373 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7377 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7378 { 2, alc889_ch2_intel_init },
7379 { 6, alc889_ch6_intel_init },
7380 { 8, alc889_ch8_intel_init },
7386 static struct hda_verb alc883_sixstack_ch6_init[] = {
7387 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7388 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7389 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7390 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7397 static struct hda_verb alc883_sixstack_ch8_init[] = {
7398 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7399 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7400 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7401 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7405 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7406 { 6, alc883_sixstack_ch6_init },
7407 { 8, alc883_sixstack_ch8_init },
7411 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7412 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7414 static struct snd_kcontrol_new alc882_base_mixer[] = {
7415 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7416 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7417 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7418 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7419 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7420 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7421 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7422 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7423 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7424 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7425 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7426 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7427 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7428 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7429 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7430 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7431 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7432 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7433 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7434 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7435 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7439 /* Macbook Air 2,1 same control for HP and internal Speaker */
7441 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7442 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7443 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7448 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7449 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7450 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7451 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7452 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7453 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7454 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7455 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7456 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7457 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7458 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7459 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7463 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7464 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7465 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7466 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7467 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7468 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7469 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7470 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7471 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7472 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7473 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7474 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7475 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7476 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7477 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7481 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7482 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7483 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7484 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7485 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7486 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7487 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7488 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7489 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7490 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7491 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7492 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7496 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7497 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7498 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7503 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7504 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7505 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7506 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7507 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7508 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7509 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7510 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7511 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7512 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7516 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7517 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7518 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7519 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7520 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7521 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7522 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7523 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7524 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7525 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7526 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7527 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7528 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7529 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7533 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7534 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7536 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7537 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7538 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7539 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7540 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7541 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7542 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7543 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7544 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7545 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7546 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7547 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7548 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7549 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7553 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7554 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7555 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7556 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7557 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7558 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7559 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7560 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7561 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7562 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7563 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7567 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7569 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7570 .name = "Channel Mode",
7571 .info = alc_ch_mode_info,
7572 .get = alc_ch_mode_get,
7573 .put = alc_ch_mode_put,
7578 static struct hda_verb alc882_base_init_verbs[] = {
7579 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7580 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7583 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7586 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7587 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7589 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7590 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7592 /* Front Pin: output 0 (0x0c) */
7593 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7594 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7595 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7596 /* Rear Pin: output 1 (0x0d) */
7597 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7598 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7599 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7600 /* CLFE Pin: output 2 (0x0e) */
7601 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7602 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7603 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7604 /* Side Pin: output 3 (0x0f) */
7605 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7606 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7607 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7608 /* Mic (rear) pin: input vref at 80% */
7609 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7610 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7611 /* Front Mic pin: input vref at 80% */
7612 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7613 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7614 /* Line In pin: input */
7615 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7616 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7617 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7618 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7619 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7620 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7621 /* CD pin widget for input */
7622 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7624 /* FIXME: use matrix-type input source selection */
7625 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7627 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7629 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7630 /* ADC2: mute amp left and right */
7631 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7632 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7633 /* ADC3: mute amp left and right */
7634 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7635 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7640 static struct hda_verb alc882_adc1_init_verbs[] = {
7641 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7642 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7643 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7644 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7645 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7646 /* ADC1: mute amp left and right */
7647 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7648 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7652 static struct hda_verb alc882_eapd_verbs[] = {
7653 /* change to EAPD mode */
7654 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7655 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7659 static struct hda_verb alc889_eapd_verbs[] = {
7660 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7661 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7665 static struct hda_verb alc_hp15_unsol_verbs[] = {
7666 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7667 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7671 static struct hda_verb alc885_init_verbs[] = {
7672 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7673 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7674 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7676 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7677 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7679 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7680 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7682 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7683 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7685 /* Front HP Pin: output 0 (0x0c) */
7686 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7687 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7688 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7689 /* Front Pin: output 0 (0x0c) */
7690 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7691 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7692 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7693 /* Rear Pin: output 1 (0x0d) */
7694 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7695 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7696 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7697 /* CLFE Pin: output 2 (0x0e) */
7698 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7699 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7700 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7701 /* Side Pin: output 3 (0x0f) */
7702 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7703 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7704 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7705 /* Mic (rear) pin: input vref at 80% */
7706 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7707 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7708 /* Front Mic pin: input vref at 80% */
7709 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7710 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7711 /* Line In pin: input */
7712 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7713 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7715 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7717 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7719 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7721 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7722 /* ADC2: mute amp left and right */
7723 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7724 /* ADC3: mute amp left and right */
7725 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7730 static struct hda_verb alc885_init_input_verbs[] = {
7731 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7732 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7733 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7738 /* Unmute Selector 24h and set the default input to front mic */
7739 static struct hda_verb alc889_init_input_verbs[] = {
7740 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7741 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7746 #define alc883_init_verbs alc882_base_init_verbs
7749 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7750 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7751 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7752 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7753 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7754 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7755 /* FIXME: this looks suspicious...
7756 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7757 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7762 static struct hda_verb alc882_macpro_init_verbs[] = {
7763 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7764 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7765 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7766 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7767 /* Front Pin: output 0 (0x0c) */
7768 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7769 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7770 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7771 /* Front Mic pin: input vref at 80% */
7772 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7773 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7774 /* Speaker: output */
7775 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7776 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7777 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7778 /* Headphone output (output 0 - 0x0c) */
7779 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7780 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7781 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7783 /* FIXME: use matrix-type input source selection */
7784 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7785 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7786 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7787 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7788 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7789 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7791 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7792 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7793 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7794 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7796 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7797 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7798 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7799 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7800 /* ADC1: mute amp left and right */
7801 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7802 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7803 /* ADC2: mute amp left and right */
7804 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7805 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7806 /* ADC3: mute amp left and right */
7807 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7808 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7814 static struct hda_verb alc885_mb5_init_verbs[] = {
7816 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7817 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7818 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7819 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7821 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7823 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7824 /* Surround mixer */
7825 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7826 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7827 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7829 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7830 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7831 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7833 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7834 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7835 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7836 /* Front Pin (0x0c) */
7837 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7838 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7839 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7840 /* LFE Pin (0x0e) */
7841 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7842 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7843 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7845 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7846 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7847 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7848 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7849 /* Front Mic pin: input vref at 80% */
7850 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7851 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7856 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7857 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7858 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7859 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7864 static struct hda_verb alc885_macmini3_init_verbs[] = {
7866 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7867 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7868 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7869 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7871 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7872 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7873 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7874 /* Surround mixer */
7875 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7876 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7877 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7879 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7881 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7883 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7884 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7885 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7886 /* Front Pin (0x0c) */
7887 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7888 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7889 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7890 /* LFE Pin (0x0e) */
7891 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7892 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7893 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7895 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7896 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7897 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7898 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7900 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7901 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7903 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7904 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7905 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7906 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7911 static struct hda_verb alc885_mba21_init_verbs[] = {
7912 /*Internal and HP Speaker Mixer*/
7913 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7914 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7915 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7916 /*Internal Speaker Pin (0x0c)*/
7917 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
7918 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7919 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7920 /* HP Pin: output 0 (0x0e) */
7921 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7922 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7923 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7924 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
7925 /* Line in (is hp when jack connected)*/
7926 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
7927 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7933 /* Macbook Pro rev3 */
7934 static struct hda_verb alc885_mbp3_init_verbs[] = {
7935 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7936 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7938 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7940 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7941 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7942 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7944 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7945 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7946 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7947 /* Front Pin: output 0 (0x0c) */
7948 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7949 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7950 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7951 /* HP Pin: output 0 (0x0e) */
7952 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7953 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7954 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7955 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7956 /* Mic (rear) pin: input vref at 80% */
7957 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7958 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7959 /* Front Mic pin: input vref at 80% */
7960 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7961 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7962 /* Line In pin: use output 1 when in LineOut mode */
7963 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7964 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7965 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7967 /* FIXME: use matrix-type input source selection */
7968 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7969 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7970 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7971 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7972 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7973 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7975 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7976 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7977 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7978 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7980 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7981 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7982 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7983 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7984 /* ADC1: mute amp left and right */
7985 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7986 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7987 /* ADC2: mute amp left and right */
7988 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7989 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7990 /* ADC3: mute amp left and right */
7991 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7992 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7998 static struct hda_verb alc885_imac91_init_verbs[] = {
7999 /* Internal Speaker Pin (0x0c) */
8000 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8001 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8002 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8003 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8004 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8005 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8008 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8009 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8010 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8012 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8013 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8014 /* Front Mic pin: input vref at 80% */
8015 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8016 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8018 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8019 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8020 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8021 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8024 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8025 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8026 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8027 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8028 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8030 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8031 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8032 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8035 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8040 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8041 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8042 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8043 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8044 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8045 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8046 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8047 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8048 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8052 /* iMac 24 mixer. */
8053 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8054 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8055 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8059 /* iMac 24 init verbs. */
8060 static struct hda_verb alc885_imac24_init_verbs[] = {
8061 /* Internal speakers: output 0 (0x0c) */
8062 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8063 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8064 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8065 /* Internal speakers: output 0 (0x0c) */
8066 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8067 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8068 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8069 /* Headphone: output 0 (0x0c) */
8070 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8071 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8072 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8073 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8074 /* Front Mic: input vref at 80% */
8075 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8076 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8080 /* Toggle speaker-output according to the hp-jack state */
8081 static void alc885_imac24_setup(struct hda_codec *codec)
8083 struct alc_spec *spec = codec->spec;
8085 spec->autocfg.hp_pins[0] = 0x14;
8086 spec->autocfg.speaker_pins[0] = 0x18;
8087 spec->autocfg.speaker_pins[1] = 0x1a;
8090 #define alc885_mb5_setup alc885_imac24_setup
8091 #define alc885_macmini3_setup alc885_imac24_setup
8093 /* Macbook Air 2,1 */
8094 static void alc885_mba21_setup(struct hda_codec *codec)
8096 struct alc_spec *spec = codec->spec;
8098 spec->autocfg.hp_pins[0] = 0x14;
8099 spec->autocfg.speaker_pins[0] = 0x18;
8104 static void alc885_mbp3_setup(struct hda_codec *codec)
8106 struct alc_spec *spec = codec->spec;
8108 spec->autocfg.hp_pins[0] = 0x15;
8109 spec->autocfg.speaker_pins[0] = 0x14;
8112 static void alc885_imac91_setup(struct hda_codec *codec)
8114 struct alc_spec *spec = codec->spec;
8116 spec->autocfg.hp_pins[0] = 0x14;
8117 spec->autocfg.speaker_pins[0] = 0x18;
8118 spec->autocfg.speaker_pins[1] = 0x1a;
8121 static struct hda_verb alc882_targa_verbs[] = {
8122 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8123 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8125 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8126 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8128 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8129 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8130 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8132 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8136 /* toggle speaker-output according to the hp-jack state */
8137 static void alc882_targa_automute(struct hda_codec *codec)
8139 struct alc_spec *spec = codec->spec;
8140 alc_automute_amp(codec);
8141 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8142 spec->jack_present ? 1 : 3);
8145 static void alc882_targa_setup(struct hda_codec *codec)
8147 struct alc_spec *spec = codec->spec;
8149 spec->autocfg.hp_pins[0] = 0x14;
8150 spec->autocfg.speaker_pins[0] = 0x1b;
8153 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8155 if ((res >> 26) == ALC880_HP_EVENT)
8156 alc882_targa_automute(codec);
8159 static struct hda_verb alc882_asus_a7j_verbs[] = {
8160 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8161 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8163 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8164 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8165 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8167 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8168 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8169 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8171 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8172 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8173 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8177 static struct hda_verb alc882_asus_a7m_verbs[] = {
8178 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8179 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8181 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8182 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8183 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8185 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8186 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8187 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8189 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8190 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8191 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8195 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8197 unsigned int gpiostate, gpiomask, gpiodir;
8199 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8200 AC_VERB_GET_GPIO_DATA, 0);
8203 gpiostate |= (1 << pin);
8205 gpiostate &= ~(1 << pin);
8207 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8208 AC_VERB_GET_GPIO_MASK, 0);
8209 gpiomask |= (1 << pin);
8211 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8212 AC_VERB_GET_GPIO_DIRECTION, 0);
8213 gpiodir |= (1 << pin);
8216 snd_hda_codec_write(codec, codec->afg, 0,
8217 AC_VERB_SET_GPIO_MASK, gpiomask);
8218 snd_hda_codec_write(codec, codec->afg, 0,
8219 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8223 snd_hda_codec_write(codec, codec->afg, 0,
8224 AC_VERB_SET_GPIO_DATA, gpiostate);
8227 /* set up GPIO at initialization */
8228 static void alc885_macpro_init_hook(struct hda_codec *codec)
8230 alc882_gpio_mute(codec, 0, 0);
8231 alc882_gpio_mute(codec, 1, 0);
8234 /* set up GPIO and update auto-muting at initialization */
8235 static void alc885_imac24_init_hook(struct hda_codec *codec)
8237 alc885_macpro_init_hook(codec);
8238 alc_automute_amp(codec);
8242 * generic initialization of ADC, input mixers and output mixers
8244 static struct hda_verb alc883_auto_init_verbs[] = {
8246 * Unmute ADC0-2 and set the default input to mic-in
8248 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8249 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8250 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8251 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8254 * Set up output mixers (0x0c - 0x0f)
8256 /* set vol=0 to output mixers */
8257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8258 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8259 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8260 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8261 /* set up input amps for analog loopback */
8262 /* Amp Indices: DAC = 0, mixer = 1 */
8263 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8264 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8265 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8266 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8267 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8268 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8269 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8270 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8271 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8272 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8274 /* FIXME: use matrix-type input source selection */
8275 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8277 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8279 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8283 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8284 static struct hda_verb alc889A_mb31_ch2_init[] = {
8285 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8286 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8287 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8288 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8292 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8293 static struct hda_verb alc889A_mb31_ch4_init[] = {
8294 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8295 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8296 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8297 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8301 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8302 static struct hda_verb alc889A_mb31_ch5_init[] = {
8303 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8304 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8305 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8306 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8310 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8311 static struct hda_verb alc889A_mb31_ch6_init[] = {
8312 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8313 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8314 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8315 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8319 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8320 { 2, alc889A_mb31_ch2_init },
8321 { 4, alc889A_mb31_ch4_init },
8322 { 5, alc889A_mb31_ch5_init },
8323 { 6, alc889A_mb31_ch6_init },
8326 static struct hda_verb alc883_medion_eapd_verbs[] = {
8327 /* eanable EAPD on medion laptop */
8328 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8329 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8333 #define alc883_base_mixer alc882_base_mixer
8335 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8336 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8337 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8338 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8339 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8340 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8341 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8342 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8343 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8344 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8345 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8346 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8347 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8348 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8352 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8353 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8354 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8355 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8356 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8357 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8358 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8359 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8360 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8361 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8362 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8366 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8367 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8368 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8369 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8370 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8371 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8372 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8373 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8374 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8375 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8376 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8380 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8381 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8382 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8383 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8384 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8385 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8386 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8387 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8388 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8389 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8391 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8392 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8393 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8397 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8398 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8399 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8400 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8401 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8402 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8403 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8404 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8405 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8406 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8407 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8408 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8409 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8410 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8411 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8412 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8413 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8414 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8415 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8416 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8420 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8421 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8422 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8423 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8424 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8425 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8427 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8428 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8429 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8430 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8431 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8432 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8433 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8434 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8435 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8436 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8437 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8438 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8439 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8440 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8444 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8445 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8446 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8447 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8448 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8449 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8451 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8452 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8453 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8454 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8455 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8456 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8457 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8458 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8459 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8460 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8461 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8462 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8463 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8464 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8468 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8469 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8470 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8471 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8472 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8473 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8474 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8475 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8476 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8477 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8478 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8479 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8480 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8481 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8482 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8483 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8484 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8485 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8486 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8487 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8491 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8492 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8493 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8494 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8495 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8496 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8497 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8498 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8499 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8500 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8501 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8502 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8503 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8504 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8505 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8506 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8507 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8508 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8512 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8513 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8514 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8515 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8516 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8517 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8518 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8519 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8520 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8521 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8522 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8523 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8524 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8528 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8529 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8530 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8531 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8532 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8533 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8537 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8538 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8539 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8540 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8541 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8542 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8543 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8544 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8545 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8549 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8550 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8551 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8552 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8553 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8554 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8555 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8556 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8557 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8558 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8562 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8563 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8564 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8565 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8566 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8567 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8568 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8569 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8570 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8571 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8575 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
8576 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8577 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8578 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8579 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
8580 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
8581 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
8585 static struct hda_verb alc883_medion_wim2160_verbs[] = {
8586 /* Unmute front mixer */
8587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8588 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8590 /* Set speaker pin to front mixer */
8591 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8593 /* Init headphone pin */
8594 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8595 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8596 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8597 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8602 /* toggle speaker-output according to the hp-jack state */
8603 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
8605 struct alc_spec *spec = codec->spec;
8607 spec->autocfg.hp_pins[0] = 0x1a;
8608 spec->autocfg.speaker_pins[0] = 0x15;
8611 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8612 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8613 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8614 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8615 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8616 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8617 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8618 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8619 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8623 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8624 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8625 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8626 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8627 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8628 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8629 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8630 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8631 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8632 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8636 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8637 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8638 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8639 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8640 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8641 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8642 0x0d, 1, 0x0, HDA_OUTPUT),
8643 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8644 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8645 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8646 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8647 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8648 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8649 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8650 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8651 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8652 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8653 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8654 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8655 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8656 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8657 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8661 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8663 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8664 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8665 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8666 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8667 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8669 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8670 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8671 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8672 /* Output switches */
8673 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8674 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8675 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8677 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8678 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8680 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8681 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8682 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8683 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8687 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8688 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8689 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8690 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8691 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8692 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8693 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8697 static struct hda_bind_ctls alc883_bind_cap_vol = {
8698 .ops = &snd_hda_bind_vol,
8700 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8701 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8706 static struct hda_bind_ctls alc883_bind_cap_switch = {
8707 .ops = &snd_hda_bind_sw,
8709 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8710 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8715 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8716 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8717 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8718 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8719 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8720 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8721 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8722 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8723 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8727 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8728 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8729 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8731 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8732 /* .name = "Capture Source", */
8733 .name = "Input Source",
8735 .info = alc_mux_enum_info,
8736 .get = alc_mux_enum_get,
8737 .put = alc_mux_enum_put,
8742 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8744 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8745 .name = "Channel Mode",
8746 .info = alc_ch_mode_info,
8747 .get = alc_ch_mode_get,
8748 .put = alc_ch_mode_put,
8753 /* toggle speaker-output according to the hp-jack state */
8754 static void alc883_mitac_setup(struct hda_codec *codec)
8756 struct alc_spec *spec = codec->spec;
8758 spec->autocfg.hp_pins[0] = 0x15;
8759 spec->autocfg.speaker_pins[0] = 0x14;
8760 spec->autocfg.speaker_pins[1] = 0x17;
8763 /* auto-toggle front mic */
8765 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8767 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8769 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8773 static struct hda_verb alc883_mitac_verbs[] = {
8775 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8776 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8778 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8779 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8781 /* enable unsolicited event */
8782 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8783 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8788 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8790 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8791 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8793 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8795 /* enable unsolicited event */
8797 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8798 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8804 static struct hda_verb alc883_clevo_m720_verbs[] = {
8806 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8807 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8809 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8810 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8812 /* enable unsolicited event */
8813 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8814 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8819 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8821 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8822 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8824 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8825 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8827 /* enable unsolicited event */
8828 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8833 static struct hda_verb alc883_targa_verbs[] = {
8834 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8835 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8837 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8838 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8840 /* Connect Line-Out side jack (SPDIF) to Side */
8841 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8842 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8843 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8844 /* Connect Mic jack to CLFE */
8845 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8846 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8847 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8848 /* Connect Line-in jack to Surround */
8849 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8850 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8851 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8852 /* Connect HP out jack to Front */
8853 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8854 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8855 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8857 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8862 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8863 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8864 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8865 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8869 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8870 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8871 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8872 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8877 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8878 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8879 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8880 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8881 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8882 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8886 static struct hda_verb alc883_haier_w66_verbs[] = {
8887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8890 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8892 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8893 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8894 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8895 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8899 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8900 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8902 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8903 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8904 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8905 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8906 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8907 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8911 static struct hda_verb alc888_6st_dell_verbs[] = {
8912 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8916 static struct hda_verb alc883_vaiott_verbs[] = {
8918 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8919 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8921 /* enable unsolicited event */
8922 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8927 static void alc888_3st_hp_setup(struct hda_codec *codec)
8929 struct alc_spec *spec = codec->spec;
8931 spec->autocfg.hp_pins[0] = 0x1b;
8932 spec->autocfg.speaker_pins[0] = 0x14;
8933 spec->autocfg.speaker_pins[1] = 0x16;
8934 spec->autocfg.speaker_pins[2] = 0x18;
8937 static struct hda_verb alc888_3st_hp_verbs[] = {
8938 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8939 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8940 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8941 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8948 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8949 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8950 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8951 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8952 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8959 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8960 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8961 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8962 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8963 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8964 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8971 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8972 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8973 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8974 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8975 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8976 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8977 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8981 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8982 { 2, alc888_3st_hp_2ch_init },
8983 { 4, alc888_3st_hp_4ch_init },
8984 { 6, alc888_3st_hp_6ch_init },
8987 /* toggle front-jack and RCA according to the hp-jack state */
8988 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8990 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8992 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8993 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8994 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8995 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8998 /* toggle RCA according to the front-jack state */
8999 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9001 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9003 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9004 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9007 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9010 if ((res >> 26) == ALC880_HP_EVENT)
9011 alc888_lenovo_ms7195_front_automute(codec);
9012 if ((res >> 26) == ALC880_FRONT_EVENT)
9013 alc888_lenovo_ms7195_rca_automute(codec);
9016 static struct hda_verb alc883_medion_md2_verbs[] = {
9017 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9018 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9020 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9022 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9026 /* toggle speaker-output according to the hp-jack state */
9027 static void alc883_medion_md2_setup(struct hda_codec *codec)
9029 struct alc_spec *spec = codec->spec;
9031 spec->autocfg.hp_pins[0] = 0x14;
9032 spec->autocfg.speaker_pins[0] = 0x15;
9035 /* toggle speaker-output according to the hp-jack state */
9036 #define alc883_targa_init_hook alc882_targa_init_hook
9037 #define alc883_targa_unsol_event alc882_targa_unsol_event
9039 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
9041 unsigned int present;
9043 present = snd_hda_jack_detect(codec, 0x18);
9044 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
9045 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9048 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9050 struct alc_spec *spec = codec->spec;
9052 spec->autocfg.hp_pins[0] = 0x15;
9053 spec->autocfg.speaker_pins[0] = 0x14;
9056 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9058 alc_automute_amp(codec);
9059 alc883_clevo_m720_mic_automute(codec);
9062 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9065 switch (res >> 26) {
9066 case ALC880_MIC_EVENT:
9067 alc883_clevo_m720_mic_automute(codec);
9070 alc_automute_amp_unsol_event(codec, res);
9075 /* toggle speaker-output according to the hp-jack state */
9076 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9078 struct alc_spec *spec = codec->spec;
9080 spec->autocfg.hp_pins[0] = 0x14;
9081 spec->autocfg.speaker_pins[0] = 0x15;
9084 static void alc883_haier_w66_setup(struct hda_codec *codec)
9086 struct alc_spec *spec = codec->spec;
9088 spec->autocfg.hp_pins[0] = 0x1b;
9089 spec->autocfg.speaker_pins[0] = 0x14;
9092 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9094 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9096 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9097 HDA_AMP_MUTE, bits);
9100 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9102 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9104 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9105 HDA_AMP_MUTE, bits);
9106 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9107 HDA_AMP_MUTE, bits);
9110 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9113 if ((res >> 26) == ALC880_HP_EVENT)
9114 alc883_lenovo_101e_all_automute(codec);
9115 if ((res >> 26) == ALC880_FRONT_EVENT)
9116 alc883_lenovo_101e_ispeaker_automute(codec);
9119 /* toggle speaker-output according to the hp-jack state */
9120 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9122 struct alc_spec *spec = codec->spec;
9124 spec->autocfg.hp_pins[0] = 0x14;
9125 spec->autocfg.speaker_pins[0] = 0x15;
9126 spec->autocfg.speaker_pins[1] = 0x16;
9129 static struct hda_verb alc883_acer_eapd_verbs[] = {
9130 /* HP Pin: output 0 (0x0c) */
9131 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9132 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9133 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9134 /* Front Pin: output 0 (0x0c) */
9135 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9136 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9137 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9138 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9139 /* eanable EAPD on medion laptop */
9140 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9141 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9142 /* enable unsolicited event */
9143 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9147 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9148 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9149 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9150 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9154 static void alc888_6st_dell_setup(struct hda_codec *codec)
9156 struct alc_spec *spec = codec->spec;
9158 spec->autocfg.hp_pins[0] = 0x1b;
9159 spec->autocfg.speaker_pins[0] = 0x14;
9160 spec->autocfg.speaker_pins[1] = 0x15;
9161 spec->autocfg.speaker_pins[2] = 0x16;
9162 spec->autocfg.speaker_pins[3] = 0x17;
9165 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9167 struct alc_spec *spec = codec->spec;
9169 spec->autocfg.hp_pins[0] = 0x1b;
9170 spec->autocfg.speaker_pins[0] = 0x14;
9171 spec->autocfg.speaker_pins[1] = 0x15;
9172 spec->autocfg.speaker_pins[2] = 0x16;
9173 spec->autocfg.speaker_pins[3] = 0x17;
9174 spec->autocfg.speaker_pins[4] = 0x1a;
9177 static void alc883_vaiott_setup(struct hda_codec *codec)
9179 struct alc_spec *spec = codec->spec;
9181 spec->autocfg.hp_pins[0] = 0x15;
9182 spec->autocfg.speaker_pins[0] = 0x14;
9183 spec->autocfg.speaker_pins[1] = 0x17;
9186 static struct hda_verb alc888_asus_m90v_verbs[] = {
9187 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9188 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9189 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9190 /* enable unsolicited event */
9191 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9192 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9196 static void alc883_mode2_setup(struct hda_codec *codec)
9198 struct alc_spec *spec = codec->spec;
9200 spec->autocfg.hp_pins[0] = 0x1b;
9201 spec->autocfg.speaker_pins[0] = 0x14;
9202 spec->autocfg.speaker_pins[1] = 0x15;
9203 spec->autocfg.speaker_pins[2] = 0x16;
9204 spec->ext_mic.pin = 0x18;
9205 spec->int_mic.pin = 0x19;
9206 spec->ext_mic.mux_idx = 0;
9207 spec->int_mic.mux_idx = 1;
9211 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9212 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9213 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9214 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9215 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9216 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9217 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9218 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9219 /* enable unsolicited event */
9220 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9224 static void alc883_eee1601_inithook(struct hda_codec *codec)
9226 struct alc_spec *spec = codec->spec;
9228 spec->autocfg.hp_pins[0] = 0x14;
9229 spec->autocfg.speaker_pins[0] = 0x1b;
9230 alc_automute_pin(codec);
9233 static struct hda_verb alc889A_mb31_verbs[] = {
9234 /* Init rear pin (used as headphone output) */
9235 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9236 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9237 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9238 /* Init line pin (used as output in 4ch and 6ch mode) */
9239 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9240 /* Init line 2 pin (used as headphone out by default) */
9241 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9242 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9246 /* Mute speakers according to the headphone jack state */
9247 static void alc889A_mb31_automute(struct hda_codec *codec)
9249 unsigned int present;
9251 /* Mute only in 2ch or 4ch mode */
9252 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9254 present = snd_hda_jack_detect(codec, 0x15);
9255 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9256 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9257 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9258 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9262 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9264 if ((res >> 26) == ALC880_HP_EVENT)
9265 alc889A_mb31_automute(codec);
9269 #ifdef CONFIG_SND_HDA_POWER_SAVE
9270 #define alc882_loopbacks alc880_loopbacks
9273 /* pcm configuration: identical with ALC880 */
9274 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9275 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9276 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9277 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9279 static hda_nid_t alc883_slave_dig_outs[] = {
9280 ALC1200_DIGOUT_NID, 0,
9283 static hda_nid_t alc1200_slave_dig_outs[] = {
9284 ALC883_DIGOUT_NID, 0,
9288 * configuration and preset
9290 static const char *alc882_models[ALC882_MODEL_LAST] = {
9291 [ALC882_3ST_DIG] = "3stack-dig",
9292 [ALC882_6ST_DIG] = "6stack-dig",
9293 [ALC882_ARIMA] = "arima",
9294 [ALC882_W2JC] = "w2jc",
9295 [ALC882_TARGA] = "targa",
9296 [ALC882_ASUS_A7J] = "asus-a7j",
9297 [ALC882_ASUS_A7M] = "asus-a7m",
9298 [ALC885_MACPRO] = "macpro",
9299 [ALC885_MB5] = "mb5",
9300 [ALC885_MACMINI3] = "macmini3",
9301 [ALC885_MBA21] = "mba21",
9302 [ALC885_MBP3] = "mbp3",
9303 [ALC885_IMAC24] = "imac24",
9304 [ALC885_IMAC91] = "imac91",
9305 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9306 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9307 [ALC883_3ST_6ch] = "3stack-6ch",
9308 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9309 [ALC883_TARGA_DIG] = "targa-dig",
9310 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9311 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9312 [ALC883_ACER] = "acer",
9313 [ALC883_ACER_ASPIRE] = "acer-aspire",
9314 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9315 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9316 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9317 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9318 [ALC883_MEDION] = "medion",
9319 [ALC883_MEDION_MD2] = "medion-md2",
9320 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9321 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9322 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9323 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9324 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9325 [ALC888_LENOVO_SKY] = "lenovo-sky",
9326 [ALC883_HAIER_W66] = "haier-w66",
9327 [ALC888_3ST_HP] = "3stack-hp",
9328 [ALC888_6ST_DELL] = "6stack-dell",
9329 [ALC883_MITAC] = "mitac",
9330 [ALC883_CLEVO_M540R] = "clevo-m540r",
9331 [ALC883_CLEVO_M720] = "clevo-m720",
9332 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9333 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9334 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9335 [ALC889A_INTEL] = "intel-alc889a",
9336 [ALC889_INTEL] = "intel-x58",
9337 [ALC1200_ASUS_P5Q] = "asus-p5q",
9338 [ALC889A_MB31] = "mb31",
9339 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9340 [ALC882_AUTO] = "auto",
9343 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9344 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9346 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9347 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9348 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9349 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9350 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9351 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9352 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9353 ALC888_ACER_ASPIRE_4930G),
9354 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9355 ALC888_ACER_ASPIRE_4930G),
9356 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9357 ALC888_ACER_ASPIRE_8930G),
9358 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9359 ALC888_ACER_ASPIRE_8930G),
9360 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9361 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9362 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9363 ALC888_ACER_ASPIRE_6530G),
9364 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9365 ALC888_ACER_ASPIRE_6530G),
9366 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9367 ALC888_ACER_ASPIRE_7730G),
9368 /* default Acer -- disabled as it causes more problems.
9369 * model=auto should work fine now
9371 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9373 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9375 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9376 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9377 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9378 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9379 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9380 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9382 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9383 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9384 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9385 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9386 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9387 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9388 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9389 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9390 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9391 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9392 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9394 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9395 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9396 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9397 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9398 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9399 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9400 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9401 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9402 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9404 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9405 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9406 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9407 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9408 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9409 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9410 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9411 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9412 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9413 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9414 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9415 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9416 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9417 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9418 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9419 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9420 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9421 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9422 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9423 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9424 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9425 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9426 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9427 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9428 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9429 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9430 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9431 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9432 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9433 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9434 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9436 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9437 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9438 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9439 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9440 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9441 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9442 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9443 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9444 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9445 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9446 ALC883_FUJITSU_PI2515),
9447 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9448 ALC888_FUJITSU_XA3530),
9449 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9450 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9451 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9452 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9453 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9454 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9455 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9456 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9457 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9459 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9460 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9461 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9462 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9463 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9464 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9465 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9470 /* codec SSID table for Intel Mac */
9471 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9472 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9473 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9474 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9475 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9476 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9477 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9478 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9479 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9480 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9481 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9482 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9483 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9484 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9485 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9486 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9487 * so apparently no perfect solution yet
9489 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9490 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9491 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9495 static struct alc_config_preset alc882_presets[] = {
9496 [ALC882_3ST_DIG] = {
9497 .mixers = { alc882_base_mixer },
9498 .init_verbs = { alc882_base_init_verbs,
9499 alc882_adc1_init_verbs },
9500 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9501 .dac_nids = alc882_dac_nids,
9502 .dig_out_nid = ALC882_DIGOUT_NID,
9503 .dig_in_nid = ALC882_DIGIN_NID,
9504 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9505 .channel_mode = alc882_ch_modes,
9507 .input_mux = &alc882_capture_source,
9509 [ALC882_6ST_DIG] = {
9510 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9511 .init_verbs = { alc882_base_init_verbs,
9512 alc882_adc1_init_verbs },
9513 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9514 .dac_nids = alc882_dac_nids,
9515 .dig_out_nid = ALC882_DIGOUT_NID,
9516 .dig_in_nid = ALC882_DIGIN_NID,
9517 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9518 .channel_mode = alc882_sixstack_modes,
9519 .input_mux = &alc882_capture_source,
9522 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9523 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9524 alc882_eapd_verbs },
9525 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9526 .dac_nids = alc882_dac_nids,
9527 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9528 .channel_mode = alc882_sixstack_modes,
9529 .input_mux = &alc882_capture_source,
9532 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9533 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9534 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9535 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9536 .dac_nids = alc882_dac_nids,
9537 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9538 .channel_mode = alc880_threestack_modes,
9540 .input_mux = &alc882_capture_source,
9541 .dig_out_nid = ALC882_DIGOUT_NID,
9544 .mixers = { alc885_mba21_mixer },
9545 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9547 .dac_nids = alc882_dac_nids,
9548 .channel_mode = alc885_mba21_ch_modes,
9549 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9550 .input_mux = &alc882_capture_source,
9551 .unsol_event = alc_automute_amp_unsol_event,
9552 .setup = alc885_mba21_setup,
9553 .init_hook = alc_automute_amp,
9556 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9557 .init_verbs = { alc885_mbp3_init_verbs,
9558 alc880_gpio1_init_verbs },
9560 .dac_nids = alc882_dac_nids,
9562 .channel_mode = alc885_mbp_4ch_modes,
9563 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9564 .input_mux = &alc882_capture_source,
9565 .dig_out_nid = ALC882_DIGOUT_NID,
9566 .dig_in_nid = ALC882_DIGIN_NID,
9567 .unsol_event = alc_automute_amp_unsol_event,
9568 .setup = alc885_mbp3_setup,
9569 .init_hook = alc_automute_amp,
9572 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9573 .init_verbs = { alc885_mb5_init_verbs,
9574 alc880_gpio1_init_verbs },
9575 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9576 .dac_nids = alc882_dac_nids,
9577 .channel_mode = alc885_mb5_6ch_modes,
9578 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9579 .input_mux = &mb5_capture_source,
9580 .dig_out_nid = ALC882_DIGOUT_NID,
9581 .dig_in_nid = ALC882_DIGIN_NID,
9582 .unsol_event = alc_automute_amp_unsol_event,
9583 .setup = alc885_mb5_setup,
9584 .init_hook = alc_automute_amp,
9586 [ALC885_MACMINI3] = {
9587 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9588 .init_verbs = { alc885_macmini3_init_verbs,
9589 alc880_gpio1_init_verbs },
9590 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9591 .dac_nids = alc882_dac_nids,
9592 .channel_mode = alc885_macmini3_6ch_modes,
9593 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9594 .input_mux = &macmini3_capture_source,
9595 .dig_out_nid = ALC882_DIGOUT_NID,
9596 .dig_in_nid = ALC882_DIGIN_NID,
9597 .unsol_event = alc_automute_amp_unsol_event,
9598 .setup = alc885_macmini3_setup,
9599 .init_hook = alc_automute_amp,
9602 .mixers = { alc882_macpro_mixer },
9603 .init_verbs = { alc882_macpro_init_verbs },
9604 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9605 .dac_nids = alc882_dac_nids,
9606 .dig_out_nid = ALC882_DIGOUT_NID,
9607 .dig_in_nid = ALC882_DIGIN_NID,
9608 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9609 .channel_mode = alc882_ch_modes,
9610 .input_mux = &alc882_capture_source,
9611 .init_hook = alc885_macpro_init_hook,
9614 .mixers = { alc885_imac24_mixer },
9615 .init_verbs = { alc885_imac24_init_verbs },
9616 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9617 .dac_nids = alc882_dac_nids,
9618 .dig_out_nid = ALC882_DIGOUT_NID,
9619 .dig_in_nid = ALC882_DIGIN_NID,
9620 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9621 .channel_mode = alc882_ch_modes,
9622 .input_mux = &alc882_capture_source,
9623 .unsol_event = alc_automute_amp_unsol_event,
9624 .setup = alc885_imac24_setup,
9625 .init_hook = alc885_imac24_init_hook,
9628 .mixers = {alc885_imac91_mixer},
9629 .init_verbs = { alc885_imac91_init_verbs,
9630 alc880_gpio1_init_verbs },
9631 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9632 .dac_nids = alc882_dac_nids,
9633 .channel_mode = alc885_mba21_ch_modes,
9634 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9635 .input_mux = &alc889A_imac91_capture_source,
9636 .dig_out_nid = ALC882_DIGOUT_NID,
9637 .dig_in_nid = ALC882_DIGIN_NID,
9638 .unsol_event = alc_automute_amp_unsol_event,
9639 .setup = alc885_imac91_setup,
9640 .init_hook = alc_automute_amp,
9643 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9644 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9645 alc880_gpio3_init_verbs, alc882_targa_verbs},
9646 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9647 .dac_nids = alc882_dac_nids,
9648 .dig_out_nid = ALC882_DIGOUT_NID,
9649 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9650 .adc_nids = alc882_adc_nids,
9651 .capsrc_nids = alc882_capsrc_nids,
9652 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9653 .channel_mode = alc882_3ST_6ch_modes,
9655 .input_mux = &alc882_capture_source,
9656 .unsol_event = alc882_targa_unsol_event,
9657 .setup = alc882_targa_setup,
9658 .init_hook = alc882_targa_automute,
9660 [ALC882_ASUS_A7J] = {
9661 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9662 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9663 alc882_asus_a7j_verbs},
9664 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9665 .dac_nids = alc882_dac_nids,
9666 .dig_out_nid = ALC882_DIGOUT_NID,
9667 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9668 .adc_nids = alc882_adc_nids,
9669 .capsrc_nids = alc882_capsrc_nids,
9670 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9671 .channel_mode = alc882_3ST_6ch_modes,
9673 .input_mux = &alc882_capture_source,
9675 [ALC882_ASUS_A7M] = {
9676 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9677 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9678 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9679 alc882_asus_a7m_verbs },
9680 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9681 .dac_nids = alc882_dac_nids,
9682 .dig_out_nid = ALC882_DIGOUT_NID,
9683 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9684 .channel_mode = alc880_threestack_modes,
9686 .input_mux = &alc882_capture_source,
9688 [ALC883_3ST_2ch_DIG] = {
9689 .mixers = { alc883_3ST_2ch_mixer },
9690 .init_verbs = { alc883_init_verbs },
9691 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9692 .dac_nids = alc883_dac_nids,
9693 .dig_out_nid = ALC883_DIGOUT_NID,
9694 .dig_in_nid = ALC883_DIGIN_NID,
9695 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9696 .channel_mode = alc883_3ST_2ch_modes,
9697 .input_mux = &alc883_capture_source,
9699 [ALC883_3ST_6ch_DIG] = {
9700 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9701 .init_verbs = { alc883_init_verbs },
9702 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9703 .dac_nids = alc883_dac_nids,
9704 .dig_out_nid = ALC883_DIGOUT_NID,
9705 .dig_in_nid = ALC883_DIGIN_NID,
9706 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9707 .channel_mode = alc883_3ST_6ch_modes,
9709 .input_mux = &alc883_capture_source,
9711 [ALC883_3ST_6ch] = {
9712 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9713 .init_verbs = { alc883_init_verbs },
9714 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9715 .dac_nids = alc883_dac_nids,
9716 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9717 .channel_mode = alc883_3ST_6ch_modes,
9719 .input_mux = &alc883_capture_source,
9721 [ALC883_3ST_6ch_INTEL] = {
9722 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9723 .init_verbs = { alc883_init_verbs },
9724 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9725 .dac_nids = alc883_dac_nids,
9726 .dig_out_nid = ALC883_DIGOUT_NID,
9727 .dig_in_nid = ALC883_DIGIN_NID,
9728 .slave_dig_outs = alc883_slave_dig_outs,
9729 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9730 .channel_mode = alc883_3ST_6ch_intel_modes,
9732 .input_mux = &alc883_3stack_6ch_intel,
9735 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9736 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9737 alc_hp15_unsol_verbs },
9738 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9739 .dac_nids = alc883_dac_nids,
9740 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9741 .adc_nids = alc889_adc_nids,
9742 .dig_out_nid = ALC883_DIGOUT_NID,
9743 .dig_in_nid = ALC883_DIGIN_NID,
9744 .slave_dig_outs = alc883_slave_dig_outs,
9745 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9746 .channel_mode = alc889_8ch_intel_modes,
9747 .capsrc_nids = alc889_capsrc_nids,
9748 .input_mux = &alc889_capture_source,
9749 .setup = alc889_automute_setup,
9750 .init_hook = alc_automute_amp,
9751 .unsol_event = alc_automute_amp_unsol_event,
9755 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9756 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9757 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9758 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9759 .dac_nids = alc883_dac_nids,
9760 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9761 .adc_nids = alc889_adc_nids,
9762 .dig_out_nid = ALC883_DIGOUT_NID,
9763 .dig_in_nid = ALC883_DIGIN_NID,
9764 .slave_dig_outs = alc883_slave_dig_outs,
9765 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9766 .channel_mode = alc889_8ch_intel_modes,
9767 .capsrc_nids = alc889_capsrc_nids,
9768 .input_mux = &alc889_capture_source,
9769 .setup = alc889_automute_setup,
9770 .init_hook = alc889_intel_init_hook,
9771 .unsol_event = alc_automute_amp_unsol_event,
9774 [ALC883_6ST_DIG] = {
9775 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9776 .init_verbs = { alc883_init_verbs },
9777 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9778 .dac_nids = alc883_dac_nids,
9779 .dig_out_nid = ALC883_DIGOUT_NID,
9780 .dig_in_nid = ALC883_DIGIN_NID,
9781 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9782 .channel_mode = alc883_sixstack_modes,
9783 .input_mux = &alc883_capture_source,
9785 [ALC883_TARGA_DIG] = {
9786 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9787 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9788 alc883_targa_verbs},
9789 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9790 .dac_nids = alc883_dac_nids,
9791 .dig_out_nid = ALC883_DIGOUT_NID,
9792 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9793 .channel_mode = alc883_3ST_6ch_modes,
9795 .input_mux = &alc883_capture_source,
9796 .unsol_event = alc883_targa_unsol_event,
9797 .setup = alc882_targa_setup,
9798 .init_hook = alc882_targa_automute,
9800 [ALC883_TARGA_2ch_DIG] = {
9801 .mixers = { alc883_targa_2ch_mixer},
9802 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9803 alc883_targa_verbs},
9804 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9805 .dac_nids = alc883_dac_nids,
9806 .adc_nids = alc883_adc_nids_alt,
9807 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9808 .capsrc_nids = alc883_capsrc_nids,
9809 .dig_out_nid = ALC883_DIGOUT_NID,
9810 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9811 .channel_mode = alc883_3ST_2ch_modes,
9812 .input_mux = &alc883_capture_source,
9813 .unsol_event = alc883_targa_unsol_event,
9814 .setup = alc882_targa_setup,
9815 .init_hook = alc882_targa_automute,
9817 [ALC883_TARGA_8ch_DIG] = {
9818 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9819 alc883_chmode_mixer },
9820 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9821 alc883_targa_verbs },
9822 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9823 .dac_nids = alc883_dac_nids,
9824 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9825 .adc_nids = alc883_adc_nids_rev,
9826 .capsrc_nids = alc883_capsrc_nids_rev,
9827 .dig_out_nid = ALC883_DIGOUT_NID,
9828 .dig_in_nid = ALC883_DIGIN_NID,
9829 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9830 .channel_mode = alc883_4ST_8ch_modes,
9832 .input_mux = &alc883_capture_source,
9833 .unsol_event = alc883_targa_unsol_event,
9834 .setup = alc882_targa_setup,
9835 .init_hook = alc882_targa_automute,
9838 .mixers = { alc883_base_mixer },
9839 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9840 * and the headphone jack. Turn this on and rely on the
9841 * standard mute methods whenever the user wants to turn
9842 * these outputs off.
9844 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9845 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9846 .dac_nids = alc883_dac_nids,
9847 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9848 .channel_mode = alc883_3ST_2ch_modes,
9849 .input_mux = &alc883_capture_source,
9851 [ALC883_ACER_ASPIRE] = {
9852 .mixers = { alc883_acer_aspire_mixer },
9853 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9854 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9855 .dac_nids = alc883_dac_nids,
9856 .dig_out_nid = ALC883_DIGOUT_NID,
9857 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9858 .channel_mode = alc883_3ST_2ch_modes,
9859 .input_mux = &alc883_capture_source,
9860 .unsol_event = alc_automute_amp_unsol_event,
9861 .setup = alc883_acer_aspire_setup,
9862 .init_hook = alc_automute_amp,
9864 [ALC888_ACER_ASPIRE_4930G] = {
9865 .mixers = { alc888_base_mixer,
9866 alc883_chmode_mixer },
9867 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9868 alc888_acer_aspire_4930g_verbs },
9869 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9870 .dac_nids = alc883_dac_nids,
9871 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9872 .adc_nids = alc883_adc_nids_rev,
9873 .capsrc_nids = alc883_capsrc_nids_rev,
9874 .dig_out_nid = ALC883_DIGOUT_NID,
9875 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9876 .channel_mode = alc883_3ST_6ch_modes,
9878 .const_channel_count = 6,
9880 ARRAY_SIZE(alc888_2_capture_sources),
9881 .input_mux = alc888_2_capture_sources,
9882 .unsol_event = alc_automute_amp_unsol_event,
9883 .setup = alc888_acer_aspire_4930g_setup,
9884 .init_hook = alc_automute_amp,
9886 [ALC888_ACER_ASPIRE_6530G] = {
9887 .mixers = { alc888_acer_aspire_6530_mixer },
9888 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9889 alc888_acer_aspire_6530g_verbs },
9890 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9891 .dac_nids = alc883_dac_nids,
9892 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9893 .adc_nids = alc883_adc_nids_rev,
9894 .capsrc_nids = alc883_capsrc_nids_rev,
9895 .dig_out_nid = ALC883_DIGOUT_NID,
9896 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9897 .channel_mode = alc883_3ST_2ch_modes,
9899 ARRAY_SIZE(alc888_2_capture_sources),
9900 .input_mux = alc888_acer_aspire_6530_sources,
9901 .unsol_event = alc_automute_amp_unsol_event,
9902 .setup = alc888_acer_aspire_6530g_setup,
9903 .init_hook = alc_automute_amp,
9905 [ALC888_ACER_ASPIRE_8930G] = {
9906 .mixers = { alc889_acer_aspire_8930g_mixer,
9907 alc883_chmode_mixer },
9908 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9909 alc889_acer_aspire_8930g_verbs,
9911 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9912 .dac_nids = alc883_dac_nids,
9913 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9914 .adc_nids = alc889_adc_nids,
9915 .capsrc_nids = alc889_capsrc_nids,
9916 .dig_out_nid = ALC883_DIGOUT_NID,
9917 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9918 .channel_mode = alc883_3ST_6ch_modes,
9920 .const_channel_count = 6,
9922 ARRAY_SIZE(alc889_capture_sources),
9923 .input_mux = alc889_capture_sources,
9924 .unsol_event = alc_automute_amp_unsol_event,
9925 .setup = alc889_acer_aspire_8930g_setup,
9926 .init_hook = alc_automute_amp,
9927 #ifdef CONFIG_SND_HDA_POWER_SAVE
9928 .power_hook = alc_power_eapd,
9931 [ALC888_ACER_ASPIRE_7730G] = {
9932 .mixers = { alc883_3ST_6ch_mixer,
9933 alc883_chmode_mixer },
9934 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9935 alc888_acer_aspire_7730G_verbs },
9936 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9937 .dac_nids = alc883_dac_nids,
9938 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9939 .adc_nids = alc883_adc_nids_rev,
9940 .capsrc_nids = alc883_capsrc_nids_rev,
9941 .dig_out_nid = ALC883_DIGOUT_NID,
9942 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9943 .channel_mode = alc883_3ST_6ch_modes,
9945 .const_channel_count = 6,
9946 .input_mux = &alc883_capture_source,
9947 .unsol_event = alc_automute_amp_unsol_event,
9948 .setup = alc888_acer_aspire_6530g_setup,
9949 .init_hook = alc_automute_amp,
9952 .mixers = { alc883_fivestack_mixer,
9953 alc883_chmode_mixer },
9954 .init_verbs = { alc883_init_verbs,
9955 alc883_medion_eapd_verbs },
9956 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9957 .dac_nids = alc883_dac_nids,
9958 .adc_nids = alc883_adc_nids_alt,
9959 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9960 .capsrc_nids = alc883_capsrc_nids,
9961 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9962 .channel_mode = alc883_sixstack_modes,
9963 .input_mux = &alc883_capture_source,
9965 [ALC883_MEDION_MD2] = {
9966 .mixers = { alc883_medion_md2_mixer},
9967 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9968 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9969 .dac_nids = alc883_dac_nids,
9970 .dig_out_nid = ALC883_DIGOUT_NID,
9971 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9972 .channel_mode = alc883_3ST_2ch_modes,
9973 .input_mux = &alc883_capture_source,
9974 .unsol_event = alc_automute_amp_unsol_event,
9975 .setup = alc883_medion_md2_setup,
9976 .init_hook = alc_automute_amp,
9978 [ALC883_MEDION_WIM2160] = {
9979 .mixers = { alc883_medion_wim2160_mixer },
9980 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
9981 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9982 .dac_nids = alc883_dac_nids,
9983 .dig_out_nid = ALC883_DIGOUT_NID,
9984 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9985 .adc_nids = alc883_adc_nids,
9986 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9987 .channel_mode = alc883_3ST_2ch_modes,
9988 .input_mux = &alc883_capture_source,
9989 .unsol_event = alc_automute_amp_unsol_event,
9990 .setup = alc883_medion_wim2160_setup,
9991 .init_hook = alc_automute_amp,
9993 [ALC883_LAPTOP_EAPD] = {
9994 .mixers = { alc883_base_mixer },
9995 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9996 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9997 .dac_nids = alc883_dac_nids,
9998 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9999 .channel_mode = alc883_3ST_2ch_modes,
10000 .input_mux = &alc883_capture_source,
10002 [ALC883_CLEVO_M540R] = {
10003 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10004 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10005 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10006 .dac_nids = alc883_dac_nids,
10007 .dig_out_nid = ALC883_DIGOUT_NID,
10008 .dig_in_nid = ALC883_DIGIN_NID,
10009 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10010 .channel_mode = alc883_3ST_6ch_clevo_modes,
10012 .input_mux = &alc883_capture_source,
10013 /* This machine has the hardware HP auto-muting, thus
10014 * we need no software mute via unsol event
10017 [ALC883_CLEVO_M720] = {
10018 .mixers = { alc883_clevo_m720_mixer },
10019 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10020 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10021 .dac_nids = alc883_dac_nids,
10022 .dig_out_nid = ALC883_DIGOUT_NID,
10023 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10024 .channel_mode = alc883_3ST_2ch_modes,
10025 .input_mux = &alc883_capture_source,
10026 .unsol_event = alc883_clevo_m720_unsol_event,
10027 .setup = alc883_clevo_m720_setup,
10028 .init_hook = alc883_clevo_m720_init_hook,
10030 [ALC883_LENOVO_101E_2ch] = {
10031 .mixers = { alc883_lenovo_101e_2ch_mixer},
10032 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10033 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10034 .dac_nids = alc883_dac_nids,
10035 .adc_nids = alc883_adc_nids_alt,
10036 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10037 .capsrc_nids = alc883_capsrc_nids,
10038 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10039 .channel_mode = alc883_3ST_2ch_modes,
10040 .input_mux = &alc883_lenovo_101e_capture_source,
10041 .unsol_event = alc883_lenovo_101e_unsol_event,
10042 .init_hook = alc883_lenovo_101e_all_automute,
10044 [ALC883_LENOVO_NB0763] = {
10045 .mixers = { alc883_lenovo_nb0763_mixer },
10046 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10047 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10048 .dac_nids = alc883_dac_nids,
10049 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10050 .channel_mode = alc883_3ST_2ch_modes,
10052 .input_mux = &alc883_lenovo_nb0763_capture_source,
10053 .unsol_event = alc_automute_amp_unsol_event,
10054 .setup = alc883_medion_md2_setup,
10055 .init_hook = alc_automute_amp,
10057 [ALC888_LENOVO_MS7195_DIG] = {
10058 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10059 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10060 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10061 .dac_nids = alc883_dac_nids,
10062 .dig_out_nid = ALC883_DIGOUT_NID,
10063 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10064 .channel_mode = alc883_3ST_6ch_modes,
10066 .input_mux = &alc883_capture_source,
10067 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10068 .init_hook = alc888_lenovo_ms7195_front_automute,
10070 [ALC883_HAIER_W66] = {
10071 .mixers = { alc883_targa_2ch_mixer},
10072 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10073 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10074 .dac_nids = alc883_dac_nids,
10075 .dig_out_nid = ALC883_DIGOUT_NID,
10076 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10077 .channel_mode = alc883_3ST_2ch_modes,
10078 .input_mux = &alc883_capture_source,
10079 .unsol_event = alc_automute_amp_unsol_event,
10080 .setup = alc883_haier_w66_setup,
10081 .init_hook = alc_automute_amp,
10083 [ALC888_3ST_HP] = {
10084 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10085 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10086 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10087 .dac_nids = alc883_dac_nids,
10088 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10089 .channel_mode = alc888_3st_hp_modes,
10091 .input_mux = &alc883_capture_source,
10092 .unsol_event = alc_automute_amp_unsol_event,
10093 .setup = alc888_3st_hp_setup,
10094 .init_hook = alc_automute_amp,
10096 [ALC888_6ST_DELL] = {
10097 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10098 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10099 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10100 .dac_nids = alc883_dac_nids,
10101 .dig_out_nid = ALC883_DIGOUT_NID,
10102 .dig_in_nid = ALC883_DIGIN_NID,
10103 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10104 .channel_mode = alc883_sixstack_modes,
10105 .input_mux = &alc883_capture_source,
10106 .unsol_event = alc_automute_amp_unsol_event,
10107 .setup = alc888_6st_dell_setup,
10108 .init_hook = alc_automute_amp,
10111 .mixers = { alc883_mitac_mixer },
10112 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10113 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10114 .dac_nids = alc883_dac_nids,
10115 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10116 .channel_mode = alc883_3ST_2ch_modes,
10117 .input_mux = &alc883_capture_source,
10118 .unsol_event = alc_automute_amp_unsol_event,
10119 .setup = alc883_mitac_setup,
10120 .init_hook = alc_automute_amp,
10122 [ALC883_FUJITSU_PI2515] = {
10123 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10124 .init_verbs = { alc883_init_verbs,
10125 alc883_2ch_fujitsu_pi2515_verbs},
10126 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10127 .dac_nids = alc883_dac_nids,
10128 .dig_out_nid = ALC883_DIGOUT_NID,
10129 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10130 .channel_mode = alc883_3ST_2ch_modes,
10131 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10132 .unsol_event = alc_automute_amp_unsol_event,
10133 .setup = alc883_2ch_fujitsu_pi2515_setup,
10134 .init_hook = alc_automute_amp,
10136 [ALC888_FUJITSU_XA3530] = {
10137 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10138 .init_verbs = { alc883_init_verbs,
10139 alc888_fujitsu_xa3530_verbs },
10140 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10141 .dac_nids = alc883_dac_nids,
10142 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10143 .adc_nids = alc883_adc_nids_rev,
10144 .capsrc_nids = alc883_capsrc_nids_rev,
10145 .dig_out_nid = ALC883_DIGOUT_NID,
10146 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10147 .channel_mode = alc888_4ST_8ch_intel_modes,
10149 ARRAY_SIZE(alc888_2_capture_sources),
10150 .input_mux = alc888_2_capture_sources,
10151 .unsol_event = alc_automute_amp_unsol_event,
10152 .setup = alc888_fujitsu_xa3530_setup,
10153 .init_hook = alc_automute_amp,
10155 [ALC888_LENOVO_SKY] = {
10156 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10157 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10158 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10159 .dac_nids = alc883_dac_nids,
10160 .dig_out_nid = ALC883_DIGOUT_NID,
10161 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10162 .channel_mode = alc883_sixstack_modes,
10164 .input_mux = &alc883_lenovo_sky_capture_source,
10165 .unsol_event = alc_automute_amp_unsol_event,
10166 .setup = alc888_lenovo_sky_setup,
10167 .init_hook = alc_automute_amp,
10169 [ALC888_ASUS_M90V] = {
10170 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10171 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10172 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10173 .dac_nids = alc883_dac_nids,
10174 .dig_out_nid = ALC883_DIGOUT_NID,
10175 .dig_in_nid = ALC883_DIGIN_NID,
10176 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10177 .channel_mode = alc883_3ST_6ch_modes,
10179 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10180 .unsol_event = alc_sku_unsol_event,
10181 .setup = alc883_mode2_setup,
10182 .init_hook = alc_inithook,
10184 [ALC888_ASUS_EEE1601] = {
10185 .mixers = { alc883_asus_eee1601_mixer },
10186 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10187 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10188 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10189 .dac_nids = alc883_dac_nids,
10190 .dig_out_nid = ALC883_DIGOUT_NID,
10191 .dig_in_nid = ALC883_DIGIN_NID,
10192 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10193 .channel_mode = alc883_3ST_2ch_modes,
10195 .input_mux = &alc883_asus_eee1601_capture_source,
10196 .unsol_event = alc_sku_unsol_event,
10197 .init_hook = alc883_eee1601_inithook,
10199 [ALC1200_ASUS_P5Q] = {
10200 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10201 .init_verbs = { alc883_init_verbs },
10202 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10203 .dac_nids = alc883_dac_nids,
10204 .dig_out_nid = ALC1200_DIGOUT_NID,
10205 .dig_in_nid = ALC883_DIGIN_NID,
10206 .slave_dig_outs = alc1200_slave_dig_outs,
10207 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10208 .channel_mode = alc883_sixstack_modes,
10209 .input_mux = &alc883_capture_source,
10212 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10213 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10214 alc880_gpio1_init_verbs },
10215 .adc_nids = alc883_adc_nids,
10216 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10217 .capsrc_nids = alc883_capsrc_nids,
10218 .dac_nids = alc883_dac_nids,
10219 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10220 .channel_mode = alc889A_mb31_6ch_modes,
10221 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10222 .input_mux = &alc889A_mb31_capture_source,
10223 .dig_out_nid = ALC883_DIGOUT_NID,
10224 .unsol_event = alc889A_mb31_unsol_event,
10225 .init_hook = alc889A_mb31_automute,
10227 [ALC883_SONY_VAIO_TT] = {
10228 .mixers = { alc883_vaiott_mixer },
10229 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10230 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10231 .dac_nids = alc883_dac_nids,
10232 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10233 .channel_mode = alc883_3ST_2ch_modes,
10234 .input_mux = &alc883_capture_source,
10235 .unsol_event = alc_automute_amp_unsol_event,
10236 .setup = alc883_vaiott_setup,
10237 .init_hook = alc_automute_amp,
10246 PINFIX_ABIT_AW9D_MAX
10249 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
10250 { 0x15, 0x01080104 }, /* side */
10251 { 0x16, 0x01011012 }, /* rear */
10252 { 0x17, 0x01016011 }, /* clfe */
10256 static const struct alc_fixup alc882_fixups[] = {
10257 [PINFIX_ABIT_AW9D_MAX] = {
10258 .pins = alc882_abit_aw9d_pinfix
10262 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10263 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10268 * BIOS auto configuration
10270 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10271 const struct auto_pin_cfg *cfg)
10273 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10276 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10277 hda_nid_t nid, int pin_type,
10282 /* set as output */
10283 alc_set_pin_output(codec, nid, pin_type);
10287 else if (dac >= 0x02 && dac <= 0x05)
10291 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10294 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10296 struct alc_spec *spec = codec->spec;
10299 for (i = 0; i <= HDA_SIDE; i++) {
10300 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10301 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10303 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10304 spec->multiout.dac_nids[i]);
10308 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10310 struct alc_spec *spec = codec->spec;
10311 hda_nid_t pin, dac;
10313 pin = spec->autocfg.hp_pins[0];
10315 dac = spec->multiout.hp_nid;
10317 dac = spec->multiout.dac_nids[0]; /* to front */
10318 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10320 pin = spec->autocfg.speaker_pins[0];
10322 dac = spec->multiout.extra_out_nid[0];
10324 dac = spec->multiout.dac_nids[0]; /* to front */
10325 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10329 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10331 struct alc_spec *spec = codec->spec;
10334 for (i = 0; i < AUTO_PIN_LAST; i++) {
10335 hda_nid_t nid = spec->autocfg.input_pins[i];
10338 alc_set_input_pin(codec, nid, i);
10339 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10340 snd_hda_codec_write(codec, nid, 0,
10341 AC_VERB_SET_AMP_GAIN_MUTE,
10346 static void alc882_auto_init_input_src(struct hda_codec *codec)
10348 struct alc_spec *spec = codec->spec;
10351 for (c = 0; c < spec->num_adc_nids; c++) {
10352 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10353 hda_nid_t nid = spec->capsrc_nids[c];
10354 unsigned int mux_idx;
10355 const struct hda_input_mux *imux;
10356 int conns, mute, idx, item;
10358 conns = snd_hda_get_connections(codec, nid, conn_list,
10359 ARRAY_SIZE(conn_list));
10362 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10363 imux = &spec->input_mux[mux_idx];
10364 if (!imux->num_items && mux_idx > 0)
10365 imux = &spec->input_mux[0];
10366 for (idx = 0; idx < conns; idx++) {
10367 /* if the current connection is the selected one,
10368 * unmute it as default - otherwise mute it
10370 mute = AMP_IN_MUTE(idx);
10371 for (item = 0; item < imux->num_items; item++) {
10372 if (imux->items[item].index == idx) {
10373 if (spec->cur_mux[c] == item)
10374 mute = AMP_IN_UNMUTE(idx);
10378 /* check if we have a selector or mixer
10379 * we could check for the widget type instead, but
10380 * just check for Amp-In presence (in case of mixer
10381 * without amp-in there is something wrong, this
10382 * function shouldn't be used or capsrc nid is wrong)
10384 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10385 snd_hda_codec_write(codec, nid, 0,
10386 AC_VERB_SET_AMP_GAIN_MUTE,
10388 else if (mute != AMP_IN_MUTE(idx))
10389 snd_hda_codec_write(codec, nid, 0,
10390 AC_VERB_SET_CONNECT_SEL,
10396 /* add mic boosts if needed */
10397 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10399 struct alc_spec *spec = codec->spec;
10403 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10404 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10405 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10407 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10411 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10412 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10413 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10415 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10422 /* almost identical with ALC880 parser... */
10423 static int alc882_parse_auto_config(struct hda_codec *codec)
10425 struct alc_spec *spec = codec->spec;
10426 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10429 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10433 if (!spec->autocfg.line_outs)
10434 return 0; /* can't find valid BIOS pin config */
10436 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10439 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10442 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10446 err = alc880_auto_create_extra_out(spec,
10447 spec->autocfg.speaker_pins[0],
10451 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10455 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10457 /* check multiple SPDIF-out (for recent codecs) */
10458 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10460 err = snd_hda_get_connections(codec,
10461 spec->autocfg.dig_out_pins[i],
10466 spec->multiout.dig_out_nid = dig_nid;
10468 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10469 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10471 spec->slave_dig_outs[i - 1] = dig_nid;
10474 if (spec->autocfg.dig_in_pin)
10475 spec->dig_in_nid = ALC880_DIGIN_NID;
10477 if (spec->kctls.list)
10478 add_mixer(spec, spec->kctls.list);
10480 add_verb(spec, alc883_auto_init_verbs);
10481 /* if ADC 0x07 is available, initialize it, too */
10482 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10483 add_verb(spec, alc882_adc1_init_verbs);
10485 spec->num_mux_defs = 1;
10486 spec->input_mux = &spec->private_imux[0];
10488 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10490 err = alc_auto_add_mic_boost(codec);
10494 return 1; /* config found */
10497 /* additional initialization for auto-configuration model */
10498 static void alc882_auto_init(struct hda_codec *codec)
10500 struct alc_spec *spec = codec->spec;
10501 alc882_auto_init_multi_out(codec);
10502 alc882_auto_init_hp_out(codec);
10503 alc882_auto_init_analog_input(codec);
10504 alc882_auto_init_input_src(codec);
10505 if (spec->unsol_event)
10506 alc_inithook(codec);
10509 static int patch_alc882(struct hda_codec *codec)
10511 struct alc_spec *spec;
10512 int err, board_config;
10514 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10518 codec->spec = spec;
10520 alc_auto_parse_customize_define(codec);
10522 switch (codec->vendor_id) {
10527 /* ALC883 and variants */
10528 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10532 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10536 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10537 board_config = snd_hda_check_board_codec_sid_config(codec,
10538 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10540 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10541 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10543 board_config = ALC882_AUTO;
10546 if (board_config == ALC882_AUTO)
10547 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10549 if (board_config == ALC882_AUTO) {
10550 /* automatic parse from the BIOS config */
10551 err = alc882_parse_auto_config(codec);
10557 "hda_codec: Cannot set up configuration "
10558 "from BIOS. Using base mode...\n");
10559 board_config = ALC882_3ST_DIG;
10563 err = snd_hda_attach_beep_device(codec, 0x1);
10569 if (board_config != ALC882_AUTO)
10570 setup_preset(codec, &alc882_presets[board_config]);
10572 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10573 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10574 /* FIXME: setup DAC5 */
10575 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10576 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10578 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10579 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10581 if (!spec->adc_nids && spec->input_mux) {
10583 spec->num_adc_nids = 0;
10584 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10585 const struct hda_input_mux *imux = spec->input_mux;
10587 hda_nid_t items[16];
10588 hda_nid_t nid = alc882_adc_nids[i];
10589 unsigned int wcap = get_wcaps(codec, nid);
10591 wcap = get_wcaps_type(wcap);
10592 if (wcap != AC_WID_AUD_IN)
10594 spec->private_adc_nids[spec->num_adc_nids] = nid;
10595 err = snd_hda_get_connections(codec, nid, &cap, 1);
10598 err = snd_hda_get_connections(codec, cap, items,
10599 ARRAY_SIZE(items));
10602 for (j = 0; j < imux->num_items; j++)
10603 if (imux->items[j].index >= err)
10605 if (j < imux->num_items)
10607 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10608 spec->num_adc_nids++;
10610 spec->adc_nids = spec->private_adc_nids;
10611 spec->capsrc_nids = spec->private_capsrc_nids;
10614 set_capture_mixer(codec);
10616 if (spec->cdefine.enable_pcbeep)
10617 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10619 if (board_config == ALC882_AUTO)
10620 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
10622 spec->vmaster_nid = 0x0c;
10624 codec->patch_ops = alc_patch_ops;
10625 if (board_config == ALC882_AUTO)
10626 spec->init_hook = alc882_auto_init;
10627 #ifdef CONFIG_SND_HDA_POWER_SAVE
10628 if (!spec->loopback.amplist)
10629 spec->loopback.amplist = alc882_loopbacks;
10640 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10641 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10643 #define alc262_dac_nids alc260_dac_nids
10644 #define alc262_adc_nids alc882_adc_nids
10645 #define alc262_adc_nids_alt alc882_adc_nids_alt
10646 #define alc262_capsrc_nids alc882_capsrc_nids
10647 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10649 #define alc262_modes alc260_modes
10650 #define alc262_capture_source alc882_capture_source
10652 static hda_nid_t alc262_dmic_adc_nids[1] = {
10657 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10659 static struct snd_kcontrol_new alc262_base_mixer[] = {
10660 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10661 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10662 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10663 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10664 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10665 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10666 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10667 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10668 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10669 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10670 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10671 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10672 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10673 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10674 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10675 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10679 /* update HP, line and mono-out pins according to the master switch */
10680 static void alc262_hp_master_update(struct hda_codec *codec)
10682 struct alc_spec *spec = codec->spec;
10683 int val = spec->master_sw;
10685 /* HP & line-out */
10686 snd_hda_codec_write_cache(codec, 0x1b, 0,
10687 AC_VERB_SET_PIN_WIDGET_CONTROL,
10689 snd_hda_codec_write_cache(codec, 0x15, 0,
10690 AC_VERB_SET_PIN_WIDGET_CONTROL,
10692 /* mono (speaker) depending on the HP jack sense */
10693 val = val && !spec->jack_present;
10694 snd_hda_codec_write_cache(codec, 0x16, 0,
10695 AC_VERB_SET_PIN_WIDGET_CONTROL,
10696 val ? PIN_OUT : 0);
10699 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10701 struct alc_spec *spec = codec->spec;
10703 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10704 alc262_hp_master_update(codec);
10707 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10709 if ((res >> 26) != ALC880_HP_EVENT)
10711 alc262_hp_bpc_automute(codec);
10714 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10716 struct alc_spec *spec = codec->spec;
10718 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10719 alc262_hp_master_update(codec);
10722 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10725 if ((res >> 26) != ALC880_HP_EVENT)
10727 alc262_hp_wildwest_automute(codec);
10730 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10732 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10733 struct snd_ctl_elem_value *ucontrol)
10735 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10736 struct alc_spec *spec = codec->spec;
10737 int val = !!*ucontrol->value.integer.value;
10739 if (val == spec->master_sw)
10741 spec->master_sw = val;
10742 alc262_hp_master_update(codec);
10746 #define ALC262_HP_MASTER_SWITCH \
10748 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10749 .name = "Master Playback Switch", \
10750 .info = snd_ctl_boolean_mono_info, \
10751 .get = alc262_hp_master_sw_get, \
10752 .put = alc262_hp_master_sw_put, \
10755 .iface = NID_MAPPING, \
10756 .name = "Master Playback Switch", \
10757 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10761 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10762 ALC262_HP_MASTER_SWITCH,
10763 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10764 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10765 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10766 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10768 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10770 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10771 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10772 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10773 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10774 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10775 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10776 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10777 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10778 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10779 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10780 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10781 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10785 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10786 ALC262_HP_MASTER_SWITCH,
10787 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10788 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10789 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10790 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10791 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10793 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10795 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10796 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10797 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10798 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10799 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10800 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10801 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10805 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10806 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10807 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10808 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10812 /* mute/unmute internal speaker according to the hp jack and mute state */
10813 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10815 struct alc_spec *spec = codec->spec;
10817 spec->autocfg.hp_pins[0] = 0x15;
10818 spec->autocfg.speaker_pins[0] = 0x14;
10821 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10822 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10823 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10824 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10825 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10826 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10827 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10828 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10832 static struct hda_verb alc262_hp_t5735_verbs[] = {
10833 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10834 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10836 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10840 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10841 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10842 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10843 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10844 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10845 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10846 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10850 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10851 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10852 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10853 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10854 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10855 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10856 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10857 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10858 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10859 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10860 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10864 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10871 /* bind hp and internal speaker mute (with plug check) as master switch */
10872 static void alc262_hippo_master_update(struct hda_codec *codec)
10874 struct alc_spec *spec = codec->spec;
10875 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10876 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10877 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10881 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10882 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10883 HDA_AMP_MUTE, mute);
10884 /* mute internal speaker per jack sense */
10885 if (spec->jack_present)
10886 mute = HDA_AMP_MUTE;
10888 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10889 HDA_AMP_MUTE, mute);
10890 if (speaker_nid && speaker_nid != line_nid)
10891 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10892 HDA_AMP_MUTE, mute);
10895 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10897 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10898 struct snd_ctl_elem_value *ucontrol)
10900 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10901 struct alc_spec *spec = codec->spec;
10902 int val = !!*ucontrol->value.integer.value;
10904 if (val == spec->master_sw)
10906 spec->master_sw = val;
10907 alc262_hippo_master_update(codec);
10911 #define ALC262_HIPPO_MASTER_SWITCH \
10913 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10914 .name = "Master Playback Switch", \
10915 .info = snd_ctl_boolean_mono_info, \
10916 .get = alc262_hippo_master_sw_get, \
10917 .put = alc262_hippo_master_sw_put, \
10920 .iface = NID_MAPPING, \
10921 .name = "Master Playback Switch", \
10922 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10923 (SUBDEV_SPEAKER(0) << 16), \
10926 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10927 ALC262_HIPPO_MASTER_SWITCH,
10928 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10929 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10930 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10931 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10932 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10933 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10934 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10935 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10936 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10937 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10938 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10939 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10943 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10944 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10945 ALC262_HIPPO_MASTER_SWITCH,
10946 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10947 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10948 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10949 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10950 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10951 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10952 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10953 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10954 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10955 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10959 /* mute/unmute internal speaker according to the hp jack and mute state */
10960 static void alc262_hippo_automute(struct hda_codec *codec)
10962 struct alc_spec *spec = codec->spec;
10963 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10965 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10966 alc262_hippo_master_update(codec);
10969 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10971 if ((res >> 26) != ALC880_HP_EVENT)
10973 alc262_hippo_automute(codec);
10976 static void alc262_hippo_setup(struct hda_codec *codec)
10978 struct alc_spec *spec = codec->spec;
10980 spec->autocfg.hp_pins[0] = 0x15;
10981 spec->autocfg.speaker_pins[0] = 0x14;
10984 static void alc262_hippo1_setup(struct hda_codec *codec)
10986 struct alc_spec *spec = codec->spec;
10988 spec->autocfg.hp_pins[0] = 0x1b;
10989 spec->autocfg.speaker_pins[0] = 0x14;
10993 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10994 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10995 ALC262_HIPPO_MASTER_SWITCH,
10996 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10997 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10998 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10999 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11003 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11004 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11005 ALC262_HIPPO_MASTER_SWITCH,
11006 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11007 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11008 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11009 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11010 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11014 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11015 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11016 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11017 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11018 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11019 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11020 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11021 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11022 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11023 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11024 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11025 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11026 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11030 static struct hda_verb alc262_tyan_verbs[] = {
11031 /* Headphone automute */
11032 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11033 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11034 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11036 /* P11 AUX_IN, white 4-pin connector */
11037 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11038 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11039 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11040 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11045 /* unsolicited event for HP jack sensing */
11046 static void alc262_tyan_setup(struct hda_codec *codec)
11048 struct alc_spec *spec = codec->spec;
11050 spec->autocfg.hp_pins[0] = 0x1b;
11051 spec->autocfg.speaker_pins[0] = 0x15;
11055 #define alc262_capture_mixer alc882_capture_mixer
11056 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11059 * generic initialization of ADC, input mixers and output mixers
11061 static struct hda_verb alc262_init_verbs[] = {
11063 * Unmute ADC0-2 and set the default input to mic-in
11065 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11066 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11067 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11068 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11069 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11070 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11072 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11074 * Note: PASD motherboards uses the Line In 2 as the input for
11075 * front panel mic (mic 2)
11077 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11078 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11079 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11080 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11081 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11082 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11085 * Set up output mixers (0x0c - 0x0e)
11087 /* set vol=0 to output mixers */
11088 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11089 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11090 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11091 /* set up input amps for analog loopback */
11092 /* Amp Indices: DAC = 0, mixer = 1 */
11093 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11094 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11095 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11096 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11097 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11098 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11100 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11101 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11102 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11103 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11104 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11105 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11107 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11108 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11109 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11110 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11111 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11113 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11114 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11116 /* FIXME: use matrix-type input source selection */
11117 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11118 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11119 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11120 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11121 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11122 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11124 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11125 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11126 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11127 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11129 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11130 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11131 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11132 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11137 static struct hda_verb alc262_eapd_verbs[] = {
11138 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11139 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11143 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11144 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11145 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11146 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11148 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11149 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11153 static struct hda_verb alc262_sony_unsol_verbs[] = {
11154 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11155 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11156 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11158 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11159 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11163 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11164 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11165 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11166 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11168 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11172 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11173 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11174 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11175 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11176 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11177 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11178 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11179 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11180 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11184 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11186 struct alc_spec *spec = codec->spec;
11188 spec->autocfg.hp_pins[0] = 0x15;
11189 spec->autocfg.speaker_pins[0] = 0x14;
11190 spec->ext_mic.pin = 0x18;
11191 spec->ext_mic.mux_idx = 0;
11192 spec->int_mic.pin = 0x12;
11193 spec->int_mic.mux_idx = 9;
11194 spec->auto_mic = 1;
11200 * 0x16 = internal speaker
11201 * 0x18 = external mic
11204 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11205 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11206 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11208 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11209 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11210 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11212 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11213 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11217 static struct hda_verb alc262_nec_verbs[] = {
11218 /* Unmute Speaker */
11219 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11222 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11223 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11225 /* External mic to headphone */
11226 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11227 /* External mic to speaker */
11228 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11234 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11235 * 0x1b = port replicator headphone out
11238 #define ALC_HP_EVENT 0x37
11240 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11241 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11242 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11243 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11244 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11248 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11249 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11250 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11254 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11255 /* Front Mic pin: input vref at 50% */
11256 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11257 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11261 static struct hda_input_mux alc262_fujitsu_capture_source = {
11265 { "Int Mic", 0x1 },
11270 static struct hda_input_mux alc262_HP_capture_source = {
11274 { "Front Mic", 0x1 },
11281 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11285 { "Front Mic", 0x2 },
11291 /* mute/unmute internal speaker according to the hp jacks and mute state */
11292 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11294 struct alc_spec *spec = codec->spec;
11297 if (force || !spec->sense_updated) {
11298 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11299 snd_hda_jack_detect(codec, 0x1b);
11300 spec->sense_updated = 1;
11302 /* unmute internal speaker only if both HPs are unplugged and
11303 * master switch is on
11305 if (spec->jack_present)
11306 mute = HDA_AMP_MUTE;
11308 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11309 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11310 HDA_AMP_MUTE, mute);
11313 /* unsolicited event for HP jack sensing */
11314 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11317 if ((res >> 26) != ALC_HP_EVENT)
11319 alc262_fujitsu_automute(codec, 1);
11322 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11324 alc262_fujitsu_automute(codec, 1);
11327 /* bind volumes of both NID 0x0c and 0x0d */
11328 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11329 .ops = &snd_hda_bind_vol,
11331 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11332 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11337 /* mute/unmute internal speaker according to the hp jack and mute state */
11338 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11340 struct alc_spec *spec = codec->spec;
11343 if (force || !spec->sense_updated) {
11344 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11345 spec->sense_updated = 1;
11347 if (spec->jack_present) {
11348 /* mute internal speaker */
11349 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11350 HDA_AMP_MUTE, HDA_AMP_MUTE);
11351 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11352 HDA_AMP_MUTE, HDA_AMP_MUTE);
11354 /* unmute internal speaker if necessary */
11355 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11356 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11357 HDA_AMP_MUTE, mute);
11358 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11359 HDA_AMP_MUTE, mute);
11363 /* unsolicited event for HP jack sensing */
11364 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11367 if ((res >> 26) != ALC_HP_EVENT)
11369 alc262_lenovo_3000_automute(codec, 1);
11372 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11373 int dir, int idx, long *valp)
11377 for (i = 0; i < 2; i++, valp++)
11378 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11380 *valp ? 0 : HDA_AMP_MUTE);
11384 /* bind hp and internal speaker mute (with plug check) */
11385 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11386 struct snd_ctl_elem_value *ucontrol)
11388 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11389 long *valp = ucontrol->value.integer.value;
11392 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11393 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11395 alc262_fujitsu_automute(codec, 0);
11399 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11400 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11402 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11403 .name = "Master Playback Switch",
11404 .subdevice = HDA_SUBDEV_AMP_FLAG,
11405 .info = snd_hda_mixer_amp_switch_info,
11406 .get = snd_hda_mixer_amp_switch_get,
11407 .put = alc262_fujitsu_master_sw_put,
11408 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11411 .iface = NID_MAPPING,
11412 .name = "Master Playback Switch",
11413 .private_value = 0x1b,
11415 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11416 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11417 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11418 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11419 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11420 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11421 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11422 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11426 /* bind hp and internal speaker mute (with plug check) */
11427 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11428 struct snd_ctl_elem_value *ucontrol)
11430 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11431 long *valp = ucontrol->value.integer.value;
11434 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11436 alc262_lenovo_3000_automute(codec, 0);
11440 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11441 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11444 .name = "Master Playback Switch",
11445 .subdevice = HDA_SUBDEV_AMP_FLAG,
11446 .info = snd_hda_mixer_amp_switch_info,
11447 .get = snd_hda_mixer_amp_switch_get,
11448 .put = alc262_lenovo_3000_master_sw_put,
11449 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11451 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11452 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11453 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11454 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11455 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11456 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11457 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11458 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11462 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11463 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11464 ALC262_HIPPO_MASTER_SWITCH,
11465 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11466 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11467 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11468 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11469 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11470 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11474 /* additional init verbs for Benq laptops */
11475 static struct hda_verb alc262_EAPD_verbs[] = {
11476 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11477 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11481 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11482 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11483 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11485 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11486 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11490 /* Samsung Q1 Ultra Vista model setup */
11491 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11492 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11493 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11494 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11495 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11496 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11497 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11501 static struct hda_verb alc262_ultra_verbs[] = {
11503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11504 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11505 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11507 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11508 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11509 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11510 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11512 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11513 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11514 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11515 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11516 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11518 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11520 /* ADC, choose mic */
11521 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11522 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11523 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11524 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11525 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11526 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11527 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11528 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11529 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11530 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11534 /* mute/unmute internal speaker according to the hp jack and mute state */
11535 static void alc262_ultra_automute(struct hda_codec *codec)
11537 struct alc_spec *spec = codec->spec;
11541 /* auto-mute only when HP is used as HP */
11542 if (!spec->cur_mux[0]) {
11543 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11544 if (spec->jack_present)
11545 mute = HDA_AMP_MUTE;
11547 /* mute/unmute internal speaker */
11548 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11549 HDA_AMP_MUTE, mute);
11550 /* mute/unmute HP */
11551 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11552 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11555 /* unsolicited event for HP jack sensing */
11556 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11559 if ((res >> 26) != ALC880_HP_EVENT)
11561 alc262_ultra_automute(codec);
11564 static struct hda_input_mux alc262_ultra_capture_source = {
11568 { "Headphone", 0x7 },
11572 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11573 struct snd_ctl_elem_value *ucontrol)
11575 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11576 struct alc_spec *spec = codec->spec;
11579 ret = alc_mux_enum_put(kcontrol, ucontrol);
11582 /* reprogram the HP pin as mic or HP according to the input source */
11583 snd_hda_codec_write_cache(codec, 0x15, 0,
11584 AC_VERB_SET_PIN_WIDGET_CONTROL,
11585 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11586 alc262_ultra_automute(codec); /* mute/unmute HP */
11590 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11591 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11592 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11594 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11595 .name = "Capture Source",
11596 .info = alc_mux_enum_info,
11597 .get = alc_mux_enum_get,
11598 .put = alc262_ultra_mux_enum_put,
11601 .iface = NID_MAPPING,
11602 .name = "Capture Source",
11603 .private_value = 0x15,
11608 /* We use two mixers depending on the output pin; 0x16 is a mono output
11609 * and thus it's bound with a different mixer.
11610 * This function returns which mixer amp should be used.
11612 static int alc262_check_volbit(hda_nid_t nid)
11616 else if (nid == 0x16)
11622 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11623 const char *pfx, int *vbits)
11628 vbit = alc262_check_volbit(nid);
11631 if (*vbits & vbit) /* a volume control for this mixer already there */
11635 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11637 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11638 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11641 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11649 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11651 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11652 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11655 /* add playback controls from the parsed DAC table */
11656 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11657 const struct auto_pin_cfg *cfg)
11663 spec->multiout.num_dacs = 1; /* only use one dac */
11664 spec->multiout.dac_nids = spec->private_dac_nids;
11665 spec->multiout.dac_nids[0] = 2;
11667 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11669 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11673 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11676 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11679 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11683 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11684 alc262_check_volbit(cfg->speaker_pins[0]) |
11685 alc262_check_volbit(cfg->hp_pins[0]);
11686 if (vbits == 1 || vbits == 2)
11687 pfx = "Master"; /* only one mixer is used */
11688 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11693 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11696 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11700 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11707 #define alc262_auto_create_input_ctls \
11708 alc882_auto_create_input_ctls
11711 * generic initialization of ADC, input mixers and output mixers
11713 static struct hda_verb alc262_volume_init_verbs[] = {
11715 * Unmute ADC0-2 and set the default input to mic-in
11717 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11718 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11719 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11720 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11721 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11722 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11724 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11726 * Note: PASD motherboards uses the Line In 2 as the input for
11727 * front panel mic (mic 2)
11729 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11733 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11734 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11737 * Set up output mixers (0x0c - 0x0f)
11739 /* set vol=0 to output mixers */
11740 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11741 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11742 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11744 /* set up input amps for analog loopback */
11745 /* Amp Indices: DAC = 0, mixer = 1 */
11746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11747 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11748 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11749 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11750 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11751 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11753 /* FIXME: use matrix-type input source selection */
11754 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11755 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11756 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11757 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11758 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11759 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11761 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11762 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11763 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11764 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11766 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11767 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11768 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11769 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11774 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11776 * Unmute ADC0-2 and set the default input to mic-in
11778 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11779 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11780 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11781 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11782 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11783 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11785 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11787 * Note: PASD motherboards uses the Line In 2 as the input for
11788 * front panel mic (mic 2)
11790 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11791 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11792 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11793 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11794 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11795 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11796 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11797 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11800 * Set up output mixers (0x0c - 0x0e)
11802 /* set vol=0 to output mixers */
11803 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11804 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11805 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11807 /* set up input amps for analog loopback */
11808 /* Amp Indices: DAC = 0, mixer = 1 */
11809 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11810 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11811 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11812 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11813 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11814 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11816 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11817 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11818 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11820 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11821 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11823 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11824 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11826 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11827 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11828 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11829 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11830 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11832 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11833 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11834 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11835 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11836 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11837 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11840 /* FIXME: use matrix-type input source selection */
11841 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11842 /* Input mixer1: only unmute Mic */
11843 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11844 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11845 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11846 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11847 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11848 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11849 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11850 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11851 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11853 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11854 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11855 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11856 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11857 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11858 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11859 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11860 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11861 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11863 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11864 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11865 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11866 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11867 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11868 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11869 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11870 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11871 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11873 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11878 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11880 * Unmute ADC0-2 and set the default input to mic-in
11882 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11883 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11884 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11885 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11886 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11887 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11889 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11891 * Note: PASD motherboards uses the Line In 2 as the input for front
11892 * panel mic (mic 2)
11894 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11895 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11896 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11897 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11898 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11899 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11900 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11901 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11902 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11904 * Set up output mixers (0x0c - 0x0e)
11906 /* set vol=0 to output mixers */
11907 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11908 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11909 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11911 /* set up input amps for analog loopback */
11912 /* Amp Indices: DAC = 0, mixer = 1 */
11913 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11914 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11915 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11916 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11917 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11918 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11921 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11922 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11923 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11924 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11925 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11926 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11927 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11929 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11932 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11933 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11935 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11936 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11937 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11938 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11939 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11940 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11942 /* FIXME: use matrix-type input source selection */
11943 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11944 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11945 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11946 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11947 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11948 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11949 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11950 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11951 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11953 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11954 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11955 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11956 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11957 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11958 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11959 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11961 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11962 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11963 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11964 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11965 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11966 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11967 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11969 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11974 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11976 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11977 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11978 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11980 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11981 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11982 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11983 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11985 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11986 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11987 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11992 #ifdef CONFIG_SND_HDA_POWER_SAVE
11993 #define alc262_loopbacks alc880_loopbacks
11996 /* pcm configuration: identical with ALC880 */
11997 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11998 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11999 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12000 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12003 * BIOS auto configuration
12005 static int alc262_parse_auto_config(struct hda_codec *codec)
12007 struct alc_spec *spec = codec->spec;
12009 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12011 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12015 if (!spec->autocfg.line_outs) {
12016 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12017 spec->multiout.max_channels = 2;
12018 spec->no_analog = 1;
12021 return 0; /* can't find valid BIOS pin config */
12023 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12026 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12030 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12033 if (spec->autocfg.dig_outs) {
12034 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
12035 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12037 if (spec->autocfg.dig_in_pin)
12038 spec->dig_in_nid = ALC262_DIGIN_NID;
12040 if (spec->kctls.list)
12041 add_mixer(spec, spec->kctls.list);
12043 add_verb(spec, alc262_volume_init_verbs);
12044 spec->num_mux_defs = 1;
12045 spec->input_mux = &spec->private_imux[0];
12047 err = alc_auto_add_mic_boost(codec);
12051 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12056 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12057 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12058 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12059 #define alc262_auto_init_input_src alc882_auto_init_input_src
12062 /* init callback for auto-configuration model -- overriding the default init */
12063 static void alc262_auto_init(struct hda_codec *codec)
12065 struct alc_spec *spec = codec->spec;
12066 alc262_auto_init_multi_out(codec);
12067 alc262_auto_init_hp_out(codec);
12068 alc262_auto_init_analog_input(codec);
12069 alc262_auto_init_input_src(codec);
12070 if (spec->unsol_event)
12071 alc_inithook(codec);
12075 * configuration and preset
12077 static const char *alc262_models[ALC262_MODEL_LAST] = {
12078 [ALC262_BASIC] = "basic",
12079 [ALC262_HIPPO] = "hippo",
12080 [ALC262_HIPPO_1] = "hippo_1",
12081 [ALC262_FUJITSU] = "fujitsu",
12082 [ALC262_HP_BPC] = "hp-bpc",
12083 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12084 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12085 [ALC262_HP_RP5700] = "hp-rp5700",
12086 [ALC262_BENQ_ED8] = "benq",
12087 [ALC262_BENQ_T31] = "benq-t31",
12088 [ALC262_SONY_ASSAMD] = "sony-assamd",
12089 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12090 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12091 [ALC262_ULTRA] = "ultra",
12092 [ALC262_LENOVO_3000] = "lenovo-3000",
12093 [ALC262_NEC] = "nec",
12094 [ALC262_TYAN] = "tyan",
12095 [ALC262_AUTO] = "auto",
12098 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12099 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12100 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12101 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12103 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12105 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12107 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12108 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12109 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12110 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12111 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12112 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12113 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12114 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12115 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12116 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12117 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12118 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12119 ALC262_HP_TC_T5735),
12120 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12121 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12122 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12123 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12124 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12125 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12126 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12127 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12128 #if 0 /* disable the quirk since model=auto works better in recent versions */
12129 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12130 ALC262_SONY_ASSAMD),
12132 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12133 ALC262_TOSHIBA_RX1),
12134 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12135 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12136 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12137 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12138 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12140 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12141 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12142 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12143 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12144 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12148 static struct alc_config_preset alc262_presets[] = {
12150 .mixers = { alc262_base_mixer },
12151 .init_verbs = { alc262_init_verbs },
12152 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12153 .dac_nids = alc262_dac_nids,
12155 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12156 .channel_mode = alc262_modes,
12157 .input_mux = &alc262_capture_source,
12160 .mixers = { alc262_hippo_mixer },
12161 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12162 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12163 .dac_nids = alc262_dac_nids,
12165 .dig_out_nid = ALC262_DIGOUT_NID,
12166 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12167 .channel_mode = alc262_modes,
12168 .input_mux = &alc262_capture_source,
12169 .unsol_event = alc262_hippo_unsol_event,
12170 .setup = alc262_hippo_setup,
12171 .init_hook = alc262_hippo_automute,
12173 [ALC262_HIPPO_1] = {
12174 .mixers = { alc262_hippo1_mixer },
12175 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12176 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12177 .dac_nids = alc262_dac_nids,
12179 .dig_out_nid = ALC262_DIGOUT_NID,
12180 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12181 .channel_mode = alc262_modes,
12182 .input_mux = &alc262_capture_source,
12183 .unsol_event = alc262_hippo_unsol_event,
12184 .setup = alc262_hippo1_setup,
12185 .init_hook = alc262_hippo_automute,
12187 [ALC262_FUJITSU] = {
12188 .mixers = { alc262_fujitsu_mixer },
12189 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12190 alc262_fujitsu_unsol_verbs },
12191 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12192 .dac_nids = alc262_dac_nids,
12194 .dig_out_nid = ALC262_DIGOUT_NID,
12195 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12196 .channel_mode = alc262_modes,
12197 .input_mux = &alc262_fujitsu_capture_source,
12198 .unsol_event = alc262_fujitsu_unsol_event,
12199 .init_hook = alc262_fujitsu_init_hook,
12201 [ALC262_HP_BPC] = {
12202 .mixers = { alc262_HP_BPC_mixer },
12203 .init_verbs = { alc262_HP_BPC_init_verbs },
12204 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12205 .dac_nids = alc262_dac_nids,
12207 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12208 .channel_mode = alc262_modes,
12209 .input_mux = &alc262_HP_capture_source,
12210 .unsol_event = alc262_hp_bpc_unsol_event,
12211 .init_hook = alc262_hp_bpc_automute,
12213 [ALC262_HP_BPC_D7000_WF] = {
12214 .mixers = { alc262_HP_BPC_WildWest_mixer },
12215 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12216 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12217 .dac_nids = alc262_dac_nids,
12219 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12220 .channel_mode = alc262_modes,
12221 .input_mux = &alc262_HP_D7000_capture_source,
12222 .unsol_event = alc262_hp_wildwest_unsol_event,
12223 .init_hook = alc262_hp_wildwest_automute,
12225 [ALC262_HP_BPC_D7000_WL] = {
12226 .mixers = { alc262_HP_BPC_WildWest_mixer,
12227 alc262_HP_BPC_WildWest_option_mixer },
12228 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12229 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12230 .dac_nids = alc262_dac_nids,
12232 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12233 .channel_mode = alc262_modes,
12234 .input_mux = &alc262_HP_D7000_capture_source,
12235 .unsol_event = alc262_hp_wildwest_unsol_event,
12236 .init_hook = alc262_hp_wildwest_automute,
12238 [ALC262_HP_TC_T5735] = {
12239 .mixers = { alc262_hp_t5735_mixer },
12240 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12241 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12242 .dac_nids = alc262_dac_nids,
12244 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12245 .channel_mode = alc262_modes,
12246 .input_mux = &alc262_capture_source,
12247 .unsol_event = alc_sku_unsol_event,
12248 .setup = alc262_hp_t5735_setup,
12249 .init_hook = alc_inithook,
12251 [ALC262_HP_RP5700] = {
12252 .mixers = { alc262_hp_rp5700_mixer },
12253 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12254 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12255 .dac_nids = alc262_dac_nids,
12256 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12257 .channel_mode = alc262_modes,
12258 .input_mux = &alc262_hp_rp5700_capture_source,
12260 [ALC262_BENQ_ED8] = {
12261 .mixers = { alc262_base_mixer },
12262 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12263 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12264 .dac_nids = alc262_dac_nids,
12266 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12267 .channel_mode = alc262_modes,
12268 .input_mux = &alc262_capture_source,
12270 [ALC262_SONY_ASSAMD] = {
12271 .mixers = { alc262_sony_mixer },
12272 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12273 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12274 .dac_nids = alc262_dac_nids,
12276 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12277 .channel_mode = alc262_modes,
12278 .input_mux = &alc262_capture_source,
12279 .unsol_event = alc262_hippo_unsol_event,
12280 .setup = alc262_hippo_setup,
12281 .init_hook = alc262_hippo_automute,
12283 [ALC262_BENQ_T31] = {
12284 .mixers = { alc262_benq_t31_mixer },
12285 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12286 alc_hp15_unsol_verbs },
12287 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12288 .dac_nids = alc262_dac_nids,
12290 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12291 .channel_mode = alc262_modes,
12292 .input_mux = &alc262_capture_source,
12293 .unsol_event = alc262_hippo_unsol_event,
12294 .setup = alc262_hippo_setup,
12295 .init_hook = alc262_hippo_automute,
12298 .mixers = { alc262_ultra_mixer },
12299 .cap_mixer = alc262_ultra_capture_mixer,
12300 .init_verbs = { alc262_ultra_verbs },
12301 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12302 .dac_nids = alc262_dac_nids,
12303 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12304 .channel_mode = alc262_modes,
12305 .input_mux = &alc262_ultra_capture_source,
12306 .adc_nids = alc262_adc_nids, /* ADC0 */
12307 .capsrc_nids = alc262_capsrc_nids,
12308 .num_adc_nids = 1, /* single ADC */
12309 .unsol_event = alc262_ultra_unsol_event,
12310 .init_hook = alc262_ultra_automute,
12312 [ALC262_LENOVO_3000] = {
12313 .mixers = { alc262_lenovo_3000_mixer },
12314 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12315 alc262_lenovo_3000_unsol_verbs,
12316 alc262_lenovo_3000_init_verbs },
12317 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12318 .dac_nids = alc262_dac_nids,
12320 .dig_out_nid = ALC262_DIGOUT_NID,
12321 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12322 .channel_mode = alc262_modes,
12323 .input_mux = &alc262_fujitsu_capture_source,
12324 .unsol_event = alc262_lenovo_3000_unsol_event,
12327 .mixers = { alc262_nec_mixer },
12328 .init_verbs = { alc262_nec_verbs },
12329 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12330 .dac_nids = alc262_dac_nids,
12332 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12333 .channel_mode = alc262_modes,
12334 .input_mux = &alc262_capture_source,
12336 [ALC262_TOSHIBA_S06] = {
12337 .mixers = { alc262_toshiba_s06_mixer },
12338 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12339 alc262_eapd_verbs },
12340 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12341 .capsrc_nids = alc262_dmic_capsrc_nids,
12342 .dac_nids = alc262_dac_nids,
12343 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12344 .num_adc_nids = 1, /* single ADC */
12345 .dig_out_nid = ALC262_DIGOUT_NID,
12346 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12347 .channel_mode = alc262_modes,
12348 .unsol_event = alc_sku_unsol_event,
12349 .setup = alc262_toshiba_s06_setup,
12350 .init_hook = alc_inithook,
12352 [ALC262_TOSHIBA_RX1] = {
12353 .mixers = { alc262_toshiba_rx1_mixer },
12354 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12355 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12356 .dac_nids = alc262_dac_nids,
12358 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12359 .channel_mode = alc262_modes,
12360 .input_mux = &alc262_capture_source,
12361 .unsol_event = alc262_hippo_unsol_event,
12362 .setup = alc262_hippo_setup,
12363 .init_hook = alc262_hippo_automute,
12366 .mixers = { alc262_tyan_mixer },
12367 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12368 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12369 .dac_nids = alc262_dac_nids,
12371 .dig_out_nid = ALC262_DIGOUT_NID,
12372 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12373 .channel_mode = alc262_modes,
12374 .input_mux = &alc262_capture_source,
12375 .unsol_event = alc_automute_amp_unsol_event,
12376 .setup = alc262_tyan_setup,
12377 .init_hook = alc_automute_amp,
12381 static int patch_alc262(struct hda_codec *codec)
12383 struct alc_spec *spec;
12387 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12391 codec->spec = spec;
12393 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12398 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12399 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12400 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12401 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12404 alc_auto_parse_customize_define(codec);
12406 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12408 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12412 if (board_config < 0) {
12413 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12415 board_config = ALC262_AUTO;
12418 if (board_config == ALC262_AUTO) {
12419 /* automatic parse from the BIOS config */
12420 err = alc262_parse_auto_config(codec);
12426 "hda_codec: Cannot set up configuration "
12427 "from BIOS. Using base mode...\n");
12428 board_config = ALC262_BASIC;
12432 if (!spec->no_analog) {
12433 err = snd_hda_attach_beep_device(codec, 0x1);
12440 if (board_config != ALC262_AUTO)
12441 setup_preset(codec, &alc262_presets[board_config]);
12443 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12444 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12446 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12447 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12449 if (!spec->adc_nids && spec->input_mux) {
12451 /* check whether the digital-mic has to be supported */
12452 for (i = 0; i < spec->input_mux->num_items; i++) {
12453 if (spec->input_mux->items[i].index >= 9)
12456 if (i < spec->input_mux->num_items) {
12457 /* use only ADC0 */
12458 spec->adc_nids = alc262_dmic_adc_nids;
12459 spec->num_adc_nids = 1;
12460 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12462 /* all analog inputs */
12463 /* check whether NID 0x07 is valid */
12464 unsigned int wcap = get_wcaps(codec, 0x07);
12467 wcap = get_wcaps_type(wcap);
12468 if (wcap != AC_WID_AUD_IN) {
12469 spec->adc_nids = alc262_adc_nids_alt;
12470 spec->num_adc_nids =
12471 ARRAY_SIZE(alc262_adc_nids_alt);
12472 spec->capsrc_nids = alc262_capsrc_nids_alt;
12474 spec->adc_nids = alc262_adc_nids;
12475 spec->num_adc_nids =
12476 ARRAY_SIZE(alc262_adc_nids);
12477 spec->capsrc_nids = alc262_capsrc_nids;
12481 if (!spec->cap_mixer && !spec->no_analog)
12482 set_capture_mixer(codec);
12483 if (!spec->no_analog && spec->cdefine.enable_pcbeep)
12484 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12486 spec->vmaster_nid = 0x0c;
12488 codec->patch_ops = alc_patch_ops;
12489 if (board_config == ALC262_AUTO)
12490 spec->init_hook = alc262_auto_init;
12491 #ifdef CONFIG_SND_HDA_POWER_SAVE
12492 if (!spec->loopback.amplist)
12493 spec->loopback.amplist = alc262_loopbacks;
12500 * ALC268 channel source setting (2 channel)
12502 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12503 #define alc268_modes alc260_modes
12505 static hda_nid_t alc268_dac_nids[2] = {
12510 static hda_nid_t alc268_adc_nids[2] = {
12515 static hda_nid_t alc268_adc_nids_alt[1] = {
12520 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12522 static struct snd_kcontrol_new alc268_base_mixer[] = {
12523 /* output mixer control */
12524 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12525 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12526 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12527 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12528 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12529 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12530 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12534 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12535 /* output mixer control */
12536 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12537 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12538 ALC262_HIPPO_MASTER_SWITCH,
12539 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12540 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12541 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12545 /* bind Beep switches of both NID 0x0f and 0x10 */
12546 static struct hda_bind_ctls alc268_bind_beep_sw = {
12547 .ops = &snd_hda_bind_sw,
12549 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12550 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12555 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12556 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12557 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12561 static struct hda_verb alc268_eapd_verbs[] = {
12562 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12563 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12567 /* Toshiba specific */
12568 static struct hda_verb alc268_toshiba_verbs[] = {
12569 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12573 /* Acer specific */
12574 /* bind volumes of both NID 0x02 and 0x03 */
12575 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12576 .ops = &snd_hda_bind_vol,
12578 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12579 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12584 /* mute/unmute internal speaker according to the hp jack and mute state */
12585 static void alc268_acer_automute(struct hda_codec *codec, int force)
12587 struct alc_spec *spec = codec->spec;
12590 if (force || !spec->sense_updated) {
12591 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12592 spec->sense_updated = 1;
12594 if (spec->jack_present)
12595 mute = HDA_AMP_MUTE; /* mute internal speaker */
12596 else /* unmute internal speaker if necessary */
12597 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12598 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12599 HDA_AMP_MUTE, mute);
12603 /* bind hp and internal speaker mute (with plug check) */
12604 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12605 struct snd_ctl_elem_value *ucontrol)
12607 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12608 long *valp = ucontrol->value.integer.value;
12611 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12613 alc268_acer_automute(codec, 0);
12617 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12618 /* output mixer control */
12619 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12621 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12622 .name = "Master Playback Switch",
12623 .subdevice = HDA_SUBDEV_AMP_FLAG,
12624 .info = snd_hda_mixer_amp_switch_info,
12625 .get = snd_hda_mixer_amp_switch_get,
12626 .put = alc268_acer_master_sw_put,
12627 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12629 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12633 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12634 /* output mixer control */
12635 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12637 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12638 .name = "Master Playback Switch",
12639 .subdevice = HDA_SUBDEV_AMP_FLAG,
12640 .info = snd_hda_mixer_amp_switch_info,
12641 .get = snd_hda_mixer_amp_switch_get,
12642 .put = alc268_acer_master_sw_put,
12643 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12645 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12646 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12647 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12651 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12652 /* output mixer control */
12653 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12655 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12656 .name = "Master Playback Switch",
12657 .subdevice = HDA_SUBDEV_AMP_FLAG,
12658 .info = snd_hda_mixer_amp_switch_info,
12659 .get = snd_hda_mixer_amp_switch_get,
12660 .put = alc268_acer_master_sw_put,
12661 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12663 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12664 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12668 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12669 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12670 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12671 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12672 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12673 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12674 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12678 static struct hda_verb alc268_acer_verbs[] = {
12679 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12680 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12681 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12682 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12683 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12684 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12685 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12689 /* unsolicited event for HP jack sensing */
12690 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12691 #define alc268_toshiba_setup alc262_hippo_setup
12692 #define alc268_toshiba_automute alc262_hippo_automute
12694 static void alc268_acer_unsol_event(struct hda_codec *codec,
12697 if ((res >> 26) != ALC880_HP_EVENT)
12699 alc268_acer_automute(codec, 1);
12702 static void alc268_acer_init_hook(struct hda_codec *codec)
12704 alc268_acer_automute(codec, 1);
12707 /* toggle speaker-output according to the hp-jack state */
12708 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12710 unsigned int present;
12711 unsigned char bits;
12713 present = snd_hda_jack_detect(codec, 0x15);
12714 bits = present ? HDA_AMP_MUTE : 0;
12715 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12716 HDA_AMP_MUTE, bits);
12717 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12718 HDA_AMP_MUTE, bits);
12721 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12724 switch (res >> 26) {
12725 case ALC880_HP_EVENT:
12726 alc268_aspire_one_speaker_automute(codec);
12728 case ALC880_MIC_EVENT:
12729 alc_mic_automute(codec);
12734 static void alc268_acer_lc_setup(struct hda_codec *codec)
12736 struct alc_spec *spec = codec->spec;
12737 spec->ext_mic.pin = 0x18;
12738 spec->ext_mic.mux_idx = 0;
12739 spec->int_mic.pin = 0x12;
12740 spec->int_mic.mux_idx = 6;
12741 spec->auto_mic = 1;
12744 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12746 alc268_aspire_one_speaker_automute(codec);
12747 alc_mic_automute(codec);
12750 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12751 /* output mixer control */
12752 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12753 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12754 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12755 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12756 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12757 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12761 static struct hda_verb alc268_dell_verbs[] = {
12762 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12763 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12764 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12765 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12769 /* mute/unmute internal speaker according to the hp jack and mute state */
12770 static void alc268_dell_setup(struct hda_codec *codec)
12772 struct alc_spec *spec = codec->spec;
12774 spec->autocfg.hp_pins[0] = 0x15;
12775 spec->autocfg.speaker_pins[0] = 0x14;
12776 spec->ext_mic.pin = 0x18;
12777 spec->ext_mic.mux_idx = 0;
12778 spec->int_mic.pin = 0x19;
12779 spec->int_mic.mux_idx = 1;
12780 spec->auto_mic = 1;
12783 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12784 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12785 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12786 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12787 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12788 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12789 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12790 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12791 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12795 static struct hda_verb alc267_quanta_il1_verbs[] = {
12796 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12797 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12801 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12803 struct alc_spec *spec = codec->spec;
12804 spec->autocfg.hp_pins[0] = 0x15;
12805 spec->autocfg.speaker_pins[0] = 0x14;
12806 spec->ext_mic.pin = 0x18;
12807 spec->ext_mic.mux_idx = 0;
12808 spec->int_mic.pin = 0x19;
12809 spec->int_mic.mux_idx = 1;
12810 spec->auto_mic = 1;
12814 * generic initialization of ADC, input mixers and output mixers
12816 static struct hda_verb alc268_base_init_verbs[] = {
12817 /* Unmute DAC0-1 and set vol = 0 */
12818 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12819 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12822 * Set up output mixers (0x0c - 0x0e)
12824 /* set vol=0 to output mixers */
12825 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12826 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12828 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12829 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12831 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12832 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12833 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12834 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12835 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12836 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12837 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12838 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12840 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12841 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12842 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12843 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12844 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12846 /* set PCBEEP vol = 0, mute connections */
12847 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12848 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12849 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12851 /* Unmute Selector 23h,24h and set the default input to mic-in */
12853 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12854 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12855 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12856 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12862 * generic initialization of ADC, input mixers and output mixers
12864 static struct hda_verb alc268_volume_init_verbs[] = {
12865 /* set output DAC */
12866 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12867 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12869 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12870 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12871 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12872 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12873 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12875 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12876 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12877 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12879 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12880 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12882 /* set PCBEEP vol = 0, mute connections */
12883 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12884 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12885 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12890 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12891 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12892 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12896 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12897 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12898 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12903 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12904 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12905 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12906 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12907 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12912 static struct hda_input_mux alc268_capture_source = {
12916 { "Front Mic", 0x1 },
12922 static struct hda_input_mux alc268_acer_capture_source = {
12926 { "Internal Mic", 0x1 },
12931 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12935 { "Internal Mic", 0x6 },
12940 #ifdef CONFIG_SND_DEBUG
12941 static struct snd_kcontrol_new alc268_test_mixer[] = {
12942 /* Volume widgets */
12943 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12944 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12945 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12946 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12947 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12948 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12949 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12950 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12951 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12952 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12953 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12954 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12955 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12956 /* The below appears problematic on some hardwares */
12957 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12958 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12959 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12960 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12961 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12963 /* Modes for retasking pin widgets */
12964 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12965 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12966 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12967 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12969 /* Controls for GPIO pins, assuming they are configured as outputs */
12970 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12971 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12972 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12973 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12975 /* Switches to allow the digital SPDIF output pin to be enabled.
12976 * The ALC268 does not have an SPDIF input.
12978 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12980 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12981 * this output to turn on an external amplifier.
12983 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12984 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12990 /* create input playback/capture controls for the given pin */
12991 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12992 const char *ctlname, int idx)
13003 case 0x21: /* ALC269vb has this pin, too */
13009 if (spec->multiout.dac_nids[0] != dac &&
13010 spec->multiout.dac_nids[1] != dac) {
13011 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13012 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13016 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13020 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13021 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13023 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13024 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13030 /* add playback controls from the parsed DAC table */
13031 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13032 const struct auto_pin_cfg *cfg)
13037 spec->multiout.dac_nids = spec->private_dac_nids;
13039 nid = cfg->line_out_pins[0];
13042 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13046 err = alc268_new_analog_output(spec, nid, name, 0);
13051 nid = cfg->speaker_pins[0];
13053 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13054 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13058 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13062 nid = cfg->hp_pins[0];
13064 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13069 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13071 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13072 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13079 /* create playback/capture controls for input pins */
13080 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13081 const struct auto_pin_cfg *cfg)
13083 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13086 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13087 hda_nid_t nid, int pin_type)
13091 alc_set_pin_output(codec, nid, pin_type);
13092 if (nid == 0x14 || nid == 0x16)
13096 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13099 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13101 struct alc_spec *spec = codec->spec;
13102 hda_nid_t nid = spec->autocfg.line_out_pins[0];
13104 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13105 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13109 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13111 struct alc_spec *spec = codec->spec;
13114 pin = spec->autocfg.hp_pins[0];
13116 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13117 pin = spec->autocfg.speaker_pins[0];
13119 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13122 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13124 struct alc_spec *spec = codec->spec;
13125 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13126 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13127 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13128 unsigned int dac_vol1, dac_vol2;
13130 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13131 snd_hda_codec_write(codec, speaker_nid, 0,
13132 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13133 /* mute mixer inputs from 0x1d */
13134 snd_hda_codec_write(codec, 0x0f, 0,
13135 AC_VERB_SET_AMP_GAIN_MUTE,
13137 snd_hda_codec_write(codec, 0x10, 0,
13138 AC_VERB_SET_AMP_GAIN_MUTE,
13141 /* unmute mixer inputs from 0x1d */
13142 snd_hda_codec_write(codec, 0x0f, 0,
13143 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13144 snd_hda_codec_write(codec, 0x10, 0,
13145 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13148 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13149 if (line_nid == 0x14)
13150 dac_vol2 = AMP_OUT_ZERO;
13151 else if (line_nid == 0x15)
13152 dac_vol1 = AMP_OUT_ZERO;
13153 if (hp_nid == 0x14)
13154 dac_vol2 = AMP_OUT_ZERO;
13155 else if (hp_nid == 0x15)
13156 dac_vol1 = AMP_OUT_ZERO;
13157 if (line_nid != 0x16 || hp_nid != 0x16 ||
13158 spec->autocfg.line_out_pins[1] != 0x16 ||
13159 spec->autocfg.line_out_pins[2] != 0x16)
13160 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13162 snd_hda_codec_write(codec, 0x02, 0,
13163 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13164 snd_hda_codec_write(codec, 0x03, 0,
13165 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13168 /* pcm configuration: identical with ALC880 */
13169 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13170 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13171 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13172 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13175 * BIOS auto configuration
13177 static int alc268_parse_auto_config(struct hda_codec *codec)
13179 struct alc_spec *spec = codec->spec;
13181 static hda_nid_t alc268_ignore[] = { 0 };
13183 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13187 if (!spec->autocfg.line_outs) {
13188 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13189 spec->multiout.max_channels = 2;
13190 spec->no_analog = 1;
13193 return 0; /* can't find valid BIOS pin config */
13195 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13198 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13202 spec->multiout.max_channels = 2;
13205 /* digital only support output */
13206 if (spec->autocfg.dig_outs) {
13207 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
13208 spec->dig_out_type = spec->autocfg.dig_out_type[0];
13210 if (spec->kctls.list)
13211 add_mixer(spec, spec->kctls.list);
13213 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13214 add_mixer(spec, alc268_beep_mixer);
13216 add_verb(spec, alc268_volume_init_verbs);
13217 spec->num_mux_defs = 2;
13218 spec->input_mux = &spec->private_imux[0];
13220 err = alc_auto_add_mic_boost(codec);
13224 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13229 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13231 /* init callback for auto-configuration model -- overriding the default init */
13232 static void alc268_auto_init(struct hda_codec *codec)
13234 struct alc_spec *spec = codec->spec;
13235 alc268_auto_init_multi_out(codec);
13236 alc268_auto_init_hp_out(codec);
13237 alc268_auto_init_mono_speaker_out(codec);
13238 alc268_auto_init_analog_input(codec);
13239 if (spec->unsol_event)
13240 alc_inithook(codec);
13244 * configuration and preset
13246 static const char *alc268_models[ALC268_MODEL_LAST] = {
13247 [ALC267_QUANTA_IL1] = "quanta-il1",
13248 [ALC268_3ST] = "3stack",
13249 [ALC268_TOSHIBA] = "toshiba",
13250 [ALC268_ACER] = "acer",
13251 [ALC268_ACER_DMIC] = "acer-dmic",
13252 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13253 [ALC268_DELL] = "dell",
13254 [ALC268_ZEPTO] = "zepto",
13255 #ifdef CONFIG_SND_DEBUG
13256 [ALC268_TEST] = "test",
13258 [ALC268_AUTO] = "auto",
13261 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13262 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13263 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13264 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13265 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13266 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13267 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13268 ALC268_ACER_ASPIRE_ONE),
13269 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13270 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13271 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13272 /* almost compatible with toshiba but with optional digital outs;
13273 * auto-probing seems working fine
13275 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13277 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13278 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13279 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13280 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13281 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13282 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13286 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13287 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13288 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13289 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13290 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13295 static struct alc_config_preset alc268_presets[] = {
13296 [ALC267_QUANTA_IL1] = {
13297 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13298 alc268_capture_nosrc_mixer },
13299 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13300 alc267_quanta_il1_verbs },
13301 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13302 .dac_nids = alc268_dac_nids,
13303 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13304 .adc_nids = alc268_adc_nids_alt,
13306 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13307 .channel_mode = alc268_modes,
13308 .unsol_event = alc_sku_unsol_event,
13309 .setup = alc267_quanta_il1_setup,
13310 .init_hook = alc_inithook,
13313 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13314 alc268_beep_mixer },
13315 .init_verbs = { alc268_base_init_verbs },
13316 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13317 .dac_nids = alc268_dac_nids,
13318 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13319 .adc_nids = alc268_adc_nids_alt,
13320 .capsrc_nids = alc268_capsrc_nids,
13322 .dig_out_nid = ALC268_DIGOUT_NID,
13323 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13324 .channel_mode = alc268_modes,
13325 .input_mux = &alc268_capture_source,
13327 [ALC268_TOSHIBA] = {
13328 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13329 alc268_beep_mixer },
13330 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13331 alc268_toshiba_verbs },
13332 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13333 .dac_nids = alc268_dac_nids,
13334 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13335 .adc_nids = alc268_adc_nids_alt,
13336 .capsrc_nids = alc268_capsrc_nids,
13338 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13339 .channel_mode = alc268_modes,
13340 .input_mux = &alc268_capture_source,
13341 .unsol_event = alc268_toshiba_unsol_event,
13342 .setup = alc268_toshiba_setup,
13343 .init_hook = alc268_toshiba_automute,
13346 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13347 alc268_beep_mixer },
13348 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13349 alc268_acer_verbs },
13350 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13351 .dac_nids = alc268_dac_nids,
13352 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13353 .adc_nids = alc268_adc_nids_alt,
13354 .capsrc_nids = alc268_capsrc_nids,
13356 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13357 .channel_mode = alc268_modes,
13358 .input_mux = &alc268_acer_capture_source,
13359 .unsol_event = alc268_acer_unsol_event,
13360 .init_hook = alc268_acer_init_hook,
13362 [ALC268_ACER_DMIC] = {
13363 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13364 alc268_beep_mixer },
13365 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13366 alc268_acer_verbs },
13367 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13368 .dac_nids = alc268_dac_nids,
13369 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13370 .adc_nids = alc268_adc_nids_alt,
13371 .capsrc_nids = alc268_capsrc_nids,
13373 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13374 .channel_mode = alc268_modes,
13375 .input_mux = &alc268_acer_dmic_capture_source,
13376 .unsol_event = alc268_acer_unsol_event,
13377 .init_hook = alc268_acer_init_hook,
13379 [ALC268_ACER_ASPIRE_ONE] = {
13380 .mixers = { alc268_acer_aspire_one_mixer,
13382 alc268_capture_nosrc_mixer },
13383 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13384 alc268_acer_aspire_one_verbs },
13385 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13386 .dac_nids = alc268_dac_nids,
13387 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13388 .adc_nids = alc268_adc_nids_alt,
13389 .capsrc_nids = alc268_capsrc_nids,
13391 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13392 .channel_mode = alc268_modes,
13393 .unsol_event = alc268_acer_lc_unsol_event,
13394 .setup = alc268_acer_lc_setup,
13395 .init_hook = alc268_acer_lc_init_hook,
13398 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13399 alc268_capture_nosrc_mixer },
13400 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13401 alc268_dell_verbs },
13402 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13403 .dac_nids = alc268_dac_nids,
13404 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13405 .adc_nids = alc268_adc_nids_alt,
13406 .capsrc_nids = alc268_capsrc_nids,
13408 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13409 .channel_mode = alc268_modes,
13410 .unsol_event = alc_sku_unsol_event,
13411 .setup = alc268_dell_setup,
13412 .init_hook = alc_inithook,
13415 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13416 alc268_beep_mixer },
13417 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13418 alc268_toshiba_verbs },
13419 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13420 .dac_nids = alc268_dac_nids,
13421 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13422 .adc_nids = alc268_adc_nids_alt,
13423 .capsrc_nids = alc268_capsrc_nids,
13425 .dig_out_nid = ALC268_DIGOUT_NID,
13426 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13427 .channel_mode = alc268_modes,
13428 .input_mux = &alc268_capture_source,
13429 .setup = alc268_toshiba_setup,
13430 .init_hook = alc268_toshiba_automute,
13432 #ifdef CONFIG_SND_DEBUG
13434 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13435 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13436 alc268_volume_init_verbs },
13437 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13438 .dac_nids = alc268_dac_nids,
13439 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13440 .adc_nids = alc268_adc_nids_alt,
13441 .capsrc_nids = alc268_capsrc_nids,
13443 .dig_out_nid = ALC268_DIGOUT_NID,
13444 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13445 .channel_mode = alc268_modes,
13446 .input_mux = &alc268_capture_source,
13451 static int patch_alc268(struct hda_codec *codec)
13453 struct alc_spec *spec;
13455 int i, has_beep, err;
13457 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13461 codec->spec = spec;
13463 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13467 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13468 board_config = snd_hda_check_board_codec_sid_config(codec,
13469 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13471 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13472 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13474 board_config = ALC268_AUTO;
13477 if (board_config == ALC268_AUTO) {
13478 /* automatic parse from the BIOS config */
13479 err = alc268_parse_auto_config(codec);
13485 "hda_codec: Cannot set up configuration "
13486 "from BIOS. Using base mode...\n");
13487 board_config = ALC268_3ST;
13491 if (board_config != ALC268_AUTO)
13492 setup_preset(codec, &alc268_presets[board_config]);
13494 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13495 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13496 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13498 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13501 for (i = 0; i < spec->num_mixers; i++) {
13502 if (spec->mixers[i] == alc268_beep_mixer) {
13509 err = snd_hda_attach_beep_device(codec, 0x1);
13514 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13515 /* override the amp caps for beep generator */
13516 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13517 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13518 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13519 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13520 (0 << AC_AMPCAP_MUTE_SHIFT));
13523 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13524 /* check whether NID 0x07 is valid */
13525 unsigned int wcap = get_wcaps(codec, 0x07);
13528 spec->capsrc_nids = alc268_capsrc_nids;
13530 wcap = get_wcaps_type(wcap);
13531 if (spec->auto_mic ||
13532 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13533 spec->adc_nids = alc268_adc_nids_alt;
13534 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13535 if (spec->auto_mic)
13536 fixup_automic_adc(codec);
13537 if (spec->auto_mic || spec->input_mux->num_items == 1)
13538 add_mixer(spec, alc268_capture_nosrc_mixer);
13540 add_mixer(spec, alc268_capture_alt_mixer);
13542 spec->adc_nids = alc268_adc_nids;
13543 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13544 add_mixer(spec, alc268_capture_mixer);
13546 /* set default input source */
13547 for (i = 0; i < spec->num_adc_nids; i++)
13548 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13549 0, AC_VERB_SET_CONNECT_SEL,
13550 i < spec->num_mux_defs ?
13551 spec->input_mux[i].items[0].index :
13552 spec->input_mux->items[0].index);
13555 spec->vmaster_nid = 0x02;
13557 codec->patch_ops = alc_patch_ops;
13558 if (board_config == ALC268_AUTO)
13559 spec->init_hook = alc268_auto_init;
13565 * ALC269 channel source setting (2 channel)
13567 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13569 #define alc269_dac_nids alc260_dac_nids
13571 static hda_nid_t alc269_adc_nids[1] = {
13576 static hda_nid_t alc269_capsrc_nids[1] = {
13580 static hda_nid_t alc269vb_adc_nids[1] = {
13585 static hda_nid_t alc269vb_capsrc_nids[1] = {
13589 static hda_nid_t alc269_adc_candidates[] = {
13593 #define alc269_modes alc260_modes
13594 #define alc269_capture_source alc880_lg_lw_capture_source
13596 static struct snd_kcontrol_new alc269_base_mixer[] = {
13597 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13598 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13599 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13600 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13601 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13602 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13603 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13604 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13605 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13606 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13607 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13608 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13612 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13613 /* output mixer control */
13614 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13616 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13617 .name = "Master Playback Switch",
13618 .subdevice = HDA_SUBDEV_AMP_FLAG,
13619 .info = snd_hda_mixer_amp_switch_info,
13620 .get = snd_hda_mixer_amp_switch_get,
13621 .put = alc268_acer_master_sw_put,
13622 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13624 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13625 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13626 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13627 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13628 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13629 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13633 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13634 /* output mixer control */
13635 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13637 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13638 .name = "Master Playback Switch",
13639 .subdevice = HDA_SUBDEV_AMP_FLAG,
13640 .info = snd_hda_mixer_amp_switch_info,
13641 .get = snd_hda_mixer_amp_switch_get,
13642 .put = alc268_acer_master_sw_put,
13643 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13645 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13646 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13647 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13648 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13649 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13650 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13651 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13652 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13653 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13657 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13658 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13659 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13660 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13661 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13665 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13666 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13667 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13668 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13669 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13673 /* capture mixer elements */
13674 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13675 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13676 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13677 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13678 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13682 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13683 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13684 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13685 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13689 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13690 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13691 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13692 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13693 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13697 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13698 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13699 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13700 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13705 #define alc269_fujitsu_mixer alc269_laptop_mixer
13707 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13708 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13709 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13710 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13711 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13712 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13713 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13717 static struct hda_verb alc269_lifebook_verbs[] = {
13718 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13719 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13720 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13721 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13722 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13723 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13724 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13725 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13726 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13727 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13731 /* toggle speaker-output according to the hp-jack state */
13732 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13734 unsigned int present;
13735 unsigned char bits;
13737 present = snd_hda_jack_detect(codec, 0x15);
13738 bits = present ? HDA_AMP_MUTE : 0;
13739 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13740 HDA_AMP_MUTE, bits);
13741 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13742 HDA_AMP_MUTE, bits);
13744 snd_hda_codec_write(codec, 0x20, 0,
13745 AC_VERB_SET_COEF_INDEX, 0x0c);
13746 snd_hda_codec_write(codec, 0x20, 0,
13747 AC_VERB_SET_PROC_COEF, 0x680);
13749 snd_hda_codec_write(codec, 0x20, 0,
13750 AC_VERB_SET_COEF_INDEX, 0x0c);
13751 snd_hda_codec_write(codec, 0x20, 0,
13752 AC_VERB_SET_PROC_COEF, 0x480);
13755 /* toggle speaker-output according to the hp-jacks state */
13756 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13758 unsigned int present;
13759 unsigned char bits;
13761 /* Check laptop headphone socket */
13762 present = snd_hda_jack_detect(codec, 0x15);
13764 /* Check port replicator headphone socket */
13765 present |= snd_hda_jack_detect(codec, 0x1a);
13767 bits = present ? HDA_AMP_MUTE : 0;
13768 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13769 HDA_AMP_MUTE, bits);
13770 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13771 HDA_AMP_MUTE, bits);
13773 snd_hda_codec_write(codec, 0x20, 0,
13774 AC_VERB_SET_COEF_INDEX, 0x0c);
13775 snd_hda_codec_write(codec, 0x20, 0,
13776 AC_VERB_SET_PROC_COEF, 0x680);
13778 snd_hda_codec_write(codec, 0x20, 0,
13779 AC_VERB_SET_COEF_INDEX, 0x0c);
13780 snd_hda_codec_write(codec, 0x20, 0,
13781 AC_VERB_SET_PROC_COEF, 0x480);
13784 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13786 unsigned int present_laptop;
13787 unsigned int present_dock;
13789 present_laptop = snd_hda_jack_detect(codec, 0x18);
13790 present_dock = snd_hda_jack_detect(codec, 0x1b);
13792 /* Laptop mic port overrides dock mic port, design decision */
13794 snd_hda_codec_write(codec, 0x23, 0,
13795 AC_VERB_SET_CONNECT_SEL, 0x3);
13796 if (present_laptop)
13797 snd_hda_codec_write(codec, 0x23, 0,
13798 AC_VERB_SET_CONNECT_SEL, 0x0);
13799 if (!present_dock && !present_laptop)
13800 snd_hda_codec_write(codec, 0x23, 0,
13801 AC_VERB_SET_CONNECT_SEL, 0x1);
13804 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13807 switch (res >> 26) {
13808 case ALC880_HP_EVENT:
13809 alc269_quanta_fl1_speaker_automute(codec);
13811 case ALC880_MIC_EVENT:
13812 alc_mic_automute(codec);
13817 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13820 if ((res >> 26) == ALC880_HP_EVENT)
13821 alc269_lifebook_speaker_automute(codec);
13822 if ((res >> 26) == ALC880_MIC_EVENT)
13823 alc269_lifebook_mic_autoswitch(codec);
13826 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13828 struct alc_spec *spec = codec->spec;
13829 spec->autocfg.hp_pins[0] = 0x15;
13830 spec->autocfg.speaker_pins[0] = 0x14;
13831 spec->ext_mic.pin = 0x18;
13832 spec->ext_mic.mux_idx = 0;
13833 spec->int_mic.pin = 0x19;
13834 spec->int_mic.mux_idx = 1;
13835 spec->auto_mic = 1;
13838 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13840 alc269_quanta_fl1_speaker_automute(codec);
13841 alc_mic_automute(codec);
13844 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13846 alc269_lifebook_speaker_automute(codec);
13847 alc269_lifebook_mic_autoswitch(codec);
13850 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13851 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13852 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13853 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13854 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13855 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13856 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13857 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13861 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13862 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13863 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13864 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13865 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13866 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13867 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13871 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13872 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13873 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13874 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13875 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13876 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13877 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13878 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13882 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13883 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13884 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13885 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13886 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13887 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13888 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13889 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13893 /* toggle speaker-output according to the hp-jack state */
13894 static void alc269_speaker_automute(struct hda_codec *codec)
13896 struct alc_spec *spec = codec->spec;
13897 unsigned int nid = spec->autocfg.hp_pins[0];
13898 unsigned int present;
13899 unsigned char bits;
13901 present = snd_hda_jack_detect(codec, nid);
13902 bits = present ? HDA_AMP_MUTE : 0;
13903 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13904 HDA_AMP_MUTE, bits);
13905 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13906 HDA_AMP_MUTE, bits);
13909 /* unsolicited event for HP jack sensing */
13910 static void alc269_laptop_unsol_event(struct hda_codec *codec,
13913 switch (res >> 26) {
13914 case ALC880_HP_EVENT:
13915 alc269_speaker_automute(codec);
13917 case ALC880_MIC_EVENT:
13918 alc_mic_automute(codec);
13923 static void alc269_laptop_amic_setup(struct hda_codec *codec)
13925 struct alc_spec *spec = codec->spec;
13926 spec->autocfg.hp_pins[0] = 0x15;
13927 spec->autocfg.speaker_pins[0] = 0x14;
13928 spec->ext_mic.pin = 0x18;
13929 spec->ext_mic.mux_idx = 0;
13930 spec->int_mic.pin = 0x19;
13931 spec->int_mic.mux_idx = 1;
13932 spec->auto_mic = 1;
13935 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
13937 struct alc_spec *spec = codec->spec;
13938 spec->autocfg.hp_pins[0] = 0x15;
13939 spec->autocfg.speaker_pins[0] = 0x14;
13940 spec->ext_mic.pin = 0x18;
13941 spec->ext_mic.mux_idx = 0;
13942 spec->int_mic.pin = 0x12;
13943 spec->int_mic.mux_idx = 5;
13944 spec->auto_mic = 1;
13947 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
13949 struct alc_spec *spec = codec->spec;
13950 spec->autocfg.hp_pins[0] = 0x21;
13951 spec->autocfg.speaker_pins[0] = 0x14;
13952 spec->ext_mic.pin = 0x18;
13953 spec->ext_mic.mux_idx = 0;
13954 spec->int_mic.pin = 0x19;
13955 spec->int_mic.mux_idx = 1;
13956 spec->auto_mic = 1;
13959 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
13961 struct alc_spec *spec = codec->spec;
13962 spec->autocfg.hp_pins[0] = 0x21;
13963 spec->autocfg.speaker_pins[0] = 0x14;
13964 spec->ext_mic.pin = 0x18;
13965 spec->ext_mic.mux_idx = 0;
13966 spec->int_mic.pin = 0x12;
13967 spec->int_mic.mux_idx = 6;
13968 spec->auto_mic = 1;
13971 static void alc269_laptop_inithook(struct hda_codec *codec)
13973 alc269_speaker_automute(codec);
13974 alc_mic_automute(codec);
13978 * generic initialization of ADC, input mixers and output mixers
13980 static struct hda_verb alc269_init_verbs[] = {
13982 * Unmute ADC0 and set the default input to mic-in
13984 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13987 * Set up output mixers (0x02 - 0x03)
13989 /* set vol=0 to output mixers */
13990 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13991 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13993 /* set up input amps for analog loopback */
13994 /* Amp Indices: DAC = 0, mixer = 1 */
13995 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13996 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13997 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13998 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13999 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14000 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14002 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14003 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14004 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14005 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14006 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14007 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14008 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14010 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14011 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14013 /* FIXME: use Mux-type input source selection */
14014 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14015 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14016 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14019 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14023 static struct hda_verb alc269vb_init_verbs[] = {
14025 * Unmute ADC0 and set the default input to mic-in
14027 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14030 * Set up output mixers (0x02 - 0x03)
14032 /* set vol=0 to output mixers */
14033 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14034 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14036 /* set up input amps for analog loopback */
14037 /* Amp Indices: DAC = 0, mixer = 1 */
14038 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14039 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14040 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14041 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14042 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14043 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14045 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14046 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14047 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14048 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14049 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14050 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14051 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14053 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14054 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14056 /* FIXME: use Mux-type input source selection */
14057 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14058 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14059 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14062 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14066 #define alc269_auto_create_multi_out_ctls \
14067 alc268_auto_create_multi_out_ctls
14068 #define alc269_auto_create_input_ctls \
14069 alc268_auto_create_input_ctls
14071 #ifdef CONFIG_SND_HDA_POWER_SAVE
14072 #define alc269_loopbacks alc880_loopbacks
14075 /* pcm configuration: identical with ALC880 */
14076 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14077 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14078 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14079 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14081 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14085 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14086 /* NID is set in alc_build_pcms */
14088 .open = alc880_playback_pcm_open,
14089 .prepare = alc880_playback_pcm_prepare,
14090 .cleanup = alc880_playback_pcm_cleanup
14094 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14098 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14099 /* NID is set in alc_build_pcms */
14102 #ifdef CONFIG_SND_HDA_POWER_SAVE
14103 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14105 switch (codec->subsystem_id) {
14112 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14114 /* update mute-LED according to the speaker mute state */
14115 if (nid == 0x01 || nid == 0x14) {
14117 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14122 /* mic2 vref pin is used for mute LED control */
14123 snd_hda_codec_update_cache(codec, 0x19, 0,
14124 AC_VERB_SET_PIN_WIDGET_CONTROL,
14127 return alc_check_power_status(codec, nid);
14129 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14132 * BIOS auto configuration
14134 static int alc269_parse_auto_config(struct hda_codec *codec)
14136 struct alc_spec *spec = codec->spec;
14138 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14140 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14145 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14148 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14152 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14154 if (spec->autocfg.dig_outs)
14155 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
14157 if (spec->kctls.list)
14158 add_mixer(spec, spec->kctls.list);
14160 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14161 add_verb(spec, alc269vb_init_verbs);
14162 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14164 add_verb(spec, alc269_init_verbs);
14165 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14168 spec->num_mux_defs = 1;
14169 spec->input_mux = &spec->private_imux[0];
14170 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14171 sizeof(alc269_adc_candidates));
14173 /* set default input source */
14174 snd_hda_codec_write_cache(codec, spec->capsrc_nids[0],
14175 0, AC_VERB_SET_CONNECT_SEL,
14176 spec->input_mux->items[0].index);
14178 err = alc_auto_add_mic_boost(codec);
14182 if (!spec->cap_mixer && !spec->no_analog)
14183 set_capture_mixer(codec);
14188 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14189 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14190 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14193 /* init callback for auto-configuration model -- overriding the default init */
14194 static void alc269_auto_init(struct hda_codec *codec)
14196 struct alc_spec *spec = codec->spec;
14197 alc269_auto_init_multi_out(codec);
14198 alc269_auto_init_hp_out(codec);
14199 alc269_auto_init_analog_input(codec);
14200 if (spec->unsol_event)
14201 alc_inithook(codec);
14205 ALC269_FIXUP_SONY_VAIO,
14208 static const struct hda_verb alc269_sony_vaio_fixup_verbs[] = {
14209 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14213 static const struct alc_fixup alc269_fixups[] = {
14214 [ALC269_FIXUP_SONY_VAIO] = {
14215 .verbs = alc269_sony_vaio_fixup_verbs
14219 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14220 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14226 * configuration and preset
14228 static const char *alc269_models[ALC269_MODEL_LAST] = {
14229 [ALC269_BASIC] = "basic",
14230 [ALC269_QUANTA_FL1] = "quanta",
14231 [ALC269_AMIC] = "laptop-amic",
14232 [ALC269_DMIC] = "laptop-dmic",
14233 [ALC269_FUJITSU] = "fujitsu",
14234 [ALC269_LIFEBOOK] = "lifebook",
14235 [ALC269_AUTO] = "auto",
14238 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14239 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14240 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14242 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14243 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14244 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14245 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14246 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14247 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14248 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14249 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14250 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14251 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14252 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14253 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14254 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14255 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14256 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14257 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14258 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14259 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14260 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14261 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14262 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14263 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14264 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14265 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14266 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14267 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14268 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14269 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14270 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14271 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14272 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14273 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14274 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14275 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14276 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14277 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14278 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14280 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14282 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14283 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14284 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14285 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14286 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14287 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14288 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14289 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14290 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14291 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14295 static struct alc_config_preset alc269_presets[] = {
14297 .mixers = { alc269_base_mixer },
14298 .init_verbs = { alc269_init_verbs },
14299 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14300 .dac_nids = alc269_dac_nids,
14302 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14303 .channel_mode = alc269_modes,
14304 .input_mux = &alc269_capture_source,
14306 [ALC269_QUANTA_FL1] = {
14307 .mixers = { alc269_quanta_fl1_mixer },
14308 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14309 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14310 .dac_nids = alc269_dac_nids,
14312 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14313 .channel_mode = alc269_modes,
14314 .input_mux = &alc269_capture_source,
14315 .unsol_event = alc269_quanta_fl1_unsol_event,
14316 .setup = alc269_quanta_fl1_setup,
14317 .init_hook = alc269_quanta_fl1_init_hook,
14320 .mixers = { alc269_laptop_mixer },
14321 .cap_mixer = alc269_laptop_analog_capture_mixer,
14322 .init_verbs = { alc269_init_verbs,
14323 alc269_laptop_amic_init_verbs },
14324 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14325 .dac_nids = alc269_dac_nids,
14327 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14328 .channel_mode = alc269_modes,
14329 .unsol_event = alc269_laptop_unsol_event,
14330 .setup = alc269_laptop_amic_setup,
14331 .init_hook = alc269_laptop_inithook,
14334 .mixers = { alc269_laptop_mixer },
14335 .cap_mixer = alc269_laptop_digital_capture_mixer,
14336 .init_verbs = { alc269_init_verbs,
14337 alc269_laptop_dmic_init_verbs },
14338 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14339 .dac_nids = alc269_dac_nids,
14341 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14342 .channel_mode = alc269_modes,
14343 .unsol_event = alc269_laptop_unsol_event,
14344 .setup = alc269_laptop_dmic_setup,
14345 .init_hook = alc269_laptop_inithook,
14347 [ALC269VB_AMIC] = {
14348 .mixers = { alc269vb_laptop_mixer },
14349 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14350 .init_verbs = { alc269vb_init_verbs,
14351 alc269vb_laptop_amic_init_verbs },
14352 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14353 .dac_nids = alc269_dac_nids,
14355 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14356 .channel_mode = alc269_modes,
14357 .unsol_event = alc269_laptop_unsol_event,
14358 .setup = alc269vb_laptop_amic_setup,
14359 .init_hook = alc269_laptop_inithook,
14361 [ALC269VB_DMIC] = {
14362 .mixers = { alc269vb_laptop_mixer },
14363 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14364 .init_verbs = { alc269vb_init_verbs,
14365 alc269vb_laptop_dmic_init_verbs },
14366 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14367 .dac_nids = alc269_dac_nids,
14369 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14370 .channel_mode = alc269_modes,
14371 .unsol_event = alc269_laptop_unsol_event,
14372 .setup = alc269vb_laptop_dmic_setup,
14373 .init_hook = alc269_laptop_inithook,
14375 [ALC269_FUJITSU] = {
14376 .mixers = { alc269_fujitsu_mixer },
14377 .cap_mixer = alc269_laptop_digital_capture_mixer,
14378 .init_verbs = { alc269_init_verbs,
14379 alc269_laptop_dmic_init_verbs },
14380 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14381 .dac_nids = alc269_dac_nids,
14383 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14384 .channel_mode = alc269_modes,
14385 .unsol_event = alc269_laptop_unsol_event,
14386 .setup = alc269_laptop_dmic_setup,
14387 .init_hook = alc269_laptop_inithook,
14389 [ALC269_LIFEBOOK] = {
14390 .mixers = { alc269_lifebook_mixer },
14391 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14392 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14393 .dac_nids = alc269_dac_nids,
14395 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14396 .channel_mode = alc269_modes,
14397 .input_mux = &alc269_capture_source,
14398 .unsol_event = alc269_lifebook_unsol_event,
14399 .init_hook = alc269_lifebook_init_hook,
14403 static int patch_alc269(struct hda_codec *codec)
14405 struct alc_spec *spec;
14408 int is_alc269vb = 0;
14410 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14414 codec->spec = spec;
14416 alc_auto_parse_customize_define(codec);
14418 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14419 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14420 spec->cdefine.platform_type == 1)
14421 alc_codec_rename(codec, "ALC271X");
14423 alc_codec_rename(codec, "ALC259");
14426 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14428 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14432 if (board_config < 0) {
14433 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14435 board_config = ALC269_AUTO;
14438 if (board_config == ALC269_AUTO)
14439 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
14441 if (board_config == ALC269_AUTO) {
14442 /* automatic parse from the BIOS config */
14443 err = alc269_parse_auto_config(codec);
14449 "hda_codec: Cannot set up configuration "
14450 "from BIOS. Using base mode...\n");
14451 board_config = ALC269_BASIC;
14455 err = snd_hda_attach_beep_device(codec, 0x1);
14461 if (board_config != ALC269_AUTO)
14462 setup_preset(codec, &alc269_presets[board_config]);
14464 if (board_config == ALC269_QUANTA_FL1) {
14465 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14466 * fix the sample rate of analog I/O to 44.1kHz
14468 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14469 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14471 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14472 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14474 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14475 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14477 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14478 if (!is_alc269vb) {
14479 spec->adc_nids = alc269_adc_nids;
14480 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14481 spec->capsrc_nids = alc269_capsrc_nids;
14483 spec->adc_nids = alc269vb_adc_nids;
14484 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14485 spec->capsrc_nids = alc269vb_capsrc_nids;
14489 if (!spec->cap_mixer)
14490 set_capture_mixer(codec);
14491 if (spec->cdefine.enable_pcbeep)
14492 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14494 if (board_config == ALC269_AUTO)
14495 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
14497 spec->vmaster_nid = 0x02;
14499 codec->patch_ops = alc_patch_ops;
14500 if (board_config == ALC269_AUTO)
14501 spec->init_hook = alc269_auto_init;
14502 #ifdef CONFIG_SND_HDA_POWER_SAVE
14503 if (!spec->loopback.amplist)
14504 spec->loopback.amplist = alc269_loopbacks;
14505 if (alc269_mic2_for_mute_led(codec))
14506 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
14513 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14517 * set the path ways for 2 channel output
14518 * need to set the codec line out and mic 1 pin widgets to inputs
14520 static struct hda_verb alc861_threestack_ch2_init[] = {
14521 /* set pin widget 1Ah (line in) for input */
14522 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14523 /* set pin widget 18h (mic1/2) for input, for mic also enable
14526 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14528 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14530 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14531 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14537 * need to set the codec line out and mic 1 pin widgets to outputs
14539 static struct hda_verb alc861_threestack_ch6_init[] = {
14540 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14541 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14542 /* set pin widget 18h (mic1) for output (CLFE)*/
14543 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14545 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14546 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14548 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14550 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14551 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14556 static struct hda_channel_mode alc861_threestack_modes[2] = {
14557 { 2, alc861_threestack_ch2_init },
14558 { 6, alc861_threestack_ch6_init },
14560 /* Set mic1 as input and unmute the mixer */
14561 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14562 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14563 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14566 /* Set mic1 as output and mute mixer */
14567 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14568 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14569 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14573 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14574 { 2, alc861_uniwill_m31_ch2_init },
14575 { 4, alc861_uniwill_m31_ch4_init },
14578 /* Set mic1 and line-in as input and unmute the mixer */
14579 static struct hda_verb alc861_asus_ch2_init[] = {
14580 /* set pin widget 1Ah (line in) for input */
14581 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14582 /* set pin widget 18h (mic1/2) for input, for mic also enable
14585 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14587 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14589 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14590 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14594 /* Set mic1 nad line-in as output and mute mixer */
14595 static struct hda_verb alc861_asus_ch6_init[] = {
14596 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14597 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14598 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14599 /* set pin widget 18h (mic1) for output (CLFE)*/
14600 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14601 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14602 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14603 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14605 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14607 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14608 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14613 static struct hda_channel_mode alc861_asus_modes[2] = {
14614 { 2, alc861_asus_ch2_init },
14615 { 6, alc861_asus_ch6_init },
14620 static struct snd_kcontrol_new alc861_base_mixer[] = {
14621 /* output mixer control */
14622 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14623 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14624 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14625 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14626 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14628 /*Input mixer control */
14629 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14630 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14631 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14632 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14633 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14634 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14635 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14636 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14637 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14638 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14643 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14644 /* output mixer control */
14645 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14646 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14647 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14648 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14649 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14651 /* Input mixer control */
14652 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14653 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14654 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14655 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14656 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14657 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14658 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14659 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14660 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14661 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14664 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14665 .name = "Channel Mode",
14666 .info = alc_ch_mode_info,
14667 .get = alc_ch_mode_get,
14668 .put = alc_ch_mode_put,
14669 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14674 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14675 /* output mixer control */
14676 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14677 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14678 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14683 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14684 /* output mixer control */
14685 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14686 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14687 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14688 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14689 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14691 /* Input mixer control */
14692 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14693 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14694 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14695 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14696 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14697 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14698 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14699 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14700 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14701 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14704 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14705 .name = "Channel Mode",
14706 .info = alc_ch_mode_info,
14707 .get = alc_ch_mode_get,
14708 .put = alc_ch_mode_put,
14709 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14714 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14715 /* output mixer control */
14716 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14717 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14718 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14719 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14720 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14722 /* Input mixer control */
14723 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14724 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14725 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14726 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14727 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14728 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14729 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14730 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14731 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14732 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14735 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14736 .name = "Channel Mode",
14737 .info = alc_ch_mode_info,
14738 .get = alc_ch_mode_get,
14739 .put = alc_ch_mode_put,
14740 .private_value = ARRAY_SIZE(alc861_asus_modes),
14745 /* additional mixer */
14746 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14747 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14748 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14753 * generic initialization of ADC, input mixers and output mixers
14755 static struct hda_verb alc861_base_init_verbs[] = {
14757 * Unmute ADC0 and set the default input to mic-in
14759 /* port-A for surround (rear panel) */
14760 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14761 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14762 /* port-B for mic-in (rear panel) with vref */
14763 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14764 /* port-C for line-in (rear panel) */
14765 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14766 /* port-D for Front */
14767 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14768 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14769 /* port-E for HP out (front panel) */
14770 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14771 /* route front PCM to HP */
14772 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14773 /* port-F for mic-in (front panel) with vref */
14774 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14775 /* port-G for CLFE (rear panel) */
14776 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14777 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14778 /* port-H for side (rear panel) */
14779 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14780 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14782 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14783 /* route front mic to ADC1*/
14784 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14785 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14787 /* Unmute DAC0~3 & spdif out*/
14788 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14789 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14790 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14791 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14792 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14794 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14795 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14796 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14797 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14798 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14800 /* Unmute Stereo Mixer 15 */
14801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14802 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14803 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14804 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14806 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14807 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14808 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14809 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14810 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14811 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14812 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14813 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14814 /* hp used DAC 3 (Front) */
14815 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14816 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14821 static struct hda_verb alc861_threestack_init_verbs[] = {
14823 * Unmute ADC0 and set the default input to mic-in
14825 /* port-A for surround (rear panel) */
14826 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14827 /* port-B for mic-in (rear panel) with vref */
14828 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14829 /* port-C for line-in (rear panel) */
14830 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14831 /* port-D for Front */
14832 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14833 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14834 /* port-E for HP out (front panel) */
14835 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14836 /* route front PCM to HP */
14837 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14838 /* port-F for mic-in (front panel) with vref */
14839 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14840 /* port-G for CLFE (rear panel) */
14841 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14842 /* port-H for side (rear panel) */
14843 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14845 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14846 /* route front mic to ADC1*/
14847 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14848 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14849 /* Unmute DAC0~3 & spdif out*/
14850 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14851 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14852 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14853 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14854 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14856 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14857 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14858 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14859 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14860 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14862 /* Unmute Stereo Mixer 15 */
14863 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14864 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14865 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14866 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14868 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14869 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14870 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14871 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14872 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14873 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14874 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14875 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14876 /* hp used DAC 3 (Front) */
14877 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14878 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14882 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14884 * Unmute ADC0 and set the default input to mic-in
14886 /* port-A for surround (rear panel) */
14887 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14888 /* port-B for mic-in (rear panel) with vref */
14889 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14890 /* port-C for line-in (rear panel) */
14891 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14892 /* port-D for Front */
14893 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14894 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14895 /* port-E for HP out (front panel) */
14896 /* this has to be set to VREF80 */
14897 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14898 /* route front PCM to HP */
14899 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14900 /* port-F for mic-in (front panel) with vref */
14901 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14902 /* port-G for CLFE (rear panel) */
14903 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14904 /* port-H for side (rear panel) */
14905 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14907 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14908 /* route front mic to ADC1*/
14909 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14910 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14911 /* Unmute DAC0~3 & spdif out*/
14912 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14913 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14914 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14915 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14918 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14919 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14920 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14921 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14922 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14924 /* Unmute Stereo Mixer 15 */
14925 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14926 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14927 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14928 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14930 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14931 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14932 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14933 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14934 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14935 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14936 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14937 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14938 /* hp used DAC 3 (Front) */
14939 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14940 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14944 static struct hda_verb alc861_asus_init_verbs[] = {
14946 * Unmute ADC0 and set the default input to mic-in
14948 /* port-A for surround (rear panel)
14949 * according to codec#0 this is the HP jack
14951 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14952 /* route front PCM to HP */
14953 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14954 /* port-B for mic-in (rear panel) with vref */
14955 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14956 /* port-C for line-in (rear panel) */
14957 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14958 /* port-D for Front */
14959 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14960 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14961 /* port-E for HP out (front panel) */
14962 /* this has to be set to VREF80 */
14963 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14964 /* route front PCM to HP */
14965 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14966 /* port-F for mic-in (front panel) with vref */
14967 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14968 /* port-G for CLFE (rear panel) */
14969 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14970 /* port-H for side (rear panel) */
14971 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14973 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14974 /* route front mic to ADC1*/
14975 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14976 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14977 /* Unmute DAC0~3 & spdif out*/
14978 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14979 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14980 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14981 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14982 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14983 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14984 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14985 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14986 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14987 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14989 /* Unmute Stereo Mixer 15 */
14990 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14991 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14992 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14993 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14995 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14996 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14997 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14998 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14999 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15000 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15001 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15002 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15003 /* hp used DAC 3 (Front) */
15004 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15005 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15009 /* additional init verbs for ASUS laptops */
15010 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15011 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15012 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15017 * generic initialization of ADC, input mixers and output mixers
15019 static struct hda_verb alc861_auto_init_verbs[] = {
15021 * Unmute ADC0 and set the default input to mic-in
15023 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15024 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15026 /* Unmute DAC0~3 & spdif out*/
15027 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15028 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15029 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15030 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15031 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15033 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15034 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15035 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15036 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15037 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15039 /* Unmute Stereo Mixer 15 */
15040 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15041 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15042 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15043 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15045 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15046 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15047 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15048 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15049 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15050 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15051 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15052 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15054 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15055 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15056 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15057 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15058 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15059 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15060 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15061 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15063 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15068 static struct hda_verb alc861_toshiba_init_verbs[] = {
15069 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15074 /* toggle speaker-output according to the hp-jack state */
15075 static void alc861_toshiba_automute(struct hda_codec *codec)
15077 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15079 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15080 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15081 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15082 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15085 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15088 if ((res >> 26) == ALC880_HP_EVENT)
15089 alc861_toshiba_automute(codec);
15092 /* pcm configuration: identical with ALC880 */
15093 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15094 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15095 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15096 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15099 #define ALC861_DIGOUT_NID 0x07
15101 static struct hda_channel_mode alc861_8ch_modes[1] = {
15105 static hda_nid_t alc861_dac_nids[4] = {
15106 /* front, surround, clfe, side */
15107 0x03, 0x06, 0x05, 0x04
15110 static hda_nid_t alc660_dac_nids[3] = {
15111 /* front, clfe, surround */
15115 static hda_nid_t alc861_adc_nids[1] = {
15120 static struct hda_input_mux alc861_capture_source = {
15124 { "Front Mic", 0x3 },
15131 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15133 struct alc_spec *spec = codec->spec;
15134 hda_nid_t mix, srcs[5];
15137 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15139 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15142 for (i = 0; i < num; i++) {
15144 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15145 if (type != AC_WID_AUD_OUT)
15147 for (j = 0; j < spec->multiout.num_dacs; j++)
15148 if (spec->multiout.dac_nids[j] == srcs[i])
15150 if (j >= spec->multiout.num_dacs)
15156 /* fill in the dac_nids table from the parsed pin configuration */
15157 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15158 const struct auto_pin_cfg *cfg)
15160 struct alc_spec *spec = codec->spec;
15162 hda_nid_t nid, dac;
15164 spec->multiout.dac_nids = spec->private_dac_nids;
15165 for (i = 0; i < cfg->line_outs; i++) {
15166 nid = cfg->line_out_pins[i];
15167 dac = alc861_look_for_dac(codec, nid);
15170 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15175 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15176 hda_nid_t nid, unsigned int chs)
15178 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15179 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15182 /* add playback controls from the parsed DAC table */
15183 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15184 const struct auto_pin_cfg *cfg)
15186 struct alc_spec *spec = codec->spec;
15187 static const char *chname[4] = {
15188 "Front", "Surround", NULL /*CLFE*/, "Side"
15193 if (cfg->line_outs == 1) {
15194 const char *pfx = NULL;
15197 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15200 nid = spec->multiout.dac_nids[0];
15201 return alc861_create_out_sw(codec, pfx, nid, 3);
15205 for (i = 0; i < cfg->line_outs; i++) {
15206 nid = spec->multiout.dac_nids[i];
15211 err = alc861_create_out_sw(codec, "Center", nid, 1);
15214 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15218 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15226 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15228 struct alc_spec *spec = codec->spec;
15235 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15236 nid = alc861_look_for_dac(codec, pin);
15238 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15241 spec->multiout.hp_nid = nid;
15247 /* create playback/capture controls for input pins */
15248 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15249 const struct auto_pin_cfg *cfg)
15251 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15254 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15256 int pin_type, hda_nid_t dac)
15258 hda_nid_t mix, srcs[5];
15261 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15263 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15265 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15267 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15270 for (i = 0; i < num; i++) {
15272 if (srcs[i] == dac || srcs[i] == 0x15)
15273 mute = AMP_IN_UNMUTE(i);
15275 mute = AMP_IN_MUTE(i);
15276 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15281 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15283 struct alc_spec *spec = codec->spec;
15286 for (i = 0; i < spec->autocfg.line_outs; i++) {
15287 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15288 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15290 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15291 spec->multiout.dac_nids[i]);
15295 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15297 struct alc_spec *spec = codec->spec;
15299 if (spec->autocfg.hp_outs)
15300 alc861_auto_set_output_and_unmute(codec,
15301 spec->autocfg.hp_pins[0],
15303 spec->multiout.hp_nid);
15304 if (spec->autocfg.speaker_outs)
15305 alc861_auto_set_output_and_unmute(codec,
15306 spec->autocfg.speaker_pins[0],
15308 spec->multiout.dac_nids[0]);
15311 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15313 struct alc_spec *spec = codec->spec;
15316 for (i = 0; i < AUTO_PIN_LAST; i++) {
15317 hda_nid_t nid = spec->autocfg.input_pins[i];
15318 if (nid >= 0x0c && nid <= 0x11)
15319 alc_set_input_pin(codec, nid, i);
15323 /* parse the BIOS configuration and set up the alc_spec */
15324 /* return 1 if successful, 0 if the proper config is not found,
15325 * or a negative error code
15327 static int alc861_parse_auto_config(struct hda_codec *codec)
15329 struct alc_spec *spec = codec->spec;
15331 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15333 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15337 if (!spec->autocfg.line_outs)
15338 return 0; /* can't find valid BIOS pin config */
15340 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15343 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15346 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15349 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15353 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15355 if (spec->autocfg.dig_outs)
15356 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
15358 if (spec->kctls.list)
15359 add_mixer(spec, spec->kctls.list);
15361 add_verb(spec, alc861_auto_init_verbs);
15363 spec->num_mux_defs = 1;
15364 spec->input_mux = &spec->private_imux[0];
15366 spec->adc_nids = alc861_adc_nids;
15367 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15368 set_capture_mixer(codec);
15370 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15375 /* additional initialization for auto-configuration model */
15376 static void alc861_auto_init(struct hda_codec *codec)
15378 struct alc_spec *spec = codec->spec;
15379 alc861_auto_init_multi_out(codec);
15380 alc861_auto_init_hp_out(codec);
15381 alc861_auto_init_analog_input(codec);
15382 if (spec->unsol_event)
15383 alc_inithook(codec);
15386 #ifdef CONFIG_SND_HDA_POWER_SAVE
15387 static struct hda_amp_list alc861_loopbacks[] = {
15388 { 0x15, HDA_INPUT, 0 },
15389 { 0x15, HDA_INPUT, 1 },
15390 { 0x15, HDA_INPUT, 2 },
15391 { 0x15, HDA_INPUT, 3 },
15398 * configuration and preset
15400 static const char *alc861_models[ALC861_MODEL_LAST] = {
15401 [ALC861_3ST] = "3stack",
15402 [ALC660_3ST] = "3stack-660",
15403 [ALC861_3ST_DIG] = "3stack-dig",
15404 [ALC861_6ST_DIG] = "6stack-dig",
15405 [ALC861_UNIWILL_M31] = "uniwill-m31",
15406 [ALC861_TOSHIBA] = "toshiba",
15407 [ALC861_ASUS] = "asus",
15408 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15409 [ALC861_AUTO] = "auto",
15412 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15413 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15414 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15415 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15416 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15417 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15418 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15419 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15420 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15421 * Any other models that need this preset?
15423 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15424 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15425 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15426 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15427 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15428 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15429 /* FIXME: the below seems conflict */
15430 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15431 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15432 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15436 static struct alc_config_preset alc861_presets[] = {
15438 .mixers = { alc861_3ST_mixer },
15439 .init_verbs = { alc861_threestack_init_verbs },
15440 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15441 .dac_nids = alc861_dac_nids,
15442 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15443 .channel_mode = alc861_threestack_modes,
15445 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15446 .adc_nids = alc861_adc_nids,
15447 .input_mux = &alc861_capture_source,
15449 [ALC861_3ST_DIG] = {
15450 .mixers = { alc861_base_mixer },
15451 .init_verbs = { alc861_threestack_init_verbs },
15452 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15453 .dac_nids = alc861_dac_nids,
15454 .dig_out_nid = ALC861_DIGOUT_NID,
15455 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15456 .channel_mode = alc861_threestack_modes,
15458 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15459 .adc_nids = alc861_adc_nids,
15460 .input_mux = &alc861_capture_source,
15462 [ALC861_6ST_DIG] = {
15463 .mixers = { alc861_base_mixer },
15464 .init_verbs = { alc861_base_init_verbs },
15465 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15466 .dac_nids = alc861_dac_nids,
15467 .dig_out_nid = ALC861_DIGOUT_NID,
15468 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15469 .channel_mode = alc861_8ch_modes,
15470 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15471 .adc_nids = alc861_adc_nids,
15472 .input_mux = &alc861_capture_source,
15475 .mixers = { alc861_3ST_mixer },
15476 .init_verbs = { alc861_threestack_init_verbs },
15477 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15478 .dac_nids = alc660_dac_nids,
15479 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15480 .channel_mode = alc861_threestack_modes,
15482 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15483 .adc_nids = alc861_adc_nids,
15484 .input_mux = &alc861_capture_source,
15486 [ALC861_UNIWILL_M31] = {
15487 .mixers = { alc861_uniwill_m31_mixer },
15488 .init_verbs = { alc861_uniwill_m31_init_verbs },
15489 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15490 .dac_nids = alc861_dac_nids,
15491 .dig_out_nid = ALC861_DIGOUT_NID,
15492 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15493 .channel_mode = alc861_uniwill_m31_modes,
15495 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15496 .adc_nids = alc861_adc_nids,
15497 .input_mux = &alc861_capture_source,
15499 [ALC861_TOSHIBA] = {
15500 .mixers = { alc861_toshiba_mixer },
15501 .init_verbs = { alc861_base_init_verbs,
15502 alc861_toshiba_init_verbs },
15503 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15504 .dac_nids = alc861_dac_nids,
15505 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15506 .channel_mode = alc883_3ST_2ch_modes,
15507 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15508 .adc_nids = alc861_adc_nids,
15509 .input_mux = &alc861_capture_source,
15510 .unsol_event = alc861_toshiba_unsol_event,
15511 .init_hook = alc861_toshiba_automute,
15514 .mixers = { alc861_asus_mixer },
15515 .init_verbs = { alc861_asus_init_verbs },
15516 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15517 .dac_nids = alc861_dac_nids,
15518 .dig_out_nid = ALC861_DIGOUT_NID,
15519 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15520 .channel_mode = alc861_asus_modes,
15523 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15524 .adc_nids = alc861_adc_nids,
15525 .input_mux = &alc861_capture_source,
15527 [ALC861_ASUS_LAPTOP] = {
15528 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15529 .init_verbs = { alc861_asus_init_verbs,
15530 alc861_asus_laptop_init_verbs },
15531 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15532 .dac_nids = alc861_dac_nids,
15533 .dig_out_nid = ALC861_DIGOUT_NID,
15534 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15535 .channel_mode = alc883_3ST_2ch_modes,
15537 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15538 .adc_nids = alc861_adc_nids,
15539 .input_mux = &alc861_capture_source,
15543 /* Pin config fixes */
15545 PINFIX_FSC_AMILO_PI1505,
15548 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15549 { 0x0b, 0x0221101f }, /* HP */
15550 { 0x0f, 0x90170310 }, /* speaker */
15554 static const struct alc_fixup alc861_fixups[] = {
15555 [PINFIX_FSC_AMILO_PI1505] = {
15556 .pins = alc861_fsc_amilo_pi1505_pinfix
15560 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15561 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15565 static int patch_alc861(struct hda_codec *codec)
15567 struct alc_spec *spec;
15571 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15575 codec->spec = spec;
15577 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15581 if (board_config < 0) {
15582 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15584 board_config = ALC861_AUTO;
15587 if (board_config == ALC861_AUTO)
15588 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
15590 if (board_config == ALC861_AUTO) {
15591 /* automatic parse from the BIOS config */
15592 err = alc861_parse_auto_config(codec);
15598 "hda_codec: Cannot set up configuration "
15599 "from BIOS. Using base mode...\n");
15600 board_config = ALC861_3ST_DIG;
15604 err = snd_hda_attach_beep_device(codec, 0x23);
15610 if (board_config != ALC861_AUTO)
15611 setup_preset(codec, &alc861_presets[board_config]);
15613 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15614 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15616 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15617 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15619 if (!spec->cap_mixer)
15620 set_capture_mixer(codec);
15621 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15623 spec->vmaster_nid = 0x03;
15625 if (board_config == ALC861_AUTO)
15626 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
15628 codec->patch_ops = alc_patch_ops;
15629 if (board_config == ALC861_AUTO) {
15630 spec->init_hook = alc861_auto_init;
15631 #ifdef CONFIG_SND_HDA_POWER_SAVE
15632 spec->power_hook = alc_power_eapd;
15635 #ifdef CONFIG_SND_HDA_POWER_SAVE
15636 if (!spec->loopback.amplist)
15637 spec->loopback.amplist = alc861_loopbacks;
15644 * ALC861-VD support
15648 * In addition, an independent DAC
15650 #define ALC861VD_DIGOUT_NID 0x06
15652 static hda_nid_t alc861vd_dac_nids[4] = {
15653 /* front, surr, clfe, side surr */
15654 0x02, 0x03, 0x04, 0x05
15657 /* dac_nids for ALC660vd are in a different order - according to
15658 * Realtek's driver.
15659 * This should probably result in a different mixer for 6stack models
15660 * of ALC660vd codecs, but for now there is only 3stack mixer
15661 * - and it is the same as in 861vd.
15662 * adc_nids in ALC660vd are (is) the same as in 861vd
15664 static hda_nid_t alc660vd_dac_nids[3] = {
15665 /* front, rear, clfe, rear_surr */
15669 static hda_nid_t alc861vd_adc_nids[1] = {
15674 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15677 /* FIXME: should be a matrix-type input source selection */
15678 static struct hda_input_mux alc861vd_capture_source = {
15682 { "Front Mic", 0x1 },
15688 static struct hda_input_mux alc861vd_dallas_capture_source = {
15691 { "Ext Mic", 0x0 },
15692 { "Int Mic", 0x1 },
15696 static struct hda_input_mux alc861vd_hp_capture_source = {
15699 { "Front Mic", 0x0 },
15700 { "ATAPI Mic", 0x1 },
15707 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15714 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15715 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15716 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15717 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15718 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15725 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15726 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15727 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15728 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15729 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15733 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15734 { 6, alc861vd_6stack_ch6_init },
15735 { 8, alc861vd_6stack_ch8_init },
15738 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15740 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15741 .name = "Channel Mode",
15742 .info = alc_ch_mode_info,
15743 .get = alc_ch_mode_get,
15744 .put = alc_ch_mode_put,
15749 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15750 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15752 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15753 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15754 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15756 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15757 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15759 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15761 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15763 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15764 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15766 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15767 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15769 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15771 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15772 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15773 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15775 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15776 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15777 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15779 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15780 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15782 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15783 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15788 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15789 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15790 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15792 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15794 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15796 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15798 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15799 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15800 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15802 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15803 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15805 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15806 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15811 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15812 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15813 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15814 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15816 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15818 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15819 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15820 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15822 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15823 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15824 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15826 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15827 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15832 /* Pin assignment: Speaker=0x14, HP = 0x15,
15833 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15835 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15836 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15837 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15838 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15839 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15840 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15841 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15842 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15843 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15844 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15845 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15849 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15850 * Front Mic=0x18, ATAPI Mic = 0x19,
15852 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15853 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15854 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15855 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15856 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15857 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15858 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15859 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15860 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15866 * generic initialization of ADC, input mixers and output mixers
15868 static struct hda_verb alc861vd_volume_init_verbs[] = {
15870 * Unmute ADC0 and set the default input to mic-in
15872 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15873 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15875 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15876 * the analog-loopback mixer widget
15878 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15879 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15881 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15882 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15883 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15885 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15886 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15887 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15888 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15889 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15892 * Set up output mixers (0x02 - 0x05)
15894 /* set vol=0 to output mixers */
15895 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15896 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15897 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15898 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15900 /* set up input amps for analog loopback */
15901 /* Amp Indices: DAC = 0, mixer = 1 */
15902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15903 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15904 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15905 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15906 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15907 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15908 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15909 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15915 * 3-stack pin configuration:
15916 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15918 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15920 * Set pin mode and muting
15922 /* set front pin widgets 0x14 for output */
15923 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15924 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15925 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15927 /* Mic (rear) pin: input vref at 80% */
15928 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15929 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15930 /* Front Mic pin: input vref at 80% */
15931 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15932 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15933 /* Line In pin: input */
15934 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15935 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15936 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15937 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15938 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15939 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15940 /* CD pin widget for input */
15941 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15947 * 6-stack pin configuration:
15949 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15951 * Set pin mode and muting
15953 /* set front pin widgets 0x14 for output */
15954 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15955 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15956 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15958 /* Rear Pin: output 1 (0x0d) */
15959 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15960 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15961 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15962 /* CLFE Pin: output 2 (0x0e) */
15963 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15964 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15965 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15966 /* Side Pin: output 3 (0x0f) */
15967 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15968 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15969 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15971 /* Mic (rear) pin: input vref at 80% */
15972 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15973 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15974 /* Front Mic pin: input vref at 80% */
15975 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15976 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15977 /* Line In pin: input */
15978 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15979 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15980 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15981 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15982 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15983 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15984 /* CD pin widget for input */
15985 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15990 static struct hda_verb alc861vd_eapd_verbs[] = {
15991 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15995 static struct hda_verb alc660vd_eapd_verbs[] = {
15996 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15997 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16001 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16002 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16003 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16004 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16005 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16006 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16010 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
16012 unsigned int present;
16013 unsigned char bits;
16015 present = snd_hda_jack_detect(codec, 0x18);
16016 bits = present ? HDA_AMP_MUTE : 0;
16018 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
16019 HDA_AMP_MUTE, bits);
16022 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16024 struct alc_spec *spec = codec->spec;
16025 spec->autocfg.hp_pins[0] = 0x1b;
16026 spec->autocfg.speaker_pins[0] = 0x14;
16029 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16031 alc_automute_amp(codec);
16032 alc861vd_lenovo_mic_automute(codec);
16035 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16038 switch (res >> 26) {
16039 case ALC880_MIC_EVENT:
16040 alc861vd_lenovo_mic_automute(codec);
16043 alc_automute_amp_unsol_event(codec, res);
16048 static struct hda_verb alc861vd_dallas_verbs[] = {
16049 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16050 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16051 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16052 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16054 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16055 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16056 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16057 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16058 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16059 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16060 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16061 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16063 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16064 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16065 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16066 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16067 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16068 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16069 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16070 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16072 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16073 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16074 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16075 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16076 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16077 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16078 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16079 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16081 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16082 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16083 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16084 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16086 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16087 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16088 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16093 /* toggle speaker-output according to the hp-jack state */
16094 static void alc861vd_dallas_setup(struct hda_codec *codec)
16096 struct alc_spec *spec = codec->spec;
16098 spec->autocfg.hp_pins[0] = 0x15;
16099 spec->autocfg.speaker_pins[0] = 0x14;
16102 #ifdef CONFIG_SND_HDA_POWER_SAVE
16103 #define alc861vd_loopbacks alc880_loopbacks
16106 /* pcm configuration: identical with ALC880 */
16107 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16108 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16109 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16110 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16113 * configuration and preset
16115 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16116 [ALC660VD_3ST] = "3stack-660",
16117 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16118 [ALC660VD_ASUS_V1S] = "asus-v1s",
16119 [ALC861VD_3ST] = "3stack",
16120 [ALC861VD_3ST_DIG] = "3stack-digout",
16121 [ALC861VD_6ST_DIG] = "6stack-digout",
16122 [ALC861VD_LENOVO] = "lenovo",
16123 [ALC861VD_DALLAS] = "dallas",
16124 [ALC861VD_HP] = "hp",
16125 [ALC861VD_AUTO] = "auto",
16128 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16129 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16130 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16131 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16132 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16133 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16134 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16135 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16136 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16137 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16138 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16139 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16140 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16141 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16142 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16143 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16147 static struct alc_config_preset alc861vd_presets[] = {
16149 .mixers = { alc861vd_3st_mixer },
16150 .init_verbs = { alc861vd_volume_init_verbs,
16151 alc861vd_3stack_init_verbs },
16152 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16153 .dac_nids = alc660vd_dac_nids,
16154 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16155 .channel_mode = alc861vd_3stack_2ch_modes,
16156 .input_mux = &alc861vd_capture_source,
16158 [ALC660VD_3ST_DIG] = {
16159 .mixers = { alc861vd_3st_mixer },
16160 .init_verbs = { alc861vd_volume_init_verbs,
16161 alc861vd_3stack_init_verbs },
16162 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16163 .dac_nids = alc660vd_dac_nids,
16164 .dig_out_nid = ALC861VD_DIGOUT_NID,
16165 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16166 .channel_mode = alc861vd_3stack_2ch_modes,
16167 .input_mux = &alc861vd_capture_source,
16170 .mixers = { alc861vd_3st_mixer },
16171 .init_verbs = { alc861vd_volume_init_verbs,
16172 alc861vd_3stack_init_verbs },
16173 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16174 .dac_nids = alc861vd_dac_nids,
16175 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16176 .channel_mode = alc861vd_3stack_2ch_modes,
16177 .input_mux = &alc861vd_capture_source,
16179 [ALC861VD_3ST_DIG] = {
16180 .mixers = { alc861vd_3st_mixer },
16181 .init_verbs = { alc861vd_volume_init_verbs,
16182 alc861vd_3stack_init_verbs },
16183 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16184 .dac_nids = alc861vd_dac_nids,
16185 .dig_out_nid = ALC861VD_DIGOUT_NID,
16186 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16187 .channel_mode = alc861vd_3stack_2ch_modes,
16188 .input_mux = &alc861vd_capture_source,
16190 [ALC861VD_6ST_DIG] = {
16191 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16192 .init_verbs = { alc861vd_volume_init_verbs,
16193 alc861vd_6stack_init_verbs },
16194 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16195 .dac_nids = alc861vd_dac_nids,
16196 .dig_out_nid = ALC861VD_DIGOUT_NID,
16197 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16198 .channel_mode = alc861vd_6stack_modes,
16199 .input_mux = &alc861vd_capture_source,
16201 [ALC861VD_LENOVO] = {
16202 .mixers = { alc861vd_lenovo_mixer },
16203 .init_verbs = { alc861vd_volume_init_verbs,
16204 alc861vd_3stack_init_verbs,
16205 alc861vd_eapd_verbs,
16206 alc861vd_lenovo_unsol_verbs },
16207 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16208 .dac_nids = alc660vd_dac_nids,
16209 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16210 .channel_mode = alc861vd_3stack_2ch_modes,
16211 .input_mux = &alc861vd_capture_source,
16212 .unsol_event = alc861vd_lenovo_unsol_event,
16213 .setup = alc861vd_lenovo_setup,
16214 .init_hook = alc861vd_lenovo_init_hook,
16216 [ALC861VD_DALLAS] = {
16217 .mixers = { alc861vd_dallas_mixer },
16218 .init_verbs = { alc861vd_dallas_verbs },
16219 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16220 .dac_nids = alc861vd_dac_nids,
16221 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16222 .channel_mode = alc861vd_3stack_2ch_modes,
16223 .input_mux = &alc861vd_dallas_capture_source,
16224 .unsol_event = alc_automute_amp_unsol_event,
16225 .setup = alc861vd_dallas_setup,
16226 .init_hook = alc_automute_amp,
16229 .mixers = { alc861vd_hp_mixer },
16230 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16231 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16232 .dac_nids = alc861vd_dac_nids,
16233 .dig_out_nid = ALC861VD_DIGOUT_NID,
16234 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16235 .channel_mode = alc861vd_3stack_2ch_modes,
16236 .input_mux = &alc861vd_hp_capture_source,
16237 .unsol_event = alc_automute_amp_unsol_event,
16238 .setup = alc861vd_dallas_setup,
16239 .init_hook = alc_automute_amp,
16241 [ALC660VD_ASUS_V1S] = {
16242 .mixers = { alc861vd_lenovo_mixer },
16243 .init_verbs = { alc861vd_volume_init_verbs,
16244 alc861vd_3stack_init_verbs,
16245 alc861vd_eapd_verbs,
16246 alc861vd_lenovo_unsol_verbs },
16247 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16248 .dac_nids = alc660vd_dac_nids,
16249 .dig_out_nid = ALC861VD_DIGOUT_NID,
16250 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16251 .channel_mode = alc861vd_3stack_2ch_modes,
16252 .input_mux = &alc861vd_capture_source,
16253 .unsol_event = alc861vd_lenovo_unsol_event,
16254 .setup = alc861vd_lenovo_setup,
16255 .init_hook = alc861vd_lenovo_init_hook,
16260 * BIOS auto configuration
16262 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16263 const struct auto_pin_cfg *cfg)
16265 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16269 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16270 hda_nid_t nid, int pin_type, int dac_idx)
16272 alc_set_pin_output(codec, nid, pin_type);
16275 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16277 struct alc_spec *spec = codec->spec;
16280 for (i = 0; i <= HDA_SIDE; i++) {
16281 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16282 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16284 alc861vd_auto_set_output_and_unmute(codec, nid,
16290 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16292 struct alc_spec *spec = codec->spec;
16295 pin = spec->autocfg.hp_pins[0];
16296 if (pin) /* connect to front and use dac 0 */
16297 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16298 pin = spec->autocfg.speaker_pins[0];
16300 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16303 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16305 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16307 struct alc_spec *spec = codec->spec;
16310 for (i = 0; i < AUTO_PIN_LAST; i++) {
16311 hda_nid_t nid = spec->autocfg.input_pins[i];
16312 if (alc_is_input_pin(codec, nid)) {
16313 alc_set_input_pin(codec, nid, i);
16314 if (nid != ALC861VD_PIN_CD_NID &&
16315 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16316 snd_hda_codec_write(codec, nid, 0,
16317 AC_VERB_SET_AMP_GAIN_MUTE,
16323 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16325 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16326 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16328 /* add playback controls from the parsed DAC table */
16329 /* Based on ALC880 version. But ALC861VD has separate,
16330 * different NIDs for mute/unmute switch and volume control */
16331 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16332 const struct auto_pin_cfg *cfg)
16334 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16335 hda_nid_t nid_v, nid_s;
16338 for (i = 0; i < cfg->line_outs; i++) {
16339 if (!spec->multiout.dac_nids[i])
16341 nid_v = alc861vd_idx_to_mixer_vol(
16343 spec->multiout.dac_nids[i]));
16344 nid_s = alc861vd_idx_to_mixer_switch(
16346 spec->multiout.dac_nids[i]));
16350 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16352 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16356 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16358 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16362 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16364 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16368 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16370 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16376 if (cfg->line_outs == 1 &&
16377 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16384 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16385 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16389 if (cfg->line_outs == 1 &&
16390 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16392 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16393 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16402 /* add playback controls for speaker and HP outputs */
16403 /* Based on ALC880 version. But ALC861VD has separate,
16404 * different NIDs for mute/unmute switch and volume control */
16405 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16406 hda_nid_t pin, const char *pfx)
16408 hda_nid_t nid_v, nid_s;
16414 if (alc880_is_fixed_pin(pin)) {
16415 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16416 /* specify the DAC as the extra output */
16417 if (!spec->multiout.hp_nid)
16418 spec->multiout.hp_nid = nid_v;
16420 spec->multiout.extra_out_nid[0] = nid_v;
16421 /* control HP volume/switch on the output mixer amp */
16422 nid_v = alc861vd_idx_to_mixer_vol(
16423 alc880_fixed_pin_idx(pin));
16424 nid_s = alc861vd_idx_to_mixer_switch(
16425 alc880_fixed_pin_idx(pin));
16427 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16428 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16431 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16432 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16435 } else if (alc880_is_multi_pin(pin)) {
16436 /* set manual connection */
16437 /* we have only a switch on HP-out PIN */
16438 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16439 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16446 /* parse the BIOS configuration and set up the alc_spec
16447 * return 1 if successful, 0 if the proper config is not found,
16448 * or a negative error code
16449 * Based on ALC880 version - had to change it to override
16450 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16451 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16453 struct alc_spec *spec = codec->spec;
16455 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16457 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16461 if (!spec->autocfg.line_outs)
16462 return 0; /* can't find valid BIOS pin config */
16464 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16467 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16470 err = alc861vd_auto_create_extra_out(spec,
16471 spec->autocfg.speaker_pins[0],
16475 err = alc861vd_auto_create_extra_out(spec,
16476 spec->autocfg.hp_pins[0],
16480 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16484 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16486 if (spec->autocfg.dig_outs)
16487 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
16489 if (spec->kctls.list)
16490 add_mixer(spec, spec->kctls.list);
16492 add_verb(spec, alc861vd_volume_init_verbs);
16494 spec->num_mux_defs = 1;
16495 spec->input_mux = &spec->private_imux[0];
16497 err = alc_auto_add_mic_boost(codec);
16501 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16506 /* additional initialization for auto-configuration model */
16507 static void alc861vd_auto_init(struct hda_codec *codec)
16509 struct alc_spec *spec = codec->spec;
16510 alc861vd_auto_init_multi_out(codec);
16511 alc861vd_auto_init_hp_out(codec);
16512 alc861vd_auto_init_analog_input(codec);
16513 alc861vd_auto_init_input_src(codec);
16514 if (spec->unsol_event)
16515 alc_inithook(codec);
16519 ALC660VD_FIX_ASUS_GPIO1
16523 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16524 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16525 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16526 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16530 static const struct alc_fixup alc861vd_fixups[] = {
16531 [ALC660VD_FIX_ASUS_GPIO1] = {
16532 .verbs = alc660vd_fix_asus_gpio1_verbs,
16536 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16537 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16541 static int patch_alc861vd(struct hda_codec *codec)
16543 struct alc_spec *spec;
16544 int err, board_config;
16546 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16550 codec->spec = spec;
16552 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16556 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16557 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16559 board_config = ALC861VD_AUTO;
16562 if (board_config == ALC861VD_AUTO)
16563 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
16565 if (board_config == ALC861VD_AUTO) {
16566 /* automatic parse from the BIOS config */
16567 err = alc861vd_parse_auto_config(codec);
16573 "hda_codec: Cannot set up configuration "
16574 "from BIOS. Using base mode...\n");
16575 board_config = ALC861VD_3ST;
16579 err = snd_hda_attach_beep_device(codec, 0x23);
16585 if (board_config != ALC861VD_AUTO)
16586 setup_preset(codec, &alc861vd_presets[board_config]);
16588 if (codec->vendor_id == 0x10ec0660) {
16589 /* always turn on EAPD */
16590 add_verb(spec, alc660vd_eapd_verbs);
16593 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16594 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16596 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16597 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16599 if (!spec->adc_nids) {
16600 spec->adc_nids = alc861vd_adc_nids;
16601 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16603 if (!spec->capsrc_nids)
16604 spec->capsrc_nids = alc861vd_capsrc_nids;
16606 set_capture_mixer(codec);
16607 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16609 spec->vmaster_nid = 0x02;
16611 if (board_config == ALC861VD_AUTO)
16612 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
16614 codec->patch_ops = alc_patch_ops;
16616 if (board_config == ALC861VD_AUTO)
16617 spec->init_hook = alc861vd_auto_init;
16618 #ifdef CONFIG_SND_HDA_POWER_SAVE
16619 if (!spec->loopback.amplist)
16620 spec->loopback.amplist = alc861vd_loopbacks;
16629 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16630 * configuration. Each pin widget can choose any input DACs and a mixer.
16631 * Each ADC is connected from a mixer of all inputs. This makes possible
16632 * 6-channel independent captures.
16634 * In addition, an independent DAC for the multi-playback (not used in this
16637 #define ALC662_DIGOUT_NID 0x06
16638 #define ALC662_DIGIN_NID 0x0a
16640 static hda_nid_t alc662_dac_nids[4] = {
16641 /* front, rear, clfe, rear_surr */
16645 static hda_nid_t alc272_dac_nids[2] = {
16649 static hda_nid_t alc662_adc_nids[2] = {
16654 static hda_nid_t alc272_adc_nids[1] = {
16659 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16660 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16664 /* FIXME: should be a matrix-type input source selection */
16665 static struct hda_input_mux alc662_capture_source = {
16669 { "Front Mic", 0x1 },
16675 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16683 static struct hda_input_mux alc663_capture_source = {
16687 { "Front Mic", 0x1 },
16692 #if 0 /* set to 1 for testing other input sources below */
16693 static struct hda_input_mux alc272_nc10_capture_source = {
16696 { "Autoselect Mic", 0x0 },
16697 { "Internal Mic", 0x1 },
16698 { "In-0x02", 0x2 },
16699 { "In-0x03", 0x3 },
16700 { "In-0x04", 0x4 },
16701 { "In-0x05", 0x5 },
16702 { "In-0x06", 0x6 },
16703 { "In-0x07", 0x7 },
16704 { "In-0x08", 0x8 },
16705 { "In-0x09", 0x9 },
16706 { "In-0x0a", 0x0a },
16707 { "In-0x0b", 0x0b },
16708 { "In-0x0c", 0x0c },
16709 { "In-0x0d", 0x0d },
16710 { "In-0x0e", 0x0e },
16711 { "In-0x0f", 0x0f },
16719 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16726 static struct hda_verb alc662_3ST_ch2_init[] = {
16727 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16728 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16729 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16730 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16737 static struct hda_verb alc662_3ST_ch6_init[] = {
16738 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16739 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16740 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16741 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16742 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16743 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16747 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16748 { 2, alc662_3ST_ch2_init },
16749 { 6, alc662_3ST_ch6_init },
16755 static struct hda_verb alc662_sixstack_ch6_init[] = {
16756 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16757 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16758 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16765 static struct hda_verb alc662_sixstack_ch8_init[] = {
16766 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16767 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16768 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16772 static struct hda_channel_mode alc662_5stack_modes[2] = {
16773 { 2, alc662_sixstack_ch6_init },
16774 { 6, alc662_sixstack_ch8_init },
16777 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16778 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16781 static struct snd_kcontrol_new alc662_base_mixer[] = {
16782 /* output mixer control */
16783 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16784 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16785 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16786 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16787 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16788 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16789 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16790 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16791 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16793 /*Input mixer control */
16794 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16795 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16796 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16797 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16798 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16799 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16800 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16801 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16805 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16806 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16807 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16808 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16809 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16810 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16811 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16812 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16813 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16814 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16815 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16816 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16820 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16821 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16822 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16823 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16824 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16825 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16826 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16827 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16828 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16829 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16830 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16831 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16832 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16833 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16834 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16835 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16836 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16837 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16841 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16842 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16843 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16844 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16845 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16846 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16847 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16848 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16849 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16850 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16854 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16855 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16856 ALC262_HIPPO_MASTER_SWITCH,
16858 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16859 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16860 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16862 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16863 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16864 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16868 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16869 ALC262_HIPPO_MASTER_SWITCH,
16870 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16871 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16872 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16873 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16874 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16875 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16876 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16877 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16878 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16882 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16883 .ops = &snd_hda_bind_vol,
16885 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16886 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16891 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16892 .ops = &snd_hda_bind_sw,
16894 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16895 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16900 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16901 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16902 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16903 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16904 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16908 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16909 .ops = &snd_hda_bind_sw,
16911 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16912 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16913 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16918 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16919 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16920 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16921 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16922 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16923 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16924 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16929 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16930 .ops = &snd_hda_bind_sw,
16932 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16933 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16934 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16939 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16940 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16941 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16942 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16943 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16944 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16945 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16949 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16950 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16951 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16952 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16953 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16954 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16955 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16956 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16960 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16961 .ops = &snd_hda_bind_vol,
16963 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16964 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16969 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16970 .ops = &snd_hda_bind_sw,
16972 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16973 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16978 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16979 HDA_BIND_VOL("Master Playback Volume",
16980 &alc663_asus_two_bind_master_vol),
16981 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16982 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16983 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16984 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16985 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16989 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16990 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16991 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16992 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16993 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16994 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16995 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16999 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17000 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17001 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17002 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17003 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17004 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17006 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17007 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17008 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17009 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17013 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17014 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17015 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17016 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17018 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17019 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17020 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17021 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17022 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17023 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17027 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17028 .ops = &snd_hda_bind_sw,
17030 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17031 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17032 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17033 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17034 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17039 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17040 .ops = &snd_hda_bind_sw,
17042 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17043 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17048 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17049 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17050 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17051 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17052 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17053 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17054 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17055 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17056 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17057 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17061 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17062 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17063 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17064 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17065 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17066 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17067 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17073 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17075 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17076 .name = "Channel Mode",
17077 .info = alc_ch_mode_info,
17078 .get = alc_ch_mode_get,
17079 .put = alc_ch_mode_put,
17084 static struct hda_verb alc662_init_verbs[] = {
17085 /* ADC: mute amp left and right */
17086 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17087 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17091 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17092 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17093 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17094 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17096 /* Front Pin: output 0 (0x0c) */
17097 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17098 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17100 /* Rear Pin: output 1 (0x0d) */
17101 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17102 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17104 /* CLFE Pin: output 2 (0x0e) */
17105 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17106 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17108 /* Mic (rear) pin: input vref at 80% */
17109 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17110 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17111 /* Front Mic pin: input vref at 80% */
17112 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17113 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17114 /* Line In pin: input */
17115 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17116 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17117 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17118 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17119 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17120 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17121 /* CD pin widget for input */
17122 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17124 /* FIXME: use matrix-type input source selection */
17125 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17127 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17128 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17130 /* always trun on EAPD */
17131 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17132 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17137 static struct hda_verb alc663_init_verbs[] = {
17138 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17139 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17140 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17141 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17142 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17143 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17147 static struct hda_verb alc272_init_verbs[] = {
17148 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17149 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17150 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17151 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17152 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17153 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17154 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17155 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17159 static struct hda_verb alc662_sue_init_verbs[] = {
17160 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17161 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17165 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17166 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17167 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17171 /* Set Unsolicited Event*/
17172 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17173 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17174 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17178 static struct hda_verb alc663_m51va_init_verbs[] = {
17179 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17180 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17181 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17182 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17183 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17184 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17185 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17186 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17187 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17191 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17192 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17193 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17194 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17195 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17196 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17197 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17198 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17202 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17203 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17204 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17205 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17206 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17207 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17208 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17209 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17210 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17214 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17215 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17216 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17217 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17219 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17220 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17221 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17225 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17226 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17227 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17228 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17229 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17230 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17231 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17232 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17233 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17234 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17235 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17236 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17237 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17241 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17242 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17243 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17244 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17245 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17246 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17247 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17248 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17249 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17250 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17251 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17252 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17253 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17257 static struct hda_verb alc663_g71v_init_verbs[] = {
17258 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17259 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17260 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17262 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17263 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17264 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17266 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17267 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17268 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17272 static struct hda_verb alc663_g50v_init_verbs[] = {
17273 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17274 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17275 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17277 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17278 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17282 static struct hda_verb alc662_ecs_init_verbs[] = {
17283 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17284 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17285 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17286 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17290 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17291 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17292 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17294 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17295 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17296 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17297 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17298 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17299 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17300 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17301 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17305 static struct hda_verb alc272_dell_init_verbs[] = {
17306 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17307 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17308 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17309 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17310 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17311 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17312 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17313 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17314 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17315 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17316 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17320 static struct hda_verb alc663_mode7_init_verbs[] = {
17321 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17322 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17323 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17324 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17325 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17326 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17327 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17328 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17329 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17330 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17331 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17332 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17333 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17334 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17335 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17339 static struct hda_verb alc663_mode8_init_verbs[] = {
17340 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17341 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17342 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17343 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17344 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17345 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17346 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17347 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17348 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17349 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17350 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17351 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17352 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17353 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17354 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17355 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17359 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17360 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17361 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17365 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17366 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17367 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17371 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17373 unsigned int present;
17374 unsigned char bits;
17376 present = snd_hda_jack_detect(codec, 0x14);
17377 bits = present ? HDA_AMP_MUTE : 0;
17379 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17380 HDA_AMP_MUTE, bits);
17383 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17385 unsigned int present;
17386 unsigned char bits;
17388 present = snd_hda_jack_detect(codec, 0x1b);
17389 bits = present ? HDA_AMP_MUTE : 0;
17391 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17392 HDA_AMP_MUTE, bits);
17393 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17394 HDA_AMP_MUTE, bits);
17397 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17400 if ((res >> 26) == ALC880_HP_EVENT)
17401 alc662_lenovo_101e_all_automute(codec);
17402 if ((res >> 26) == ALC880_FRONT_EVENT)
17403 alc662_lenovo_101e_ispeaker_automute(codec);
17406 /* unsolicited event for HP jack sensing */
17407 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17410 if ((res >> 26) == ALC880_MIC_EVENT)
17411 alc_mic_automute(codec);
17413 alc262_hippo_unsol_event(codec, res);
17416 static void alc662_eeepc_setup(struct hda_codec *codec)
17418 struct alc_spec *spec = codec->spec;
17420 alc262_hippo1_setup(codec);
17421 spec->ext_mic.pin = 0x18;
17422 spec->ext_mic.mux_idx = 0;
17423 spec->int_mic.pin = 0x19;
17424 spec->int_mic.mux_idx = 1;
17425 spec->auto_mic = 1;
17428 static void alc662_eeepc_inithook(struct hda_codec *codec)
17430 alc262_hippo_automute(codec);
17431 alc_mic_automute(codec);
17434 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17436 struct alc_spec *spec = codec->spec;
17438 spec->autocfg.hp_pins[0] = 0x14;
17439 spec->autocfg.speaker_pins[0] = 0x1b;
17442 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17444 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17446 unsigned int present;
17447 unsigned char bits;
17449 present = snd_hda_jack_detect(codec, 0x21);
17450 bits = present ? HDA_AMP_MUTE : 0;
17451 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17452 HDA_AMP_MUTE, bits);
17453 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17454 HDA_AMP_MUTE, bits);
17457 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17459 unsigned int present;
17460 unsigned char bits;
17462 present = snd_hda_jack_detect(codec, 0x21);
17463 bits = present ? HDA_AMP_MUTE : 0;
17464 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17465 HDA_AMP_MUTE, bits);
17466 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17467 HDA_AMP_MUTE, bits);
17468 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17469 HDA_AMP_MUTE, bits);
17470 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17471 HDA_AMP_MUTE, bits);
17474 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17476 unsigned int present;
17477 unsigned char bits;
17479 present = snd_hda_jack_detect(codec, 0x15);
17480 bits = present ? HDA_AMP_MUTE : 0;
17481 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17482 HDA_AMP_MUTE, bits);
17483 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17484 HDA_AMP_MUTE, bits);
17485 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17486 HDA_AMP_MUTE, bits);
17487 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17488 HDA_AMP_MUTE, bits);
17491 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17493 unsigned int present;
17494 unsigned char bits;
17496 present = snd_hda_jack_detect(codec, 0x1b);
17497 bits = present ? 0 : PIN_OUT;
17498 snd_hda_codec_write(codec, 0x14, 0,
17499 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17502 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17504 unsigned int present1, present2;
17506 present1 = snd_hda_jack_detect(codec, 0x21);
17507 present2 = snd_hda_jack_detect(codec, 0x15);
17509 if (present1 || present2) {
17510 snd_hda_codec_write_cache(codec, 0x14, 0,
17511 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17513 snd_hda_codec_write_cache(codec, 0x14, 0,
17514 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17518 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17520 unsigned int present1, present2;
17522 present1 = snd_hda_jack_detect(codec, 0x1b);
17523 present2 = snd_hda_jack_detect(codec, 0x15);
17525 if (present1 || present2) {
17526 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17527 HDA_AMP_MUTE, HDA_AMP_MUTE);
17528 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17529 HDA_AMP_MUTE, HDA_AMP_MUTE);
17531 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17533 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17538 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17540 unsigned int present1, present2;
17542 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17543 AC_VERB_GET_PIN_SENSE, 0)
17544 & AC_PINSENSE_PRESENCE;
17545 present2 = snd_hda_codec_read(codec, 0x21, 0,
17546 AC_VERB_GET_PIN_SENSE, 0)
17547 & AC_PINSENSE_PRESENCE;
17549 if (present1 || present2) {
17550 snd_hda_codec_write_cache(codec, 0x14, 0,
17551 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17552 snd_hda_codec_write_cache(codec, 0x17, 0,
17553 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17555 snd_hda_codec_write_cache(codec, 0x14, 0,
17556 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17557 snd_hda_codec_write_cache(codec, 0x17, 0,
17558 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17562 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17564 unsigned int present1, present2;
17566 present1 = snd_hda_codec_read(codec, 0x21, 0,
17567 AC_VERB_GET_PIN_SENSE, 0)
17568 & AC_PINSENSE_PRESENCE;
17569 present2 = snd_hda_codec_read(codec, 0x15, 0,
17570 AC_VERB_GET_PIN_SENSE, 0)
17571 & AC_PINSENSE_PRESENCE;
17573 if (present1 || present2) {
17574 snd_hda_codec_write_cache(codec, 0x14, 0,
17575 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17576 snd_hda_codec_write_cache(codec, 0x17, 0,
17577 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17579 snd_hda_codec_write_cache(codec, 0x14, 0,
17580 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17581 snd_hda_codec_write_cache(codec, 0x17, 0,
17582 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17586 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17589 switch (res >> 26) {
17590 case ALC880_HP_EVENT:
17591 alc663_m51va_speaker_automute(codec);
17593 case ALC880_MIC_EVENT:
17594 alc_mic_automute(codec);
17599 static void alc663_m51va_setup(struct hda_codec *codec)
17601 struct alc_spec *spec = codec->spec;
17602 spec->ext_mic.pin = 0x18;
17603 spec->ext_mic.mux_idx = 0;
17604 spec->int_mic.pin = 0x12;
17605 spec->int_mic.mux_idx = 9;
17606 spec->auto_mic = 1;
17609 static void alc663_m51va_inithook(struct hda_codec *codec)
17611 alc663_m51va_speaker_automute(codec);
17612 alc_mic_automute(codec);
17615 /* ***************** Mode1 ******************************/
17616 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17618 static void alc663_mode1_setup(struct hda_codec *codec)
17620 struct alc_spec *spec = codec->spec;
17621 spec->ext_mic.pin = 0x18;
17622 spec->ext_mic.mux_idx = 0;
17623 spec->int_mic.pin = 0x19;
17624 spec->int_mic.mux_idx = 1;
17625 spec->auto_mic = 1;
17628 #define alc663_mode1_inithook alc663_m51va_inithook
17630 /* ***************** Mode2 ******************************/
17631 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17634 switch (res >> 26) {
17635 case ALC880_HP_EVENT:
17636 alc662_f5z_speaker_automute(codec);
17638 case ALC880_MIC_EVENT:
17639 alc_mic_automute(codec);
17644 #define alc662_mode2_setup alc663_mode1_setup
17646 static void alc662_mode2_inithook(struct hda_codec *codec)
17648 alc662_f5z_speaker_automute(codec);
17649 alc_mic_automute(codec);
17651 /* ***************** Mode3 ******************************/
17652 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17655 switch (res >> 26) {
17656 case ALC880_HP_EVENT:
17657 alc663_two_hp_m1_speaker_automute(codec);
17659 case ALC880_MIC_EVENT:
17660 alc_mic_automute(codec);
17665 #define alc663_mode3_setup alc663_mode1_setup
17667 static void alc663_mode3_inithook(struct hda_codec *codec)
17669 alc663_two_hp_m1_speaker_automute(codec);
17670 alc_mic_automute(codec);
17672 /* ***************** Mode4 ******************************/
17673 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17676 switch (res >> 26) {
17677 case ALC880_HP_EVENT:
17678 alc663_21jd_two_speaker_automute(codec);
17680 case ALC880_MIC_EVENT:
17681 alc_mic_automute(codec);
17686 #define alc663_mode4_setup alc663_mode1_setup
17688 static void alc663_mode4_inithook(struct hda_codec *codec)
17690 alc663_21jd_two_speaker_automute(codec);
17691 alc_mic_automute(codec);
17693 /* ***************** Mode5 ******************************/
17694 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17697 switch (res >> 26) {
17698 case ALC880_HP_EVENT:
17699 alc663_15jd_two_speaker_automute(codec);
17701 case ALC880_MIC_EVENT:
17702 alc_mic_automute(codec);
17707 #define alc663_mode5_setup alc663_mode1_setup
17709 static void alc663_mode5_inithook(struct hda_codec *codec)
17711 alc663_15jd_two_speaker_automute(codec);
17712 alc_mic_automute(codec);
17714 /* ***************** Mode6 ******************************/
17715 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17718 switch (res >> 26) {
17719 case ALC880_HP_EVENT:
17720 alc663_two_hp_m2_speaker_automute(codec);
17722 case ALC880_MIC_EVENT:
17723 alc_mic_automute(codec);
17728 #define alc663_mode6_setup alc663_mode1_setup
17730 static void alc663_mode6_inithook(struct hda_codec *codec)
17732 alc663_two_hp_m2_speaker_automute(codec);
17733 alc_mic_automute(codec);
17736 /* ***************** Mode7 ******************************/
17737 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17740 switch (res >> 26) {
17741 case ALC880_HP_EVENT:
17742 alc663_two_hp_m7_speaker_automute(codec);
17744 case ALC880_MIC_EVENT:
17745 alc_mic_automute(codec);
17750 #define alc663_mode7_setup alc663_mode1_setup
17752 static void alc663_mode7_inithook(struct hda_codec *codec)
17754 alc663_two_hp_m7_speaker_automute(codec);
17755 alc_mic_automute(codec);
17758 /* ***************** Mode8 ******************************/
17759 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17762 switch (res >> 26) {
17763 case ALC880_HP_EVENT:
17764 alc663_two_hp_m8_speaker_automute(codec);
17766 case ALC880_MIC_EVENT:
17767 alc_mic_automute(codec);
17772 #define alc663_mode8_setup alc663_m51va_setup
17774 static void alc663_mode8_inithook(struct hda_codec *codec)
17776 alc663_two_hp_m8_speaker_automute(codec);
17777 alc_mic_automute(codec);
17780 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17782 unsigned int present;
17783 unsigned char bits;
17785 present = snd_hda_jack_detect(codec, 0x21);
17786 bits = present ? HDA_AMP_MUTE : 0;
17787 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17788 HDA_AMP_MUTE, bits);
17789 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17790 HDA_AMP_MUTE, bits);
17793 static void alc663_g71v_front_automute(struct hda_codec *codec)
17795 unsigned int present;
17796 unsigned char bits;
17798 present = snd_hda_jack_detect(codec, 0x15);
17799 bits = present ? HDA_AMP_MUTE : 0;
17800 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17801 HDA_AMP_MUTE, bits);
17804 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17807 switch (res >> 26) {
17808 case ALC880_HP_EVENT:
17809 alc663_g71v_hp_automute(codec);
17811 case ALC880_FRONT_EVENT:
17812 alc663_g71v_front_automute(codec);
17814 case ALC880_MIC_EVENT:
17815 alc_mic_automute(codec);
17820 #define alc663_g71v_setup alc663_m51va_setup
17822 static void alc663_g71v_inithook(struct hda_codec *codec)
17824 alc663_g71v_front_automute(codec);
17825 alc663_g71v_hp_automute(codec);
17826 alc_mic_automute(codec);
17829 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17832 switch (res >> 26) {
17833 case ALC880_HP_EVENT:
17834 alc663_m51va_speaker_automute(codec);
17836 case ALC880_MIC_EVENT:
17837 alc_mic_automute(codec);
17842 #define alc663_g50v_setup alc663_m51va_setup
17844 static void alc663_g50v_inithook(struct hda_codec *codec)
17846 alc663_m51va_speaker_automute(codec);
17847 alc_mic_automute(codec);
17850 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17851 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17852 ALC262_HIPPO_MASTER_SWITCH,
17854 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17855 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17856 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17858 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17859 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17860 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17864 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17865 /* Master Playback automatically created from Speaker and Headphone */
17866 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17867 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17868 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17869 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17871 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17872 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17873 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17875 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17876 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17877 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17881 #ifdef CONFIG_SND_HDA_POWER_SAVE
17882 #define alc662_loopbacks alc880_loopbacks
17886 /* pcm configuration: identical with ALC880 */
17887 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17888 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17889 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17890 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17893 * configuration and preset
17895 static const char *alc662_models[ALC662_MODEL_LAST] = {
17896 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17897 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17898 [ALC662_3ST_6ch] = "3stack-6ch",
17899 [ALC662_5ST_DIG] = "6stack-dig",
17900 [ALC662_LENOVO_101E] = "lenovo-101e",
17901 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17902 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17903 [ALC662_ECS] = "ecs",
17904 [ALC663_ASUS_M51VA] = "m51va",
17905 [ALC663_ASUS_G71V] = "g71v",
17906 [ALC663_ASUS_H13] = "h13",
17907 [ALC663_ASUS_G50V] = "g50v",
17908 [ALC663_ASUS_MODE1] = "asus-mode1",
17909 [ALC662_ASUS_MODE2] = "asus-mode2",
17910 [ALC663_ASUS_MODE3] = "asus-mode3",
17911 [ALC663_ASUS_MODE4] = "asus-mode4",
17912 [ALC663_ASUS_MODE5] = "asus-mode5",
17913 [ALC663_ASUS_MODE6] = "asus-mode6",
17914 [ALC663_ASUS_MODE7] = "asus-mode7",
17915 [ALC663_ASUS_MODE8] = "asus-mode8",
17916 [ALC272_DELL] = "dell",
17917 [ALC272_DELL_ZM1] = "dell-zm1",
17918 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17919 [ALC662_AUTO] = "auto",
17922 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17923 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17924 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17925 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17926 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17927 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17928 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17929 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17930 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17931 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17932 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17933 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17934 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17935 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17936 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17937 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17938 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17939 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17940 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17941 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17942 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17943 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17944 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17945 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17946 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17947 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17948 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17949 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17950 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17951 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17952 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17953 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17954 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17955 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17956 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17957 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17958 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17959 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17960 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17961 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17962 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17963 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17964 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17965 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17966 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17967 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17968 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17969 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17970 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17971 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17972 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17973 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17974 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17975 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17976 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17977 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17978 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17979 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17980 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17981 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17982 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17983 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17984 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17985 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17986 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17987 ALC662_3ST_6ch_DIG),
17988 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17989 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17990 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17991 ALC662_3ST_6ch_DIG),
17992 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
17993 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17994 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17995 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17996 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17997 ALC662_3ST_6ch_DIG),
17998 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18003 static struct alc_config_preset alc662_presets[] = {
18004 [ALC662_3ST_2ch_DIG] = {
18005 .mixers = { alc662_3ST_2ch_mixer },
18006 .init_verbs = { alc662_init_verbs },
18007 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18008 .dac_nids = alc662_dac_nids,
18009 .dig_out_nid = ALC662_DIGOUT_NID,
18010 .dig_in_nid = ALC662_DIGIN_NID,
18011 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18012 .channel_mode = alc662_3ST_2ch_modes,
18013 .input_mux = &alc662_capture_source,
18015 [ALC662_3ST_6ch_DIG] = {
18016 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18017 .init_verbs = { alc662_init_verbs },
18018 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18019 .dac_nids = alc662_dac_nids,
18020 .dig_out_nid = ALC662_DIGOUT_NID,
18021 .dig_in_nid = ALC662_DIGIN_NID,
18022 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18023 .channel_mode = alc662_3ST_6ch_modes,
18025 .input_mux = &alc662_capture_source,
18027 [ALC662_3ST_6ch] = {
18028 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18029 .init_verbs = { alc662_init_verbs },
18030 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18031 .dac_nids = alc662_dac_nids,
18032 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18033 .channel_mode = alc662_3ST_6ch_modes,
18035 .input_mux = &alc662_capture_source,
18037 [ALC662_5ST_DIG] = {
18038 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18039 .init_verbs = { alc662_init_verbs },
18040 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18041 .dac_nids = alc662_dac_nids,
18042 .dig_out_nid = ALC662_DIGOUT_NID,
18043 .dig_in_nid = ALC662_DIGIN_NID,
18044 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18045 .channel_mode = alc662_5stack_modes,
18046 .input_mux = &alc662_capture_source,
18048 [ALC662_LENOVO_101E] = {
18049 .mixers = { alc662_lenovo_101e_mixer },
18050 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18051 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18052 .dac_nids = alc662_dac_nids,
18053 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18054 .channel_mode = alc662_3ST_2ch_modes,
18055 .input_mux = &alc662_lenovo_101e_capture_source,
18056 .unsol_event = alc662_lenovo_101e_unsol_event,
18057 .init_hook = alc662_lenovo_101e_all_automute,
18059 [ALC662_ASUS_EEEPC_P701] = {
18060 .mixers = { alc662_eeepc_p701_mixer },
18061 .init_verbs = { alc662_init_verbs,
18062 alc662_eeepc_sue_init_verbs },
18063 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18064 .dac_nids = alc662_dac_nids,
18065 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18066 .channel_mode = alc662_3ST_2ch_modes,
18067 .unsol_event = alc662_eeepc_unsol_event,
18068 .setup = alc662_eeepc_setup,
18069 .init_hook = alc662_eeepc_inithook,
18071 [ALC662_ASUS_EEEPC_EP20] = {
18072 .mixers = { alc662_eeepc_ep20_mixer,
18073 alc662_chmode_mixer },
18074 .init_verbs = { alc662_init_verbs,
18075 alc662_eeepc_ep20_sue_init_verbs },
18076 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18077 .dac_nids = alc662_dac_nids,
18078 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18079 .channel_mode = alc662_3ST_6ch_modes,
18080 .input_mux = &alc662_lenovo_101e_capture_source,
18081 .unsol_event = alc662_eeepc_unsol_event,
18082 .setup = alc662_eeepc_ep20_setup,
18083 .init_hook = alc662_eeepc_ep20_inithook,
18086 .mixers = { alc662_ecs_mixer },
18087 .init_verbs = { alc662_init_verbs,
18088 alc662_ecs_init_verbs },
18089 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18090 .dac_nids = alc662_dac_nids,
18091 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18092 .channel_mode = alc662_3ST_2ch_modes,
18093 .unsol_event = alc662_eeepc_unsol_event,
18094 .setup = alc662_eeepc_setup,
18095 .init_hook = alc662_eeepc_inithook,
18097 [ALC663_ASUS_M51VA] = {
18098 .mixers = { alc663_m51va_mixer },
18099 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18100 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18101 .dac_nids = alc662_dac_nids,
18102 .dig_out_nid = ALC662_DIGOUT_NID,
18103 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18104 .channel_mode = alc662_3ST_2ch_modes,
18105 .unsol_event = alc663_m51va_unsol_event,
18106 .setup = alc663_m51va_setup,
18107 .init_hook = alc663_m51va_inithook,
18109 [ALC663_ASUS_G71V] = {
18110 .mixers = { alc663_g71v_mixer },
18111 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18112 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18113 .dac_nids = alc662_dac_nids,
18114 .dig_out_nid = ALC662_DIGOUT_NID,
18115 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18116 .channel_mode = alc662_3ST_2ch_modes,
18117 .unsol_event = alc663_g71v_unsol_event,
18118 .setup = alc663_g71v_setup,
18119 .init_hook = alc663_g71v_inithook,
18121 [ALC663_ASUS_H13] = {
18122 .mixers = { alc663_m51va_mixer },
18123 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18124 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18125 .dac_nids = alc662_dac_nids,
18126 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18127 .channel_mode = alc662_3ST_2ch_modes,
18128 .unsol_event = alc663_m51va_unsol_event,
18129 .init_hook = alc663_m51va_inithook,
18131 [ALC663_ASUS_G50V] = {
18132 .mixers = { alc663_g50v_mixer },
18133 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18134 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18135 .dac_nids = alc662_dac_nids,
18136 .dig_out_nid = ALC662_DIGOUT_NID,
18137 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18138 .channel_mode = alc662_3ST_6ch_modes,
18139 .input_mux = &alc663_capture_source,
18140 .unsol_event = alc663_g50v_unsol_event,
18141 .setup = alc663_g50v_setup,
18142 .init_hook = alc663_g50v_inithook,
18144 [ALC663_ASUS_MODE1] = {
18145 .mixers = { alc663_m51va_mixer },
18146 .cap_mixer = alc662_auto_capture_mixer,
18147 .init_verbs = { alc662_init_verbs,
18148 alc663_21jd_amic_init_verbs },
18149 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18151 .dac_nids = alc662_dac_nids,
18152 .dig_out_nid = ALC662_DIGOUT_NID,
18153 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18154 .channel_mode = alc662_3ST_2ch_modes,
18155 .unsol_event = alc663_mode1_unsol_event,
18156 .setup = alc663_mode1_setup,
18157 .init_hook = alc663_mode1_inithook,
18159 [ALC662_ASUS_MODE2] = {
18160 .mixers = { alc662_1bjd_mixer },
18161 .cap_mixer = alc662_auto_capture_mixer,
18162 .init_verbs = { alc662_init_verbs,
18163 alc662_1bjd_amic_init_verbs },
18164 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18165 .dac_nids = alc662_dac_nids,
18166 .dig_out_nid = ALC662_DIGOUT_NID,
18167 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18168 .channel_mode = alc662_3ST_2ch_modes,
18169 .unsol_event = alc662_mode2_unsol_event,
18170 .setup = alc662_mode2_setup,
18171 .init_hook = alc662_mode2_inithook,
18173 [ALC663_ASUS_MODE3] = {
18174 .mixers = { alc663_two_hp_m1_mixer },
18175 .cap_mixer = alc662_auto_capture_mixer,
18176 .init_verbs = { alc662_init_verbs,
18177 alc663_two_hp_amic_m1_init_verbs },
18178 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18180 .dac_nids = alc662_dac_nids,
18181 .dig_out_nid = ALC662_DIGOUT_NID,
18182 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18183 .channel_mode = alc662_3ST_2ch_modes,
18184 .unsol_event = alc663_mode3_unsol_event,
18185 .setup = alc663_mode3_setup,
18186 .init_hook = alc663_mode3_inithook,
18188 [ALC663_ASUS_MODE4] = {
18189 .mixers = { alc663_asus_21jd_clfe_mixer },
18190 .cap_mixer = alc662_auto_capture_mixer,
18191 .init_verbs = { alc662_init_verbs,
18192 alc663_21jd_amic_init_verbs},
18193 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18195 .dac_nids = alc662_dac_nids,
18196 .dig_out_nid = ALC662_DIGOUT_NID,
18197 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18198 .channel_mode = alc662_3ST_2ch_modes,
18199 .unsol_event = alc663_mode4_unsol_event,
18200 .setup = alc663_mode4_setup,
18201 .init_hook = alc663_mode4_inithook,
18203 [ALC663_ASUS_MODE5] = {
18204 .mixers = { alc663_asus_15jd_clfe_mixer },
18205 .cap_mixer = alc662_auto_capture_mixer,
18206 .init_verbs = { alc662_init_verbs,
18207 alc663_15jd_amic_init_verbs },
18208 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18210 .dac_nids = alc662_dac_nids,
18211 .dig_out_nid = ALC662_DIGOUT_NID,
18212 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18213 .channel_mode = alc662_3ST_2ch_modes,
18214 .unsol_event = alc663_mode5_unsol_event,
18215 .setup = alc663_mode5_setup,
18216 .init_hook = alc663_mode5_inithook,
18218 [ALC663_ASUS_MODE6] = {
18219 .mixers = { alc663_two_hp_m2_mixer },
18220 .cap_mixer = alc662_auto_capture_mixer,
18221 .init_verbs = { alc662_init_verbs,
18222 alc663_two_hp_amic_m2_init_verbs },
18223 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18225 .dac_nids = alc662_dac_nids,
18226 .dig_out_nid = ALC662_DIGOUT_NID,
18227 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18228 .channel_mode = alc662_3ST_2ch_modes,
18229 .unsol_event = alc663_mode6_unsol_event,
18230 .setup = alc663_mode6_setup,
18231 .init_hook = alc663_mode6_inithook,
18233 [ALC663_ASUS_MODE7] = {
18234 .mixers = { alc663_mode7_mixer },
18235 .cap_mixer = alc662_auto_capture_mixer,
18236 .init_verbs = { alc662_init_verbs,
18237 alc663_mode7_init_verbs },
18238 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18240 .dac_nids = alc662_dac_nids,
18241 .dig_out_nid = ALC662_DIGOUT_NID,
18242 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18243 .channel_mode = alc662_3ST_2ch_modes,
18244 .unsol_event = alc663_mode7_unsol_event,
18245 .setup = alc663_mode7_setup,
18246 .init_hook = alc663_mode7_inithook,
18248 [ALC663_ASUS_MODE8] = {
18249 .mixers = { alc663_mode8_mixer },
18250 .cap_mixer = alc662_auto_capture_mixer,
18251 .init_verbs = { alc662_init_verbs,
18252 alc663_mode8_init_verbs },
18253 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18255 .dac_nids = alc662_dac_nids,
18256 .dig_out_nid = ALC662_DIGOUT_NID,
18257 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18258 .channel_mode = alc662_3ST_2ch_modes,
18259 .unsol_event = alc663_mode8_unsol_event,
18260 .setup = alc663_mode8_setup,
18261 .init_hook = alc663_mode8_inithook,
18264 .mixers = { alc663_m51va_mixer },
18265 .cap_mixer = alc272_auto_capture_mixer,
18266 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18267 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18268 .dac_nids = alc662_dac_nids,
18269 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18270 .adc_nids = alc272_adc_nids,
18271 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18272 .capsrc_nids = alc272_capsrc_nids,
18273 .channel_mode = alc662_3ST_2ch_modes,
18274 .unsol_event = alc663_m51va_unsol_event,
18275 .setup = alc663_m51va_setup,
18276 .init_hook = alc663_m51va_inithook,
18278 [ALC272_DELL_ZM1] = {
18279 .mixers = { alc663_m51va_mixer },
18280 .cap_mixer = alc662_auto_capture_mixer,
18281 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18282 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18283 .dac_nids = alc662_dac_nids,
18284 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18285 .adc_nids = alc662_adc_nids,
18287 .capsrc_nids = alc662_capsrc_nids,
18288 .channel_mode = alc662_3ST_2ch_modes,
18289 .unsol_event = alc663_m51va_unsol_event,
18290 .setup = alc663_m51va_setup,
18291 .init_hook = alc663_m51va_inithook,
18293 [ALC272_SAMSUNG_NC10] = {
18294 .mixers = { alc272_nc10_mixer },
18295 .init_verbs = { alc662_init_verbs,
18296 alc663_21jd_amic_init_verbs },
18297 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18298 .dac_nids = alc272_dac_nids,
18299 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18300 .channel_mode = alc662_3ST_2ch_modes,
18301 /*.input_mux = &alc272_nc10_capture_source,*/
18302 .unsol_event = alc663_mode4_unsol_event,
18303 .setup = alc663_mode4_setup,
18304 .init_hook = alc663_mode4_inithook,
18310 * BIOS auto configuration
18313 /* convert from MIX nid to DAC */
18314 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18318 else if (nid >= 0x0c && nid <= 0x0e)
18319 return nid - 0x0c + 0x02;
18324 /* get MIX nid connected to the given pin targeted to DAC */
18325 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18331 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18332 for (i = 0; i < num; i++) {
18333 if (alc662_mix_to_dac(mix[i]) == dac)
18339 /* look for an empty DAC slot */
18340 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18342 struct alc_spec *spec = codec->spec;
18346 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18349 for (i = 0; i < num; i++) {
18350 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18353 for (j = 0; j < spec->multiout.num_dacs; j++)
18354 if (spec->multiout.dac_nids[j] == nid)
18356 if (j >= spec->multiout.num_dacs)
18362 /* fill in the dac_nids table from the parsed pin configuration */
18363 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18364 const struct auto_pin_cfg *cfg)
18366 struct alc_spec *spec = codec->spec;
18370 spec->multiout.dac_nids = spec->private_dac_nids;
18371 for (i = 0; i < cfg->line_outs; i++) {
18372 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18375 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18380 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18381 hda_nid_t nid, unsigned int chs)
18383 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18384 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18387 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18388 hda_nid_t nid, unsigned int chs)
18390 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18391 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18394 #define alc662_add_stereo_vol(spec, pfx, nid) \
18395 alc662_add_vol_ctl(spec, pfx, nid, 3)
18396 #define alc662_add_stereo_sw(spec, pfx, nid) \
18397 alc662_add_sw_ctl(spec, pfx, nid, 3)
18399 /* add playback controls from the parsed DAC table */
18400 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18401 const struct auto_pin_cfg *cfg)
18403 struct alc_spec *spec = codec->spec;
18404 static const char *chname[4] = {
18405 "Front", "Surround", NULL /*CLFE*/, "Side"
18407 hda_nid_t nid, mix;
18410 for (i = 0; i < cfg->line_outs; i++) {
18411 nid = spec->multiout.dac_nids[i];
18414 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18419 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18422 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18425 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18428 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18433 if (cfg->line_outs == 1 &&
18434 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18441 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18444 if (cfg->line_outs == 1 &&
18445 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18447 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18455 /* add playback controls for speaker and HP outputs */
18456 /* return DAC nid if any new DAC is assigned */
18457 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18460 struct alc_spec *spec = codec->spec;
18461 hda_nid_t nid, mix;
18466 nid = alc662_look_for_dac(codec, pin);
18468 /* the corresponding DAC is already occupied */
18469 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18470 return 0; /* no way */
18471 /* create a switch only */
18472 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18473 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18476 mix = alc662_dac_to_mix(codec, pin, nid);
18479 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18482 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18488 /* create playback/capture controls for input pins */
18489 #define alc662_auto_create_input_ctls \
18490 alc882_auto_create_input_ctls
18492 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18493 hda_nid_t nid, int pin_type,
18499 alc_set_pin_output(codec, nid, pin_type);
18500 /* need the manual connection? */
18501 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18504 for (i = 0; i < num; i++) {
18505 if (alc662_mix_to_dac(srcs[i]) != dac)
18507 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18512 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18514 struct alc_spec *spec = codec->spec;
18515 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18518 for (i = 0; i <= HDA_SIDE; i++) {
18519 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18521 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18522 spec->multiout.dac_nids[i]);
18526 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18528 struct alc_spec *spec = codec->spec;
18531 pin = spec->autocfg.hp_pins[0];
18533 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18534 spec->multiout.hp_nid);
18535 pin = spec->autocfg.speaker_pins[0];
18537 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18538 spec->multiout.extra_out_nid[0]);
18541 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18543 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18545 struct alc_spec *spec = codec->spec;
18548 for (i = 0; i < AUTO_PIN_LAST; i++) {
18549 hda_nid_t nid = spec->autocfg.input_pins[i];
18550 if (alc_is_input_pin(codec, nid)) {
18551 alc_set_input_pin(codec, nid, i);
18552 if (nid != ALC662_PIN_CD_NID &&
18553 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18554 snd_hda_codec_write(codec, nid, 0,
18555 AC_VERB_SET_AMP_GAIN_MUTE,
18561 #define alc662_auto_init_input_src alc882_auto_init_input_src
18563 static int alc662_parse_auto_config(struct hda_codec *codec)
18565 struct alc_spec *spec = codec->spec;
18567 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18569 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18573 if (!spec->autocfg.line_outs)
18574 return 0; /* can't find valid BIOS pin config */
18576 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18579 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18582 err = alc662_auto_create_extra_out(codec,
18583 spec->autocfg.speaker_pins[0],
18588 spec->multiout.extra_out_nid[0] = err;
18589 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18594 spec->multiout.hp_nid = err;
18595 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18599 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18601 if (spec->autocfg.dig_outs)
18602 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18604 if (spec->kctls.list)
18605 add_mixer(spec, spec->kctls.list);
18607 spec->num_mux_defs = 1;
18608 spec->input_mux = &spec->private_imux[0];
18610 add_verb(spec, alc662_init_verbs);
18611 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18612 codec->vendor_id == 0x10ec0665)
18613 add_verb(spec, alc663_init_verbs);
18615 if (codec->vendor_id == 0x10ec0272)
18616 add_verb(spec, alc272_init_verbs);
18618 err = alc_auto_add_mic_boost(codec);
18622 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18623 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18624 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18626 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18631 /* additional initialization for auto-configuration model */
18632 static void alc662_auto_init(struct hda_codec *codec)
18634 struct alc_spec *spec = codec->spec;
18635 alc662_auto_init_multi_out(codec);
18636 alc662_auto_init_hp_out(codec);
18637 alc662_auto_init_analog_input(codec);
18638 alc662_auto_init_input_src(codec);
18639 if (spec->unsol_event)
18640 alc_inithook(codec);
18643 static int patch_alc662(struct hda_codec *codec)
18645 struct alc_spec *spec;
18646 int err, board_config;
18648 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18652 codec->spec = spec;
18654 alc_auto_parse_customize_define(codec);
18656 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18658 if (alc_read_coef_idx(codec, 0) == 0x8020)
18659 alc_codec_rename(codec, "ALC661");
18660 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
18661 codec->bus->pci->subsystem_vendor == 0x1025 &&
18662 spec->cdefine.platform_type == 1)
18663 alc_codec_rename(codec, "ALC272X");
18665 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18668 if (board_config < 0) {
18669 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18671 board_config = ALC662_AUTO;
18674 if (board_config == ALC662_AUTO) {
18675 /* automatic parse from the BIOS config */
18676 err = alc662_parse_auto_config(codec);
18682 "hda_codec: Cannot set up configuration "
18683 "from BIOS. Using base mode...\n");
18684 board_config = ALC662_3ST_2ch_DIG;
18688 err = snd_hda_attach_beep_device(codec, 0x1);
18694 if (board_config != ALC662_AUTO)
18695 setup_preset(codec, &alc662_presets[board_config]);
18697 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18698 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18700 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18701 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18703 if (!spec->adc_nids) {
18704 spec->adc_nids = alc662_adc_nids;
18705 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18707 if (!spec->capsrc_nids)
18708 spec->capsrc_nids = alc662_capsrc_nids;
18710 if (!spec->cap_mixer)
18711 set_capture_mixer(codec);
18713 if (spec->cdefine.enable_pcbeep) {
18714 switch (codec->vendor_id) {
18716 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18721 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18724 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18728 spec->vmaster_nid = 0x02;
18730 codec->patch_ops = alc_patch_ops;
18731 if (board_config == ALC662_AUTO)
18732 spec->init_hook = alc662_auto_init;
18733 #ifdef CONFIG_SND_HDA_POWER_SAVE
18734 if (!spec->loopback.amplist)
18735 spec->loopback.amplist = alc662_loopbacks;
18741 static int patch_alc888(struct hda_codec *codec)
18743 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18744 kfree(codec->chip_name);
18745 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18746 if (!codec->chip_name) {
18750 return patch_alc662(codec);
18752 return patch_alc882(codec);
18758 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18759 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18760 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18761 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18762 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18763 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18764 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18765 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18766 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18767 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18768 .patch = patch_alc861 },
18769 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18770 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18771 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18772 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18773 .patch = patch_alc882 },
18774 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18775 .patch = patch_alc662 },
18776 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18777 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18778 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
18779 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18780 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18781 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18782 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18783 .patch = patch_alc882 },
18784 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18785 .patch = patch_alc882 },
18786 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18787 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18788 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18789 .patch = patch_alc882 },
18790 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18791 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18792 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18793 {} /* terminator */
18796 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18798 MODULE_LICENSE("GPL");
18799 MODULE_DESCRIPTION("Realtek HD-audio codec");
18801 static struct hda_codec_preset_list realtek_list = {
18802 .preset = snd_hda_preset_realtek,
18803 .owner = THIS_MODULE,
18806 static int __init patch_realtek_init(void)
18808 return snd_hda_add_codec_preset(&realtek_list);
18811 static void __exit patch_realtek_exit(void)
18813 snd_hda_delete_codec_preset(&realtek_list);
18816 module_init(patch_realtek_init)
18817 module_exit(patch_realtek_exit)