2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
134 ALC269_ASUS_EEEPC_P703,
135 ALC269_ASUS_EEEPC_P901,
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
216 ALC883_TARGA_2ch_DIG,
217 ALC883_TARGA_8ch_DIG,
220 ALC888_ACER_ASPIRE_4930G,
221 ALC888_ACER_ASPIRE_6530G,
222 ALC888_ACER_ASPIRE_8930G,
226 ALC883_LENOVO_101E_2ch,
227 ALC883_LENOVO_NB0763,
228 ALC888_LENOVO_MS7195_DIG,
235 ALC883_FUJITSU_PI2515,
236 ALC888_FUJITSU_XA3530,
237 ALC883_3ST_6ch_INTEL,
250 #define GPIO_MASK 0x03
252 /* extra amp-initialization sequence types */
262 /* codec parameterization */
263 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
264 unsigned int num_mixers;
265 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
266 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
268 const struct hda_verb *init_verbs[5]; /* initialization verbs
272 unsigned int num_init_verbs;
274 char stream_name_analog[16]; /* analog PCM stream */
275 struct hda_pcm_stream *stream_analog_playback;
276 struct hda_pcm_stream *stream_analog_capture;
277 struct hda_pcm_stream *stream_analog_alt_playback;
278 struct hda_pcm_stream *stream_analog_alt_capture;
280 char stream_name_digital[16]; /* digital PCM stream */
281 struct hda_pcm_stream *stream_digital_playback;
282 struct hda_pcm_stream *stream_digital_capture;
285 struct hda_multi_out multiout; /* playback set-up
286 * max_channels, dacs must be set
287 * dig_out_nid and hp_nid are optional
289 hda_nid_t alt_dac_nid;
290 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
294 unsigned int num_adc_nids;
296 hda_nid_t *capsrc_nids;
297 hda_nid_t dig_in_nid; /* digital-in NID; optional */
300 unsigned int num_mux_defs;
301 const struct hda_input_mux *input_mux;
302 unsigned int cur_mux[3];
305 const struct hda_channel_mode *channel_mode;
306 int num_channel_mode;
308 int const_channel_count;
309 int ext_channel_count;
311 /* PCM information */
312 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
314 /* dynamic controls, init_verbs and input_mux */
315 struct auto_pin_cfg autocfg;
316 struct snd_array kctls;
317 struct hda_input_mux private_imux[3];
318 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
319 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
320 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
323 void (*init_hook)(struct hda_codec *codec);
324 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
326 /* for pin sensing */
327 unsigned int sense_updated: 1;
328 unsigned int jack_present: 1;
329 unsigned int master_sw: 1;
332 unsigned int no_analog :1; /* digital I/O only */
335 /* for virtual master */
336 hda_nid_t vmaster_nid;
337 #ifdef CONFIG_SND_HDA_POWER_SAVE
338 struct hda_loopback_check loopback;
343 unsigned int pll_coef_idx, pll_coef_bit;
347 * configuration template - to be copied to the spec instance
349 struct alc_config_preset {
350 struct snd_kcontrol_new *mixers[5]; /* should be identical size
353 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
354 const struct hda_verb *init_verbs[5];
355 unsigned int num_dacs;
357 hda_nid_t dig_out_nid; /* optional */
358 hda_nid_t hp_nid; /* optional */
359 hda_nid_t *slave_dig_outs;
360 unsigned int num_adc_nids;
362 hda_nid_t *capsrc_nids;
363 hda_nid_t dig_in_nid;
364 unsigned int num_channel_mode;
365 const struct hda_channel_mode *channel_mode;
367 int const_channel_count;
368 unsigned int num_mux_defs;
369 const struct hda_input_mux *input_mux;
370 void (*unsol_event)(struct hda_codec *, unsigned int);
371 void (*init_hook)(struct hda_codec *);
372 #ifdef CONFIG_SND_HDA_POWER_SAVE
373 struct hda_amp_list *loopbacks;
381 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
382 struct snd_ctl_elem_info *uinfo)
384 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
385 struct alc_spec *spec = codec->spec;
386 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
387 if (mux_idx >= spec->num_mux_defs)
389 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
392 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
393 struct snd_ctl_elem_value *ucontrol)
395 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
396 struct alc_spec *spec = codec->spec;
397 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
399 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
403 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
404 struct snd_ctl_elem_value *ucontrol)
406 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
407 struct alc_spec *spec = codec->spec;
408 const struct hda_input_mux *imux;
409 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
410 unsigned int mux_idx;
411 hda_nid_t nid = spec->capsrc_nids ?
412 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
415 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
416 imux = &spec->input_mux[mux_idx];
418 type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
419 if (type == AC_WID_AUD_MIX) {
420 /* Matrix-mixer style (e.g. ALC882) */
421 unsigned int *cur_val = &spec->cur_mux[adc_idx];
424 idx = ucontrol->value.enumerated.item[0];
425 if (idx >= imux->num_items)
426 idx = imux->num_items - 1;
429 for (i = 0; i < imux->num_items; i++) {
430 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
431 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
432 imux->items[i].index,
438 /* MUX style (e.g. ALC880) */
439 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
440 &spec->cur_mux[adc_idx]);
445 * channel mode setting
447 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
448 struct snd_ctl_elem_info *uinfo)
450 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
451 struct alc_spec *spec = codec->spec;
452 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
453 spec->num_channel_mode);
456 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
457 struct snd_ctl_elem_value *ucontrol)
459 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
460 struct alc_spec *spec = codec->spec;
461 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
462 spec->num_channel_mode,
463 spec->ext_channel_count);
466 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
467 struct snd_ctl_elem_value *ucontrol)
469 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
470 struct alc_spec *spec = codec->spec;
471 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
472 spec->num_channel_mode,
473 &spec->ext_channel_count);
474 if (err >= 0 && !spec->const_channel_count) {
475 spec->multiout.max_channels = spec->ext_channel_count;
476 if (spec->need_dac_fix)
477 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
483 * Control the mode of pin widget settings via the mixer. "pc" is used
484 * instead of "%" to avoid consequences of accidently treating the % as
485 * being part of a format specifier. Maximum allowed length of a value is
486 * 63 characters plus NULL terminator.
488 * Note: some retasking pin complexes seem to ignore requests for input
489 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
490 * are requested. Therefore order this list so that this behaviour will not
491 * cause problems when mixer clients move through the enum sequentially.
492 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
495 static char *alc_pin_mode_names[] = {
496 "Mic 50pc bias", "Mic 80pc bias",
497 "Line in", "Line out", "Headphone out",
499 static unsigned char alc_pin_mode_values[] = {
500 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
502 /* The control can present all 5 options, or it can limit the options based
503 * in the pin being assumed to be exclusively an input or an output pin. In
504 * addition, "input" pins may or may not process the mic bias option
505 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
506 * accept requests for bias as of chip versions up to March 2006) and/or
507 * wiring in the computer.
509 #define ALC_PIN_DIR_IN 0x00
510 #define ALC_PIN_DIR_OUT 0x01
511 #define ALC_PIN_DIR_INOUT 0x02
512 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
513 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
515 /* Info about the pin modes supported by the different pin direction modes.
516 * For each direction the minimum and maximum values are given.
518 static signed char alc_pin_mode_dir_info[5][2] = {
519 { 0, 2 }, /* ALC_PIN_DIR_IN */
520 { 3, 4 }, /* ALC_PIN_DIR_OUT */
521 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
522 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
523 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
525 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
526 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
527 #define alc_pin_mode_n_items(_dir) \
528 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
530 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
531 struct snd_ctl_elem_info *uinfo)
533 unsigned int item_num = uinfo->value.enumerated.item;
534 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
536 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
538 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
540 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
541 item_num = alc_pin_mode_min(dir);
542 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
546 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
547 struct snd_ctl_elem_value *ucontrol)
550 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
551 hda_nid_t nid = kcontrol->private_value & 0xffff;
552 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
553 long *valp = ucontrol->value.integer.value;
554 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
555 AC_VERB_GET_PIN_WIDGET_CONTROL,
558 /* Find enumerated value for current pinctl setting */
559 i = alc_pin_mode_min(dir);
560 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
562 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
566 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
567 struct snd_ctl_elem_value *ucontrol)
570 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
571 hda_nid_t nid = kcontrol->private_value & 0xffff;
572 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
573 long val = *ucontrol->value.integer.value;
574 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
575 AC_VERB_GET_PIN_WIDGET_CONTROL,
578 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
579 val = alc_pin_mode_min(dir);
581 change = pinctl != alc_pin_mode_values[val];
583 /* Set pin mode to that requested */
584 snd_hda_codec_write_cache(codec, nid, 0,
585 AC_VERB_SET_PIN_WIDGET_CONTROL,
586 alc_pin_mode_values[val]);
588 /* Also enable the retasking pin's input/output as required
589 * for the requested pin mode. Enum values of 2 or less are
592 * Dynamically switching the input/output buffers probably
593 * reduces noise slightly (particularly on input) so we'll
594 * do it. However, having both input and output buffers
595 * enabled simultaneously doesn't seem to be problematic if
596 * this turns out to be necessary in the future.
599 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
600 HDA_AMP_MUTE, HDA_AMP_MUTE);
601 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
604 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
605 HDA_AMP_MUTE, HDA_AMP_MUTE);
606 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
613 #define ALC_PIN_MODE(xname, nid, dir) \
614 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
615 .info = alc_pin_mode_info, \
616 .get = alc_pin_mode_get, \
617 .put = alc_pin_mode_put, \
618 .private_value = nid | (dir<<16) }
620 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
621 * together using a mask with more than one bit set. This control is
622 * currently used only by the ALC260 test model. At this stage they are not
623 * needed for any "production" models.
625 #ifdef CONFIG_SND_DEBUG
626 #define alc_gpio_data_info snd_ctl_boolean_mono_info
628 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
629 struct snd_ctl_elem_value *ucontrol)
631 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
632 hda_nid_t nid = kcontrol->private_value & 0xffff;
633 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
634 long *valp = ucontrol->value.integer.value;
635 unsigned int val = snd_hda_codec_read(codec, nid, 0,
636 AC_VERB_GET_GPIO_DATA, 0x00);
638 *valp = (val & mask) != 0;
641 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
642 struct snd_ctl_elem_value *ucontrol)
645 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
646 hda_nid_t nid = kcontrol->private_value & 0xffff;
647 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
648 long val = *ucontrol->value.integer.value;
649 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
650 AC_VERB_GET_GPIO_DATA,
653 /* Set/unset the masked GPIO bit(s) as needed */
654 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
659 snd_hda_codec_write_cache(codec, nid, 0,
660 AC_VERB_SET_GPIO_DATA, gpio_data);
664 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
665 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
666 .info = alc_gpio_data_info, \
667 .get = alc_gpio_data_get, \
668 .put = alc_gpio_data_put, \
669 .private_value = nid | (mask<<16) }
670 #endif /* CONFIG_SND_DEBUG */
672 /* A switch control to allow the enabling of the digital IO pins on the
673 * ALC260. This is incredibly simplistic; the intention of this control is
674 * to provide something in the test model allowing digital outputs to be
675 * identified if present. If models are found which can utilise these
676 * outputs a more complete mixer control can be devised for those models if
679 #ifdef CONFIG_SND_DEBUG
680 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
682 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
683 struct snd_ctl_elem_value *ucontrol)
685 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
686 hda_nid_t nid = kcontrol->private_value & 0xffff;
687 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
688 long *valp = ucontrol->value.integer.value;
689 unsigned int val = snd_hda_codec_read(codec, nid, 0,
690 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
692 *valp = (val & mask) != 0;
695 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
696 struct snd_ctl_elem_value *ucontrol)
699 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
700 hda_nid_t nid = kcontrol->private_value & 0xffff;
701 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
702 long val = *ucontrol->value.integer.value;
703 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
704 AC_VERB_GET_DIGI_CONVERT_1,
707 /* Set/unset the masked control bit(s) as needed */
708 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
713 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
718 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
719 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
720 .info = alc_spdif_ctrl_info, \
721 .get = alc_spdif_ctrl_get, \
722 .put = alc_spdif_ctrl_put, \
723 .private_value = nid | (mask<<16) }
724 #endif /* CONFIG_SND_DEBUG */
726 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
727 * Again, this is only used in the ALC26x test models to help identify when
728 * the EAPD line must be asserted for features to work.
730 #ifdef CONFIG_SND_DEBUG
731 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
733 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
734 struct snd_ctl_elem_value *ucontrol)
736 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
737 hda_nid_t nid = kcontrol->private_value & 0xffff;
738 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
739 long *valp = ucontrol->value.integer.value;
740 unsigned int val = snd_hda_codec_read(codec, nid, 0,
741 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
743 *valp = (val & mask) != 0;
747 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
748 struct snd_ctl_elem_value *ucontrol)
751 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
752 hda_nid_t nid = kcontrol->private_value & 0xffff;
753 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
754 long val = *ucontrol->value.integer.value;
755 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
756 AC_VERB_GET_EAPD_BTLENABLE,
759 /* Set/unset the masked control bit(s) as needed */
760 change = (!val ? 0 : mask) != (ctrl_data & mask);
765 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
771 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
772 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
773 .info = alc_eapd_ctrl_info, \
774 .get = alc_eapd_ctrl_get, \
775 .put = alc_eapd_ctrl_put, \
776 .private_value = nid | (mask<<16) }
777 #endif /* CONFIG_SND_DEBUG */
780 * set up the input pin config (depending on the given auto-pin type)
782 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
785 unsigned int val = PIN_IN;
787 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
789 pincap = snd_hda_query_pin_caps(codec, nid);
790 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
791 if (pincap & AC_PINCAP_VREF_80)
793 else if (pincap & AC_PINCAP_VREF_50)
795 else if (pincap & AC_PINCAP_VREF_100)
797 else if (pincap & AC_PINCAP_VREF_GRD)
800 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
805 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
807 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
809 spec->mixers[spec->num_mixers++] = mix;
812 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
814 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
816 spec->init_verbs[spec->num_init_verbs++] = verb;
819 #ifdef CONFIG_PROC_FS
823 static void print_realtek_coef(struct snd_info_buffer *buffer,
824 struct hda_codec *codec, hda_nid_t nid)
830 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
831 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
832 coeff = snd_hda_codec_read(codec, nid, 0,
833 AC_VERB_GET_COEF_INDEX, 0);
834 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
837 #define print_realtek_coef NULL
841 * set up from the preset table
843 static void setup_preset(struct alc_spec *spec,
844 const struct alc_config_preset *preset)
848 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
849 add_mixer(spec, preset->mixers[i]);
850 spec->cap_mixer = preset->cap_mixer;
851 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
853 add_verb(spec, preset->init_verbs[i]);
855 spec->channel_mode = preset->channel_mode;
856 spec->num_channel_mode = preset->num_channel_mode;
857 spec->need_dac_fix = preset->need_dac_fix;
858 spec->const_channel_count = preset->const_channel_count;
860 if (preset->const_channel_count)
861 spec->multiout.max_channels = preset->const_channel_count;
863 spec->multiout.max_channels = spec->channel_mode[0].channels;
864 spec->ext_channel_count = spec->channel_mode[0].channels;
866 spec->multiout.num_dacs = preset->num_dacs;
867 spec->multiout.dac_nids = preset->dac_nids;
868 spec->multiout.dig_out_nid = preset->dig_out_nid;
869 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
870 spec->multiout.hp_nid = preset->hp_nid;
872 spec->num_mux_defs = preset->num_mux_defs;
873 if (!spec->num_mux_defs)
874 spec->num_mux_defs = 1;
875 spec->input_mux = preset->input_mux;
877 spec->num_adc_nids = preset->num_adc_nids;
878 spec->adc_nids = preset->adc_nids;
879 spec->capsrc_nids = preset->capsrc_nids;
880 spec->dig_in_nid = preset->dig_in_nid;
882 spec->unsol_event = preset->unsol_event;
883 spec->init_hook = preset->init_hook;
884 #ifdef CONFIG_SND_HDA_POWER_SAVE
885 spec->loopback.amplist = preset->loopbacks;
889 /* Enable GPIO mask and set output */
890 static struct hda_verb alc_gpio1_init_verbs[] = {
891 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
892 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
893 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
897 static struct hda_verb alc_gpio2_init_verbs[] = {
898 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
899 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
900 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
904 static struct hda_verb alc_gpio3_init_verbs[] = {
905 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
906 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
907 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
912 * Fix hardware PLL issue
913 * On some codecs, the analog PLL gating control must be off while
914 * the default value is 1.
916 static void alc_fix_pll(struct hda_codec *codec)
918 struct alc_spec *spec = codec->spec;
923 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
925 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
926 AC_VERB_GET_PROC_COEF, 0);
927 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
929 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
930 val & ~(1 << spec->pll_coef_bit));
933 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
934 unsigned int coef_idx, unsigned int coef_bit)
936 struct alc_spec *spec = codec->spec;
938 spec->pll_coef_idx = coef_idx;
939 spec->pll_coef_bit = coef_bit;
943 static void alc_automute_pin(struct hda_codec *codec)
945 struct alc_spec *spec = codec->spec;
946 unsigned int present, pincap;
947 unsigned int nid = spec->autocfg.hp_pins[0];
950 pincap = snd_hda_query_pin_caps(codec, nid);
951 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
952 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
953 present = snd_hda_codec_read(codec, nid, 0,
954 AC_VERB_GET_PIN_SENSE, 0);
955 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
956 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
957 nid = spec->autocfg.speaker_pins[i];
960 snd_hda_codec_write(codec, nid, 0,
961 AC_VERB_SET_PIN_WIDGET_CONTROL,
962 spec->jack_present ? 0 : PIN_OUT);
966 #if 0 /* it's broken in some cases -- temporarily disabled */
967 static void alc_mic_automute(struct hda_codec *codec)
969 struct alc_spec *spec = codec->spec;
970 unsigned int present;
971 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
972 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
973 unsigned int mix_nid = spec->capsrc_nids[0];
974 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
976 capsrc_idx_mic = mic_nid - 0x18;
977 capsrc_idx_fmic = fmic_nid - 0x18;
978 present = snd_hda_codec_read(codec, mic_nid, 0,
979 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
980 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
981 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
982 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
983 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
984 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
985 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
988 #define alc_mic_automute(codec) do {} while(0) /* NOP */
989 #endif /* disabled */
991 /* unsolicited event for HP jack sensing */
992 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
994 if (codec->vendor_id == 0x10ec0880)
999 case ALC880_HP_EVENT:
1000 alc_automute_pin(codec);
1002 case ALC880_MIC_EVENT:
1003 alc_mic_automute(codec);
1008 static void alc_inithook(struct hda_codec *codec)
1010 alc_automute_pin(codec);
1011 alc_mic_automute(codec);
1014 /* additional initialization for ALC888 variants */
1015 static void alc888_coef_init(struct hda_codec *codec)
1019 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1020 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1021 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1022 if ((tmp & 0xf0) == 0x20)
1024 snd_hda_codec_read(codec, 0x20, 0,
1025 AC_VERB_SET_PROC_COEF, 0x830);
1028 snd_hda_codec_read(codec, 0x20, 0,
1029 AC_VERB_SET_PROC_COEF, 0x3030);
1032 static void alc889_coef_init(struct hda_codec *codec)
1036 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1037 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1038 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1039 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1042 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1047 case ALC_INIT_GPIO1:
1048 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1050 case ALC_INIT_GPIO2:
1051 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1053 case ALC_INIT_GPIO3:
1054 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1056 case ALC_INIT_DEFAULT:
1057 switch (codec->vendor_id) {
1059 snd_hda_codec_write(codec, 0x0f, 0,
1060 AC_VERB_SET_EAPD_BTLENABLE, 2);
1061 snd_hda_codec_write(codec, 0x10, 0,
1062 AC_VERB_SET_EAPD_BTLENABLE, 2);
1074 snd_hda_codec_write(codec, 0x14, 0,
1075 AC_VERB_SET_EAPD_BTLENABLE, 2);
1076 snd_hda_codec_write(codec, 0x15, 0,
1077 AC_VERB_SET_EAPD_BTLENABLE, 2);
1080 switch (codec->vendor_id) {
1082 snd_hda_codec_write(codec, 0x1a, 0,
1083 AC_VERB_SET_COEF_INDEX, 7);
1084 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1085 AC_VERB_GET_PROC_COEF, 0);
1086 snd_hda_codec_write(codec, 0x1a, 0,
1087 AC_VERB_SET_COEF_INDEX, 7);
1088 snd_hda_codec_write(codec, 0x1a, 0,
1089 AC_VERB_SET_PROC_COEF,
1099 alc889_coef_init(codec);
1102 alc888_coef_init(codec);
1106 snd_hda_codec_write(codec, 0x20, 0,
1107 AC_VERB_SET_COEF_INDEX, 7);
1108 tmp = snd_hda_codec_read(codec, 0x20, 0,
1109 AC_VERB_GET_PROC_COEF, 0);
1110 snd_hda_codec_write(codec, 0x20, 0,
1111 AC_VERB_SET_COEF_INDEX, 7);
1112 snd_hda_codec_write(codec, 0x20, 0,
1113 AC_VERB_SET_PROC_COEF,
1121 static void alc_init_auto_hp(struct hda_codec *codec)
1123 struct alc_spec *spec = codec->spec;
1125 if (!spec->autocfg.hp_pins[0])
1128 if (!spec->autocfg.speaker_pins[0]) {
1129 if (spec->autocfg.line_out_pins[0] &&
1130 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1131 spec->autocfg.speaker_pins[0] =
1132 spec->autocfg.line_out_pins[0];
1137 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1138 spec->autocfg.hp_pins[0]);
1139 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1140 AC_VERB_SET_UNSOLICITED_ENABLE,
1141 AC_USRSP_EN | ALC880_HP_EVENT);
1142 spec->unsol_event = alc_sku_unsol_event;
1145 /* check subsystem ID and set up device-specific initialization;
1146 * return 1 if initialized, 0 if invalid SSID
1148 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1149 * 31 ~ 16 : Manufacture ID
1151 * 7 ~ 0 : Assembly ID
1152 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1154 static int alc_subsystem_id(struct hda_codec *codec,
1155 hda_nid_t porta, hda_nid_t porte,
1158 unsigned int ass, tmp, i;
1160 struct alc_spec *spec = codec->spec;
1162 ass = codec->subsystem_id & 0xffff;
1163 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1166 /* invalid SSID, check the special NID pin defcfg instead */
1168 * 31~30 : port connectivity
1171 * 19~16 : Check sum (15:1)
1176 if (codec->vendor_id == 0x10ec0260)
1178 ass = snd_hda_codec_get_pincfg(codec, nid);
1179 snd_printd("realtek: No valid SSID, "
1180 "checking pincfg 0x%08x for NID 0x%x\n",
1182 if (!(ass & 1) && !(ass & 0x100000))
1184 if ((ass >> 30) != 1) /* no physical connection */
1189 for (i = 1; i < 16; i++) {
1193 if (((ass >> 16) & 0xf) != tmp)
1196 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1197 ass & 0xffff, codec->vendor_id);
1201 * 2 : 0 --> Desktop, 1 --> Laptop
1202 * 3~5 : External Amplifier control
1205 tmp = (ass & 0x38) >> 3; /* external Amp control */
1208 spec->init_amp = ALC_INIT_GPIO1;
1211 spec->init_amp = ALC_INIT_GPIO2;
1214 spec->init_amp = ALC_INIT_GPIO3;
1217 spec->init_amp = ALC_INIT_DEFAULT;
1221 /* is laptop or Desktop and enable the function "Mute internal speaker
1222 * when the external headphone out jack is plugged"
1224 if (!(ass & 0x8000))
1227 * 10~8 : Jack location
1228 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1230 * 15 : 1 --> enable the function "Mute internal speaker
1231 * when the external headphone out jack is plugged"
1233 if (!spec->autocfg.hp_pins[0]) {
1234 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1236 spec->autocfg.hp_pins[0] = porta;
1238 spec->autocfg.hp_pins[0] = porte;
1240 spec->autocfg.hp_pins[0] = portd;
1245 alc_init_auto_hp(codec);
1249 static void alc_ssid_check(struct hda_codec *codec,
1250 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1252 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1253 struct alc_spec *spec = codec->spec;
1254 snd_printd("realtek: "
1255 "Enable default setup for auto mode as fallback\n");
1256 spec->init_amp = ALC_INIT_DEFAULT;
1257 alc_init_auto_hp(codec);
1262 * Fix-up pin default configurations
1270 static void alc_fix_pincfg(struct hda_codec *codec,
1271 const struct snd_pci_quirk *quirk,
1272 const struct alc_pincfg **pinfix)
1274 const struct alc_pincfg *cfg;
1276 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1280 cfg = pinfix[quirk->value];
1281 for (; cfg->nid; cfg++)
1282 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1292 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1293 /* Mic-in jack as mic in */
1294 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1295 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1296 /* Line-in jack as Line in */
1297 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1298 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1299 /* Line-Out as Front */
1300 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1307 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1308 /* Mic-in jack as mic in */
1309 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1310 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1311 /* Line-in jack as Surround */
1312 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1313 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1314 /* Line-Out as Front */
1315 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1322 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1323 /* Mic-in jack as CLFE */
1324 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1325 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1326 /* Line-in jack as Surround */
1327 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1328 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1329 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1330 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1337 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1338 /* Mic-in jack as CLFE */
1339 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1340 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1341 /* Line-in jack as Surround */
1342 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1343 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1344 /* Line-Out as Side */
1345 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1349 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1350 { 2, alc888_4ST_ch2_intel_init },
1351 { 4, alc888_4ST_ch4_intel_init },
1352 { 6, alc888_4ST_ch6_intel_init },
1353 { 8, alc888_4ST_ch8_intel_init },
1357 * ALC888 Fujitsu Siemens Amillo xa3530
1360 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1361 /* Front Mic: set to PIN_IN (empty by default) */
1362 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1363 /* Connect Internal HP to Front */
1364 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1365 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1366 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1367 /* Connect Bass HP to Front */
1368 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1370 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1371 /* Connect Line-Out side jack (SPDIF) to Side */
1372 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1373 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1374 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1375 /* Connect Mic jack to CLFE */
1376 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1377 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1378 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1379 /* Connect Line-in jack to Surround */
1380 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1381 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1382 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1383 /* Connect HP out jack to Front */
1384 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1385 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1386 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1387 /* Enable unsolicited event for HP jack and Line-out jack */
1388 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1389 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1393 static void alc_automute_amp(struct hda_codec *codec)
1395 struct alc_spec *spec = codec->spec;
1396 unsigned int val, mute, pincap;
1400 spec->jack_present = 0;
1401 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1402 nid = spec->autocfg.hp_pins[i];
1405 pincap = snd_hda_query_pin_caps(codec, nid);
1406 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1407 snd_hda_codec_read(codec, nid, 0,
1408 AC_VERB_SET_PIN_SENSE, 0);
1409 val = snd_hda_codec_read(codec, nid, 0,
1410 AC_VERB_GET_PIN_SENSE, 0);
1411 if (val & AC_PINSENSE_PRESENCE) {
1412 spec->jack_present = 1;
1417 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1418 /* Toggle internal speakers muting */
1419 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1420 nid = spec->autocfg.speaker_pins[i];
1423 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1424 HDA_AMP_MUTE, mute);
1428 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1431 if (codec->vendor_id == 0x10ec0880)
1435 if (res == ALC880_HP_EVENT)
1436 alc_automute_amp(codec);
1439 static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec)
1441 struct alc_spec *spec = codec->spec;
1443 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1444 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1445 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1446 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1447 alc_automute_amp(codec);
1451 * ALC888 Acer Aspire 4930G model
1454 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1455 /* Front Mic: set to PIN_IN (empty by default) */
1456 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1457 /* Unselect Front Mic by default in input mixer 3 */
1458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1459 /* Enable unsolicited event for HP jack */
1460 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1461 /* Connect Internal HP to front */
1462 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1463 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1464 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1465 /* Connect HP out to front */
1466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1467 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1468 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1473 * ALC888 Acer Aspire 6530G model
1476 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1477 /* Bias voltage on for external mic port */
1478 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1479 /* Front Mic: set to PIN_IN (empty by default) */
1480 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1481 /* Unselect Front Mic by default in input mixer 3 */
1482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1483 /* Enable unsolicited event for HP jack */
1484 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1485 /* Enable speaker output */
1486 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1487 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1488 /* Enable headphone output */
1489 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1490 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1491 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1496 * ALC889 Acer Aspire 8930G model
1499 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1500 /* Front Mic: set to PIN_IN (empty by default) */
1501 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1502 /* Unselect Front Mic by default in input mixer 3 */
1503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1504 /* Enable unsolicited event for HP jack */
1505 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1506 /* Connect Internal Front to Front */
1507 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1508 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1509 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1510 /* Connect Internal Rear to Rear */
1511 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1512 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1513 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1514 /* Connect Internal CLFE to CLFE */
1515 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1516 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1517 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1518 /* Connect HP out to Front */
1519 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1520 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1521 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1522 /* Enable all DACs */
1523 /* DAC DISABLE/MUTE 1? */
1524 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1525 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1526 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1527 /* DAC DISABLE/MUTE 2? */
1528 /* some bit here disables the other DACs. Init=0x4900 */
1529 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1530 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1531 /* Enable amplifiers */
1532 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1533 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1535 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1536 * which makes the stereo useless. However, either the mic or the ALC889
1537 * makes the signal become a difference/sum signal instead of standard
1538 * stereo, which is annoying. So instead we flip this bit which makes the
1539 * codec replicate the sum signal to both channels, turning it into a
1542 /* DMIC_CONTROL? Init value = 0x0001 */
1543 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1544 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1548 static struct hda_input_mux alc888_2_capture_sources[2] = {
1549 /* Front mic only available on one ADC */
1556 { "Front Mic", 0xb },
1569 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1570 /* Interal mic only available on one ADC */
1577 { "Input Mix", 0xa },
1587 { "Input Mix", 0xa },
1592 static struct hda_input_mux alc889_capture_sources[3] = {
1593 /* Digital mic only available on first "ADC" */
1600 { "Front Mic", 0xb },
1601 { "Input Mix", 0xa },
1610 { "Input Mix", 0xa },
1619 { "Input Mix", 0xa },
1624 static struct snd_kcontrol_new alc888_base_mixer[] = {
1625 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1626 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1627 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1628 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1629 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1631 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1632 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1633 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1634 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1635 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1636 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1637 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1638 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1639 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1640 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1641 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1642 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1646 static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec)
1648 struct alc_spec *spec = codec->spec;
1650 spec->autocfg.hp_pins[0] = 0x15;
1651 spec->autocfg.speaker_pins[0] = 0x14;
1652 alc_automute_amp(codec);
1655 static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec)
1657 struct alc_spec *spec = codec->spec;
1659 spec->autocfg.hp_pins[0] = 0x15;
1660 spec->autocfg.speaker_pins[0] = 0x14;
1661 spec->autocfg.speaker_pins[1] = 0x16;
1662 spec->autocfg.speaker_pins[2] = 0x17;
1663 alc_automute_amp(codec);
1666 static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec)
1668 struct alc_spec *spec = codec->spec;
1670 spec->autocfg.hp_pins[0] = 0x15;
1671 spec->autocfg.speaker_pins[0] = 0x14;
1672 spec->autocfg.speaker_pins[1] = 0x16;
1673 spec->autocfg.speaker_pins[2] = 0x1b;
1674 alc_automute_amp(codec);
1678 * ALC880 3-stack model
1680 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1681 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1682 * F-Mic = 0x1b, HP = 0x19
1685 static hda_nid_t alc880_dac_nids[4] = {
1686 /* front, rear, clfe, rear_surr */
1687 0x02, 0x05, 0x04, 0x03
1690 static hda_nid_t alc880_adc_nids[3] = {
1695 /* The datasheet says the node 0x07 is connected from inputs,
1696 * but it shows zero connection in the real implementation on some devices.
1697 * Note: this is a 915GAV bug, fixed on 915GLV
1699 static hda_nid_t alc880_adc_nids_alt[2] = {
1704 #define ALC880_DIGOUT_NID 0x06
1705 #define ALC880_DIGIN_NID 0x0a
1707 static struct hda_input_mux alc880_capture_source = {
1711 { "Front Mic", 0x3 },
1717 /* channel source setting (2/6 channel selection for 3-stack) */
1719 static struct hda_verb alc880_threestack_ch2_init[] = {
1720 /* set line-in to input, mute it */
1721 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1722 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1723 /* set mic-in to input vref 80%, mute it */
1724 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1725 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1730 static struct hda_verb alc880_threestack_ch6_init[] = {
1731 /* set line-in to output, unmute it */
1732 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1733 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1734 /* set mic-in to output, unmute it */
1735 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1736 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1740 static struct hda_channel_mode alc880_threestack_modes[2] = {
1741 { 2, alc880_threestack_ch2_init },
1742 { 6, alc880_threestack_ch6_init },
1745 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1746 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1747 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1748 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1749 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1750 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1751 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1752 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1753 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1754 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1755 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1756 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1757 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1758 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1759 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1760 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1761 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1762 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1764 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1765 .name = "Channel Mode",
1766 .info = alc_ch_mode_info,
1767 .get = alc_ch_mode_get,
1768 .put = alc_ch_mode_put,
1773 /* capture mixer elements */
1774 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1775 struct snd_ctl_elem_info *uinfo)
1777 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1778 struct alc_spec *spec = codec->spec;
1781 mutex_lock(&codec->control_mutex);
1782 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1784 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1785 mutex_unlock(&codec->control_mutex);
1789 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1790 unsigned int size, unsigned int __user *tlv)
1792 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1793 struct alc_spec *spec = codec->spec;
1796 mutex_lock(&codec->control_mutex);
1797 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1799 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1800 mutex_unlock(&codec->control_mutex);
1804 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1805 struct snd_ctl_elem_value *ucontrol);
1807 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1808 struct snd_ctl_elem_value *ucontrol,
1811 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1812 struct alc_spec *spec = codec->spec;
1813 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1816 mutex_lock(&codec->control_mutex);
1817 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1819 err = func(kcontrol, ucontrol);
1820 mutex_unlock(&codec->control_mutex);
1824 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1825 struct snd_ctl_elem_value *ucontrol)
1827 return alc_cap_getput_caller(kcontrol, ucontrol,
1828 snd_hda_mixer_amp_volume_get);
1831 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1832 struct snd_ctl_elem_value *ucontrol)
1834 return alc_cap_getput_caller(kcontrol, ucontrol,
1835 snd_hda_mixer_amp_volume_put);
1838 /* capture mixer elements */
1839 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1841 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1842 struct snd_ctl_elem_value *ucontrol)
1844 return alc_cap_getput_caller(kcontrol, ucontrol,
1845 snd_hda_mixer_amp_switch_get);
1848 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1849 struct snd_ctl_elem_value *ucontrol)
1851 return alc_cap_getput_caller(kcontrol, ucontrol,
1852 snd_hda_mixer_amp_switch_put);
1855 #define _DEFINE_CAPMIX(num) \
1857 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1858 .name = "Capture Switch", \
1859 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1861 .info = alc_cap_sw_info, \
1862 .get = alc_cap_sw_get, \
1863 .put = alc_cap_sw_put, \
1866 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1867 .name = "Capture Volume", \
1868 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1869 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1870 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1872 .info = alc_cap_vol_info, \
1873 .get = alc_cap_vol_get, \
1874 .put = alc_cap_vol_put, \
1875 .tlv = { .c = alc_cap_vol_tlv }, \
1878 #define _DEFINE_CAPSRC(num) \
1880 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1881 /* .name = "Capture Source", */ \
1882 .name = "Input Source", \
1884 .info = alc_mux_enum_info, \
1885 .get = alc_mux_enum_get, \
1886 .put = alc_mux_enum_put, \
1889 #define DEFINE_CAPMIX(num) \
1890 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1891 _DEFINE_CAPMIX(num), \
1892 _DEFINE_CAPSRC(num), \
1896 #define DEFINE_CAPMIX_NOSRC(num) \
1897 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1898 _DEFINE_CAPMIX(num), \
1902 /* up to three ADCs */
1906 DEFINE_CAPMIX_NOSRC(1);
1907 DEFINE_CAPMIX_NOSRC(2);
1908 DEFINE_CAPMIX_NOSRC(3);
1911 * ALC880 5-stack model
1913 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1915 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1916 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1919 /* additional mixers to alc880_three_stack_mixer */
1920 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1921 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1922 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1926 /* channel source setting (6/8 channel selection for 5-stack) */
1928 static struct hda_verb alc880_fivestack_ch6_init[] = {
1929 /* set line-in to input, mute it */
1930 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1931 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1936 static struct hda_verb alc880_fivestack_ch8_init[] = {
1937 /* set line-in to output, unmute it */
1938 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1939 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1943 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1944 { 6, alc880_fivestack_ch6_init },
1945 { 8, alc880_fivestack_ch8_init },
1950 * ALC880 6-stack model
1952 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1953 * Side = 0x05 (0x0f)
1954 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1955 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1958 static hda_nid_t alc880_6st_dac_nids[4] = {
1959 /* front, rear, clfe, rear_surr */
1960 0x02, 0x03, 0x04, 0x05
1963 static struct hda_input_mux alc880_6stack_capture_source = {
1967 { "Front Mic", 0x1 },
1973 /* fixed 8-channels */
1974 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1978 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1979 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1980 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1981 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1982 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1983 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1984 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1985 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1986 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1987 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1988 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1989 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1990 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1991 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1992 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1995 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1996 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1998 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1999 .name = "Channel Mode",
2000 .info = alc_ch_mode_info,
2001 .get = alc_ch_mode_get,
2002 .put = alc_ch_mode_put,
2011 * W810 has rear IO for:
2014 * Center/LFE (DAC 04)
2017 * The system also has a pair of internal speakers, and a headphone jack.
2018 * These are both connected to Line2 on the codec, hence to DAC 02.
2020 * There is a variable resistor to control the speaker or headphone
2021 * volume. This is a hardware-only device without a software API.
2023 * Plugging headphones in will disable the internal speakers. This is
2024 * implemented in hardware, not via the driver using jack sense. In
2025 * a similar fashion, plugging into the rear socket marked "front" will
2026 * disable both the speakers and headphones.
2028 * For input, there's a microphone jack, and an "audio in" jack.
2029 * These may not do anything useful with this driver yet, because I
2030 * haven't setup any initialization verbs for these yet...
2033 static hda_nid_t alc880_w810_dac_nids[3] = {
2034 /* front, rear/surround, clfe */
2038 /* fixed 6 channels */
2039 static struct hda_channel_mode alc880_w810_modes[1] = {
2043 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2044 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2045 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2046 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2047 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2048 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2049 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2050 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2051 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2052 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2053 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2061 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2062 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2066 static hda_nid_t alc880_z71v_dac_nids[1] = {
2069 #define ALC880_Z71V_HP_DAC 0x03
2071 /* fixed 2 channels */
2072 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2076 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2077 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2078 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2079 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2080 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2081 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2082 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2083 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2084 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2090 * ALC880 F1734 model
2092 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2093 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2096 static hda_nid_t alc880_f1734_dac_nids[1] = {
2099 #define ALC880_F1734_HP_DAC 0x02
2101 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2102 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2103 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2104 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2105 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2106 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2107 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2113 static struct hda_input_mux alc880_f1734_capture_source = {
2125 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2126 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2127 * Mic = 0x18, Line = 0x1a
2130 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2131 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2133 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2134 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2135 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2136 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2137 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2138 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2139 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2140 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2141 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2142 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2143 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2144 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2145 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2146 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2147 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2149 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2150 .name = "Channel Mode",
2151 .info = alc_ch_mode_info,
2152 .get = alc_ch_mode_get,
2153 .put = alc_ch_mode_put,
2159 * ALC880 ASUS W1V model
2161 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2162 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2163 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2166 /* additional mixers to alc880_asus_mixer */
2167 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2168 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2169 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2174 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2175 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2176 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2177 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2178 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2179 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2180 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2181 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2182 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2183 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2188 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2189 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2190 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2191 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2192 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2193 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2194 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2195 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2196 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2197 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2198 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2199 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2200 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2202 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2203 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2204 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2206 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2207 .name = "Channel Mode",
2208 .info = alc_ch_mode_info,
2209 .get = alc_ch_mode_get,
2210 .put = alc_ch_mode_put,
2215 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2216 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2217 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2218 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2219 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2220 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2221 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2222 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2223 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2224 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2225 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2229 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2230 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2231 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2232 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2233 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2240 * virtual master controls
2244 * slave controls for virtual master
2246 static const char *alc_slave_vols[] = {
2247 "Front Playback Volume",
2248 "Surround Playback Volume",
2249 "Center Playback Volume",
2250 "LFE Playback Volume",
2251 "Side Playback Volume",
2252 "Headphone Playback Volume",
2253 "Speaker Playback Volume",
2254 "Mono Playback Volume",
2255 "Line-Out Playback Volume",
2256 "PCM Playback Volume",
2260 static const char *alc_slave_sws[] = {
2261 "Front Playback Switch",
2262 "Surround Playback Switch",
2263 "Center Playback Switch",
2264 "LFE Playback Switch",
2265 "Side Playback Switch",
2266 "Headphone Playback Switch",
2267 "Speaker Playback Switch",
2268 "Mono Playback Switch",
2269 "IEC958 Playback Switch",
2274 * build control elements
2277 static void alc_free_kctls(struct hda_codec *codec);
2279 /* additional beep mixers; the actual parameters are overwritten at build */
2280 static struct snd_kcontrol_new alc_beep_mixer[] = {
2281 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2282 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2286 static int alc_build_controls(struct hda_codec *codec)
2288 struct alc_spec *spec = codec->spec;
2292 for (i = 0; i < spec->num_mixers; i++) {
2293 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2297 if (spec->cap_mixer) {
2298 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2302 if (spec->multiout.dig_out_nid) {
2303 err = snd_hda_create_spdif_out_ctls(codec,
2304 spec->multiout.dig_out_nid);
2307 if (!spec->no_analog) {
2308 err = snd_hda_create_spdif_share_sw(codec,
2312 spec->multiout.share_spdif = 1;
2315 if (spec->dig_in_nid) {
2316 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2321 /* create beep controls if needed */
2322 if (spec->beep_amp) {
2323 struct snd_kcontrol_new *knew;
2324 for (knew = alc_beep_mixer; knew->name; knew++) {
2325 struct snd_kcontrol *kctl;
2326 kctl = snd_ctl_new1(knew, codec);
2329 kctl->private_value = spec->beep_amp;
2330 err = snd_hda_ctl_add(codec, kctl);
2336 /* if we have no master control, let's create it */
2337 if (!spec->no_analog &&
2338 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2339 unsigned int vmaster_tlv[4];
2340 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2341 HDA_OUTPUT, vmaster_tlv);
2342 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2343 vmaster_tlv, alc_slave_vols);
2347 if (!spec->no_analog &&
2348 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2349 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2350 NULL, alc_slave_sws);
2355 alc_free_kctls(codec); /* no longer needed */
2361 * initialize the codec volumes, etc
2365 * generic initialization of ADC, input mixers and output mixers
2367 static struct hda_verb alc880_volume_init_verbs[] = {
2369 * Unmute ADC0-2 and set the default input to mic-in
2371 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2372 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2373 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2374 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2375 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2376 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2378 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2380 * Note: PASD motherboards uses the Line In 2 as the input for front
2383 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2384 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2385 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2386 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2387 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2388 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2389 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2390 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2393 * Set up output mixers (0x0c - 0x0f)
2395 /* set vol=0 to output mixers */
2396 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2397 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2398 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2399 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2400 /* set up input amps for analog loopback */
2401 /* Amp Indices: DAC = 0, mixer = 1 */
2402 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2404 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2405 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2406 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2408 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2409 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2415 * 3-stack pin configuration:
2416 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2418 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2420 * preset connection lists of input pins
2421 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2423 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2424 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2425 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2428 * Set pin mode and muting
2430 /* set front pin widgets 0x14 for output */
2431 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2432 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2433 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2434 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2435 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2436 /* Mic2 (as headphone out) for HP output */
2437 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2438 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2439 /* Line In pin widget for input */
2440 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2441 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2442 /* Line2 (as front mic) pin widget for input and vref at 80% */
2443 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2444 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2445 /* CD pin widget for input */
2446 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2452 * 5-stack pin configuration:
2453 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2454 * line-in/side = 0x1a, f-mic = 0x1b
2456 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2458 * preset connection lists of input pins
2459 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2461 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2462 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2465 * Set pin mode and muting
2467 /* set pin widgets 0x14-0x17 for output */
2468 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2469 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2470 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2471 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2472 /* unmute pins for output (no gain on this amp) */
2473 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2474 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2475 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2476 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2478 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2479 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2480 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2481 /* Mic2 (as headphone out) for HP output */
2482 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2483 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2484 /* Line In pin widget for input */
2485 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2486 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2487 /* Line2 (as front mic) pin widget for input and vref at 80% */
2488 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2489 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2490 /* CD pin widget for input */
2491 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2497 * W810 pin configuration:
2498 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2500 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2501 /* hphone/speaker input selector: front DAC */
2502 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2506 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2507 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2508 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2509 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2511 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2512 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2518 * Z71V pin configuration:
2519 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2521 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2522 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2523 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2524 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2525 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2527 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2528 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2529 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2530 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2536 * 6-stack pin configuration:
2537 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2538 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2540 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2541 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2543 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2544 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2545 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2546 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2547 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2548 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2549 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2550 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2552 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2553 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2554 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2555 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2556 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2557 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2558 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2559 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2560 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2566 * Uniwill pin configuration:
2567 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2570 static struct hda_verb alc880_uniwill_init_verbs[] = {
2571 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2573 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2574 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2575 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2576 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2577 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2578 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2579 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2580 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2583 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2585 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2586 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2588 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2589 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2590 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2591 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2592 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2593 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2594 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2595 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2596 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2598 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2599 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2606 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2608 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2609 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2611 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2612 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2613 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2614 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2615 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2616 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2618 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2619 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2620 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2621 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2622 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2624 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2625 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2626 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2627 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2628 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2629 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2631 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2632 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2637 static struct hda_verb alc880_beep_init_verbs[] = {
2638 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2642 /* auto-toggle front mic */
2643 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2645 unsigned int present;
2648 present = snd_hda_codec_read(codec, 0x18, 0,
2649 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2650 bits = present ? HDA_AMP_MUTE : 0;
2651 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2654 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2656 struct alc_spec *spec = codec->spec;
2658 spec->autocfg.hp_pins[0] = 0x14;
2659 spec->autocfg.speaker_pins[0] = 0x15;
2660 spec->autocfg.speaker_pins[0] = 0x16;
2661 alc_automute_amp(codec);
2662 alc880_uniwill_mic_automute(codec);
2665 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2668 /* Looks like the unsol event is incompatible with the standard
2669 * definition. 4bit tag is placed at 28 bit!
2671 switch (res >> 28) {
2672 case ALC880_MIC_EVENT:
2673 alc880_uniwill_mic_automute(codec);
2676 alc_automute_amp_unsol_event(codec, res);
2681 static void alc880_uniwill_p53_init_hook(struct hda_codec *codec)
2683 struct alc_spec *spec = codec->spec;
2685 spec->autocfg.hp_pins[0] = 0x14;
2686 spec->autocfg.speaker_pins[0] = 0x15;
2687 alc_automute_amp(codec);
2690 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2692 unsigned int present;
2694 present = snd_hda_codec_read(codec, 0x21, 0,
2695 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2696 present &= HDA_AMP_VOLMASK;
2697 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2698 HDA_AMP_VOLMASK, present);
2699 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2700 HDA_AMP_VOLMASK, present);
2703 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2706 /* Looks like the unsol event is incompatible with the standard
2707 * definition. 4bit tag is placed at 28 bit!
2709 if ((res >> 28) == ALC880_DCVOL_EVENT)
2710 alc880_uniwill_p53_dcvol_automute(codec);
2712 alc_automute_amp_unsol_event(codec, res);
2716 * F1734 pin configuration:
2717 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2719 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2720 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2721 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2722 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2723 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2724 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2726 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2727 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2728 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2729 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2731 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2732 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2733 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2734 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2735 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2736 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2737 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2738 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2739 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2741 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2742 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2748 * ASUS pin configuration:
2749 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2751 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2752 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2753 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2754 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2755 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2757 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2758 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2759 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2760 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2761 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2762 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2763 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2764 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2766 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2767 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2768 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2769 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2770 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2771 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2772 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2773 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2774 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2779 /* Enable GPIO mask and set output */
2780 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2781 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2782 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2784 /* Clevo m520g init */
2785 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2786 /* headphone output */
2787 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2790 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2792 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2793 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2795 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2796 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2797 /* Mic1 (rear panel) */
2798 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2799 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2800 /* Mic2 (front panel) */
2801 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2802 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2804 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2805 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2806 /* change to EAPD mode */
2807 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2808 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2813 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2814 /* change to EAPD mode */
2815 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2816 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2818 /* Headphone output */
2819 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2821 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2822 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2824 /* Line In pin widget for input */
2825 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2826 /* CD pin widget for input */
2827 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2828 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2829 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2831 /* change to EAPD mode */
2832 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2833 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2839 * LG m1 express dual
2842 * Rear Line-In/Out (blue): 0x14
2843 * Build-in Mic-In: 0x15
2845 * HP-Out (green): 0x1b
2846 * Mic-In/Out (red): 0x19
2850 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2851 static hda_nid_t alc880_lg_dac_nids[3] = {
2855 /* seems analog CD is not working */
2856 static struct hda_input_mux alc880_lg_capture_source = {
2861 { "Internal Mic", 0x6 },
2865 /* 2,4,6 channel modes */
2866 static struct hda_verb alc880_lg_ch2_init[] = {
2867 /* set line-in and mic-in to input */
2868 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2869 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2873 static struct hda_verb alc880_lg_ch4_init[] = {
2874 /* set line-in to out and mic-in to input */
2875 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2876 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2880 static struct hda_verb alc880_lg_ch6_init[] = {
2881 /* set line-in and mic-in to output */
2882 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2883 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2887 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2888 { 2, alc880_lg_ch2_init },
2889 { 4, alc880_lg_ch4_init },
2890 { 6, alc880_lg_ch6_init },
2893 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2894 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2895 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2896 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2897 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2898 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2899 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2900 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2901 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2904 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2905 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2906 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2907 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2909 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2910 .name = "Channel Mode",
2911 .info = alc_ch_mode_info,
2912 .get = alc_ch_mode_get,
2913 .put = alc_ch_mode_put,
2918 static struct hda_verb alc880_lg_init_verbs[] = {
2919 /* set capture source to mic-in */
2920 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2921 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2922 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2923 /* mute all amp mixer inputs */
2924 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2925 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2926 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2927 /* line-in to input */
2928 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2929 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2931 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2932 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2934 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2935 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2936 /* mic-in to input */
2937 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2938 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2939 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2941 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2942 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2943 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2945 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2949 /* toggle speaker-output according to the hp-jack state */
2950 static void alc880_lg_init_hook(struct hda_codec *codec)
2952 struct alc_spec *spec = codec->spec;
2954 spec->autocfg.hp_pins[0] = 0x1b;
2955 spec->autocfg.speaker_pins[0] = 0x17;
2956 alc_automute_amp(codec);
2965 * Built-in Mic-In: 0x19
2971 static struct hda_input_mux alc880_lg_lw_capture_source = {
2975 { "Internal Mic", 0x1 },
2980 #define alc880_lg_lw_modes alc880_threestack_modes
2982 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2983 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2984 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2985 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2986 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2987 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2988 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2989 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2990 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2991 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2992 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2995 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2996 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2998 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2999 .name = "Channel Mode",
3000 .info = alc_ch_mode_info,
3001 .get = alc_ch_mode_get,
3002 .put = alc_ch_mode_put,
3007 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3008 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3009 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3010 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3012 /* set capture source to mic-in */
3013 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3014 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3015 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3016 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3018 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3019 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3021 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3022 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3023 /* mic-in to input */
3024 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3025 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3027 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3028 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3030 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3034 /* toggle speaker-output according to the hp-jack state */
3035 static void alc880_lg_lw_init_hook(struct hda_codec *codec)
3037 struct alc_spec *spec = codec->spec;
3039 spec->autocfg.hp_pins[0] = 0x1b;
3040 spec->autocfg.speaker_pins[0] = 0x14;
3041 alc_automute_amp(codec);
3044 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3045 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3046 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3047 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3048 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3049 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3050 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3054 static struct hda_input_mux alc880_medion_rim_capture_source = {
3058 { "Internal Mic", 0x1 },
3062 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3063 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3065 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3066 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3068 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3069 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3070 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3071 /* Mic2 (as headphone out) for HP output */
3072 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3073 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3074 /* Internal Speaker */
3075 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3076 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3078 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3079 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3081 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3085 /* toggle speaker-output according to the hp-jack state */
3086 static void alc880_medion_rim_automute(struct hda_codec *codec)
3088 struct alc_spec *spec = codec->spec;
3089 alc_automute_amp(codec);
3091 if (spec->jack_present)
3092 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3094 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3097 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3100 /* Looks like the unsol event is incompatible with the standard
3101 * definition. 4bit tag is placed at 28 bit!
3103 if ((res >> 28) == ALC880_HP_EVENT)
3104 alc880_medion_rim_automute(codec);
3107 static void alc880_medion_rim_init_hook(struct hda_codec *codec)
3109 struct alc_spec *spec = codec->spec;
3111 spec->autocfg.hp_pins[0] = 0x14;
3112 spec->autocfg.speaker_pins[0] = 0x1b;
3113 alc880_medion_rim_automute(codec);
3116 #ifdef CONFIG_SND_HDA_POWER_SAVE
3117 static struct hda_amp_list alc880_loopbacks[] = {
3118 { 0x0b, HDA_INPUT, 0 },
3119 { 0x0b, HDA_INPUT, 1 },
3120 { 0x0b, HDA_INPUT, 2 },
3121 { 0x0b, HDA_INPUT, 3 },
3122 { 0x0b, HDA_INPUT, 4 },
3126 static struct hda_amp_list alc880_lg_loopbacks[] = {
3127 { 0x0b, HDA_INPUT, 1 },
3128 { 0x0b, HDA_INPUT, 6 },
3129 { 0x0b, HDA_INPUT, 7 },
3138 static int alc_init(struct hda_codec *codec)
3140 struct alc_spec *spec = codec->spec;
3144 alc_auto_init_amp(codec, spec->init_amp);
3146 for (i = 0; i < spec->num_init_verbs; i++)
3147 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3149 if (spec->init_hook)
3150 spec->init_hook(codec);
3155 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3157 struct alc_spec *spec = codec->spec;
3159 if (spec->unsol_event)
3160 spec->unsol_event(codec, res);
3163 #ifdef CONFIG_SND_HDA_POWER_SAVE
3164 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3166 struct alc_spec *spec = codec->spec;
3167 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3172 * Analog playback callbacks
3174 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3175 struct hda_codec *codec,
3176 struct snd_pcm_substream *substream)
3178 struct alc_spec *spec = codec->spec;
3179 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3183 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3184 struct hda_codec *codec,
3185 unsigned int stream_tag,
3186 unsigned int format,
3187 struct snd_pcm_substream *substream)
3189 struct alc_spec *spec = codec->spec;
3190 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3191 stream_tag, format, substream);
3194 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3195 struct hda_codec *codec,
3196 struct snd_pcm_substream *substream)
3198 struct alc_spec *spec = codec->spec;
3199 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3205 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3206 struct hda_codec *codec,
3207 struct snd_pcm_substream *substream)
3209 struct alc_spec *spec = codec->spec;
3210 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3213 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3214 struct hda_codec *codec,
3215 unsigned int stream_tag,
3216 unsigned int format,
3217 struct snd_pcm_substream *substream)
3219 struct alc_spec *spec = codec->spec;
3220 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3221 stream_tag, format, substream);
3224 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3225 struct hda_codec *codec,
3226 struct snd_pcm_substream *substream)
3228 struct alc_spec *spec = codec->spec;
3229 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3232 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3233 struct hda_codec *codec,
3234 struct snd_pcm_substream *substream)
3236 struct alc_spec *spec = codec->spec;
3237 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3243 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3244 struct hda_codec *codec,
3245 unsigned int stream_tag,
3246 unsigned int format,
3247 struct snd_pcm_substream *substream)
3249 struct alc_spec *spec = codec->spec;
3251 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3252 stream_tag, 0, format);
3256 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3257 struct hda_codec *codec,
3258 struct snd_pcm_substream *substream)
3260 struct alc_spec *spec = codec->spec;
3262 snd_hda_codec_cleanup_stream(codec,
3263 spec->adc_nids[substream->number + 1]);
3270 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3274 /* NID is set in alc_build_pcms */
3276 .open = alc880_playback_pcm_open,
3277 .prepare = alc880_playback_pcm_prepare,
3278 .cleanup = alc880_playback_pcm_cleanup
3282 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3286 /* NID is set in alc_build_pcms */
3289 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3293 /* NID is set in alc_build_pcms */
3296 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3297 .substreams = 2, /* can be overridden */
3300 /* NID is set in alc_build_pcms */
3302 .prepare = alc880_alt_capture_pcm_prepare,
3303 .cleanup = alc880_alt_capture_pcm_cleanup
3307 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3311 /* NID is set in alc_build_pcms */
3313 .open = alc880_dig_playback_pcm_open,
3314 .close = alc880_dig_playback_pcm_close,
3315 .prepare = alc880_dig_playback_pcm_prepare,
3316 .cleanup = alc880_dig_playback_pcm_cleanup
3320 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3324 /* NID is set in alc_build_pcms */
3327 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3328 static struct hda_pcm_stream alc_pcm_null_stream = {
3334 static int alc_build_pcms(struct hda_codec *codec)
3336 struct alc_spec *spec = codec->spec;
3337 struct hda_pcm *info = spec->pcm_rec;
3340 codec->num_pcms = 1;
3341 codec->pcm_info = info;
3343 if (spec->no_analog)
3346 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3347 "%s Analog", codec->chip_name);
3348 info->name = spec->stream_name_analog;
3350 if (spec->stream_analog_playback) {
3351 if (snd_BUG_ON(!spec->multiout.dac_nids))
3353 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3354 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3356 if (spec->stream_analog_capture) {
3357 if (snd_BUG_ON(!spec->adc_nids))
3359 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3360 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3363 if (spec->channel_mode) {
3364 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3365 for (i = 0; i < spec->num_channel_mode; i++) {
3366 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3367 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3373 /* SPDIF for stream index #1 */
3374 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3375 snprintf(spec->stream_name_digital,
3376 sizeof(spec->stream_name_digital),
3377 "%s Digital", codec->chip_name);
3378 codec->num_pcms = 2;
3379 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3380 info = spec->pcm_rec + 1;
3381 info->name = spec->stream_name_digital;
3382 if (spec->dig_out_type)
3383 info->pcm_type = spec->dig_out_type;
3385 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3386 if (spec->multiout.dig_out_nid &&
3387 spec->stream_digital_playback) {
3388 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3389 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3391 if (spec->dig_in_nid &&
3392 spec->stream_digital_capture) {
3393 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3394 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3396 /* FIXME: do we need this for all Realtek codec models? */
3397 codec->spdif_status_reset = 1;
3400 if (spec->no_analog)
3403 /* If the use of more than one ADC is requested for the current
3404 * model, configure a second analog capture-only PCM.
3406 /* Additional Analaog capture for index #2 */
3407 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3408 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3409 codec->num_pcms = 3;
3410 info = spec->pcm_rec + 2;
3411 info->name = spec->stream_name_analog;
3412 if (spec->alt_dac_nid) {
3413 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3414 *spec->stream_analog_alt_playback;
3415 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3418 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3419 alc_pcm_null_stream;
3420 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3422 if (spec->num_adc_nids > 1) {
3423 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3424 *spec->stream_analog_alt_capture;
3425 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3427 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3428 spec->num_adc_nids - 1;
3430 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3431 alc_pcm_null_stream;
3432 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3439 static void alc_free_kctls(struct hda_codec *codec)
3441 struct alc_spec *spec = codec->spec;
3443 if (spec->kctls.list) {
3444 struct snd_kcontrol_new *kctl = spec->kctls.list;
3446 for (i = 0; i < spec->kctls.used; i++)
3447 kfree(kctl[i].name);
3449 snd_array_free(&spec->kctls);
3452 static void alc_free(struct hda_codec *codec)
3454 struct alc_spec *spec = codec->spec;
3459 alc_free_kctls(codec);
3461 snd_hda_detach_beep_device(codec);
3464 #ifdef SND_HDA_NEEDS_RESUME
3465 static int alc_resume(struct hda_codec *codec)
3467 codec->patch_ops.init(codec);
3468 snd_hda_codec_resume_amp(codec);
3469 snd_hda_codec_resume_cache(codec);
3476 static struct hda_codec_ops alc_patch_ops = {
3477 .build_controls = alc_build_controls,
3478 .build_pcms = alc_build_pcms,
3481 .unsol_event = alc_unsol_event,
3482 #ifdef SND_HDA_NEEDS_RESUME
3483 .resume = alc_resume,
3485 #ifdef CONFIG_SND_HDA_POWER_SAVE
3486 .check_power_status = alc_check_power_status,
3492 * Test configuration for debugging
3494 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3497 #ifdef CONFIG_SND_DEBUG
3498 static hda_nid_t alc880_test_dac_nids[4] = {
3499 0x02, 0x03, 0x04, 0x05
3502 static struct hda_input_mux alc880_test_capture_source = {
3511 { "Surround", 0x6 },
3515 static struct hda_channel_mode alc880_test_modes[4] = {
3522 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3523 struct snd_ctl_elem_info *uinfo)
3525 static char *texts[] = {
3526 "N/A", "Line Out", "HP Out",
3527 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3529 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3531 uinfo->value.enumerated.items = 8;
3532 if (uinfo->value.enumerated.item >= 8)
3533 uinfo->value.enumerated.item = 7;
3534 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3538 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3539 struct snd_ctl_elem_value *ucontrol)
3541 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3542 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3543 unsigned int pin_ctl, item = 0;
3545 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3546 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3547 if (pin_ctl & AC_PINCTL_OUT_EN) {
3548 if (pin_ctl & AC_PINCTL_HP_EN)
3552 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3553 switch (pin_ctl & AC_PINCTL_VREFEN) {
3554 case AC_PINCTL_VREF_HIZ: item = 3; break;
3555 case AC_PINCTL_VREF_50: item = 4; break;
3556 case AC_PINCTL_VREF_GRD: item = 5; break;
3557 case AC_PINCTL_VREF_80: item = 6; break;
3558 case AC_PINCTL_VREF_100: item = 7; break;
3561 ucontrol->value.enumerated.item[0] = item;
3565 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3566 struct snd_ctl_elem_value *ucontrol)
3568 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3569 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3570 static unsigned int ctls[] = {
3571 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3572 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3573 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3574 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3575 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3576 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3578 unsigned int old_ctl, new_ctl;
3580 old_ctl = snd_hda_codec_read(codec, nid, 0,
3581 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3582 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3583 if (old_ctl != new_ctl) {
3585 snd_hda_codec_write_cache(codec, nid, 0,
3586 AC_VERB_SET_PIN_WIDGET_CONTROL,
3588 val = ucontrol->value.enumerated.item[0] >= 3 ?
3590 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3597 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3598 struct snd_ctl_elem_info *uinfo)
3600 static char *texts[] = {
3601 "Front", "Surround", "CLFE", "Side"
3603 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3605 uinfo->value.enumerated.items = 4;
3606 if (uinfo->value.enumerated.item >= 4)
3607 uinfo->value.enumerated.item = 3;
3608 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3612 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3613 struct snd_ctl_elem_value *ucontrol)
3615 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3616 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3619 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3620 ucontrol->value.enumerated.item[0] = sel & 3;
3624 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3625 struct snd_ctl_elem_value *ucontrol)
3627 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3628 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3631 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3632 if (ucontrol->value.enumerated.item[0] != sel) {
3633 sel = ucontrol->value.enumerated.item[0] & 3;
3634 snd_hda_codec_write_cache(codec, nid, 0,
3635 AC_VERB_SET_CONNECT_SEL, sel);
3641 #define PIN_CTL_TEST(xname,nid) { \
3642 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3644 .info = alc_test_pin_ctl_info, \
3645 .get = alc_test_pin_ctl_get, \
3646 .put = alc_test_pin_ctl_put, \
3647 .private_value = nid \
3650 #define PIN_SRC_TEST(xname,nid) { \
3651 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3653 .info = alc_test_pin_src_info, \
3654 .get = alc_test_pin_src_get, \
3655 .put = alc_test_pin_src_put, \
3656 .private_value = nid \
3659 static struct snd_kcontrol_new alc880_test_mixer[] = {
3660 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3661 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3662 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3663 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3664 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3665 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3666 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3667 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3668 PIN_CTL_TEST("Front Pin Mode", 0x14),
3669 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3670 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3671 PIN_CTL_TEST("Side Pin Mode", 0x17),
3672 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3673 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3674 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3675 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3676 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3677 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3678 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3679 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3680 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3681 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3682 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3683 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3684 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3685 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3686 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3687 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3688 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3689 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3691 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3692 .name = "Channel Mode",
3693 .info = alc_ch_mode_info,
3694 .get = alc_ch_mode_get,
3695 .put = alc_ch_mode_put,
3700 static struct hda_verb alc880_test_init_verbs[] = {
3701 /* Unmute inputs of 0x0c - 0x0f */
3702 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3703 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3704 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3705 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3706 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3707 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3708 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3709 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3710 /* Vol output for 0x0c-0x0f */
3711 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3712 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3713 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3714 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3715 /* Set output pins 0x14-0x17 */
3716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3717 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3718 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3719 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3720 /* Unmute output pins 0x14-0x17 */
3721 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3722 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3723 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3724 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3725 /* Set input pins 0x18-0x1c */
3726 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3727 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3728 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3729 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3730 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3731 /* Mute input pins 0x18-0x1b */
3732 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3733 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3734 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3735 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3738 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3739 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3740 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3741 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3742 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3743 /* Analog input/passthru */
3744 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3745 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3746 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3747 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3748 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3756 static const char *alc880_models[ALC880_MODEL_LAST] = {
3757 [ALC880_3ST] = "3stack",
3758 [ALC880_TCL_S700] = "tcl",
3759 [ALC880_3ST_DIG] = "3stack-digout",
3760 [ALC880_CLEVO] = "clevo",
3761 [ALC880_5ST] = "5stack",
3762 [ALC880_5ST_DIG] = "5stack-digout",
3763 [ALC880_W810] = "w810",
3764 [ALC880_Z71V] = "z71v",
3765 [ALC880_6ST] = "6stack",
3766 [ALC880_6ST_DIG] = "6stack-digout",
3767 [ALC880_ASUS] = "asus",
3768 [ALC880_ASUS_W1V] = "asus-w1v",
3769 [ALC880_ASUS_DIG] = "asus-dig",
3770 [ALC880_ASUS_DIG2] = "asus-dig2",
3771 [ALC880_UNIWILL_DIG] = "uniwill",
3772 [ALC880_UNIWILL_P53] = "uniwill-p53",
3773 [ALC880_FUJITSU] = "fujitsu",
3774 [ALC880_F1734] = "F1734",
3776 [ALC880_LG_LW] = "lg-lw",
3777 [ALC880_MEDION_RIM] = "medion",
3778 #ifdef CONFIG_SND_DEBUG
3779 [ALC880_TEST] = "test",
3781 [ALC880_AUTO] = "auto",
3784 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3785 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3786 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3787 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3788 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3789 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3790 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3791 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3792 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3793 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3794 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3795 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3796 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3797 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3798 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3799 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3800 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3801 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3802 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3803 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3804 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3805 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3806 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3807 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3808 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3809 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3810 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3811 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3812 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3813 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3814 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3815 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3816 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3817 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3818 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3819 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3820 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3821 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3822 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3823 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3824 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3825 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3826 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3827 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3828 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3829 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3830 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3831 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3832 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3833 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3834 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3835 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3836 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3837 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3838 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3839 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3840 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3841 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3842 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3843 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3844 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3845 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3846 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3847 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3848 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3849 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3850 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3851 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3852 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3854 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3855 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3856 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3861 * ALC880 codec presets
3863 static struct alc_config_preset alc880_presets[] = {
3865 .mixers = { alc880_three_stack_mixer },
3866 .init_verbs = { alc880_volume_init_verbs,
3867 alc880_pin_3stack_init_verbs },
3868 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3869 .dac_nids = alc880_dac_nids,
3870 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3871 .channel_mode = alc880_threestack_modes,
3873 .input_mux = &alc880_capture_source,
3875 [ALC880_3ST_DIG] = {
3876 .mixers = { alc880_three_stack_mixer },
3877 .init_verbs = { alc880_volume_init_verbs,
3878 alc880_pin_3stack_init_verbs },
3879 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3880 .dac_nids = alc880_dac_nids,
3881 .dig_out_nid = ALC880_DIGOUT_NID,
3882 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3883 .channel_mode = alc880_threestack_modes,
3885 .input_mux = &alc880_capture_source,
3887 [ALC880_TCL_S700] = {
3888 .mixers = { alc880_tcl_s700_mixer },
3889 .init_verbs = { alc880_volume_init_verbs,
3890 alc880_pin_tcl_S700_init_verbs,
3891 alc880_gpio2_init_verbs },
3892 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3893 .dac_nids = alc880_dac_nids,
3894 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3895 .num_adc_nids = 1, /* single ADC */
3897 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3898 .channel_mode = alc880_2_jack_modes,
3899 .input_mux = &alc880_capture_source,
3902 .mixers = { alc880_three_stack_mixer,
3903 alc880_five_stack_mixer},
3904 .init_verbs = { alc880_volume_init_verbs,
3905 alc880_pin_5stack_init_verbs },
3906 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3907 .dac_nids = alc880_dac_nids,
3908 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3909 .channel_mode = alc880_fivestack_modes,
3910 .input_mux = &alc880_capture_source,
3912 [ALC880_5ST_DIG] = {
3913 .mixers = { alc880_three_stack_mixer,
3914 alc880_five_stack_mixer },
3915 .init_verbs = { alc880_volume_init_verbs,
3916 alc880_pin_5stack_init_verbs },
3917 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3918 .dac_nids = alc880_dac_nids,
3919 .dig_out_nid = ALC880_DIGOUT_NID,
3920 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3921 .channel_mode = alc880_fivestack_modes,
3922 .input_mux = &alc880_capture_source,
3925 .mixers = { alc880_six_stack_mixer },
3926 .init_verbs = { alc880_volume_init_verbs,
3927 alc880_pin_6stack_init_verbs },
3928 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3929 .dac_nids = alc880_6st_dac_nids,
3930 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3931 .channel_mode = alc880_sixstack_modes,
3932 .input_mux = &alc880_6stack_capture_source,
3934 [ALC880_6ST_DIG] = {
3935 .mixers = { alc880_six_stack_mixer },
3936 .init_verbs = { alc880_volume_init_verbs,
3937 alc880_pin_6stack_init_verbs },
3938 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3939 .dac_nids = alc880_6st_dac_nids,
3940 .dig_out_nid = ALC880_DIGOUT_NID,
3941 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3942 .channel_mode = alc880_sixstack_modes,
3943 .input_mux = &alc880_6stack_capture_source,
3946 .mixers = { alc880_w810_base_mixer },
3947 .init_verbs = { alc880_volume_init_verbs,
3948 alc880_pin_w810_init_verbs,
3949 alc880_gpio2_init_verbs },
3950 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3951 .dac_nids = alc880_w810_dac_nids,
3952 .dig_out_nid = ALC880_DIGOUT_NID,
3953 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3954 .channel_mode = alc880_w810_modes,
3955 .input_mux = &alc880_capture_source,
3958 .mixers = { alc880_z71v_mixer },
3959 .init_verbs = { alc880_volume_init_verbs,
3960 alc880_pin_z71v_init_verbs },
3961 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3962 .dac_nids = alc880_z71v_dac_nids,
3963 .dig_out_nid = ALC880_DIGOUT_NID,
3965 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3966 .channel_mode = alc880_2_jack_modes,
3967 .input_mux = &alc880_capture_source,
3970 .mixers = { alc880_f1734_mixer },
3971 .init_verbs = { alc880_volume_init_verbs,
3972 alc880_pin_f1734_init_verbs },
3973 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3974 .dac_nids = alc880_f1734_dac_nids,
3976 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3977 .channel_mode = alc880_2_jack_modes,
3978 .input_mux = &alc880_f1734_capture_source,
3979 .unsol_event = alc880_uniwill_p53_unsol_event,
3980 .init_hook = alc880_uniwill_p53_init_hook,
3983 .mixers = { alc880_asus_mixer },
3984 .init_verbs = { alc880_volume_init_verbs,
3985 alc880_pin_asus_init_verbs,
3986 alc880_gpio1_init_verbs },
3987 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3988 .dac_nids = alc880_asus_dac_nids,
3989 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3990 .channel_mode = alc880_asus_modes,
3992 .input_mux = &alc880_capture_source,
3994 [ALC880_ASUS_DIG] = {
3995 .mixers = { alc880_asus_mixer },
3996 .init_verbs = { alc880_volume_init_verbs,
3997 alc880_pin_asus_init_verbs,
3998 alc880_gpio1_init_verbs },
3999 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4000 .dac_nids = alc880_asus_dac_nids,
4001 .dig_out_nid = ALC880_DIGOUT_NID,
4002 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4003 .channel_mode = alc880_asus_modes,
4005 .input_mux = &alc880_capture_source,
4007 [ALC880_ASUS_DIG2] = {
4008 .mixers = { alc880_asus_mixer },
4009 .init_verbs = { alc880_volume_init_verbs,
4010 alc880_pin_asus_init_verbs,
4011 alc880_gpio2_init_verbs }, /* use GPIO2 */
4012 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4013 .dac_nids = alc880_asus_dac_nids,
4014 .dig_out_nid = ALC880_DIGOUT_NID,
4015 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4016 .channel_mode = alc880_asus_modes,
4018 .input_mux = &alc880_capture_source,
4020 [ALC880_ASUS_W1V] = {
4021 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4022 .init_verbs = { alc880_volume_init_verbs,
4023 alc880_pin_asus_init_verbs,
4024 alc880_gpio1_init_verbs },
4025 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4026 .dac_nids = alc880_asus_dac_nids,
4027 .dig_out_nid = ALC880_DIGOUT_NID,
4028 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4029 .channel_mode = alc880_asus_modes,
4031 .input_mux = &alc880_capture_source,
4033 [ALC880_UNIWILL_DIG] = {
4034 .mixers = { alc880_asus_mixer },
4035 .init_verbs = { alc880_volume_init_verbs,
4036 alc880_pin_asus_init_verbs },
4037 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4038 .dac_nids = alc880_asus_dac_nids,
4039 .dig_out_nid = ALC880_DIGOUT_NID,
4040 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4041 .channel_mode = alc880_asus_modes,
4043 .input_mux = &alc880_capture_source,
4045 [ALC880_UNIWILL] = {
4046 .mixers = { alc880_uniwill_mixer },
4047 .init_verbs = { alc880_volume_init_verbs,
4048 alc880_uniwill_init_verbs },
4049 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4050 .dac_nids = alc880_asus_dac_nids,
4051 .dig_out_nid = ALC880_DIGOUT_NID,
4052 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4053 .channel_mode = alc880_threestack_modes,
4055 .input_mux = &alc880_capture_source,
4056 .unsol_event = alc880_uniwill_unsol_event,
4057 .init_hook = alc880_uniwill_init_hook,
4059 [ALC880_UNIWILL_P53] = {
4060 .mixers = { alc880_uniwill_p53_mixer },
4061 .init_verbs = { alc880_volume_init_verbs,
4062 alc880_uniwill_p53_init_verbs },
4063 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4064 .dac_nids = alc880_asus_dac_nids,
4065 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4066 .channel_mode = alc880_threestack_modes,
4067 .input_mux = &alc880_capture_source,
4068 .unsol_event = alc880_uniwill_p53_unsol_event,
4069 .init_hook = alc880_uniwill_p53_init_hook,
4071 [ALC880_FUJITSU] = {
4072 .mixers = { alc880_fujitsu_mixer },
4073 .init_verbs = { alc880_volume_init_verbs,
4074 alc880_uniwill_p53_init_verbs,
4075 alc880_beep_init_verbs },
4076 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4077 .dac_nids = alc880_dac_nids,
4078 .dig_out_nid = ALC880_DIGOUT_NID,
4079 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4080 .channel_mode = alc880_2_jack_modes,
4081 .input_mux = &alc880_capture_source,
4082 .unsol_event = alc880_uniwill_p53_unsol_event,
4083 .init_hook = alc880_uniwill_p53_init_hook,
4086 .mixers = { alc880_three_stack_mixer },
4087 .init_verbs = { alc880_volume_init_verbs,
4088 alc880_pin_clevo_init_verbs },
4089 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4090 .dac_nids = alc880_dac_nids,
4092 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4093 .channel_mode = alc880_threestack_modes,
4095 .input_mux = &alc880_capture_source,
4098 .mixers = { alc880_lg_mixer },
4099 .init_verbs = { alc880_volume_init_verbs,
4100 alc880_lg_init_verbs },
4101 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4102 .dac_nids = alc880_lg_dac_nids,
4103 .dig_out_nid = ALC880_DIGOUT_NID,
4104 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4105 .channel_mode = alc880_lg_ch_modes,
4107 .input_mux = &alc880_lg_capture_source,
4108 .unsol_event = alc_automute_amp_unsol_event,
4109 .init_hook = alc880_lg_init_hook,
4110 #ifdef CONFIG_SND_HDA_POWER_SAVE
4111 .loopbacks = alc880_lg_loopbacks,
4115 .mixers = { alc880_lg_lw_mixer },
4116 .init_verbs = { alc880_volume_init_verbs,
4117 alc880_lg_lw_init_verbs },
4118 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4119 .dac_nids = alc880_dac_nids,
4120 .dig_out_nid = ALC880_DIGOUT_NID,
4121 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4122 .channel_mode = alc880_lg_lw_modes,
4123 .input_mux = &alc880_lg_lw_capture_source,
4124 .unsol_event = alc_automute_amp_unsol_event,
4125 .init_hook = alc880_lg_lw_init_hook,
4127 [ALC880_MEDION_RIM] = {
4128 .mixers = { alc880_medion_rim_mixer },
4129 .init_verbs = { alc880_volume_init_verbs,
4130 alc880_medion_rim_init_verbs,
4131 alc_gpio2_init_verbs },
4132 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4133 .dac_nids = alc880_dac_nids,
4134 .dig_out_nid = ALC880_DIGOUT_NID,
4135 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4136 .channel_mode = alc880_2_jack_modes,
4137 .input_mux = &alc880_medion_rim_capture_source,
4138 .unsol_event = alc880_medion_rim_unsol_event,
4139 .init_hook = alc880_medion_rim_init_hook,
4141 #ifdef CONFIG_SND_DEBUG
4143 .mixers = { alc880_test_mixer },
4144 .init_verbs = { alc880_test_init_verbs },
4145 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4146 .dac_nids = alc880_test_dac_nids,
4147 .dig_out_nid = ALC880_DIGOUT_NID,
4148 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4149 .channel_mode = alc880_test_modes,
4150 .input_mux = &alc880_test_capture_source,
4156 * Automatic parse of I/O pins from the BIOS configuration
4161 ALC_CTL_WIDGET_MUTE,
4164 static struct snd_kcontrol_new alc880_control_templates[] = {
4165 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4166 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4167 HDA_BIND_MUTE(NULL, 0, 0, 0),
4170 /* add dynamic controls */
4171 static int add_control(struct alc_spec *spec, int type, const char *name,
4174 struct snd_kcontrol_new *knew;
4176 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4177 knew = snd_array_new(&spec->kctls);
4180 *knew = alc880_control_templates[type];
4181 knew->name = kstrdup(name, GFP_KERNEL);
4184 knew->private_value = val;
4188 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4189 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4190 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4191 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4192 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4193 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4194 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4195 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4196 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4197 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4198 #define ALC880_PIN_CD_NID 0x1c
4200 /* fill in the dac_nids table from the parsed pin configuration */
4201 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4202 const struct auto_pin_cfg *cfg)
4208 memset(assigned, 0, sizeof(assigned));
4209 spec->multiout.dac_nids = spec->private_dac_nids;
4211 /* check the pins hardwired to audio widget */
4212 for (i = 0; i < cfg->line_outs; i++) {
4213 nid = cfg->line_out_pins[i];
4214 if (alc880_is_fixed_pin(nid)) {
4215 int idx = alc880_fixed_pin_idx(nid);
4216 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4220 /* left pins can be connect to any audio widget */
4221 for (i = 0; i < cfg->line_outs; i++) {
4222 nid = cfg->line_out_pins[i];
4223 if (alc880_is_fixed_pin(nid))
4225 /* search for an empty channel */
4226 for (j = 0; j < cfg->line_outs; j++) {
4228 spec->multiout.dac_nids[i] =
4229 alc880_idx_to_dac(j);
4235 spec->multiout.num_dacs = cfg->line_outs;
4239 /* add playback controls from the parsed DAC table */
4240 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4241 const struct auto_pin_cfg *cfg)
4244 static const char *chname[4] = {
4245 "Front", "Surround", NULL /*CLFE*/, "Side"
4250 for (i = 0; i < cfg->line_outs; i++) {
4251 if (!spec->multiout.dac_nids[i])
4253 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4256 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4257 "Center Playback Volume",
4258 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4262 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4263 "LFE Playback Volume",
4264 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4268 err = add_control(spec, ALC_CTL_BIND_MUTE,
4269 "Center Playback Switch",
4270 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4274 err = add_control(spec, ALC_CTL_BIND_MUTE,
4275 "LFE Playback Switch",
4276 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4281 sprintf(name, "%s Playback Volume", chname[i]);
4282 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4283 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4287 sprintf(name, "%s Playback Switch", chname[i]);
4288 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4289 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4298 /* add playback controls for speaker and HP outputs */
4299 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4309 if (alc880_is_fixed_pin(pin)) {
4310 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4311 /* specify the DAC as the extra output */
4312 if (!spec->multiout.hp_nid)
4313 spec->multiout.hp_nid = nid;
4315 spec->multiout.extra_out_nid[0] = nid;
4316 /* control HP volume/switch on the output mixer amp */
4317 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4318 sprintf(name, "%s Playback Volume", pfx);
4319 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4320 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4323 sprintf(name, "%s Playback Switch", pfx);
4324 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4325 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4328 } else if (alc880_is_multi_pin(pin)) {
4329 /* set manual connection */
4330 /* we have only a switch on HP-out PIN */
4331 sprintf(name, "%s Playback Switch", pfx);
4332 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4333 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4340 /* create input playback/capture controls for the given pin */
4341 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4342 const char *ctlname,
4343 int idx, hda_nid_t mix_nid)
4348 sprintf(name, "%s Playback Volume", ctlname);
4349 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4350 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4353 sprintf(name, "%s Playback Switch", ctlname);
4354 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4355 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4361 /* create playback/capture controls for input pins */
4362 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4363 const struct auto_pin_cfg *cfg)
4365 struct hda_input_mux *imux = &spec->private_imux[0];
4368 for (i = 0; i < AUTO_PIN_LAST; i++) {
4369 if (alc880_is_input_pin(cfg->input_pins[i])) {
4370 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4371 err = new_analog_input(spec, cfg->input_pins[i],
4372 auto_pin_cfg_labels[i],
4376 imux->items[imux->num_items].label =
4377 auto_pin_cfg_labels[i];
4378 imux->items[imux->num_items].index =
4379 alc880_input_pin_idx(cfg->input_pins[i]);
4386 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4387 unsigned int pin_type)
4389 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4392 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4396 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4397 hda_nid_t nid, int pin_type,
4400 alc_set_pin_output(codec, nid, pin_type);
4401 /* need the manual connection? */
4402 if (alc880_is_multi_pin(nid)) {
4403 struct alc_spec *spec = codec->spec;
4404 int idx = alc880_multi_pin_idx(nid);
4405 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4406 AC_VERB_SET_CONNECT_SEL,
4407 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4411 static int get_pin_type(int line_out_type)
4413 if (line_out_type == AUTO_PIN_HP_OUT)
4419 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4421 struct alc_spec *spec = codec->spec;
4424 for (i = 0; i < spec->autocfg.line_outs; i++) {
4425 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4426 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4427 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4431 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4433 struct alc_spec *spec = codec->spec;
4436 pin = spec->autocfg.speaker_pins[0];
4437 if (pin) /* connect to front */
4438 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4439 pin = spec->autocfg.hp_pins[0];
4440 if (pin) /* connect to front */
4441 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4444 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4446 struct alc_spec *spec = codec->spec;
4449 for (i = 0; i < AUTO_PIN_LAST; i++) {
4450 hda_nid_t nid = spec->autocfg.input_pins[i];
4451 if (alc880_is_input_pin(nid)) {
4452 alc_set_input_pin(codec, nid, i);
4453 if (nid != ALC880_PIN_CD_NID &&
4454 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4455 snd_hda_codec_write(codec, nid, 0,
4456 AC_VERB_SET_AMP_GAIN_MUTE,
4462 /* parse the BIOS configuration and set up the alc_spec */
4463 /* return 1 if successful, 0 if the proper config is not found,
4464 * or a negative error code
4466 static int alc880_parse_auto_config(struct hda_codec *codec)
4468 struct alc_spec *spec = codec->spec;
4470 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4472 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4476 if (!spec->autocfg.line_outs)
4477 return 0; /* can't find valid BIOS pin config */
4479 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4482 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4485 err = alc880_auto_create_extra_out(spec,
4486 spec->autocfg.speaker_pins[0],
4490 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4494 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4498 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4500 /* check multiple SPDIF-out (for recent codecs) */
4501 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4503 err = snd_hda_get_connections(codec,
4504 spec->autocfg.dig_out_pins[i],
4509 spec->multiout.dig_out_nid = dig_nid;
4511 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4512 spec->slave_dig_outs[i - 1] = dig_nid;
4513 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4517 if (spec->autocfg.dig_in_pin)
4518 spec->dig_in_nid = ALC880_DIGIN_NID;
4520 if (spec->kctls.list)
4521 add_mixer(spec, spec->kctls.list);
4523 add_verb(spec, alc880_volume_init_verbs);
4525 spec->num_mux_defs = 1;
4526 spec->input_mux = &spec->private_imux[0];
4528 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4533 /* additional initialization for auto-configuration model */
4534 static void alc880_auto_init(struct hda_codec *codec)
4536 struct alc_spec *spec = codec->spec;
4537 alc880_auto_init_multi_out(codec);
4538 alc880_auto_init_extra_out(codec);
4539 alc880_auto_init_analog_input(codec);
4540 if (spec->unsol_event)
4541 alc_inithook(codec);
4544 static void set_capture_mixer(struct alc_spec *spec)
4546 static struct snd_kcontrol_new *caps[2][3] = {
4547 { alc_capture_mixer_nosrc1,
4548 alc_capture_mixer_nosrc2,
4549 alc_capture_mixer_nosrc3 },
4550 { alc_capture_mixer1,
4552 alc_capture_mixer3 },
4554 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4556 if (spec->input_mux && spec->input_mux->num_items > 1)
4560 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4564 #define set_beep_amp(spec, nid, idx, dir) \
4565 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4568 * OK, here we have finally the patch for ALC880
4571 static int patch_alc880(struct hda_codec *codec)
4573 struct alc_spec *spec;
4577 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4583 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4586 if (board_config < 0) {
4587 printk(KERN_INFO "hda_codec: Unknown model for %s, "
4588 "trying auto-probe from BIOS...\n", codec->chip_name);
4589 board_config = ALC880_AUTO;
4592 if (board_config == ALC880_AUTO) {
4593 /* automatic parse from the BIOS config */
4594 err = alc880_parse_auto_config(codec);
4600 "hda_codec: Cannot set up configuration "
4601 "from BIOS. Using 3-stack mode...\n");
4602 board_config = ALC880_3ST;
4606 err = snd_hda_attach_beep_device(codec, 0x1);
4612 if (board_config != ALC880_AUTO)
4613 setup_preset(spec, &alc880_presets[board_config]);
4615 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4616 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4617 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4619 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4620 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4622 if (!spec->adc_nids && spec->input_mux) {
4623 /* check whether NID 0x07 is valid */
4624 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4626 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4627 if (wcap != AC_WID_AUD_IN) {
4628 spec->adc_nids = alc880_adc_nids_alt;
4629 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4631 spec->adc_nids = alc880_adc_nids;
4632 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4635 set_capture_mixer(spec);
4636 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4638 spec->vmaster_nid = 0x0c;
4640 codec->patch_ops = alc_patch_ops;
4641 if (board_config == ALC880_AUTO)
4642 spec->init_hook = alc880_auto_init;
4643 #ifdef CONFIG_SND_HDA_POWER_SAVE
4644 if (!spec->loopback.amplist)
4645 spec->loopback.amplist = alc880_loopbacks;
4647 codec->proc_widget_hook = print_realtek_coef;
4657 static hda_nid_t alc260_dac_nids[1] = {
4662 static hda_nid_t alc260_adc_nids[1] = {
4667 static hda_nid_t alc260_adc_nids_alt[1] = {
4672 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4673 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4675 static hda_nid_t alc260_dual_adc_nids[2] = {
4680 #define ALC260_DIGOUT_NID 0x03
4681 #define ALC260_DIGIN_NID 0x06
4683 static struct hda_input_mux alc260_capture_source = {
4687 { "Front Mic", 0x1 },
4693 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4694 * headphone jack and the internal CD lines since these are the only pins at
4695 * which audio can appear. For flexibility, also allow the option of
4696 * recording the mixer output on the second ADC (ADC0 doesn't have a
4697 * connection to the mixer output).
4699 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4703 { "Mic/Line", 0x0 },
4705 { "Headphone", 0x2 },
4711 { "Mic/Line", 0x0 },
4713 { "Headphone", 0x2 },
4720 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4721 * the Fujitsu S702x, but jacks are marked differently.
4723 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4730 { "Headphone", 0x5 },
4739 { "Headphone", 0x6 },
4745 /* Maxdata Favorit 100XS */
4746 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4750 { "Line/Mic", 0x0 },
4757 { "Line/Mic", 0x0 },
4765 * This is just place-holder, so there's something for alc_build_pcms to look
4766 * at when it calculates the maximum number of channels. ALC260 has no mixer
4767 * element which allows changing the channel mode, so the verb list is
4770 static struct hda_channel_mode alc260_modes[1] = {
4775 /* Mixer combinations
4777 * basic: base_output + input + pc_beep + capture
4778 * HP: base_output + input + capture_alt
4779 * HP_3013: hp_3013 + input + capture
4780 * fujitsu: fujitsu + capture
4781 * acer: acer + capture
4784 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4785 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4786 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4787 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4788 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4789 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4790 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4794 static struct snd_kcontrol_new alc260_input_mixer[] = {
4795 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4796 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4797 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4798 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4799 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4800 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4801 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4802 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4806 /* update HP, line and mono out pins according to the master switch */
4807 static void alc260_hp_master_update(struct hda_codec *codec,
4808 hda_nid_t hp, hda_nid_t line,
4811 struct alc_spec *spec = codec->spec;
4812 unsigned int val = spec->master_sw ? PIN_HP : 0;
4813 /* change HP and line-out pins */
4814 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4816 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4818 /* mono (speaker) depending on the HP jack sense */
4819 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4820 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4824 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4825 struct snd_ctl_elem_value *ucontrol)
4827 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4828 struct alc_spec *spec = codec->spec;
4829 *ucontrol->value.integer.value = spec->master_sw;
4833 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4834 struct snd_ctl_elem_value *ucontrol)
4836 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4837 struct alc_spec *spec = codec->spec;
4838 int val = !!*ucontrol->value.integer.value;
4839 hda_nid_t hp, line, mono;
4841 if (val == spec->master_sw)
4843 spec->master_sw = val;
4844 hp = (kcontrol->private_value >> 16) & 0xff;
4845 line = (kcontrol->private_value >> 8) & 0xff;
4846 mono = kcontrol->private_value & 0xff;
4847 alc260_hp_master_update(codec, hp, line, mono);
4851 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4853 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4854 .name = "Master Playback Switch",
4855 .info = snd_ctl_boolean_mono_info,
4856 .get = alc260_hp_master_sw_get,
4857 .put = alc260_hp_master_sw_put,
4858 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4860 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4861 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4862 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4863 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4864 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4866 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4870 static struct hda_verb alc260_hp_unsol_verbs[] = {
4871 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4875 static void alc260_hp_automute(struct hda_codec *codec)
4877 struct alc_spec *spec = codec->spec;
4878 unsigned int present;
4880 present = snd_hda_codec_read(codec, 0x10, 0,
4881 AC_VERB_GET_PIN_SENSE, 0);
4882 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4883 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4886 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4888 if ((res >> 26) == ALC880_HP_EVENT)
4889 alc260_hp_automute(codec);
4892 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4894 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4895 .name = "Master Playback Switch",
4896 .info = snd_ctl_boolean_mono_info,
4897 .get = alc260_hp_master_sw_get,
4898 .put = alc260_hp_master_sw_put,
4899 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4901 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4902 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4903 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4904 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4905 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4906 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4907 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4908 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4912 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4913 .ops = &snd_hda_bind_vol,
4915 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4916 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4917 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4922 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4923 .ops = &snd_hda_bind_sw,
4925 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4926 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4931 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4932 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4933 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4934 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4935 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4939 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4940 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4944 static void alc260_hp_3013_automute(struct hda_codec *codec)
4946 struct alc_spec *spec = codec->spec;
4947 unsigned int present;
4949 present = snd_hda_codec_read(codec, 0x15, 0,
4950 AC_VERB_GET_PIN_SENSE, 0);
4951 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4952 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4955 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4958 if ((res >> 26) == ALC880_HP_EVENT)
4959 alc260_hp_3013_automute(codec);
4962 static void alc260_hp_3012_automute(struct hda_codec *codec)
4964 unsigned int present, bits;
4966 present = snd_hda_codec_read(codec, 0x10, 0,
4967 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4969 bits = present ? 0 : PIN_OUT;
4970 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4972 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4974 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4978 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4981 if ((res >> 26) == ALC880_HP_EVENT)
4982 alc260_hp_3012_automute(codec);
4985 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4986 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4988 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4989 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4990 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4991 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4992 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4993 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4994 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4995 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4996 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4997 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4998 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5002 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5003 * versions of the ALC260 don't act on requests to enable mic bias from NID
5004 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5005 * datasheet doesn't mention this restriction. At this stage it's not clear
5006 * whether this behaviour is intentional or is a hardware bug in chip
5007 * revisions available in early 2006. Therefore for now allow the
5008 * "Headphone Jack Mode" control to span all choices, but if it turns out
5009 * that the lack of mic bias for this NID is intentional we could change the
5010 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5012 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5013 * don't appear to make the mic bias available from the "line" jack, even
5014 * though the NID used for this jack (0x14) can supply it. The theory is
5015 * that perhaps Acer have included blocking capacitors between the ALC260
5016 * and the output jack. If this turns out to be the case for all such
5017 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5018 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5020 * The C20x Tablet series have a mono internal speaker which is controlled
5021 * via the chip's Mono sum widget and pin complex, so include the necessary
5022 * controls for such models. On models without a "mono speaker" the control
5023 * won't do anything.
5025 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5026 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5027 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5028 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5029 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5031 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5033 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5034 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5035 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5036 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5037 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5038 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5039 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5040 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5044 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5046 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5047 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5048 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5049 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5050 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5051 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5052 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5056 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5057 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5059 static struct snd_kcontrol_new alc260_will_mixer[] = {
5060 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5061 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5063 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5064 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5065 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5066 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5067 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5068 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5069 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5073 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5074 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5076 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5077 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5078 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5079 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5080 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5081 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5082 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5083 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5084 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5085 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5086 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5091 * initialization verbs
5093 static struct hda_verb alc260_init_verbs[] = {
5094 /* Line In pin widget for input */
5095 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5096 /* CD pin widget for input */
5097 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5098 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5099 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5100 /* Mic2 (front panel) pin widget for input and vref at 80% */
5101 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5102 /* LINE-2 is used for line-out in rear */
5103 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5104 /* select line-out */
5105 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5107 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5109 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5111 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5112 /* mute capture amp left and right */
5113 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5114 /* set connection select to line in (default select for this ADC) */
5115 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5116 /* mute capture amp left and right */
5117 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5118 /* set connection select to line in (default select for this ADC) */
5119 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5120 /* set vol=0 Line-Out mixer amp left and right */
5121 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5122 /* unmute pin widget amp left and right (no gain on this amp) */
5123 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5124 /* set vol=0 HP mixer amp left and right */
5125 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5126 /* unmute pin widget amp left and right (no gain on this amp) */
5127 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5128 /* set vol=0 Mono mixer amp left and right */
5129 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5130 /* unmute pin widget amp left and right (no gain on this amp) */
5131 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5132 /* unmute LINE-2 out pin */
5133 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5134 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5137 /* mute analog inputs */
5138 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5139 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5140 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5141 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5142 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5143 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5144 /* mute Front out path */
5145 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5146 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5147 /* mute Headphone out path */
5148 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5149 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5150 /* mute Mono out path */
5151 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5152 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5156 #if 0 /* should be identical with alc260_init_verbs? */
5157 static struct hda_verb alc260_hp_init_verbs[] = {
5158 /* Headphone and output */
5159 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5161 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5162 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5163 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5164 /* Mic2 (front panel) pin widget for input and vref at 80% */
5165 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5166 /* Line In pin widget for input */
5167 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5168 /* Line-2 pin widget for output */
5169 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5170 /* CD pin widget for input */
5171 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5172 /* unmute amp left and right */
5173 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5174 /* set connection select to line in (default select for this ADC) */
5175 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5176 /* unmute Line-Out mixer amp left and right (volume = 0) */
5177 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5178 /* mute pin widget amp left and right (no gain on this amp) */
5179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5180 /* unmute HP mixer amp left and right (volume = 0) */
5181 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5182 /* mute pin widget amp left and right (no gain on this amp) */
5183 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5184 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5187 /* mute analog inputs */
5188 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5189 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5190 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5191 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5192 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5193 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5194 /* Unmute Front out path */
5195 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5196 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5197 /* Unmute Headphone out path */
5198 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5199 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5200 /* Unmute Mono out path */
5201 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5202 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5207 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5208 /* Line out and output */
5209 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5211 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5212 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5213 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5214 /* Mic2 (front panel) pin widget for input and vref at 80% */
5215 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5216 /* Line In pin widget for input */
5217 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5218 /* Headphone pin widget for output */
5219 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5220 /* CD pin widget for input */
5221 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5222 /* unmute amp left and right */
5223 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5224 /* set connection select to line in (default select for this ADC) */
5225 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5226 /* unmute Line-Out mixer amp left and right (volume = 0) */
5227 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5228 /* mute pin widget amp left and right (no gain on this amp) */
5229 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5230 /* unmute HP mixer amp left and right (volume = 0) */
5231 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5232 /* mute pin widget amp left and right (no gain on this amp) */
5233 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5234 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5237 /* mute analog inputs */
5238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5239 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5240 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5241 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5242 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5243 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5244 /* Unmute Front out path */
5245 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5246 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5247 /* Unmute Headphone out path */
5248 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5249 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5250 /* Unmute Mono out path */
5251 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5252 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5256 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5257 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5258 * audio = 0x16, internal speaker = 0x10.
5260 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5261 /* Disable all GPIOs */
5262 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5263 /* Internal speaker is connected to headphone pin */
5264 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5265 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5266 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5267 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5268 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5269 /* Ensure all other unused pins are disabled and muted. */
5270 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5271 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5272 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5273 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5274 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5275 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5276 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5277 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5279 /* Disable digital (SPDIF) pins */
5280 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5281 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5283 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5284 * when acting as an output.
5286 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5288 /* Start with output sum widgets muted and their output gains at min */
5289 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5290 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5291 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5292 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5293 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5294 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5295 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5296 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5297 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5299 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5300 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5301 /* Unmute Line1 pin widget output buffer since it starts as an output.
5302 * If the pin mode is changed by the user the pin mode control will
5303 * take care of enabling the pin's input/output buffers as needed.
5304 * Therefore there's no need to enable the input buffer at this
5307 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5308 /* Unmute input buffer of pin widget used for Line-in (no equiv
5311 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5313 /* Mute capture amp left and right */
5314 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5315 /* Set ADC connection select to match default mixer setting - line
5318 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5320 /* Do the same for the second ADC: mute capture input amp and
5321 * set ADC connection to line in (on mic1 pin)
5323 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5324 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5326 /* Mute all inputs to mixer widget (even unconnected ones) */
5327 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5330 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5339 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5340 * similar laptops (adapted from Fujitsu init verbs).
5342 static struct hda_verb alc260_acer_init_verbs[] = {
5343 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5344 * the headphone jack. Turn this on and rely on the standard mute
5345 * methods whenever the user wants to turn these outputs off.
5347 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5348 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5349 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5350 /* Internal speaker/Headphone jack is connected to Line-out pin */
5351 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5352 /* Internal microphone/Mic jack is connected to Mic1 pin */
5353 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5354 /* Line In jack is connected to Line1 pin */
5355 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5356 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5357 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5358 /* Ensure all other unused pins are disabled and muted. */
5359 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5360 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5361 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5362 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5363 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5364 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5365 /* Disable digital (SPDIF) pins */
5366 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5367 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5369 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5370 * bus when acting as outputs.
5372 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5373 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5375 /* Start with output sum widgets muted and their output gains at min */
5376 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5377 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5378 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5379 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5380 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5381 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5382 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5383 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5384 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5386 /* Unmute Line-out pin widget amp left and right
5387 * (no equiv mixer ctrl)
5389 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5390 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5391 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5392 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5393 * inputs. If the pin mode is changed by the user the pin mode control
5394 * will take care of enabling the pin's input/output buffers as needed.
5395 * Therefore there's no need to enable the input buffer at this
5398 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5399 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5401 /* Mute capture amp left and right */
5402 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5403 /* Set ADC connection select to match default mixer setting - mic
5406 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5408 /* Do similar with the second ADC: mute capture input amp and
5409 * set ADC connection to mic to match ALSA's default state.
5411 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5412 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5414 /* Mute all inputs to mixer widget (even unconnected ones) */
5415 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5416 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5418 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5419 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5420 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5421 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5422 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5427 /* Initialisation sequence for Maxdata Favorit 100XS
5428 * (adapted from Acer init verbs).
5430 static struct hda_verb alc260_favorit100_init_verbs[] = {
5431 /* GPIO 0 enables the output jack.
5432 * Turn this on and rely on the standard mute
5433 * methods whenever the user wants to turn these outputs off.
5435 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5436 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5437 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5438 /* Line/Mic input jack is connected to Mic1 pin */
5439 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5440 /* Ensure all other unused pins are disabled and muted. */
5441 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5442 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5443 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5444 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5445 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5446 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5447 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5448 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5449 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5450 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5451 /* Disable digital (SPDIF) pins */
5452 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5453 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5455 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5456 * bus when acting as outputs.
5458 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5459 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5461 /* Start with output sum widgets muted and their output gains at min */
5462 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5463 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5464 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5465 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5466 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5467 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5468 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5469 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5470 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5472 /* Unmute Line-out pin widget amp left and right
5473 * (no equiv mixer ctrl)
5475 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5476 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5477 * inputs. If the pin mode is changed by the user the pin mode control
5478 * will take care of enabling the pin's input/output buffers as needed.
5479 * Therefore there's no need to enable the input buffer at this
5482 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5484 /* Mute capture amp left and right */
5485 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5486 /* Set ADC connection select to match default mixer setting - mic
5489 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5491 /* Do similar with the second ADC: mute capture input amp and
5492 * set ADC connection to mic to match ALSA's default state.
5494 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5495 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5497 /* Mute all inputs to mixer widget (even unconnected ones) */
5498 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5499 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5500 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5501 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5502 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5503 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5504 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5505 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5510 static struct hda_verb alc260_will_verbs[] = {
5511 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5512 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5513 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5514 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5515 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5516 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5520 static struct hda_verb alc260_replacer_672v_verbs[] = {
5521 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5522 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5523 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5525 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5526 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5527 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5529 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5533 /* toggle speaker-output according to the hp-jack state */
5534 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5536 unsigned int present;
5538 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5539 present = snd_hda_codec_read(codec, 0x0f, 0,
5540 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5542 snd_hda_codec_write_cache(codec, 0x01, 0,
5543 AC_VERB_SET_GPIO_DATA, 1);
5544 snd_hda_codec_write_cache(codec, 0x0f, 0,
5545 AC_VERB_SET_PIN_WIDGET_CONTROL,
5548 snd_hda_codec_write_cache(codec, 0x01, 0,
5549 AC_VERB_SET_GPIO_DATA, 0);
5550 snd_hda_codec_write_cache(codec, 0x0f, 0,
5551 AC_VERB_SET_PIN_WIDGET_CONTROL,
5556 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5559 if ((res >> 26) == ALC880_HP_EVENT)
5560 alc260_replacer_672v_automute(codec);
5563 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5564 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5565 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5566 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5567 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5568 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5569 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5570 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5571 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5572 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5573 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5577 /* Test configuration for debugging, modelled after the ALC880 test
5580 #ifdef CONFIG_SND_DEBUG
5581 static hda_nid_t alc260_test_dac_nids[1] = {
5584 static hda_nid_t alc260_test_adc_nids[2] = {
5587 /* For testing the ALC260, each input MUX needs its own definition since
5588 * the signal assignments are different. This assumes that the first ADC
5591 static struct hda_input_mux alc260_test_capture_sources[2] = {
5595 { "MIC1 pin", 0x0 },
5596 { "MIC2 pin", 0x1 },
5597 { "LINE1 pin", 0x2 },
5598 { "LINE2 pin", 0x3 },
5600 { "LINE-OUT pin", 0x5 },
5601 { "HP-OUT pin", 0x6 },
5607 { "MIC1 pin", 0x0 },
5608 { "MIC2 pin", 0x1 },
5609 { "LINE1 pin", 0x2 },
5610 { "LINE2 pin", 0x3 },
5613 { "LINE-OUT pin", 0x6 },
5614 { "HP-OUT pin", 0x7 },
5618 static struct snd_kcontrol_new alc260_test_mixer[] = {
5619 /* Output driver widgets */
5620 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5621 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5622 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5623 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5624 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5625 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5627 /* Modes for retasking pin widgets
5628 * Note: the ALC260 doesn't seem to act on requests to enable mic
5629 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5630 * mention this restriction. At this stage it's not clear whether
5631 * this behaviour is intentional or is a hardware bug in chip
5632 * revisions available at least up until early 2006. Therefore for
5633 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5634 * choices, but if it turns out that the lack of mic bias for these
5635 * NIDs is intentional we could change their modes from
5636 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5638 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5639 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5640 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5641 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5642 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5643 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5645 /* Loopback mixer controls */
5646 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5647 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5648 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5649 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5650 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5651 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5652 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5653 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5654 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5655 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5656 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5657 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5658 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5659 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5661 /* Controls for GPIO pins, assuming they are configured as outputs */
5662 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5663 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5664 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5665 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5667 /* Switches to allow the digital IO pins to be enabled. The datasheet
5668 * is ambigious as to which NID is which; testing on laptops which
5669 * make this output available should provide clarification.
5671 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5672 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5674 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5675 * this output to turn on an external amplifier.
5677 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5678 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5682 static struct hda_verb alc260_test_init_verbs[] = {
5683 /* Enable all GPIOs as outputs with an initial value of 0 */
5684 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5685 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5686 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5688 /* Enable retasking pins as output, initially without power amp */
5689 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5690 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5691 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5692 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5693 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5694 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5696 /* Disable digital (SPDIF) pins initially, but users can enable
5697 * them via a mixer switch. In the case of SPDIF-out, this initverb
5698 * payload also sets the generation to 0, output to be in "consumer"
5699 * PCM format, copyright asserted, no pre-emphasis and no validity
5702 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5703 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5705 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5706 * OUT1 sum bus when acting as an output.
5708 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5709 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5710 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5711 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5713 /* Start with output sum widgets muted and their output gains at min */
5714 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5715 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5716 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5717 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5718 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5719 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5720 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5721 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5722 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5724 /* Unmute retasking pin widget output buffers since the default
5725 * state appears to be output. As the pin mode is changed by the
5726 * user the pin mode control will take care of enabling the pin's
5727 * input/output buffers as needed.
5729 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5730 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5731 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5732 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5733 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5734 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5735 /* Also unmute the mono-out pin widget */
5736 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5738 /* Mute capture amp left and right */
5739 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5740 /* Set ADC connection select to match default mixer setting (mic1
5743 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5745 /* Do the same for the second ADC: mute capture input amp and
5746 * set ADC connection to mic1 pin
5748 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5749 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5751 /* Mute all inputs to mixer widget (even unconnected ones) */
5752 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5753 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5754 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5755 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5756 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5757 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5758 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5759 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5765 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5766 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5768 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5769 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5772 * for BIOS auto-configuration
5775 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5776 const char *pfx, int *vol_bits)
5779 unsigned long vol_val, sw_val;
5783 if (nid >= 0x0f && nid < 0x11) {
5784 nid_vol = nid - 0x7;
5785 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5786 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5787 } else if (nid == 0x11) {
5788 nid_vol = nid - 0x7;
5789 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5790 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5791 } else if (nid >= 0x12 && nid <= 0x15) {
5793 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5794 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5798 if (!(*vol_bits & (1 << nid_vol))) {
5799 /* first control for the volume widget */
5800 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5801 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5804 *vol_bits |= (1 << nid_vol);
5806 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5807 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5813 /* add playback controls from the parsed DAC table */
5814 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5815 const struct auto_pin_cfg *cfg)
5821 spec->multiout.num_dacs = 1;
5822 spec->multiout.dac_nids = spec->private_dac_nids;
5823 spec->multiout.dac_nids[0] = 0x02;
5825 nid = cfg->line_out_pins[0];
5827 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5832 nid = cfg->speaker_pins[0];
5834 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5839 nid = cfg->hp_pins[0];
5841 err = alc260_add_playback_controls(spec, nid, "Headphone",
5849 /* create playback/capture controls for input pins */
5850 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5851 const struct auto_pin_cfg *cfg)
5853 struct hda_input_mux *imux = &spec->private_imux[0];
5856 for (i = 0; i < AUTO_PIN_LAST; i++) {
5857 if (cfg->input_pins[i] >= 0x12) {
5858 idx = cfg->input_pins[i] - 0x12;
5859 err = new_analog_input(spec, cfg->input_pins[i],
5860 auto_pin_cfg_labels[i], idx,
5864 imux->items[imux->num_items].label =
5865 auto_pin_cfg_labels[i];
5866 imux->items[imux->num_items].index = idx;
5869 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5870 idx = cfg->input_pins[i] - 0x09;
5871 err = new_analog_input(spec, cfg->input_pins[i],
5872 auto_pin_cfg_labels[i], idx,
5876 imux->items[imux->num_items].label =
5877 auto_pin_cfg_labels[i];
5878 imux->items[imux->num_items].index = idx;
5885 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5886 hda_nid_t nid, int pin_type,
5889 alc_set_pin_output(codec, nid, pin_type);
5890 /* need the manual connection? */
5892 int idx = nid - 0x12;
5893 snd_hda_codec_write(codec, idx + 0x0b, 0,
5894 AC_VERB_SET_CONNECT_SEL, sel_idx);
5898 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5900 struct alc_spec *spec = codec->spec;
5903 nid = spec->autocfg.line_out_pins[0];
5905 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5906 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5909 nid = spec->autocfg.speaker_pins[0];
5911 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5913 nid = spec->autocfg.hp_pins[0];
5915 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5918 #define ALC260_PIN_CD_NID 0x16
5919 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5921 struct alc_spec *spec = codec->spec;
5924 for (i = 0; i < AUTO_PIN_LAST; i++) {
5925 hda_nid_t nid = spec->autocfg.input_pins[i];
5927 alc_set_input_pin(codec, nid, i);
5928 if (nid != ALC260_PIN_CD_NID &&
5929 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5930 snd_hda_codec_write(codec, nid, 0,
5931 AC_VERB_SET_AMP_GAIN_MUTE,
5938 * generic initialization of ADC, input mixers and output mixers
5940 static struct hda_verb alc260_volume_init_verbs[] = {
5942 * Unmute ADC0-1 and set the default input to mic-in
5944 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5945 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5946 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5947 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5949 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5951 * Note: PASD motherboards uses the Line In 2 as the input for
5952 * front panel mic (mic 2)
5954 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5955 /* mute analog inputs */
5956 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5957 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5958 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5959 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5960 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5963 * Set up output mixers (0x08 - 0x0a)
5965 /* set vol=0 to output mixers */
5966 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5967 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5968 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5969 /* set up input amps for analog loopback */
5970 /* Amp Indices: DAC = 0, mixer = 1 */
5971 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5972 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5973 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5974 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5975 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5976 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5981 static int alc260_parse_auto_config(struct hda_codec *codec)
5983 struct alc_spec *spec = codec->spec;
5985 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5987 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5991 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5994 if (!spec->kctls.list)
5995 return 0; /* can't find valid BIOS pin config */
5996 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
6000 spec->multiout.max_channels = 2;
6002 if (spec->autocfg.dig_outs)
6003 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6004 if (spec->kctls.list)
6005 add_mixer(spec, spec->kctls.list);
6007 add_verb(spec, alc260_volume_init_verbs);
6009 spec->num_mux_defs = 1;
6010 spec->input_mux = &spec->private_imux[0];
6012 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6017 /* additional initialization for auto-configuration model */
6018 static void alc260_auto_init(struct hda_codec *codec)
6020 struct alc_spec *spec = codec->spec;
6021 alc260_auto_init_multi_out(codec);
6022 alc260_auto_init_analog_input(codec);
6023 if (spec->unsol_event)
6024 alc_inithook(codec);
6027 #ifdef CONFIG_SND_HDA_POWER_SAVE
6028 static struct hda_amp_list alc260_loopbacks[] = {
6029 { 0x07, HDA_INPUT, 0 },
6030 { 0x07, HDA_INPUT, 1 },
6031 { 0x07, HDA_INPUT, 2 },
6032 { 0x07, HDA_INPUT, 3 },
6033 { 0x07, HDA_INPUT, 4 },
6039 * ALC260 configurations
6041 static const char *alc260_models[ALC260_MODEL_LAST] = {
6042 [ALC260_BASIC] = "basic",
6044 [ALC260_HP_3013] = "hp-3013",
6045 [ALC260_HP_DC7600] = "hp-dc7600",
6046 [ALC260_FUJITSU_S702X] = "fujitsu",
6047 [ALC260_ACER] = "acer",
6048 [ALC260_WILL] = "will",
6049 [ALC260_REPLACER_672V] = "replacer",
6050 [ALC260_FAVORIT100] = "favorit100",
6051 #ifdef CONFIG_SND_DEBUG
6052 [ALC260_TEST] = "test",
6054 [ALC260_AUTO] = "auto",
6057 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6058 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6059 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6060 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6061 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6062 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6063 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6064 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6065 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6066 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6067 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6068 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6069 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6070 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6071 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6072 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6073 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6074 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6075 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6076 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6080 static struct alc_config_preset alc260_presets[] = {
6082 .mixers = { alc260_base_output_mixer,
6083 alc260_input_mixer },
6084 .init_verbs = { alc260_init_verbs },
6085 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6086 .dac_nids = alc260_dac_nids,
6087 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6088 .adc_nids = alc260_adc_nids,
6089 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6090 .channel_mode = alc260_modes,
6091 .input_mux = &alc260_capture_source,
6094 .mixers = { alc260_hp_output_mixer,
6095 alc260_input_mixer },
6096 .init_verbs = { alc260_init_verbs,
6097 alc260_hp_unsol_verbs },
6098 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6099 .dac_nids = alc260_dac_nids,
6100 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6101 .adc_nids = alc260_adc_nids_alt,
6102 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6103 .channel_mode = alc260_modes,
6104 .input_mux = &alc260_capture_source,
6105 .unsol_event = alc260_hp_unsol_event,
6106 .init_hook = alc260_hp_automute,
6108 [ALC260_HP_DC7600] = {
6109 .mixers = { alc260_hp_dc7600_mixer,
6110 alc260_input_mixer },
6111 .init_verbs = { alc260_init_verbs,
6112 alc260_hp_dc7600_verbs },
6113 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6114 .dac_nids = alc260_dac_nids,
6115 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6116 .adc_nids = alc260_adc_nids_alt,
6117 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6118 .channel_mode = alc260_modes,
6119 .input_mux = &alc260_capture_source,
6120 .unsol_event = alc260_hp_3012_unsol_event,
6121 .init_hook = alc260_hp_3012_automute,
6123 [ALC260_HP_3013] = {
6124 .mixers = { alc260_hp_3013_mixer,
6125 alc260_input_mixer },
6126 .init_verbs = { alc260_hp_3013_init_verbs,
6127 alc260_hp_3013_unsol_verbs },
6128 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6129 .dac_nids = alc260_dac_nids,
6130 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6131 .adc_nids = alc260_adc_nids_alt,
6132 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6133 .channel_mode = alc260_modes,
6134 .input_mux = &alc260_capture_source,
6135 .unsol_event = alc260_hp_3013_unsol_event,
6136 .init_hook = alc260_hp_3013_automute,
6138 [ALC260_FUJITSU_S702X] = {
6139 .mixers = { alc260_fujitsu_mixer },
6140 .init_verbs = { alc260_fujitsu_init_verbs },
6141 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6142 .dac_nids = alc260_dac_nids,
6143 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6144 .adc_nids = alc260_dual_adc_nids,
6145 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6146 .channel_mode = alc260_modes,
6147 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6148 .input_mux = alc260_fujitsu_capture_sources,
6151 .mixers = { alc260_acer_mixer },
6152 .init_verbs = { alc260_acer_init_verbs },
6153 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6154 .dac_nids = alc260_dac_nids,
6155 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6156 .adc_nids = alc260_dual_adc_nids,
6157 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6158 .channel_mode = alc260_modes,
6159 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6160 .input_mux = alc260_acer_capture_sources,
6162 [ALC260_FAVORIT100] = {
6163 .mixers = { alc260_favorit100_mixer },
6164 .init_verbs = { alc260_favorit100_init_verbs },
6165 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6166 .dac_nids = alc260_dac_nids,
6167 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6168 .adc_nids = alc260_dual_adc_nids,
6169 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6170 .channel_mode = alc260_modes,
6171 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6172 .input_mux = alc260_favorit100_capture_sources,
6175 .mixers = { alc260_will_mixer },
6176 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6177 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6178 .dac_nids = alc260_dac_nids,
6179 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6180 .adc_nids = alc260_adc_nids,
6181 .dig_out_nid = ALC260_DIGOUT_NID,
6182 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6183 .channel_mode = alc260_modes,
6184 .input_mux = &alc260_capture_source,
6186 [ALC260_REPLACER_672V] = {
6187 .mixers = { alc260_replacer_672v_mixer },
6188 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6189 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6190 .dac_nids = alc260_dac_nids,
6191 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6192 .adc_nids = alc260_adc_nids,
6193 .dig_out_nid = ALC260_DIGOUT_NID,
6194 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6195 .channel_mode = alc260_modes,
6196 .input_mux = &alc260_capture_source,
6197 .unsol_event = alc260_replacer_672v_unsol_event,
6198 .init_hook = alc260_replacer_672v_automute,
6200 #ifdef CONFIG_SND_DEBUG
6202 .mixers = { alc260_test_mixer },
6203 .init_verbs = { alc260_test_init_verbs },
6204 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6205 .dac_nids = alc260_test_dac_nids,
6206 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6207 .adc_nids = alc260_test_adc_nids,
6208 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6209 .channel_mode = alc260_modes,
6210 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6211 .input_mux = alc260_test_capture_sources,
6216 static int patch_alc260(struct hda_codec *codec)
6218 struct alc_spec *spec;
6219 int err, board_config;
6221 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6227 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6230 if (board_config < 0) {
6231 snd_printd(KERN_INFO "hda_codec: Unknown model for %s, "
6232 "trying auto-probe from BIOS...\n",
6234 board_config = ALC260_AUTO;
6237 if (board_config == ALC260_AUTO) {
6238 /* automatic parse from the BIOS config */
6239 err = alc260_parse_auto_config(codec);
6245 "hda_codec: Cannot set up configuration "
6246 "from BIOS. Using base mode...\n");
6247 board_config = ALC260_BASIC;
6251 err = snd_hda_attach_beep_device(codec, 0x1);
6257 if (board_config != ALC260_AUTO)
6258 setup_preset(spec, &alc260_presets[board_config]);
6260 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6261 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6263 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6264 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6266 if (!spec->adc_nids && spec->input_mux) {
6267 /* check whether NID 0x04 is valid */
6268 unsigned int wcap = get_wcaps(codec, 0x04);
6269 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6271 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6272 spec->adc_nids = alc260_adc_nids_alt;
6273 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6275 spec->adc_nids = alc260_adc_nids;
6276 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6279 set_capture_mixer(spec);
6280 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6282 spec->vmaster_nid = 0x08;
6284 codec->patch_ops = alc_patch_ops;
6285 if (board_config == ALC260_AUTO)
6286 spec->init_hook = alc260_auto_init;
6287 #ifdef CONFIG_SND_HDA_POWER_SAVE
6288 if (!spec->loopback.amplist)
6289 spec->loopback.amplist = alc260_loopbacks;
6291 codec->proc_widget_hook = print_realtek_coef;
6298 * ALC882/883/885/888/889 support
6300 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6301 * configuration. Each pin widget can choose any input DACs and a mixer.
6302 * Each ADC is connected from a mixer of all inputs. This makes possible
6303 * 6-channel independent captures.
6305 * In addition, an independent DAC for the multi-playback (not used in this
6308 #define ALC882_DIGOUT_NID 0x06
6309 #define ALC882_DIGIN_NID 0x0a
6310 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6311 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6312 #define ALC1200_DIGOUT_NID 0x10
6315 static struct hda_channel_mode alc882_ch_modes[1] = {
6320 static hda_nid_t alc882_dac_nids[4] = {
6321 /* front, rear, clfe, rear_surr */
6322 0x02, 0x03, 0x04, 0x05
6324 #define alc883_dac_nids alc882_dac_nids
6327 #define alc882_adc_nids alc880_adc_nids
6328 #define alc882_adc_nids_alt alc880_adc_nids_alt
6329 #define alc883_adc_nids alc882_adc_nids_alt
6330 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6331 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6332 #define alc889_adc_nids alc880_adc_nids
6334 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6335 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6336 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6337 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6338 #define alc889_capsrc_nids alc882_capsrc_nids
6341 /* FIXME: should be a matrix-type input source selection */
6343 static struct hda_input_mux alc882_capture_source = {
6347 { "Front Mic", 0x1 },
6353 #define alc883_capture_source alc882_capture_source
6355 static struct hda_input_mux alc889_capture_source = {
6358 { "Front Mic", 0x0 },
6364 static struct hda_input_mux mb5_capture_source = {
6373 static struct hda_input_mux alc883_3stack_6ch_intel = {
6377 { "Front Mic", 0x0 },
6383 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6391 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6401 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6409 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6413 { "Front Mic", 0x1 },
6418 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6426 static struct hda_input_mux alc889A_mb31_capture_source = {
6430 /* Front Mic (0x01) unused */
6432 /* Line 2 (0x03) unused */
6433 /* CD (0x04) unsused? */
6440 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6447 static struct hda_verb alc882_3ST_ch2_init[] = {
6448 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6449 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6450 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6451 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6458 static struct hda_verb alc882_3ST_ch4_init[] = {
6459 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6460 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6461 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6462 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6463 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6470 static struct hda_verb alc882_3ST_ch6_init[] = {
6471 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6472 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6473 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6474 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6475 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6476 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6480 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6481 { 2, alc882_3ST_ch2_init },
6482 { 4, alc882_3ST_ch4_init },
6483 { 6, alc882_3ST_ch6_init },
6486 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6491 static struct hda_verb alc882_sixstack_ch6_init[] = {
6492 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6493 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6494 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6495 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6502 static struct hda_verb alc882_sixstack_ch8_init[] = {
6503 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6504 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6505 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6506 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6510 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6511 { 6, alc882_sixstack_ch6_init },
6512 { 8, alc882_sixstack_ch8_init },
6516 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6522 static struct hda_verb alc885_mbp_ch2_init[] = {
6523 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6524 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6525 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6532 static struct hda_verb alc885_mbp_ch6_init[] = {
6533 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6534 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6535 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6536 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6537 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6541 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6542 { 2, alc885_mbp_ch2_init },
6543 { 6, alc885_mbp_ch6_init },
6548 * Speakers/Woofer/HP = Front
6551 static struct hda_verb alc885_mb5_ch2_init[] = {
6552 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6553 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6559 * Speakers/HP = Front
6563 static struct hda_verb alc885_mb5_ch6_init[] = {
6564 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6565 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6566 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6570 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6571 { 2, alc885_mb5_ch2_init },
6572 { 6, alc885_mb5_ch6_init },
6579 static struct hda_verb alc883_4ST_ch2_init[] = {
6580 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6581 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6582 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6583 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6584 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6585 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6592 static struct hda_verb alc883_4ST_ch4_init[] = {
6593 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6594 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6595 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6596 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6597 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6598 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6599 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6606 static struct hda_verb alc883_4ST_ch6_init[] = {
6607 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6608 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6609 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6610 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6611 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6612 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6613 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6614 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6621 static struct hda_verb alc883_4ST_ch8_init[] = {
6622 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6623 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6624 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6625 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6626 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6627 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6628 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6629 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6630 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6634 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6635 { 2, alc883_4ST_ch2_init },
6636 { 4, alc883_4ST_ch4_init },
6637 { 6, alc883_4ST_ch6_init },
6638 { 8, alc883_4ST_ch8_init },
6645 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6646 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6647 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6648 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6649 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6656 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6657 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6658 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6659 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6660 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6661 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6668 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6669 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6670 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6671 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6672 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6673 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6674 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6678 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6679 { 2, alc883_3ST_ch2_intel_init },
6680 { 4, alc883_3ST_ch4_intel_init },
6681 { 6, alc883_3ST_ch6_intel_init },
6687 static struct hda_verb alc889_ch6_intel_init[] = {
6688 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6689 { 0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6690 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6691 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6692 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6693 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6694 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6695 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6696 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6697 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6704 static struct hda_verb alc889_ch8_intel_init[] = {
6705 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6706 { 0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6707 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6708 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6709 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6710 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6711 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6712 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6713 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6714 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6715 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6719 static struct hda_channel_mode alc889_8ch_intel_modes[2] = {
6720 { 6, alc889_ch6_intel_init },
6721 { 8, alc889_ch8_intel_init },
6727 static struct hda_verb alc883_sixstack_ch6_init[] = {
6728 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6729 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6730 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6731 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6738 static struct hda_verb alc883_sixstack_ch8_init[] = {
6739 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6740 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6741 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6742 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6746 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6747 { 6, alc883_sixstack_ch6_init },
6748 { 8, alc883_sixstack_ch8_init },
6752 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6753 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6755 static struct snd_kcontrol_new alc882_base_mixer[] = {
6756 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6757 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6758 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6759 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6760 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6761 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6762 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6763 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6764 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6765 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6766 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6767 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6768 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6769 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6770 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6771 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6772 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6773 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6774 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6775 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6776 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6780 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6781 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6782 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6783 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6784 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6785 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6786 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6787 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6788 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6789 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6790 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6794 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6795 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6796 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6797 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6798 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6799 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6800 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6801 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6802 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6803 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6804 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6805 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6806 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6807 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6808 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6812 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6813 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6814 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6815 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6816 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6817 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6818 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6819 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6820 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6821 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6825 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6826 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6827 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6828 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6829 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6830 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6831 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6832 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6833 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6835 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6836 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6837 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6838 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6842 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6843 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6845 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6846 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6847 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6848 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6849 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6850 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6851 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6852 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6853 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6854 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6855 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6856 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6857 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6858 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6862 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6863 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6864 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6865 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6866 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6867 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6868 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6869 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6870 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6871 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6872 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6876 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6878 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6879 .name = "Channel Mode",
6880 .info = alc_ch_mode_info,
6881 .get = alc_ch_mode_get,
6882 .put = alc_ch_mode_put,
6887 static struct hda_verb alc882_base_init_verbs[] = {
6888 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6889 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6890 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6891 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6893 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6894 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6895 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6897 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6898 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6899 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6901 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6902 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6903 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6905 /* mute analog input loopbacks */
6906 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6907 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6908 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6909 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6910 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6912 /* Front Pin: output 0 (0x0c) */
6913 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6914 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6915 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6916 /* Rear Pin: output 1 (0x0d) */
6917 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6918 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6919 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6920 /* CLFE Pin: output 2 (0x0e) */
6921 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6922 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6923 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6924 /* Side Pin: output 3 (0x0f) */
6925 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6926 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6927 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6928 /* Mic (rear) pin: input vref at 80% */
6929 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6930 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6931 /* Front Mic pin: input vref at 80% */
6932 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6933 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6934 /* Line In pin: input */
6935 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6936 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6937 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6938 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6939 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6940 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6941 /* CD pin widget for input */
6942 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6944 /* FIXME: use matrix-type input source selection */
6945 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6947 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6948 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6949 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6950 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6952 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6953 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6954 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6955 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6956 /* ADC2: mute amp left and right */
6957 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6958 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6959 /* ADC3: mute amp left and right */
6960 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6961 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6966 static struct hda_verb alc882_adc1_init_verbs[] = {
6967 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6968 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6969 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6970 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6971 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6972 /* ADC1: mute amp left and right */
6973 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6974 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6978 static struct hda_verb alc882_eapd_verbs[] = {
6979 /* change to EAPD mode */
6980 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6981 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6985 static struct hda_verb alc889_eapd_verbs[] = {
6986 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
6987 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
6992 static struct hda_verb alc885_init_verbs[] = {
6993 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6994 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6995 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6996 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6998 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6999 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7000 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7002 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7003 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7004 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7006 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7007 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7008 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7010 /* mute analog input loopbacks */
7011 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7013 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7015 /* Front HP Pin: output 0 (0x0c) */
7016 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7017 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7018 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7019 /* Front Pin: output 0 (0x0c) */
7020 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7021 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7022 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7023 /* Rear Pin: output 1 (0x0d) */
7024 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7025 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7026 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7027 /* CLFE Pin: output 2 (0x0e) */
7028 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7029 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7030 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7031 /* Side Pin: output 3 (0x0f) */
7032 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7033 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7034 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7035 /* Mic (rear) pin: input vref at 80% */
7036 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7037 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7038 /* Front Mic pin: input vref at 80% */
7039 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7040 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7041 /* Line In pin: input */
7042 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7043 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7045 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7047 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7048 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7049 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7051 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7052 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7053 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7055 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7056 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7057 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7058 /* ADC2: mute amp left and right */
7059 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7060 /* ADC3: mute amp left and right */
7061 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7066 static struct hda_verb alc885_init_input_verbs[] = {
7067 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7068 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7069 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7074 /* Unmute Selector 24h and set the default input to front mic */
7075 static struct hda_verb alc889_init_input_verbs[] = {
7076 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7077 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7082 #define alc883_init_verbs alc882_base_init_verbs
7085 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7086 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7087 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7088 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7089 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7090 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7091 /* FIXME: this looks suspicious...
7092 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7093 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7098 static struct hda_verb alc882_macpro_init_verbs[] = {
7099 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7100 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7101 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7103 /* Front Pin: output 0 (0x0c) */
7104 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7105 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7106 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7107 /* Front Mic pin: input vref at 80% */
7108 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7109 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7110 /* Speaker: output */
7111 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7112 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7113 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7114 /* Headphone output (output 0 - 0x0c) */
7115 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7116 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7117 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7119 /* FIXME: use matrix-type input source selection */
7120 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7121 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7122 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7123 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7124 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7125 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7127 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7128 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7129 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7130 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7132 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7133 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7134 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7135 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7136 /* ADC1: mute amp left and right */
7137 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7138 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7139 /* ADC2: mute amp left and right */
7140 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7141 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7142 /* ADC3: mute amp left and right */
7143 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7144 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7150 static struct hda_verb alc885_mb5_init_verbs[] = {
7152 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7153 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7154 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7155 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7157 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7158 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7159 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7160 /* Surround mixer */
7161 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7162 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7163 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7165 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7166 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7167 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7169 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7170 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7171 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7172 /* Front Pin (0x0c) */
7173 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7174 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7175 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7176 /* LFE Pin (0x0e) */
7177 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7178 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7179 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7181 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7182 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7183 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7184 /* Front Mic pin: input vref at 80% */
7185 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7186 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7188 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7189 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7191 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7192 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7198 /* Macbook Pro rev3 */
7199 static struct hda_verb alc885_mbp3_init_verbs[] = {
7200 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7201 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7202 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7203 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7205 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7206 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7207 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7208 /* Front Pin: output 0 (0x0c) */
7209 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7210 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7211 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7212 /* HP Pin: output 0 (0x0d) */
7213 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7214 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7215 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7216 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7217 /* Mic (rear) pin: input vref at 80% */
7218 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7219 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7220 /* Front Mic pin: input vref at 80% */
7221 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7222 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7223 /* Line In pin: use output 1 when in LineOut mode */
7224 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7225 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7226 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7228 /* FIXME: use matrix-type input source selection */
7229 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7230 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7231 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7232 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7233 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7234 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7236 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7237 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7238 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7239 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7241 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7242 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7243 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7244 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7245 /* ADC1: mute amp left and right */
7246 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7247 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7248 /* ADC2: mute amp left and right */
7249 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7250 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7251 /* ADC3: mute amp left and right */
7252 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7253 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7258 /* iMac 24 mixer. */
7259 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7260 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7261 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7265 /* iMac 24 init verbs. */
7266 static struct hda_verb alc885_imac24_init_verbs[] = {
7267 /* Internal speakers: output 0 (0x0c) */
7268 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7269 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7270 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7271 /* Internal speakers: output 0 (0x0c) */
7272 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7273 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7274 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7275 /* Headphone: output 0 (0x0c) */
7276 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7277 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7278 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7279 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7280 /* Front Mic: input vref at 80% */
7281 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7282 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7286 /* Toggle speaker-output according to the hp-jack state */
7287 static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
7289 struct alc_spec *spec = codec->spec;
7291 spec->autocfg.hp_pins[0] = 0x14;
7292 spec->autocfg.speaker_pins[0] = 0x18;
7293 spec->autocfg.speaker_pins[1] = 0x1a;
7294 alc_automute_amp(codec);
7297 static void alc885_mbp3_init_hook(struct hda_codec *codec)
7299 struct alc_spec *spec = codec->spec;
7301 spec->autocfg.hp_pins[0] = 0x15;
7302 spec->autocfg.speaker_pins[0] = 0x14;
7303 alc_automute_amp(codec);
7307 static struct hda_verb alc882_targa_verbs[] = {
7308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7311 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7312 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7314 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7315 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7316 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7318 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7322 /* toggle speaker-output according to the hp-jack state */
7323 static void alc882_targa_automute(struct hda_codec *codec)
7325 struct alc_spec *spec = codec->spec;
7326 alc_automute_amp(codec);
7327 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7328 spec->jack_present ? 1 : 3);
7331 static void alc882_targa_init_hook(struct hda_codec *codec)
7333 struct alc_spec *spec = codec->spec;
7335 spec->autocfg.hp_pins[0] = 0x14;
7336 spec->autocfg.speaker_pins[0] = 0x1b;
7337 alc882_targa_automute(codec);
7340 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7342 if ((res >> 26) == ALC880_HP_EVENT)
7343 alc882_targa_automute(codec);
7346 static struct hda_verb alc882_asus_a7j_verbs[] = {
7347 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7348 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7350 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7352 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7354 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7355 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7356 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7358 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7359 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7360 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7364 static struct hda_verb alc882_asus_a7m_verbs[] = {
7365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7366 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7368 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7369 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7370 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7372 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7373 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7374 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7376 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7377 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7378 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7382 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7384 unsigned int gpiostate, gpiomask, gpiodir;
7386 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7387 AC_VERB_GET_GPIO_DATA, 0);
7390 gpiostate |= (1 << pin);
7392 gpiostate &= ~(1 << pin);
7394 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7395 AC_VERB_GET_GPIO_MASK, 0);
7396 gpiomask |= (1 << pin);
7398 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7399 AC_VERB_GET_GPIO_DIRECTION, 0);
7400 gpiodir |= (1 << pin);
7403 snd_hda_codec_write(codec, codec->afg, 0,
7404 AC_VERB_SET_GPIO_MASK, gpiomask);
7405 snd_hda_codec_write(codec, codec->afg, 0,
7406 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7410 snd_hda_codec_write(codec, codec->afg, 0,
7411 AC_VERB_SET_GPIO_DATA, gpiostate);
7414 /* set up GPIO at initialization */
7415 static void alc885_macpro_init_hook(struct hda_codec *codec)
7417 alc882_gpio_mute(codec, 0, 0);
7418 alc882_gpio_mute(codec, 1, 0);
7421 /* set up GPIO and update auto-muting at initialization */
7422 static void alc885_imac24_init_hook(struct hda_codec *codec)
7424 alc885_macpro_init_hook(codec);
7425 alc885_imac24_automute_init_hook(codec);
7429 * generic initialization of ADC, input mixers and output mixers
7431 static struct hda_verb alc883_auto_init_verbs[] = {
7433 * Unmute ADC0-2 and set the default input to mic-in
7435 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7436 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7437 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7438 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7440 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7442 * Note: PASD motherboards uses the Line In 2 as the input for
7443 * front panel mic (mic 2)
7445 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7446 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7447 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7448 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7449 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7450 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7453 * Set up output mixers (0x0c - 0x0f)
7455 /* set vol=0 to output mixers */
7456 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7457 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7458 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7459 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7460 /* set up input amps for analog loopback */
7461 /* Amp Indices: DAC = 0, mixer = 1 */
7462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7464 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7465 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7466 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7467 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7468 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7469 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7470 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7471 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7473 /* FIXME: use matrix-type input source selection */
7474 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7476 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7477 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7478 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7479 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7484 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7489 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7490 static struct hda_verb alc889A_mb31_ch2_init[] = {
7491 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7492 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7493 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7494 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7498 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7499 static struct hda_verb alc889A_mb31_ch4_init[] = {
7500 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7501 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7502 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7503 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7507 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7508 static struct hda_verb alc889A_mb31_ch5_init[] = {
7509 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7510 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7511 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7512 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7516 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7517 static struct hda_verb alc889A_mb31_ch6_init[] = {
7518 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7519 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7520 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7521 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7525 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7526 { 2, alc889A_mb31_ch2_init },
7527 { 4, alc889A_mb31_ch4_init },
7528 { 5, alc889A_mb31_ch5_init },
7529 { 6, alc889A_mb31_ch6_init },
7532 static struct hda_verb alc883_medion_eapd_verbs[] = {
7533 /* eanable EAPD on medion laptop */
7534 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7535 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7539 #define alc883_base_mixer alc882_base_mixer
7541 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7542 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7543 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7544 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7545 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7546 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7547 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7548 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7549 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7550 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7551 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7552 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7553 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7554 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7558 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7559 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7560 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7561 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7562 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7563 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7564 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7565 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7566 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7567 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7568 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7572 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7573 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7574 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7575 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7576 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7577 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7578 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7579 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7580 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7581 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7582 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7586 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7587 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7588 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7589 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7590 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7591 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7592 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7593 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7594 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7595 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7596 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7597 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7598 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7599 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7603 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7604 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7605 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7606 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7607 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7608 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7609 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7610 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7611 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7612 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7613 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7614 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7615 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7616 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7617 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7618 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7619 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7620 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7621 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7622 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7626 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7627 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7628 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7629 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7630 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7631 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7633 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7634 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7635 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7636 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7637 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7638 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7639 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7640 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7641 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7642 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7643 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7644 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7645 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7646 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7650 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7651 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7652 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7653 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7654 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7655 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7657 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7658 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7659 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7660 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7661 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7662 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7663 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7664 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7665 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7666 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7667 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7668 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7669 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7670 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7674 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7675 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7676 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7677 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7678 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7679 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7680 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7681 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7682 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7683 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7684 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7685 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7686 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7687 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7688 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7689 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7690 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7691 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7692 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7693 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7697 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7698 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7699 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7700 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7701 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7702 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7703 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7704 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7705 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7706 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7707 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7708 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7709 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7710 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7711 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7712 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7713 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7717 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7718 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7719 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7720 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7721 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7722 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7723 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7724 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7725 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7726 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7727 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7728 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7732 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7733 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7734 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7735 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7736 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7737 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7738 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7739 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7740 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7744 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7745 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7746 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7747 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7748 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7749 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7750 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7751 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7752 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7753 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7757 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7758 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7759 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7760 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7761 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7762 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7763 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7764 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7765 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7766 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7770 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7771 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7772 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7773 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7774 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7775 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7776 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7777 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7778 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7782 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
7783 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7784 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7785 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7786 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
7787 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7788 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7789 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7790 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7791 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7792 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7793 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7797 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7798 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7799 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7800 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7801 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7802 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7803 0x0d, 1, 0x0, HDA_OUTPUT),
7804 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7805 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7806 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7807 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7808 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7809 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7810 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7811 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7812 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7813 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7814 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7815 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7816 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7817 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7818 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7822 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
7824 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7825 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7826 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7827 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7828 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
7830 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
7831 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
7832 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
7833 /* Output switches */
7834 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
7835 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
7836 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
7838 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7839 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7841 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7842 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7843 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7844 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7848 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
7849 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7850 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7851 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7852 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7853 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7854 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7858 static struct hda_bind_ctls alc883_bind_cap_vol = {
7859 .ops = &snd_hda_bind_vol,
7861 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7862 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7867 static struct hda_bind_ctls alc883_bind_cap_switch = {
7868 .ops = &snd_hda_bind_sw,
7870 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7871 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7876 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7877 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7878 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7879 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7880 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7881 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7882 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7883 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7884 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7888 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7889 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7890 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7892 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7893 /* .name = "Capture Source", */
7894 .name = "Input Source",
7896 .info = alc_mux_enum_info,
7897 .get = alc_mux_enum_get,
7898 .put = alc_mux_enum_put,
7903 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7905 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7906 .name = "Channel Mode",
7907 .info = alc_ch_mode_info,
7908 .get = alc_ch_mode_get,
7909 .put = alc_ch_mode_put,
7914 /* toggle speaker-output according to the hp-jack state */
7915 static void alc883_mitac_init_hook(struct hda_codec *codec)
7917 struct alc_spec *spec = codec->spec;
7919 spec->autocfg.hp_pins[0] = 0x15;
7920 spec->autocfg.speaker_pins[0] = 0x14;
7921 spec->autocfg.speaker_pins[1] = 0x17;
7922 alc_automute_amp(codec);
7925 /* auto-toggle front mic */
7927 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7929 unsigned int present;
7932 present = snd_hda_codec_read(codec, 0x18, 0,
7933 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7934 bits = present ? HDA_AMP_MUTE : 0;
7935 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7939 static struct hda_verb alc883_mitac_verbs[] = {
7941 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7942 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7944 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7945 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7947 /* enable unsolicited event */
7948 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7949 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7954 static struct hda_verb alc883_clevo_m720_verbs[] = {
7956 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7959 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7960 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7962 /* enable unsolicited event */
7963 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7964 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7969 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7971 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7972 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7974 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7975 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7977 /* enable unsolicited event */
7978 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7983 static struct hda_verb alc883_targa_verbs[] = {
7984 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7985 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7987 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7988 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7990 /* Connect Line-Out side jack (SPDIF) to Side */
7991 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7992 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7993 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7994 /* Connect Mic jack to CLFE */
7995 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7996 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7997 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
7998 /* Connect Line-in jack to Surround */
7999 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8000 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8001 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8002 /* Connect HP out jack to Front */
8003 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8004 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8005 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8007 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8012 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8013 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8014 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8015 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8019 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8020 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8021 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8022 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8023 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8027 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8028 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8029 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8030 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8031 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8032 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8036 static struct hda_verb alc883_haier_w66_verbs[] = {
8037 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8038 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8040 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8042 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8043 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8044 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8045 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8049 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8050 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8051 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8052 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8053 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8054 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8055 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8056 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8057 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8061 static struct hda_verb alc888_6st_dell_verbs[] = {
8062 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8066 static struct hda_verb alc883_vaiott_verbs[] = {
8068 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8069 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8071 /* enable unsolicited event */
8072 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8077 static void alc888_3st_hp_init_hook(struct hda_codec *codec)
8079 struct alc_spec *spec = codec->spec;
8081 spec->autocfg.hp_pins[0] = 0x1b;
8082 spec->autocfg.speaker_pins[0] = 0x14;
8083 spec->autocfg.speaker_pins[1] = 0x16;
8084 spec->autocfg.speaker_pins[2] = 0x18;
8085 alc_automute_amp(codec);
8088 static struct hda_verb alc888_3st_hp_verbs[] = {
8089 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8090 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8091 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8092 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8099 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8100 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8101 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8102 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8103 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8110 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8111 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8112 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8113 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8114 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8115 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8122 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8123 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8124 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8125 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8126 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8127 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8128 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8132 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8133 { 2, alc888_3st_hp_2ch_init },
8134 { 4, alc888_3st_hp_4ch_init },
8135 { 6, alc888_3st_hp_6ch_init },
8138 /* toggle front-jack and RCA according to the hp-jack state */
8139 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8141 unsigned int present;
8143 present = snd_hda_codec_read(codec, 0x1b, 0,
8144 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8145 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8146 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8147 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8148 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8151 /* toggle RCA according to the front-jack state */
8152 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8154 unsigned int present;
8156 present = snd_hda_codec_read(codec, 0x14, 0,
8157 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8158 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8159 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8162 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8165 if ((res >> 26) == ALC880_HP_EVENT)
8166 alc888_lenovo_ms7195_front_automute(codec);
8167 if ((res >> 26) == ALC880_FRONT_EVENT)
8168 alc888_lenovo_ms7195_rca_automute(codec);
8171 static struct hda_verb alc883_medion_md2_verbs[] = {
8172 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8173 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8175 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8177 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8181 /* toggle speaker-output according to the hp-jack state */
8182 static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8184 struct alc_spec *spec = codec->spec;
8186 spec->autocfg.hp_pins[0] = 0x14;
8187 spec->autocfg.speaker_pins[0] = 0x15;
8188 alc_automute_amp(codec);
8191 /* toggle speaker-output according to the hp-jack state */
8192 #define alc883_targa_init_hook alc882_targa_init_hook
8193 #define alc883_targa_unsol_event alc882_targa_unsol_event
8195 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8197 unsigned int present;
8199 present = snd_hda_codec_read(codec, 0x18, 0,
8200 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8201 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8202 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8205 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8207 struct alc_spec *spec = codec->spec;
8209 spec->autocfg.hp_pins[0] = 0x15;
8210 spec->autocfg.speaker_pins[0] = 0x14;
8211 alc_automute_amp(codec);
8212 alc883_clevo_m720_mic_automute(codec);
8215 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8218 switch (res >> 26) {
8219 case ALC880_MIC_EVENT:
8220 alc883_clevo_m720_mic_automute(codec);
8223 alc_automute_amp_unsol_event(codec, res);
8228 /* toggle speaker-output according to the hp-jack state */
8229 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec)
8231 struct alc_spec *spec = codec->spec;
8233 spec->autocfg.hp_pins[0] = 0x14;
8234 spec->autocfg.speaker_pins[0] = 0x15;
8235 alc_automute_amp(codec);
8238 static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8240 struct alc_spec *spec = codec->spec;
8242 spec->autocfg.hp_pins[0] = 0x1b;
8243 spec->autocfg.speaker_pins[0] = 0x14;
8244 alc_automute_amp(codec);
8247 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8249 unsigned int present;
8252 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8253 & AC_PINSENSE_PRESENCE;
8254 bits = present ? HDA_AMP_MUTE : 0;
8255 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8256 HDA_AMP_MUTE, bits);
8259 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8261 unsigned int present;
8264 present = snd_hda_codec_read(codec, 0x1b, 0,
8265 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8266 bits = present ? HDA_AMP_MUTE : 0;
8267 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8268 HDA_AMP_MUTE, bits);
8269 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8270 HDA_AMP_MUTE, bits);
8273 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8276 if ((res >> 26) == ALC880_HP_EVENT)
8277 alc883_lenovo_101e_all_automute(codec);
8278 if ((res >> 26) == ALC880_FRONT_EVENT)
8279 alc883_lenovo_101e_ispeaker_automute(codec);
8282 /* toggle speaker-output according to the hp-jack state */
8283 static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8285 struct alc_spec *spec = codec->spec;
8287 spec->autocfg.hp_pins[0] = 0x14;
8288 spec->autocfg.speaker_pins[0] = 0x15;
8289 spec->autocfg.speaker_pins[1] = 0x16;
8290 alc_automute_amp(codec);
8293 static struct hda_verb alc883_acer_eapd_verbs[] = {
8294 /* HP Pin: output 0 (0x0c) */
8295 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8296 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8297 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8298 /* Front Pin: output 0 (0x0c) */
8299 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8300 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8301 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8302 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8303 /* eanable EAPD on medion laptop */
8304 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8305 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8306 /* enable unsolicited event */
8307 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8311 static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8313 struct alc_spec *spec = codec->spec;
8315 spec->autocfg.hp_pins[0] = 0x1b;
8316 spec->autocfg.speaker_pins[0] = 0x14;
8317 spec->autocfg.speaker_pins[1] = 0x15;
8318 spec->autocfg.speaker_pins[2] = 0x16;
8319 spec->autocfg.speaker_pins[3] = 0x17;
8320 alc_automute_amp(codec);
8323 static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8325 struct alc_spec *spec = codec->spec;
8327 spec->autocfg.hp_pins[0] = 0x1b;
8328 spec->autocfg.speaker_pins[0] = 0x14;
8329 spec->autocfg.speaker_pins[1] = 0x15;
8330 spec->autocfg.speaker_pins[2] = 0x16;
8331 spec->autocfg.speaker_pins[3] = 0x17;
8332 spec->autocfg.speaker_pins[4] = 0x1a;
8333 alc_automute_amp(codec);
8336 static void alc883_vaiott_init_hook(struct hda_codec *codec)
8338 struct alc_spec *spec = codec->spec;
8340 spec->autocfg.hp_pins[0] = 0x15;
8341 spec->autocfg.speaker_pins[0] = 0x14;
8342 spec->autocfg.speaker_pins[1] = 0x17;
8343 alc_automute_amp(codec);
8346 static struct hda_verb alc888_asus_m90v_verbs[] = {
8347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8350 /* enable unsolicited event */
8351 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8352 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8356 static void alc883_nb_mic_automute(struct hda_codec *codec)
8358 unsigned int present;
8360 present = snd_hda_codec_read(codec, 0x18, 0,
8361 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8362 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8363 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8364 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8365 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8368 static void alc883_M90V_init_hook(struct hda_codec *codec)
8370 struct alc_spec *spec = codec->spec;
8372 spec->autocfg.hp_pins[0] = 0x1b;
8373 spec->autocfg.speaker_pins[0] = 0x14;
8374 spec->autocfg.speaker_pins[1] = 0x15;
8375 spec->autocfg.speaker_pins[2] = 0x16;
8376 alc_automute_pin(codec);
8379 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8382 switch (res >> 26) {
8383 case ALC880_MIC_EVENT:
8384 alc883_nb_mic_automute(codec);
8387 alc_sku_unsol_event(codec, res);
8392 static void alc883_mode2_inithook(struct hda_codec *codec)
8394 alc883_M90V_init_hook(codec);
8395 alc883_nb_mic_automute(codec);
8398 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8399 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8400 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8402 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8403 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8404 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8405 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8406 /* enable unsolicited event */
8407 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8411 static void alc883_eee1601_inithook(struct hda_codec *codec)
8413 struct alc_spec *spec = codec->spec;
8415 spec->autocfg.hp_pins[0] = 0x14;
8416 spec->autocfg.speaker_pins[0] = 0x1b;
8417 alc_automute_pin(codec);
8420 static struct hda_verb alc889A_mb31_verbs[] = {
8421 /* Init rear pin (used as headphone output) */
8422 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8423 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8424 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8425 /* Init line pin (used as output in 4ch and 6ch mode) */
8426 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8427 /* Init line 2 pin (used as headphone out by default) */
8428 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8429 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8433 /* Mute speakers according to the headphone jack state */
8434 static void alc889A_mb31_automute(struct hda_codec *codec)
8436 unsigned int present;
8438 /* Mute only in 2ch or 4ch mode */
8439 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8441 present = snd_hda_codec_read(codec, 0x15, 0,
8442 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8443 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8444 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8445 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8446 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8450 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8452 if ((res >> 26) == ALC880_HP_EVENT)
8453 alc889A_mb31_automute(codec);
8457 #ifdef CONFIG_SND_HDA_POWER_SAVE
8458 #define alc882_loopbacks alc880_loopbacks
8461 /* pcm configuration: identical with ALC880 */
8462 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8463 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8464 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8465 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8467 static hda_nid_t alc883_slave_dig_outs[] = {
8468 ALC1200_DIGOUT_NID, 0,
8471 static hda_nid_t alc1200_slave_dig_outs[] = {
8472 ALC883_DIGOUT_NID, 0,
8476 * configuration and preset
8478 static const char *alc882_models[ALC882_MODEL_LAST] = {
8479 [ALC882_3ST_DIG] = "3stack-dig",
8480 [ALC882_6ST_DIG] = "6stack-dig",
8481 [ALC882_ARIMA] = "arima",
8482 [ALC882_W2JC] = "w2jc",
8483 [ALC882_TARGA] = "targa",
8484 [ALC882_ASUS_A7J] = "asus-a7j",
8485 [ALC882_ASUS_A7M] = "asus-a7m",
8486 [ALC885_MACPRO] = "macpro",
8487 [ALC885_MB5] = "mb5",
8488 [ALC885_MBP3] = "mbp3",
8489 [ALC885_IMAC24] = "imac24",
8490 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8491 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8492 [ALC883_3ST_6ch] = "3stack-6ch",
8493 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8494 [ALC883_TARGA_DIG] = "targa-dig",
8495 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8496 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8497 [ALC883_ACER] = "acer",
8498 [ALC883_ACER_ASPIRE] = "acer-aspire",
8499 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8500 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8501 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8502 [ALC883_MEDION] = "medion",
8503 [ALC883_MEDION_MD2] = "medion-md2",
8504 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8505 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8506 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8507 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8508 [ALC888_LENOVO_SKY] = "lenovo-sky",
8509 [ALC883_HAIER_W66] = "haier-w66",
8510 [ALC888_3ST_HP] = "3stack-hp",
8511 [ALC888_6ST_DELL] = "6stack-dell",
8512 [ALC883_MITAC] = "mitac",
8513 [ALC883_CLEVO_M720] = "clevo-m720",
8514 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8515 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8516 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8517 [ALC889A_INTEL] = "intel-alc889a",
8518 [ALC889_INTEL] = "intel-x58",
8519 [ALC1200_ASUS_P5Q] = "asus-p5q",
8520 [ALC889A_MB31] = "mb31",
8521 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8522 [ALC882_AUTO] = "auto",
8525 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8526 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8528 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8529 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8530 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8531 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8532 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8533 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8534 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8535 ALC888_ACER_ASPIRE_4930G),
8536 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8537 ALC888_ACER_ASPIRE_4930G),
8538 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8539 ALC888_ACER_ASPIRE_8930G),
8540 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8541 ALC888_ACER_ASPIRE_8930G),
8542 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8543 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8544 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8545 ALC888_ACER_ASPIRE_6530G),
8546 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8547 ALC888_ACER_ASPIRE_6530G),
8548 /* default Acer -- disabled as it causes more problems.
8549 * model=auto should work fine now
8551 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8553 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8555 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8556 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8557 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8558 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8559 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8560 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8562 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8563 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8564 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8565 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8566 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8567 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8568 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8569 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8570 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8571 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8572 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8574 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8575 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8576 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8577 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8578 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8579 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8580 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8581 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8582 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8584 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8585 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8586 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8587 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8588 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8589 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8590 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8591 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8592 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8593 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8594 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8595 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8596 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8597 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8598 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8599 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8600 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8601 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8602 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8603 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8604 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8605 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8606 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8607 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8608 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8609 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8610 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8611 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8612 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8614 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8615 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8616 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8617 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8618 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8619 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8620 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8621 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8622 ALC883_FUJITSU_PI2515),
8623 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8624 ALC888_FUJITSU_XA3530),
8625 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8626 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8627 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8628 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8629 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8630 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8631 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8632 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8633 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8635 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8636 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8637 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8638 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8639 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8640 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8641 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8646 /* codec SSID table for Intel Mac */
8647 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8648 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8649 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8650 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8651 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8652 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8653 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8654 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8655 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8656 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8657 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8658 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8659 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8660 * no perfect solution yet
8662 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8666 static struct alc_config_preset alc882_presets[] = {
8667 [ALC882_3ST_DIG] = {
8668 .mixers = { alc882_base_mixer },
8669 .init_verbs = { alc882_base_init_verbs,
8670 alc882_adc1_init_verbs },
8671 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8672 .dac_nids = alc882_dac_nids,
8673 .dig_out_nid = ALC882_DIGOUT_NID,
8674 .dig_in_nid = ALC882_DIGIN_NID,
8675 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8676 .channel_mode = alc882_ch_modes,
8678 .input_mux = &alc882_capture_source,
8680 [ALC882_6ST_DIG] = {
8681 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8682 .init_verbs = { alc882_base_init_verbs,
8683 alc882_adc1_init_verbs },
8684 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8685 .dac_nids = alc882_dac_nids,
8686 .dig_out_nid = ALC882_DIGOUT_NID,
8687 .dig_in_nid = ALC882_DIGIN_NID,
8688 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8689 .channel_mode = alc882_sixstack_modes,
8690 .input_mux = &alc882_capture_source,
8693 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8694 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8695 alc882_eapd_verbs },
8696 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8697 .dac_nids = alc882_dac_nids,
8698 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8699 .channel_mode = alc882_sixstack_modes,
8700 .input_mux = &alc882_capture_source,
8703 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8704 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8705 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8706 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8707 .dac_nids = alc882_dac_nids,
8708 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8709 .channel_mode = alc880_threestack_modes,
8711 .input_mux = &alc882_capture_source,
8712 .dig_out_nid = ALC882_DIGOUT_NID,
8715 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8716 .init_verbs = { alc885_mbp3_init_verbs,
8717 alc880_gpio1_init_verbs },
8718 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8719 .dac_nids = alc882_dac_nids,
8720 .channel_mode = alc885_mbp_6ch_modes,
8721 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
8722 .input_mux = &alc882_capture_source,
8723 .dig_out_nid = ALC882_DIGOUT_NID,
8724 .dig_in_nid = ALC882_DIGIN_NID,
8725 .unsol_event = alc_automute_amp_unsol_event,
8726 .init_hook = alc885_mbp3_init_hook,
8729 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8730 .init_verbs = { alc885_mb5_init_verbs,
8731 alc880_gpio1_init_verbs },
8732 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8733 .dac_nids = alc882_dac_nids,
8734 .channel_mode = alc885_mb5_6ch_modes,
8735 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8736 .input_mux = &mb5_capture_source,
8737 .dig_out_nid = ALC882_DIGOUT_NID,
8738 .dig_in_nid = ALC882_DIGIN_NID,
8741 .mixers = { alc882_macpro_mixer },
8742 .init_verbs = { alc882_macpro_init_verbs },
8743 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8744 .dac_nids = alc882_dac_nids,
8745 .dig_out_nid = ALC882_DIGOUT_NID,
8746 .dig_in_nid = ALC882_DIGIN_NID,
8747 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8748 .channel_mode = alc882_ch_modes,
8749 .input_mux = &alc882_capture_source,
8750 .init_hook = alc885_macpro_init_hook,
8753 .mixers = { alc885_imac24_mixer },
8754 .init_verbs = { alc885_imac24_init_verbs },
8755 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8756 .dac_nids = alc882_dac_nids,
8757 .dig_out_nid = ALC882_DIGOUT_NID,
8758 .dig_in_nid = ALC882_DIGIN_NID,
8759 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8760 .channel_mode = alc882_ch_modes,
8761 .input_mux = &alc882_capture_source,
8762 .unsol_event = alc_automute_amp_unsol_event,
8763 .init_hook = alc885_imac24_init_hook,
8766 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
8767 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8768 alc880_gpio3_init_verbs, alc882_targa_verbs},
8769 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8770 .dac_nids = alc882_dac_nids,
8771 .dig_out_nid = ALC882_DIGOUT_NID,
8772 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8773 .adc_nids = alc882_adc_nids,
8774 .capsrc_nids = alc882_capsrc_nids,
8775 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8776 .channel_mode = alc882_3ST_6ch_modes,
8778 .input_mux = &alc882_capture_source,
8779 .unsol_event = alc882_targa_unsol_event,
8780 .init_hook = alc882_targa_init_hook,
8782 [ALC882_ASUS_A7J] = {
8783 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
8784 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8785 alc882_asus_a7j_verbs},
8786 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8787 .dac_nids = alc882_dac_nids,
8788 .dig_out_nid = ALC882_DIGOUT_NID,
8789 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8790 .adc_nids = alc882_adc_nids,
8791 .capsrc_nids = alc882_capsrc_nids,
8792 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8793 .channel_mode = alc882_3ST_6ch_modes,
8795 .input_mux = &alc882_capture_source,
8797 [ALC882_ASUS_A7M] = {
8798 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
8799 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8800 alc882_eapd_verbs, alc880_gpio1_init_verbs,
8801 alc882_asus_a7m_verbs },
8802 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8803 .dac_nids = alc882_dac_nids,
8804 .dig_out_nid = ALC882_DIGOUT_NID,
8805 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8806 .channel_mode = alc880_threestack_modes,
8808 .input_mux = &alc882_capture_source,
8810 [ALC883_3ST_2ch_DIG] = {
8811 .mixers = { alc883_3ST_2ch_mixer },
8812 .init_verbs = { alc883_init_verbs },
8813 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8814 .dac_nids = alc883_dac_nids,
8815 .dig_out_nid = ALC883_DIGOUT_NID,
8816 .dig_in_nid = ALC883_DIGIN_NID,
8817 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8818 .channel_mode = alc883_3ST_2ch_modes,
8819 .input_mux = &alc883_capture_source,
8821 [ALC883_3ST_6ch_DIG] = {
8822 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8823 .init_verbs = { alc883_init_verbs },
8824 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8825 .dac_nids = alc883_dac_nids,
8826 .dig_out_nid = ALC883_DIGOUT_NID,
8827 .dig_in_nid = ALC883_DIGIN_NID,
8828 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8829 .channel_mode = alc883_3ST_6ch_modes,
8831 .input_mux = &alc883_capture_source,
8833 [ALC883_3ST_6ch] = {
8834 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8835 .init_verbs = { alc883_init_verbs },
8836 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8837 .dac_nids = alc883_dac_nids,
8838 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8839 .channel_mode = alc883_3ST_6ch_modes,
8841 .input_mux = &alc883_capture_source,
8843 [ALC883_3ST_6ch_INTEL] = {
8844 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8845 .init_verbs = { alc883_init_verbs },
8846 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8847 .dac_nids = alc883_dac_nids,
8848 .dig_out_nid = ALC883_DIGOUT_NID,
8849 .dig_in_nid = ALC883_DIGIN_NID,
8850 .slave_dig_outs = alc883_slave_dig_outs,
8851 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8852 .channel_mode = alc883_3ST_6ch_intel_modes,
8854 .input_mux = &alc883_3stack_6ch_intel,
8857 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
8858 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs },
8859 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8860 .dac_nids = alc883_dac_nids,
8861 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
8862 .adc_nids = alc889_adc_nids,
8863 .dig_out_nid = ALC883_DIGOUT_NID,
8864 .dig_in_nid = ALC883_DIGIN_NID,
8865 .slave_dig_outs = alc883_slave_dig_outs,
8866 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
8867 .channel_mode = alc889_8ch_intel_modes,
8868 .capsrc_nids = alc889_capsrc_nids,
8869 .input_mux = &alc889_capture_source,
8873 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
8874 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
8875 alc889_eapd_verbs },
8876 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8877 .dac_nids = alc883_dac_nids,
8878 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
8879 .adc_nids = alc889_adc_nids,
8880 .dig_out_nid = ALC883_DIGOUT_NID,
8881 .dig_in_nid = ALC883_DIGIN_NID,
8882 .slave_dig_outs = alc883_slave_dig_outs,
8883 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
8884 .channel_mode = alc889_8ch_intel_modes,
8885 .capsrc_nids = alc889_capsrc_nids,
8886 .input_mux = &alc889_capture_source,
8887 .init_hook = alc889_coef_init,
8890 [ALC883_6ST_DIG] = {
8891 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8892 .init_verbs = { alc883_init_verbs },
8893 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8894 .dac_nids = alc883_dac_nids,
8895 .dig_out_nid = ALC883_DIGOUT_NID,
8896 .dig_in_nid = ALC883_DIGIN_NID,
8897 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8898 .channel_mode = alc883_sixstack_modes,
8899 .input_mux = &alc883_capture_source,
8901 [ALC883_TARGA_DIG] = {
8902 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
8903 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
8904 alc883_targa_verbs},
8905 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8906 .dac_nids = alc883_dac_nids,
8907 .dig_out_nid = ALC883_DIGOUT_NID,
8908 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8909 .channel_mode = alc883_3ST_6ch_modes,
8911 .input_mux = &alc883_capture_source,
8912 .unsol_event = alc883_targa_unsol_event,
8913 .init_hook = alc883_targa_init_hook,
8915 [ALC883_TARGA_2ch_DIG] = {
8916 .mixers = { alc883_targa_2ch_mixer},
8917 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
8918 alc883_targa_verbs},
8919 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8920 .dac_nids = alc883_dac_nids,
8921 .adc_nids = alc883_adc_nids_alt,
8922 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8923 .dig_out_nid = ALC883_DIGOUT_NID,
8924 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8925 .channel_mode = alc883_3ST_2ch_modes,
8926 .input_mux = &alc883_capture_source,
8927 .unsol_event = alc883_targa_unsol_event,
8928 .init_hook = alc883_targa_init_hook,
8930 [ALC883_TARGA_8ch_DIG] = {
8931 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8932 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
8933 alc883_targa_verbs },
8934 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8935 .dac_nids = alc883_dac_nids,
8936 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8937 .adc_nids = alc883_adc_nids_rev,
8938 .capsrc_nids = alc883_capsrc_nids_rev,
8939 .dig_out_nid = ALC883_DIGOUT_NID,
8940 .dig_in_nid = ALC883_DIGIN_NID,
8941 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
8942 .channel_mode = alc883_4ST_8ch_modes,
8944 .input_mux = &alc883_capture_source,
8945 .unsol_event = alc883_targa_unsol_event,
8946 .init_hook = alc883_targa_init_hook,
8949 .mixers = { alc883_base_mixer },
8950 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8951 * and the headphone jack. Turn this on and rely on the
8952 * standard mute methods whenever the user wants to turn
8953 * these outputs off.
8955 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8956 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8957 .dac_nids = alc883_dac_nids,
8958 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8959 .channel_mode = alc883_3ST_2ch_modes,
8960 .input_mux = &alc883_capture_source,
8962 [ALC883_ACER_ASPIRE] = {
8963 .mixers = { alc883_acer_aspire_mixer },
8964 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8965 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8966 .dac_nids = alc883_dac_nids,
8967 .dig_out_nid = ALC883_DIGOUT_NID,
8968 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8969 .channel_mode = alc883_3ST_2ch_modes,
8970 .input_mux = &alc883_capture_source,
8971 .unsol_event = alc_automute_amp_unsol_event,
8972 .init_hook = alc883_acer_aspire_init_hook,
8974 [ALC888_ACER_ASPIRE_4930G] = {
8975 .mixers = { alc888_base_mixer,
8976 alc883_chmode_mixer },
8977 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8978 alc888_acer_aspire_4930g_verbs },
8979 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8980 .dac_nids = alc883_dac_nids,
8981 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8982 .adc_nids = alc883_adc_nids_rev,
8983 .capsrc_nids = alc883_capsrc_nids_rev,
8984 .dig_out_nid = ALC883_DIGOUT_NID,
8985 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8986 .channel_mode = alc883_3ST_6ch_modes,
8989 ARRAY_SIZE(alc888_2_capture_sources),
8990 .input_mux = alc888_2_capture_sources,
8991 .unsol_event = alc_automute_amp_unsol_event,
8992 .init_hook = alc888_acer_aspire_4930g_init_hook,
8994 [ALC888_ACER_ASPIRE_6530G] = {
8995 .mixers = { alc888_acer_aspire_6530_mixer },
8996 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8997 alc888_acer_aspire_6530g_verbs },
8998 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8999 .dac_nids = alc883_dac_nids,
9000 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9001 .adc_nids = alc883_adc_nids_rev,
9002 .capsrc_nids = alc883_capsrc_nids_rev,
9003 .dig_out_nid = ALC883_DIGOUT_NID,
9004 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9005 .channel_mode = alc883_3ST_2ch_modes,
9007 ARRAY_SIZE(alc888_2_capture_sources),
9008 .input_mux = alc888_acer_aspire_6530_sources,
9009 .unsol_event = alc_automute_amp_unsol_event,
9010 .init_hook = alc888_acer_aspire_6530g_init_hook,
9012 [ALC888_ACER_ASPIRE_8930G] = {
9013 .mixers = { alc888_base_mixer,
9014 alc883_chmode_mixer },
9015 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9016 alc889_acer_aspire_8930g_verbs },
9017 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9018 .dac_nids = alc883_dac_nids,
9019 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9020 .adc_nids = alc889_adc_nids,
9021 .capsrc_nids = alc889_capsrc_nids,
9022 .dig_out_nid = ALC883_DIGOUT_NID,
9023 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9024 .channel_mode = alc883_3ST_6ch_modes,
9026 .const_channel_count = 6,
9028 ARRAY_SIZE(alc889_capture_sources),
9029 .input_mux = alc889_capture_sources,
9030 .unsol_event = alc_automute_amp_unsol_event,
9031 .init_hook = alc889_acer_aspire_8930g_init_hook,
9034 .mixers = { alc883_fivestack_mixer,
9035 alc883_chmode_mixer },
9036 .init_verbs = { alc883_init_verbs,
9037 alc883_medion_eapd_verbs },
9038 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9039 .dac_nids = alc883_dac_nids,
9040 .adc_nids = alc883_adc_nids_alt,
9041 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9042 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9043 .channel_mode = alc883_sixstack_modes,
9044 .input_mux = &alc883_capture_source,
9046 [ALC883_MEDION_MD2] = {
9047 .mixers = { alc883_medion_md2_mixer},
9048 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9049 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9050 .dac_nids = alc883_dac_nids,
9051 .dig_out_nid = ALC883_DIGOUT_NID,
9052 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9053 .channel_mode = alc883_3ST_2ch_modes,
9054 .input_mux = &alc883_capture_source,
9055 .unsol_event = alc_automute_amp_unsol_event,
9056 .init_hook = alc883_medion_md2_init_hook,
9058 [ALC883_LAPTOP_EAPD] = {
9059 .mixers = { alc883_base_mixer },
9060 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9061 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9062 .dac_nids = alc883_dac_nids,
9063 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9064 .channel_mode = alc883_3ST_2ch_modes,
9065 .input_mux = &alc883_capture_source,
9067 [ALC883_CLEVO_M720] = {
9068 .mixers = { alc883_clevo_m720_mixer },
9069 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9070 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9071 .dac_nids = alc883_dac_nids,
9072 .dig_out_nid = ALC883_DIGOUT_NID,
9073 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9074 .channel_mode = alc883_3ST_2ch_modes,
9075 .input_mux = &alc883_capture_source,
9076 .unsol_event = alc883_clevo_m720_unsol_event,
9077 .init_hook = alc883_clevo_m720_init_hook,
9079 [ALC883_LENOVO_101E_2ch] = {
9080 .mixers = { alc883_lenovo_101e_2ch_mixer},
9081 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9082 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9083 .dac_nids = alc883_dac_nids,
9084 .adc_nids = alc883_adc_nids_alt,
9085 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9086 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9087 .channel_mode = alc883_3ST_2ch_modes,
9088 .input_mux = &alc883_lenovo_101e_capture_source,
9089 .unsol_event = alc883_lenovo_101e_unsol_event,
9090 .init_hook = alc883_lenovo_101e_all_automute,
9092 [ALC883_LENOVO_NB0763] = {
9093 .mixers = { alc883_lenovo_nb0763_mixer },
9094 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9095 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9096 .dac_nids = alc883_dac_nids,
9097 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9098 .channel_mode = alc883_3ST_2ch_modes,
9100 .input_mux = &alc883_lenovo_nb0763_capture_source,
9101 .unsol_event = alc_automute_amp_unsol_event,
9102 .init_hook = alc883_medion_md2_init_hook,
9104 [ALC888_LENOVO_MS7195_DIG] = {
9105 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9106 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9107 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9108 .dac_nids = alc883_dac_nids,
9109 .dig_out_nid = ALC883_DIGOUT_NID,
9110 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9111 .channel_mode = alc883_3ST_6ch_modes,
9113 .input_mux = &alc883_capture_source,
9114 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9115 .init_hook = alc888_lenovo_ms7195_front_automute,
9117 [ALC883_HAIER_W66] = {
9118 .mixers = { alc883_targa_2ch_mixer},
9119 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9120 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9121 .dac_nids = alc883_dac_nids,
9122 .dig_out_nid = ALC883_DIGOUT_NID,
9123 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9124 .channel_mode = alc883_3ST_2ch_modes,
9125 .input_mux = &alc883_capture_source,
9126 .unsol_event = alc_automute_amp_unsol_event,
9127 .init_hook = alc883_haier_w66_init_hook,
9130 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9131 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9132 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9133 .dac_nids = alc883_dac_nids,
9134 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9135 .channel_mode = alc888_3st_hp_modes,
9137 .input_mux = &alc883_capture_source,
9138 .unsol_event = alc_automute_amp_unsol_event,
9139 .init_hook = alc888_3st_hp_init_hook,
9141 [ALC888_6ST_DELL] = {
9142 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9143 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9144 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9145 .dac_nids = alc883_dac_nids,
9146 .dig_out_nid = ALC883_DIGOUT_NID,
9147 .dig_in_nid = ALC883_DIGIN_NID,
9148 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9149 .channel_mode = alc883_sixstack_modes,
9150 .input_mux = &alc883_capture_source,
9151 .unsol_event = alc_automute_amp_unsol_event,
9152 .init_hook = alc888_6st_dell_init_hook,
9155 .mixers = { alc883_mitac_mixer },
9156 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9157 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9158 .dac_nids = alc883_dac_nids,
9159 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9160 .channel_mode = alc883_3ST_2ch_modes,
9161 .input_mux = &alc883_capture_source,
9162 .unsol_event = alc_automute_amp_unsol_event,
9163 .init_hook = alc883_mitac_init_hook,
9165 [ALC883_FUJITSU_PI2515] = {
9166 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9167 .init_verbs = { alc883_init_verbs,
9168 alc883_2ch_fujitsu_pi2515_verbs},
9169 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9170 .dac_nids = alc883_dac_nids,
9171 .dig_out_nid = ALC883_DIGOUT_NID,
9172 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9173 .channel_mode = alc883_3ST_2ch_modes,
9174 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9175 .unsol_event = alc_automute_amp_unsol_event,
9176 .init_hook = alc883_2ch_fujitsu_pi2515_init_hook,
9178 [ALC888_FUJITSU_XA3530] = {
9179 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9180 .init_verbs = { alc883_init_verbs,
9181 alc888_fujitsu_xa3530_verbs },
9182 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9183 .dac_nids = alc883_dac_nids,
9184 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9185 .adc_nids = alc883_adc_nids_rev,
9186 .capsrc_nids = alc883_capsrc_nids_rev,
9187 .dig_out_nid = ALC883_DIGOUT_NID,
9188 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9189 .channel_mode = alc888_4ST_8ch_intel_modes,
9191 ARRAY_SIZE(alc888_2_capture_sources),
9192 .input_mux = alc888_2_capture_sources,
9193 .unsol_event = alc_automute_amp_unsol_event,
9194 .init_hook = alc888_fujitsu_xa3530_init_hook,
9196 [ALC888_LENOVO_SKY] = {
9197 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9198 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9199 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9200 .dac_nids = alc883_dac_nids,
9201 .dig_out_nid = ALC883_DIGOUT_NID,
9202 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9203 .channel_mode = alc883_sixstack_modes,
9205 .input_mux = &alc883_lenovo_sky_capture_source,
9206 .unsol_event = alc_automute_amp_unsol_event,
9207 .init_hook = alc888_lenovo_sky_init_hook,
9209 [ALC888_ASUS_M90V] = {
9210 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9211 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9212 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9213 .dac_nids = alc883_dac_nids,
9214 .dig_out_nid = ALC883_DIGOUT_NID,
9215 .dig_in_nid = ALC883_DIGIN_NID,
9216 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9217 .channel_mode = alc883_3ST_6ch_modes,
9219 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9220 .unsol_event = alc883_mode2_unsol_event,
9221 .init_hook = alc883_mode2_inithook,
9223 [ALC888_ASUS_EEE1601] = {
9224 .mixers = { alc883_asus_eee1601_mixer },
9225 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9226 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9227 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9228 .dac_nids = alc883_dac_nids,
9229 .dig_out_nid = ALC883_DIGOUT_NID,
9230 .dig_in_nid = ALC883_DIGIN_NID,
9231 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9232 .channel_mode = alc883_3ST_2ch_modes,
9234 .input_mux = &alc883_asus_eee1601_capture_source,
9235 .unsol_event = alc_sku_unsol_event,
9236 .init_hook = alc883_eee1601_inithook,
9238 [ALC1200_ASUS_P5Q] = {
9239 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9240 .init_verbs = { alc883_init_verbs },
9241 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9242 .dac_nids = alc883_dac_nids,
9243 .dig_out_nid = ALC1200_DIGOUT_NID,
9244 .dig_in_nid = ALC883_DIGIN_NID,
9245 .slave_dig_outs = alc1200_slave_dig_outs,
9246 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9247 .channel_mode = alc883_sixstack_modes,
9248 .input_mux = &alc883_capture_source,
9251 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9252 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9253 alc880_gpio1_init_verbs },
9254 .adc_nids = alc883_adc_nids,
9255 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9256 .dac_nids = alc883_dac_nids,
9257 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9258 .channel_mode = alc889A_mb31_6ch_modes,
9259 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9260 .input_mux = &alc889A_mb31_capture_source,
9261 .dig_out_nid = ALC883_DIGOUT_NID,
9262 .unsol_event = alc889A_mb31_unsol_event,
9263 .init_hook = alc889A_mb31_automute,
9265 [ALC883_SONY_VAIO_TT] = {
9266 .mixers = { alc883_vaiott_mixer },
9267 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9268 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9269 .dac_nids = alc883_dac_nids,
9270 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9271 .channel_mode = alc883_3ST_2ch_modes,
9272 .input_mux = &alc883_capture_source,
9273 .unsol_event = alc_automute_amp_unsol_event,
9274 .init_hook = alc883_vaiott_init_hook,
9283 PINFIX_ABIT_AW9D_MAX
9286 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9287 { 0x15, 0x01080104 }, /* side */
9288 { 0x16, 0x01011012 }, /* rear */
9289 { 0x17, 0x01016011 }, /* clfe */
9293 static const struct alc_pincfg *alc882_pin_fixes[] = {
9294 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
9297 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
9298 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9303 * BIOS auto configuration
9305 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9306 hda_nid_t nid, int pin_type,
9310 struct alc_spec *spec = codec->spec;
9313 alc_set_pin_output(codec, nid, pin_type);
9314 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9317 idx = spec->multiout.dac_nids[dac_idx] - 2;
9318 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9322 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9324 struct alc_spec *spec = codec->spec;
9327 for (i = 0; i <= HDA_SIDE; i++) {
9328 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9329 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9331 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9336 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9338 struct alc_spec *spec = codec->spec;
9341 pin = spec->autocfg.hp_pins[0];
9342 if (pin) /* connect to front */
9344 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9345 pin = spec->autocfg.speaker_pins[0];
9347 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9350 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9352 struct alc_spec *spec = codec->spec;
9355 for (i = 0; i < AUTO_PIN_LAST; i++) {
9356 hda_nid_t nid = spec->autocfg.input_pins[i];
9359 alc_set_input_pin(codec, nid, i);
9360 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9361 snd_hda_codec_write(codec, nid, 0,
9362 AC_VERB_SET_AMP_GAIN_MUTE,
9367 static void alc882_auto_init_input_src(struct hda_codec *codec)
9369 struct alc_spec *spec = codec->spec;
9372 for (c = 0; c < spec->num_adc_nids; c++) {
9373 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9374 hda_nid_t nid = spec->capsrc_nids[c];
9375 unsigned int mux_idx;
9376 const struct hda_input_mux *imux;
9377 int conns, mute, idx, item;
9379 conns = snd_hda_get_connections(codec, nid, conn_list,
9380 ARRAY_SIZE(conn_list));
9383 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9384 imux = &spec->input_mux[mux_idx];
9385 for (idx = 0; idx < conns; idx++) {
9386 /* if the current connection is the selected one,
9387 * unmute it as default - otherwise mute it
9389 mute = AMP_IN_MUTE(idx);
9390 for (item = 0; item < imux->num_items; item++) {
9391 if (imux->items[item].index == idx) {
9392 if (spec->cur_mux[c] == item)
9393 mute = AMP_IN_UNMUTE(idx);
9397 /* check if we have a selector or mixer
9398 * we could check for the widget type instead, but
9399 * just check for Amp-In presence (in case of mixer
9400 * without amp-in there is something wrong, this
9401 * function shouldn't be used or capsrc nid is wrong)
9403 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9404 snd_hda_codec_write(codec, nid, 0,
9405 AC_VERB_SET_AMP_GAIN_MUTE,
9407 else if (mute != AMP_IN_MUTE(idx))
9408 snd_hda_codec_write(codec, nid, 0,
9409 AC_VERB_SET_CONNECT_SEL,
9415 /* add mic boosts if needed */
9416 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9418 struct alc_spec *spec = codec->spec;
9422 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9423 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9424 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9426 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9430 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9431 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9432 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9434 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9441 /* almost identical with ALC880 parser... */
9442 static int alc882_parse_auto_config(struct hda_codec *codec)
9444 struct alc_spec *spec = codec->spec;
9445 struct auto_pin_cfg *autocfg = &spec->autocfg;
9448 int err = alc880_parse_auto_config(codec);
9453 return 0; /* no config found */
9455 err = alc_auto_add_mic_boost(codec);
9459 /* hack - override the init verbs */
9460 spec->init_verbs[0] = alc883_auto_init_verbs;
9461 /* if ADC 0x07 is available, initialize it, too */
9462 wcap = get_wcaps(codec, 0x07);
9463 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9464 if (wcap == AC_WID_AUD_IN)
9465 add_verb(spec, alc882_adc1_init_verbs);
9467 /* digital-mic input pin is excluded in alc880_auto_create..()
9468 * because it's under 0x18
9470 if (autocfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9471 autocfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9472 struct hda_input_mux *imux = &spec->private_imux[0];
9473 for (i = 1; i < 3; i++)
9474 memcpy(&spec->private_imux[i],
9475 &spec->private_imux[0],
9476 sizeof(spec->private_imux[0]));
9477 imux->items[imux->num_items].label = "Int DMic";
9478 imux->items[imux->num_items].index = 0x0b;
9480 spec->num_mux_defs = 3;
9481 spec->input_mux = spec->private_imux;
9484 return 1; /* config found */
9487 /* additional initialization for auto-configuration model */
9488 static void alc882_auto_init(struct hda_codec *codec)
9490 struct alc_spec *spec = codec->spec;
9491 alc882_auto_init_multi_out(codec);
9492 alc882_auto_init_hp_out(codec);
9493 alc882_auto_init_analog_input(codec);
9494 alc882_auto_init_input_src(codec);
9495 if (spec->unsol_event)
9496 alc_inithook(codec);
9499 static int patch_alc882(struct hda_codec *codec)
9501 struct alc_spec *spec;
9502 int err, board_config;
9504 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9510 switch (codec->vendor_id) {
9515 /* ALC883 and variants */
9516 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9520 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9524 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9525 board_config = snd_hda_check_board_codec_sid_config(codec,
9526 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9528 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9529 printk(KERN_INFO "hda_codec: Unknown model for %s, "
9530 "trying auto-probe from BIOS...\n",
9532 board_config = ALC882_AUTO;
9535 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
9537 if (board_config == ALC882_AUTO) {
9538 /* automatic parse from the BIOS config */
9539 err = alc882_parse_auto_config(codec);
9545 "hda_codec: Cannot set up configuration "
9546 "from BIOS. Using base mode...\n");
9547 board_config = ALC882_3ST_DIG;
9551 err = snd_hda_attach_beep_device(codec, 0x1);
9557 if (board_config != ALC882_AUTO)
9558 setup_preset(spec, &alc882_presets[board_config]);
9560 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9561 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9562 /* FIXME: setup DAC5 */
9563 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9564 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9566 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9567 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9569 if (codec->vendor_id == 0x10ec0888)
9570 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9572 if (!spec->adc_nids && spec->input_mux) {
9574 spec->num_adc_nids = 0;
9575 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9577 hda_nid_t nid = alc882_adc_nids[i];
9578 unsigned int wcap = get_wcaps(codec, nid);
9580 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9581 if (wcap != AC_WID_AUD_IN)
9583 spec->private_adc_nids[spec->num_adc_nids] = nid;
9584 err = snd_hda_get_connections(codec, nid, &cap, 1);
9587 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9588 spec->num_adc_nids++;
9590 spec->adc_nids = spec->private_adc_nids;
9591 spec->capsrc_nids = spec->private_capsrc_nids;
9594 set_capture_mixer(spec);
9595 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9597 spec->vmaster_nid = 0x0c;
9599 codec->patch_ops = alc_patch_ops;
9600 if (board_config == ALC882_AUTO)
9601 spec->init_hook = alc882_auto_init;
9602 #ifdef CONFIG_SND_HDA_POWER_SAVE
9603 if (!spec->loopback.amplist)
9604 spec->loopback.amplist = alc882_loopbacks;
9606 codec->proc_widget_hook = print_realtek_coef;
9616 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9617 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9619 #define alc262_dac_nids alc260_dac_nids
9620 #define alc262_adc_nids alc882_adc_nids
9621 #define alc262_adc_nids_alt alc882_adc_nids_alt
9622 #define alc262_capsrc_nids alc882_capsrc_nids
9623 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9625 #define alc262_modes alc260_modes
9626 #define alc262_capture_source alc882_capture_source
9628 static hda_nid_t alc262_dmic_adc_nids[1] = {
9633 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9635 static struct snd_kcontrol_new alc262_base_mixer[] = {
9636 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9637 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9638 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9639 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9640 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9641 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9643 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9644 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9645 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9646 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9647 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9648 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9649 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9650 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9651 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9655 /* update HP, line and mono-out pins according to the master switch */
9656 static void alc262_hp_master_update(struct hda_codec *codec)
9658 struct alc_spec *spec = codec->spec;
9659 int val = spec->master_sw;
9662 snd_hda_codec_write_cache(codec, 0x1b, 0,
9663 AC_VERB_SET_PIN_WIDGET_CONTROL,
9665 snd_hda_codec_write_cache(codec, 0x15, 0,
9666 AC_VERB_SET_PIN_WIDGET_CONTROL,
9668 /* mono (speaker) depending on the HP jack sense */
9669 val = val && !spec->jack_present;
9670 snd_hda_codec_write_cache(codec, 0x16, 0,
9671 AC_VERB_SET_PIN_WIDGET_CONTROL,
9675 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9677 struct alc_spec *spec = codec->spec;
9678 unsigned int presence;
9679 presence = snd_hda_codec_read(codec, 0x1b, 0,
9680 AC_VERB_GET_PIN_SENSE, 0);
9681 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9682 alc262_hp_master_update(codec);
9685 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9687 if ((res >> 26) != ALC880_HP_EVENT)
9689 alc262_hp_bpc_automute(codec);
9692 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9694 struct alc_spec *spec = codec->spec;
9695 unsigned int presence;
9696 presence = snd_hda_codec_read(codec, 0x15, 0,
9697 AC_VERB_GET_PIN_SENSE, 0);
9698 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9699 alc262_hp_master_update(codec);
9702 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9705 if ((res >> 26) != ALC880_HP_EVENT)
9707 alc262_hp_wildwest_automute(codec);
9710 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9712 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9713 struct snd_ctl_elem_value *ucontrol)
9715 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9716 struct alc_spec *spec = codec->spec;
9717 int val = !!*ucontrol->value.integer.value;
9719 if (val == spec->master_sw)
9721 spec->master_sw = val;
9722 alc262_hp_master_update(codec);
9726 #define ALC262_HP_MASTER_SWITCH \
9728 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9729 .name = "Master Playback Switch", \
9730 .info = snd_ctl_boolean_mono_info, \
9731 .get = alc262_hp_master_sw_get, \
9732 .put = alc262_hp_master_sw_put, \
9735 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9736 ALC262_HP_MASTER_SWITCH,
9737 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9738 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9739 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9740 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9742 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9744 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9745 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9746 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9747 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9748 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9749 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9750 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9751 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9752 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9753 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9754 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9755 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9759 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9760 ALC262_HP_MASTER_SWITCH,
9761 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9762 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9763 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9764 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9765 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9767 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9769 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9770 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9771 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9772 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9773 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9774 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9775 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9779 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9780 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9781 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9782 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9786 /* mute/unmute internal speaker according to the hp jack and mute state */
9787 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9789 struct alc_spec *spec = codec->spec;
9791 spec->autocfg.hp_pins[0] = 0x15;
9792 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9793 alc_automute_amp(codec);
9796 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9797 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9798 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9799 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9800 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9801 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9802 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9803 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9807 static struct hda_verb alc262_hp_t5735_verbs[] = {
9808 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9809 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9811 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9815 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9816 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9817 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9818 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9819 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9820 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9821 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9825 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9826 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9827 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9828 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9829 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9830 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9831 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9832 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9833 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9834 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9835 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9839 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9846 /* bind hp and internal speaker mute (with plug check) as master switch */
9847 static void alc262_hippo_master_update(struct hda_codec *codec)
9849 struct alc_spec *spec = codec->spec;
9850 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9851 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9852 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9856 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
9857 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
9858 HDA_AMP_MUTE, mute);
9859 /* mute internal speaker per jack sense */
9860 if (spec->jack_present)
9861 mute = HDA_AMP_MUTE;
9863 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
9864 HDA_AMP_MUTE, mute);
9865 if (speaker_nid && speaker_nid != line_nid)
9866 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
9867 HDA_AMP_MUTE, mute);
9870 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
9872 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
9873 struct snd_ctl_elem_value *ucontrol)
9875 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9876 struct alc_spec *spec = codec->spec;
9877 int val = !!*ucontrol->value.integer.value;
9879 if (val == spec->master_sw)
9881 spec->master_sw = val;
9882 alc262_hippo_master_update(codec);
9886 #define ALC262_HIPPO_MASTER_SWITCH \
9888 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9889 .name = "Master Playback Switch", \
9890 .info = snd_ctl_boolean_mono_info, \
9891 .get = alc262_hippo_master_sw_get, \
9892 .put = alc262_hippo_master_sw_put, \
9895 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
9896 ALC262_HIPPO_MASTER_SWITCH,
9897 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9898 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9899 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9900 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9901 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9904 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9905 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9906 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9907 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9908 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9912 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9913 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9914 ALC262_HIPPO_MASTER_SWITCH,
9915 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9916 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9917 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9918 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9919 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9920 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9921 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9922 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9923 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9924 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9928 /* mute/unmute internal speaker according to the hp jack and mute state */
9929 static void alc262_hippo_automute(struct hda_codec *codec)
9931 struct alc_spec *spec = codec->spec;
9932 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9933 unsigned int present;
9935 /* need to execute and sync at first */
9936 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
9937 present = snd_hda_codec_read(codec, hp_nid, 0,
9938 AC_VERB_GET_PIN_SENSE, 0);
9939 spec->jack_present = (present & 0x80000000) != 0;
9940 alc262_hippo_master_update(codec);
9943 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
9945 if ((res >> 26) != ALC880_HP_EVENT)
9947 alc262_hippo_automute(codec);
9950 static void alc262_hippo_init_hook(struct hda_codec *codec)
9952 struct alc_spec *spec = codec->spec;
9954 spec->autocfg.hp_pins[0] = 0x15;
9955 spec->autocfg.speaker_pins[0] = 0x14;
9956 alc262_hippo_automute(codec);
9959 static void alc262_hippo1_init_hook(struct hda_codec *codec)
9961 struct alc_spec *spec = codec->spec;
9963 spec->autocfg.hp_pins[0] = 0x1b;
9964 spec->autocfg.speaker_pins[0] = 0x14;
9965 alc262_hippo_automute(codec);
9969 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9970 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9971 ALC262_HIPPO_MASTER_SWITCH,
9972 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9973 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9974 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9975 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9979 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9980 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9981 ALC262_HIPPO_MASTER_SWITCH,
9982 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9983 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9985 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9986 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9990 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9991 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9992 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9993 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9994 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9995 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9996 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9999 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10000 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10001 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10002 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10006 static struct hda_verb alc262_tyan_verbs[] = {
10007 /* Headphone automute */
10008 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10009 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10010 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10012 /* P11 AUX_IN, white 4-pin connector */
10013 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10014 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10015 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10016 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10021 /* unsolicited event for HP jack sensing */
10022 static void alc262_tyan_init_hook(struct hda_codec *codec)
10024 struct alc_spec *spec = codec->spec;
10026 spec->autocfg.hp_pins[0] = 0x1b;
10027 spec->autocfg.speaker_pins[0] = 0x15;
10028 alc_automute_amp(codec);
10032 #define alc262_capture_mixer alc882_capture_mixer
10033 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10036 * generic initialization of ADC, input mixers and output mixers
10038 static struct hda_verb alc262_init_verbs[] = {
10040 * Unmute ADC0-2 and set the default input to mic-in
10042 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10043 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10044 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10045 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10046 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10047 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10049 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10051 * Note: PASD motherboards uses the Line In 2 as the input for
10052 * front panel mic (mic 2)
10054 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10055 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10056 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10057 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10058 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10059 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10062 * Set up output mixers (0x0c - 0x0e)
10064 /* set vol=0 to output mixers */
10065 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10066 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10067 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10068 /* set up input amps for analog loopback */
10069 /* Amp Indices: DAC = 0, mixer = 1 */
10070 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10071 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10072 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10073 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10074 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10075 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10077 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10078 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10079 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10080 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10081 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10082 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10084 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10085 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10086 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10087 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10088 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10090 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10091 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10093 /* FIXME: use matrix-type input source selection */
10094 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10095 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10096 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10097 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10098 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10099 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10101 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10102 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10103 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10104 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10106 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10107 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10108 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10114 static struct hda_verb alc262_eapd_verbs[] = {
10115 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10116 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10120 static struct hda_verb alc262_hippo_unsol_verbs[] = {
10121 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10122 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10126 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10127 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10128 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10129 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10131 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10132 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10136 static struct hda_verb alc262_sony_unsol_verbs[] = {
10137 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10138 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10139 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10141 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10142 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10146 static struct hda_input_mux alc262_dmic_capture_source = {
10149 { "Int DMic", 0x9 },
10154 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10155 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10156 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10157 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10158 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10159 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10163 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10164 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10165 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10167 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10168 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10169 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10170 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10171 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10175 static void alc262_dmic_automute(struct hda_codec *codec)
10177 unsigned int present;
10179 present = snd_hda_codec_read(codec, 0x18, 0,
10180 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10181 snd_hda_codec_write(codec, 0x22, 0,
10182 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
10186 /* unsolicited event for HP jack sensing */
10187 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
10190 if ((res >> 26) == ALC880_MIC_EVENT)
10191 alc262_dmic_automute(codec);
10193 alc_sku_unsol_event(codec, res);
10196 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
10198 struct alc_spec *spec = codec->spec;
10200 spec->autocfg.hp_pins[0] = 0x15;
10201 spec->autocfg.speaker_pins[0] = 0x14;
10202 alc_automute_pin(codec);
10203 alc262_dmic_automute(codec);
10209 * 0x16 = internal speaker
10210 * 0x18 = external mic
10213 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10214 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10215 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10218 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10219 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10221 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10222 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10226 static struct hda_verb alc262_nec_verbs[] = {
10227 /* Unmute Speaker */
10228 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10231 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10232 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10234 /* External mic to headphone */
10235 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10236 /* External mic to speaker */
10237 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10243 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10244 * 0x1b = port replicator headphone out
10247 #define ALC_HP_EVENT 0x37
10249 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10250 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10251 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10252 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10253 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10257 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10258 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10259 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10263 static struct hda_input_mux alc262_fujitsu_capture_source = {
10267 { "Int Mic", 0x1 },
10272 static struct hda_input_mux alc262_HP_capture_source = {
10276 { "Front Mic", 0x1 },
10283 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10287 { "Front Mic", 0x2 },
10293 /* mute/unmute internal speaker according to the hp jacks and mute state */
10294 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10296 struct alc_spec *spec = codec->spec;
10299 if (force || !spec->sense_updated) {
10300 unsigned int present;
10301 /* need to execute and sync at first */
10302 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10303 /* check laptop HP jack */
10304 present = snd_hda_codec_read(codec, 0x14, 0,
10305 AC_VERB_GET_PIN_SENSE, 0);
10306 /* need to execute and sync at first */
10307 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10308 /* check docking HP jack */
10309 present |= snd_hda_codec_read(codec, 0x1b, 0,
10310 AC_VERB_GET_PIN_SENSE, 0);
10311 if (present & AC_PINSENSE_PRESENCE)
10312 spec->jack_present = 1;
10314 spec->jack_present = 0;
10315 spec->sense_updated = 1;
10317 /* unmute internal speaker only if both HPs are unplugged and
10318 * master switch is on
10320 if (spec->jack_present)
10321 mute = HDA_AMP_MUTE;
10323 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10324 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10325 HDA_AMP_MUTE, mute);
10328 /* unsolicited event for HP jack sensing */
10329 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10332 if ((res >> 26) != ALC_HP_EVENT)
10334 alc262_fujitsu_automute(codec, 1);
10337 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10339 alc262_fujitsu_automute(codec, 1);
10342 /* bind volumes of both NID 0x0c and 0x0d */
10343 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10344 .ops = &snd_hda_bind_vol,
10346 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10347 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10352 /* mute/unmute internal speaker according to the hp jack and mute state */
10353 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10355 struct alc_spec *spec = codec->spec;
10358 if (force || !spec->sense_updated) {
10359 unsigned int present_int_hp;
10360 /* need to execute and sync at first */
10361 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10362 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10363 AC_VERB_GET_PIN_SENSE, 0);
10364 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10365 spec->sense_updated = 1;
10367 if (spec->jack_present) {
10368 /* mute internal speaker */
10369 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10370 HDA_AMP_MUTE, HDA_AMP_MUTE);
10371 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10372 HDA_AMP_MUTE, HDA_AMP_MUTE);
10374 /* unmute internal speaker if necessary */
10375 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10376 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10377 HDA_AMP_MUTE, mute);
10378 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10379 HDA_AMP_MUTE, mute);
10383 /* unsolicited event for HP jack sensing */
10384 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10387 if ((res >> 26) != ALC_HP_EVENT)
10389 alc262_lenovo_3000_automute(codec, 1);
10392 /* bind hp and internal speaker mute (with plug check) */
10393 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10394 struct snd_ctl_elem_value *ucontrol)
10396 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10397 long *valp = ucontrol->value.integer.value;
10400 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10402 valp ? 0 : HDA_AMP_MUTE);
10403 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10405 valp ? 0 : HDA_AMP_MUTE);
10408 alc262_fujitsu_automute(codec, 0);
10412 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10413 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10415 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10416 .name = "Master Playback Switch",
10417 .info = snd_hda_mixer_amp_switch_info,
10418 .get = snd_hda_mixer_amp_switch_get,
10419 .put = alc262_fujitsu_master_sw_put,
10420 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10422 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10423 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10424 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10425 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10426 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10427 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10428 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10429 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10433 /* bind hp and internal speaker mute (with plug check) */
10434 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10435 struct snd_ctl_elem_value *ucontrol)
10437 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10438 long *valp = ucontrol->value.integer.value;
10441 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10443 valp ? 0 : HDA_AMP_MUTE);
10446 alc262_lenovo_3000_automute(codec, 0);
10450 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10451 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10453 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10454 .name = "Master Playback Switch",
10455 .info = snd_hda_mixer_amp_switch_info,
10456 .get = snd_hda_mixer_amp_switch_get,
10457 .put = alc262_lenovo_3000_master_sw_put,
10458 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10460 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10461 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10462 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10463 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10464 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10465 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10466 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10467 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10471 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10472 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10473 ALC262_HIPPO_MASTER_SWITCH,
10474 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10475 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10476 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10477 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10478 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10479 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10483 /* additional init verbs for Benq laptops */
10484 static struct hda_verb alc262_EAPD_verbs[] = {
10485 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10486 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10490 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10491 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10492 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10494 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10495 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10499 /* Samsung Q1 Ultra Vista model setup */
10500 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10501 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10502 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10503 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10504 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10505 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10506 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10510 static struct hda_verb alc262_ultra_verbs[] = {
10512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10513 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10514 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10516 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10517 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10518 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10519 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10521 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10522 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10523 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10524 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10525 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10527 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10528 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10529 /* ADC, choose mic */
10530 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10531 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10532 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10533 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10534 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10535 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10536 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10537 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10538 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10539 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10543 /* mute/unmute internal speaker according to the hp jack and mute state */
10544 static void alc262_ultra_automute(struct hda_codec *codec)
10546 struct alc_spec *spec = codec->spec;
10550 /* auto-mute only when HP is used as HP */
10551 if (!spec->cur_mux[0]) {
10552 unsigned int present;
10553 /* need to execute and sync at first */
10554 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10555 present = snd_hda_codec_read(codec, 0x15, 0,
10556 AC_VERB_GET_PIN_SENSE, 0);
10557 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10558 if (spec->jack_present)
10559 mute = HDA_AMP_MUTE;
10561 /* mute/unmute internal speaker */
10562 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10563 HDA_AMP_MUTE, mute);
10564 /* mute/unmute HP */
10565 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10566 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10569 /* unsolicited event for HP jack sensing */
10570 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10573 if ((res >> 26) != ALC880_HP_EVENT)
10575 alc262_ultra_automute(codec);
10578 static struct hda_input_mux alc262_ultra_capture_source = {
10582 { "Headphone", 0x7 },
10586 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10587 struct snd_ctl_elem_value *ucontrol)
10589 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10590 struct alc_spec *spec = codec->spec;
10593 ret = alc_mux_enum_put(kcontrol, ucontrol);
10596 /* reprogram the HP pin as mic or HP according to the input source */
10597 snd_hda_codec_write_cache(codec, 0x15, 0,
10598 AC_VERB_SET_PIN_WIDGET_CONTROL,
10599 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10600 alc262_ultra_automute(codec); /* mute/unmute HP */
10604 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10605 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10606 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10608 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10609 .name = "Capture Source",
10610 .info = alc_mux_enum_info,
10611 .get = alc_mux_enum_get,
10612 .put = alc262_ultra_mux_enum_put,
10617 /* add playback controls from the parsed DAC table */
10618 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10619 const struct auto_pin_cfg *cfg)
10624 spec->multiout.num_dacs = 1; /* only use one dac */
10625 spec->multiout.dac_nids = spec->private_dac_nids;
10626 spec->multiout.dac_nids[0] = 2;
10628 nid = cfg->line_out_pins[0];
10630 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10631 "Front Playback Volume",
10632 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10635 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10636 "Front Playback Switch",
10637 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10642 nid = cfg->speaker_pins[0];
10645 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10646 "Speaker Playback Volume",
10647 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10651 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10652 "Speaker Playback Switch",
10653 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10658 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10659 "Speaker Playback Switch",
10660 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10666 nid = cfg->hp_pins[0];
10668 /* spec->multiout.hp_nid = 2; */
10670 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10671 "Headphone Playback Volume",
10672 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10676 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10677 "Headphone Playback Switch",
10678 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10683 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10684 "Headphone Playback Switch",
10685 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10694 static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec,
10695 const struct auto_pin_cfg *cfg)
10699 err = alc880_auto_create_analog_input_ctls(spec, cfg);
10702 /* digital-mic input pin is excluded in alc880_auto_create..()
10703 * because it's under 0x18
10705 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
10706 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
10707 struct hda_input_mux *imux = &spec->private_imux[0];
10708 imux->items[imux->num_items].label = "Int Mic";
10709 imux->items[imux->num_items].index = 0x09;
10717 * generic initialization of ADC, input mixers and output mixers
10719 static struct hda_verb alc262_volume_init_verbs[] = {
10721 * Unmute ADC0-2 and set the default input to mic-in
10723 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10724 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10725 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10726 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10727 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10728 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10730 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10732 * Note: PASD motherboards uses the Line In 2 as the input for
10733 * front panel mic (mic 2)
10735 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10736 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10737 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10738 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10739 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10740 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10743 * Set up output mixers (0x0c - 0x0f)
10745 /* set vol=0 to output mixers */
10746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10747 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10748 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10750 /* set up input amps for analog loopback */
10751 /* Amp Indices: DAC = 0, mixer = 1 */
10752 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10753 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10754 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10755 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10756 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10757 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10759 /* FIXME: use matrix-type input source selection */
10760 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10761 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10762 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10763 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10764 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10765 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10767 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10768 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10769 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10770 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10775 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10780 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10782 * Unmute ADC0-2 and set the default input to mic-in
10784 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10785 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10786 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10787 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10788 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10789 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10791 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10793 * Note: PASD motherboards uses the Line In 2 as the input for
10794 * front panel mic (mic 2)
10796 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10797 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10798 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10799 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10800 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10801 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10802 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10803 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10806 * Set up output mixers (0x0c - 0x0e)
10808 /* set vol=0 to output mixers */
10809 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10810 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10811 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10813 /* set up input amps for analog loopback */
10814 /* Amp Indices: DAC = 0, mixer = 1 */
10815 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10817 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10818 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10819 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10820 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10822 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10823 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10824 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10826 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10827 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10829 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10830 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10832 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10833 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10834 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10835 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10836 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10838 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10839 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10840 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10841 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10842 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10843 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10846 /* FIXME: use matrix-type input source selection */
10847 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
10848 /* Input mixer1: only unmute Mic */
10849 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10850 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10851 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10852 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10853 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10854 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10855 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10856 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10857 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10859 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10860 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10861 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10862 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10863 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10864 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10865 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10866 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10867 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10869 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10870 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10871 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10872 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10873 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10874 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10875 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10876 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10877 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10879 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10884 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10886 * Unmute ADC0-2 and set the default input to mic-in
10888 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10889 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10890 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10891 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10892 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10893 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10895 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10897 * Note: PASD motherboards uses the Line In 2 as the input for front
10898 * panel mic (mic 2)
10900 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10901 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10902 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10903 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10904 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10905 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10906 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10907 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10908 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10910 * Set up output mixers (0x0c - 0x0e)
10912 /* set vol=0 to output mixers */
10913 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10914 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10915 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10917 /* set up input amps for analog loopback */
10918 /* Amp Indices: DAC = 0, mixer = 1 */
10919 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10920 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10921 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10922 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10923 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10924 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10927 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10928 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10929 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10930 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10931 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10932 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10933 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10935 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10936 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10938 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10939 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10941 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10942 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10943 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10944 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10945 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10946 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10948 /* FIXME: use matrix-type input source selection */
10949 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10950 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10951 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10952 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10953 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10954 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10955 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10956 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10957 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10959 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10960 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10961 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10962 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10963 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10964 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10965 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10967 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10968 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10969 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10970 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10971 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10972 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10973 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10975 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10980 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10982 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10983 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10984 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10986 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10987 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10988 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10989 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10991 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10992 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10993 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10998 #ifdef CONFIG_SND_HDA_POWER_SAVE
10999 #define alc262_loopbacks alc880_loopbacks
11002 /* pcm configuration: identical with ALC880 */
11003 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11004 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11005 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11006 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11009 * BIOS auto configuration
11011 static int alc262_parse_auto_config(struct hda_codec *codec)
11013 struct alc_spec *spec = codec->spec;
11015 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11017 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11021 if (!spec->autocfg.line_outs) {
11022 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11023 spec->multiout.max_channels = 2;
11024 spec->no_analog = 1;
11027 return 0; /* can't find valid BIOS pin config */
11029 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11032 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
11036 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11039 if (spec->autocfg.dig_outs) {
11040 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11041 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11043 if (spec->autocfg.dig_in_pin)
11044 spec->dig_in_nid = ALC262_DIGIN_NID;
11046 if (spec->kctls.list)
11047 add_mixer(spec, spec->kctls.list);
11049 add_verb(spec, alc262_volume_init_verbs);
11050 spec->num_mux_defs = 1;
11051 spec->input_mux = &spec->private_imux[0];
11053 err = alc_auto_add_mic_boost(codec);
11057 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11062 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11063 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11064 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11065 #define alc262_auto_init_input_src alc882_auto_init_input_src
11068 /* init callback for auto-configuration model -- overriding the default init */
11069 static void alc262_auto_init(struct hda_codec *codec)
11071 struct alc_spec *spec = codec->spec;
11072 alc262_auto_init_multi_out(codec);
11073 alc262_auto_init_hp_out(codec);
11074 alc262_auto_init_analog_input(codec);
11075 alc262_auto_init_input_src(codec);
11076 if (spec->unsol_event)
11077 alc_inithook(codec);
11081 * configuration and preset
11083 static const char *alc262_models[ALC262_MODEL_LAST] = {
11084 [ALC262_BASIC] = "basic",
11085 [ALC262_HIPPO] = "hippo",
11086 [ALC262_HIPPO_1] = "hippo_1",
11087 [ALC262_FUJITSU] = "fujitsu",
11088 [ALC262_HP_BPC] = "hp-bpc",
11089 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11090 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11091 [ALC262_HP_RP5700] = "hp-rp5700",
11092 [ALC262_BENQ_ED8] = "benq",
11093 [ALC262_BENQ_T31] = "benq-t31",
11094 [ALC262_SONY_ASSAMD] = "sony-assamd",
11095 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11096 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11097 [ALC262_ULTRA] = "ultra",
11098 [ALC262_LENOVO_3000] = "lenovo-3000",
11099 [ALC262_NEC] = "nec",
11100 [ALC262_TYAN] = "tyan",
11101 [ALC262_AUTO] = "auto",
11104 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11105 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11106 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11107 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11109 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11111 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11113 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11114 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11115 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11116 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11117 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11118 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11119 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11120 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11121 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11122 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11123 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11124 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11125 ALC262_HP_TC_T5735),
11126 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11127 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11128 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11129 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11130 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11131 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11132 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11133 ALC262_SONY_ASSAMD),
11134 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11135 ALC262_TOSHIBA_RX1),
11136 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11137 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11138 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11139 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11140 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11142 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11143 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11144 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11145 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11146 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11150 static struct alc_config_preset alc262_presets[] = {
11152 .mixers = { alc262_base_mixer },
11153 .init_verbs = { alc262_init_verbs },
11154 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11155 .dac_nids = alc262_dac_nids,
11157 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11158 .channel_mode = alc262_modes,
11159 .input_mux = &alc262_capture_source,
11162 .mixers = { alc262_hippo_mixer },
11163 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
11164 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11165 .dac_nids = alc262_dac_nids,
11167 .dig_out_nid = ALC262_DIGOUT_NID,
11168 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11169 .channel_mode = alc262_modes,
11170 .input_mux = &alc262_capture_source,
11171 .unsol_event = alc262_hippo_unsol_event,
11172 .init_hook = alc262_hippo_init_hook,
11174 [ALC262_HIPPO_1] = {
11175 .mixers = { alc262_hippo1_mixer },
11176 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11177 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11178 .dac_nids = alc262_dac_nids,
11180 .dig_out_nid = ALC262_DIGOUT_NID,
11181 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11182 .channel_mode = alc262_modes,
11183 .input_mux = &alc262_capture_source,
11184 .unsol_event = alc262_hippo_unsol_event,
11185 .init_hook = alc262_hippo1_init_hook,
11187 [ALC262_FUJITSU] = {
11188 .mixers = { alc262_fujitsu_mixer },
11189 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11190 alc262_fujitsu_unsol_verbs },
11191 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11192 .dac_nids = alc262_dac_nids,
11194 .dig_out_nid = ALC262_DIGOUT_NID,
11195 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11196 .channel_mode = alc262_modes,
11197 .input_mux = &alc262_fujitsu_capture_source,
11198 .unsol_event = alc262_fujitsu_unsol_event,
11199 .init_hook = alc262_fujitsu_init_hook,
11201 [ALC262_HP_BPC] = {
11202 .mixers = { alc262_HP_BPC_mixer },
11203 .init_verbs = { alc262_HP_BPC_init_verbs },
11204 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11205 .dac_nids = alc262_dac_nids,
11207 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11208 .channel_mode = alc262_modes,
11209 .input_mux = &alc262_HP_capture_source,
11210 .unsol_event = alc262_hp_bpc_unsol_event,
11211 .init_hook = alc262_hp_bpc_automute,
11213 [ALC262_HP_BPC_D7000_WF] = {
11214 .mixers = { alc262_HP_BPC_WildWest_mixer },
11215 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11216 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11217 .dac_nids = alc262_dac_nids,
11219 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11220 .channel_mode = alc262_modes,
11221 .input_mux = &alc262_HP_D7000_capture_source,
11222 .unsol_event = alc262_hp_wildwest_unsol_event,
11223 .init_hook = alc262_hp_wildwest_automute,
11225 [ALC262_HP_BPC_D7000_WL] = {
11226 .mixers = { alc262_HP_BPC_WildWest_mixer,
11227 alc262_HP_BPC_WildWest_option_mixer },
11228 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11229 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11230 .dac_nids = alc262_dac_nids,
11232 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11233 .channel_mode = alc262_modes,
11234 .input_mux = &alc262_HP_D7000_capture_source,
11235 .unsol_event = alc262_hp_wildwest_unsol_event,
11236 .init_hook = alc262_hp_wildwest_automute,
11238 [ALC262_HP_TC_T5735] = {
11239 .mixers = { alc262_hp_t5735_mixer },
11240 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11241 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11242 .dac_nids = alc262_dac_nids,
11244 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11245 .channel_mode = alc262_modes,
11246 .input_mux = &alc262_capture_source,
11247 .unsol_event = alc_automute_amp_unsol_event,
11248 .init_hook = alc262_hp_t5735_init_hook,
11250 [ALC262_HP_RP5700] = {
11251 .mixers = { alc262_hp_rp5700_mixer },
11252 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11253 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11254 .dac_nids = alc262_dac_nids,
11255 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11256 .channel_mode = alc262_modes,
11257 .input_mux = &alc262_hp_rp5700_capture_source,
11259 [ALC262_BENQ_ED8] = {
11260 .mixers = { alc262_base_mixer },
11261 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11262 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11263 .dac_nids = alc262_dac_nids,
11265 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11266 .channel_mode = alc262_modes,
11267 .input_mux = &alc262_capture_source,
11269 [ALC262_SONY_ASSAMD] = {
11270 .mixers = { alc262_sony_mixer },
11271 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11272 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11273 .dac_nids = alc262_dac_nids,
11275 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11276 .channel_mode = alc262_modes,
11277 .input_mux = &alc262_capture_source,
11278 .unsol_event = alc262_hippo_unsol_event,
11279 .init_hook = alc262_hippo_init_hook,
11281 [ALC262_BENQ_T31] = {
11282 .mixers = { alc262_benq_t31_mixer },
11283 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
11284 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11285 .dac_nids = alc262_dac_nids,
11287 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11288 .channel_mode = alc262_modes,
11289 .input_mux = &alc262_capture_source,
11290 .unsol_event = alc262_hippo_unsol_event,
11291 .init_hook = alc262_hippo_init_hook,
11294 .mixers = { alc262_ultra_mixer },
11295 .cap_mixer = alc262_ultra_capture_mixer,
11296 .init_verbs = { alc262_ultra_verbs },
11297 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11298 .dac_nids = alc262_dac_nids,
11299 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11300 .channel_mode = alc262_modes,
11301 .input_mux = &alc262_ultra_capture_source,
11302 .adc_nids = alc262_adc_nids, /* ADC0 */
11303 .capsrc_nids = alc262_capsrc_nids,
11304 .num_adc_nids = 1, /* single ADC */
11305 .unsol_event = alc262_ultra_unsol_event,
11306 .init_hook = alc262_ultra_automute,
11308 [ALC262_LENOVO_3000] = {
11309 .mixers = { alc262_lenovo_3000_mixer },
11310 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11311 alc262_lenovo_3000_unsol_verbs },
11312 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11313 .dac_nids = alc262_dac_nids,
11315 .dig_out_nid = ALC262_DIGOUT_NID,
11316 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11317 .channel_mode = alc262_modes,
11318 .input_mux = &alc262_fujitsu_capture_source,
11319 .unsol_event = alc262_lenovo_3000_unsol_event,
11322 .mixers = { alc262_nec_mixer },
11323 .init_verbs = { alc262_nec_verbs },
11324 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11325 .dac_nids = alc262_dac_nids,
11327 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11328 .channel_mode = alc262_modes,
11329 .input_mux = &alc262_capture_source,
11331 [ALC262_TOSHIBA_S06] = {
11332 .mixers = { alc262_toshiba_s06_mixer },
11333 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11334 alc262_eapd_verbs },
11335 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11336 .capsrc_nids = alc262_dmic_capsrc_nids,
11337 .dac_nids = alc262_dac_nids,
11338 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11339 .num_adc_nids = 1, /* single ADC */
11340 .dig_out_nid = ALC262_DIGOUT_NID,
11341 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11342 .channel_mode = alc262_modes,
11343 .input_mux = &alc262_dmic_capture_source,
11344 .unsol_event = alc262_toshiba_s06_unsol_event,
11345 .init_hook = alc262_toshiba_s06_init_hook,
11347 [ALC262_TOSHIBA_RX1] = {
11348 .mixers = { alc262_toshiba_rx1_mixer },
11349 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11350 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11351 .dac_nids = alc262_dac_nids,
11353 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11354 .channel_mode = alc262_modes,
11355 .input_mux = &alc262_capture_source,
11356 .unsol_event = alc262_hippo_unsol_event,
11357 .init_hook = alc262_hippo_init_hook,
11360 .mixers = { alc262_tyan_mixer },
11361 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11362 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11363 .dac_nids = alc262_dac_nids,
11365 .dig_out_nid = ALC262_DIGOUT_NID,
11366 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11367 .channel_mode = alc262_modes,
11368 .input_mux = &alc262_capture_source,
11369 .unsol_event = alc_automute_amp_unsol_event,
11370 .init_hook = alc262_tyan_init_hook,
11374 static int patch_alc262(struct hda_codec *codec)
11376 struct alc_spec *spec;
11380 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11384 codec->spec = spec;
11386 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11391 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11392 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11393 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11394 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11398 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11400 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11404 if (board_config < 0) {
11405 printk(KERN_INFO "hda_codec: Unknown model for %s, "
11406 "trying auto-probe from BIOS...\n", codec->chip_name);
11407 board_config = ALC262_AUTO;
11410 if (board_config == ALC262_AUTO) {
11411 /* automatic parse from the BIOS config */
11412 err = alc262_parse_auto_config(codec);
11418 "hda_codec: Cannot set up configuration "
11419 "from BIOS. Using base mode...\n");
11420 board_config = ALC262_BASIC;
11424 if (!spec->no_analog) {
11425 err = snd_hda_attach_beep_device(codec, 0x1);
11432 if (board_config != ALC262_AUTO)
11433 setup_preset(spec, &alc262_presets[board_config]);
11435 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11436 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11438 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11439 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11441 if (!spec->adc_nids && spec->input_mux) {
11443 /* check whether the digital-mic has to be supported */
11444 for (i = 0; i < spec->input_mux->num_items; i++) {
11445 if (spec->input_mux->items[i].index >= 9)
11448 if (i < spec->input_mux->num_items) {
11449 /* use only ADC0 */
11450 spec->adc_nids = alc262_dmic_adc_nids;
11451 spec->num_adc_nids = 1;
11452 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11454 /* all analog inputs */
11455 /* check whether NID 0x07 is valid */
11456 unsigned int wcap = get_wcaps(codec, 0x07);
11459 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11460 if (wcap != AC_WID_AUD_IN) {
11461 spec->adc_nids = alc262_adc_nids_alt;
11462 spec->num_adc_nids =
11463 ARRAY_SIZE(alc262_adc_nids_alt);
11464 spec->capsrc_nids = alc262_capsrc_nids_alt;
11466 spec->adc_nids = alc262_adc_nids;
11467 spec->num_adc_nids =
11468 ARRAY_SIZE(alc262_adc_nids);
11469 spec->capsrc_nids = alc262_capsrc_nids;
11473 if (!spec->cap_mixer && !spec->no_analog)
11474 set_capture_mixer(spec);
11475 if (!spec->no_analog)
11476 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11478 spec->vmaster_nid = 0x0c;
11480 codec->patch_ops = alc_patch_ops;
11481 if (board_config == ALC262_AUTO)
11482 spec->init_hook = alc262_auto_init;
11483 #ifdef CONFIG_SND_HDA_POWER_SAVE
11484 if (!spec->loopback.amplist)
11485 spec->loopback.amplist = alc262_loopbacks;
11487 codec->proc_widget_hook = print_realtek_coef;
11493 * ALC268 channel source setting (2 channel)
11495 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11496 #define alc268_modes alc260_modes
11498 static hda_nid_t alc268_dac_nids[2] = {
11503 static hda_nid_t alc268_adc_nids[2] = {
11508 static hda_nid_t alc268_adc_nids_alt[1] = {
11513 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11515 static struct snd_kcontrol_new alc268_base_mixer[] = {
11516 /* output mixer control */
11517 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11518 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11519 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11520 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11521 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11522 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11523 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11527 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11528 /* output mixer control */
11529 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11530 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11531 ALC262_HIPPO_MASTER_SWITCH,
11532 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11533 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11534 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11538 /* bind Beep switches of both NID 0x0f and 0x10 */
11539 static struct hda_bind_ctls alc268_bind_beep_sw = {
11540 .ops = &snd_hda_bind_sw,
11542 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11543 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11548 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11549 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11550 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11554 static struct hda_verb alc268_eapd_verbs[] = {
11555 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11556 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11560 /* Toshiba specific */
11561 static struct hda_verb alc268_toshiba_verbs[] = {
11562 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11566 static struct hda_input_mux alc268_acer_lc_capture_source = {
11574 /* Acer specific */
11575 /* bind volumes of both NID 0x02 and 0x03 */
11576 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11577 .ops = &snd_hda_bind_vol,
11579 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11580 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11585 /* mute/unmute internal speaker according to the hp jack and mute state */
11586 static void alc268_acer_automute(struct hda_codec *codec, int force)
11588 struct alc_spec *spec = codec->spec;
11591 if (force || !spec->sense_updated) {
11592 unsigned int present;
11593 present = snd_hda_codec_read(codec, 0x14, 0,
11594 AC_VERB_GET_PIN_SENSE, 0);
11595 spec->jack_present = (present & 0x80000000) != 0;
11596 spec->sense_updated = 1;
11598 if (spec->jack_present)
11599 mute = HDA_AMP_MUTE; /* mute internal speaker */
11600 else /* unmute internal speaker if necessary */
11601 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11602 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11603 HDA_AMP_MUTE, mute);
11607 /* bind hp and internal speaker mute (with plug check) */
11608 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11609 struct snd_ctl_elem_value *ucontrol)
11611 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11612 long *valp = ucontrol->value.integer.value;
11615 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11617 valp[0] ? 0 : HDA_AMP_MUTE);
11618 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11620 valp[1] ? 0 : HDA_AMP_MUTE);
11622 alc268_acer_automute(codec, 0);
11626 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11627 /* output mixer control */
11628 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11630 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11631 .name = "Master Playback Switch",
11632 .info = snd_hda_mixer_amp_switch_info,
11633 .get = snd_hda_mixer_amp_switch_get,
11634 .put = alc268_acer_master_sw_put,
11635 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11637 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11641 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11642 /* output mixer control */
11643 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11645 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11646 .name = "Master Playback Switch",
11647 .info = snd_hda_mixer_amp_switch_info,
11648 .get = snd_hda_mixer_amp_switch_get,
11649 .put = alc268_acer_master_sw_put,
11650 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11652 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11653 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11654 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11658 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11659 /* output mixer control */
11660 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11662 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11663 .name = "Master Playback Switch",
11664 .info = snd_hda_mixer_amp_switch_info,
11665 .get = snd_hda_mixer_amp_switch_get,
11666 .put = alc268_acer_master_sw_put,
11667 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11669 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11670 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11674 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11675 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11676 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11677 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11678 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11679 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11680 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11684 static struct hda_verb alc268_acer_verbs[] = {
11685 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11686 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11687 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11688 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11689 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11690 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11691 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11695 /* unsolicited event for HP jack sensing */
11696 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11697 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11699 static void alc268_acer_unsol_event(struct hda_codec *codec,
11702 if ((res >> 26) != ALC880_HP_EVENT)
11704 alc268_acer_automute(codec, 1);
11707 static void alc268_acer_init_hook(struct hda_codec *codec)
11709 alc268_acer_automute(codec, 1);
11712 /* toggle speaker-output according to the hp-jack state */
11713 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11715 unsigned int present;
11716 unsigned char bits;
11718 present = snd_hda_codec_read(codec, 0x15, 0,
11719 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11720 bits = present ? AMP_IN_MUTE(0) : 0;
11721 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11722 AMP_IN_MUTE(0), bits);
11723 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11724 AMP_IN_MUTE(0), bits);
11728 static void alc268_acer_mic_automute(struct hda_codec *codec)
11730 unsigned int present;
11732 present = snd_hda_codec_read(codec, 0x18, 0,
11733 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11734 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11735 present ? 0x0 : 0x6);
11738 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11741 if ((res >> 26) == ALC880_HP_EVENT)
11742 alc268_aspire_one_speaker_automute(codec);
11743 if ((res >> 26) == ALC880_MIC_EVENT)
11744 alc268_acer_mic_automute(codec);
11747 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11749 alc268_aspire_one_speaker_automute(codec);
11750 alc268_acer_mic_automute(codec);
11753 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11754 /* output mixer control */
11755 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11756 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11757 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11758 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11759 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11760 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11764 static struct hda_verb alc268_dell_verbs[] = {
11765 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11766 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11767 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11771 /* mute/unmute internal speaker according to the hp jack and mute state */
11772 static void alc268_dell_init_hook(struct hda_codec *codec)
11774 struct alc_spec *spec = codec->spec;
11776 spec->autocfg.hp_pins[0] = 0x15;
11777 spec->autocfg.speaker_pins[0] = 0x14;
11778 alc_automute_pin(codec);
11781 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11782 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11783 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11784 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11785 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11786 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11787 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11788 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11789 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11793 static struct hda_verb alc267_quanta_il1_verbs[] = {
11794 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11795 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11799 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11801 unsigned int present;
11803 present = snd_hda_codec_read(codec, 0x18, 0,
11804 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11805 snd_hda_codec_write(codec, 0x23, 0,
11806 AC_VERB_SET_CONNECT_SEL,
11807 present ? 0x00 : 0x01);
11810 static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
11812 struct alc_spec *spec = codec->spec;
11814 spec->autocfg.hp_pins[0] = 0x15;
11815 spec->autocfg.speaker_pins[0] = 0x14;
11816 alc_automute_pin(codec);
11817 alc267_quanta_il1_mic_automute(codec);
11820 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11823 switch (res >> 26) {
11824 case ALC880_MIC_EVENT:
11825 alc267_quanta_il1_mic_automute(codec);
11828 alc_sku_unsol_event(codec, res);
11834 * generic initialization of ADC, input mixers and output mixers
11836 static struct hda_verb alc268_base_init_verbs[] = {
11837 /* Unmute DAC0-1 and set vol = 0 */
11838 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11839 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11842 * Set up output mixers (0x0c - 0x0e)
11844 /* set vol=0 to output mixers */
11845 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11846 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11848 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11849 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11851 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11852 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11853 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11854 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11855 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11856 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11857 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11858 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11860 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11861 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11862 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11863 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11864 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11866 /* set PCBEEP vol = 0, mute connections */
11867 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11868 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11869 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11871 /* Unmute Selector 23h,24h and set the default input to mic-in */
11873 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11874 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11875 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11876 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11882 * generic initialization of ADC, input mixers and output mixers
11884 static struct hda_verb alc268_volume_init_verbs[] = {
11885 /* set output DAC */
11886 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11887 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11889 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11890 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11891 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11892 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11893 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11895 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11896 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11897 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11899 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11900 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11902 /* set PCBEEP vol = 0, mute connections */
11903 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11904 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11905 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11910 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11911 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11912 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11914 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11915 /* The multiple "Capture Source" controls confuse alsamixer
11916 * So call somewhat different..
11918 /* .name = "Capture Source", */
11919 .name = "Input Source",
11921 .info = alc_mux_enum_info,
11922 .get = alc_mux_enum_get,
11923 .put = alc_mux_enum_put,
11928 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11929 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11930 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11931 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11932 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11934 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11935 /* The multiple "Capture Source" controls confuse alsamixer
11936 * So call somewhat different..
11938 /* .name = "Capture Source", */
11939 .name = "Input Source",
11941 .info = alc_mux_enum_info,
11942 .get = alc_mux_enum_get,
11943 .put = alc_mux_enum_put,
11948 static struct hda_input_mux alc268_capture_source = {
11952 { "Front Mic", 0x1 },
11958 static struct hda_input_mux alc268_acer_capture_source = {
11962 { "Internal Mic", 0x1 },
11967 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11971 { "Internal Mic", 0x6 },
11976 #ifdef CONFIG_SND_DEBUG
11977 static struct snd_kcontrol_new alc268_test_mixer[] = {
11978 /* Volume widgets */
11979 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11980 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11981 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11982 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11983 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11984 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11985 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11986 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11987 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11988 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11989 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11990 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11991 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11992 /* The below appears problematic on some hardwares */
11993 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11994 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11995 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11996 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11997 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11999 /* Modes for retasking pin widgets */
12000 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12001 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12002 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12003 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12005 /* Controls for GPIO pins, assuming they are configured as outputs */
12006 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12007 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12008 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12009 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12011 /* Switches to allow the digital SPDIF output pin to be enabled.
12012 * The ALC268 does not have an SPDIF input.
12014 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12016 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12017 * this output to turn on an external amplifier.
12019 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12020 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12026 /* create input playback/capture controls for the given pin */
12027 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12028 const char *ctlname, int idx)
12034 sprintf(name, "%s Playback Volume", ctlname);
12046 if (spec->multiout.dac_nids[0] != dac &&
12047 spec->multiout.dac_nids[1] != dac) {
12048 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12049 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12053 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12056 sprintf(name, "%s Playback Switch", ctlname);
12058 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12059 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12061 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12062 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12068 /* add playback controls from the parsed DAC table */
12069 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12070 const struct auto_pin_cfg *cfg)
12075 spec->multiout.dac_nids = spec->private_dac_nids;
12077 nid = cfg->line_out_pins[0];
12080 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12084 err = alc268_new_analog_output(spec, nid, name, 0);
12089 nid = cfg->speaker_pins[0];
12091 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12092 "Speaker Playback Volume",
12093 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12097 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12101 nid = cfg->hp_pins[0];
12103 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12108 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12110 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12111 "Mono Playback Switch",
12112 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12119 /* create playback/capture controls for input pins */
12120 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
12121 const struct auto_pin_cfg *cfg)
12123 struct hda_input_mux *imux = &spec->private_imux[0];
12126 for (i = 0; i < AUTO_PIN_LAST; i++) {
12127 switch(cfg->input_pins[i]) {
12129 idx1 = 0; /* Mic 1 */
12132 idx1 = 1; /* Mic 2 */
12135 idx1 = 2; /* Line In */
12142 idx1 = 6; /* digital mics */
12147 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12148 imux->items[imux->num_items].index = idx1;
12154 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12156 struct alc_spec *spec = codec->spec;
12157 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12158 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12159 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12160 unsigned int dac_vol1, dac_vol2;
12163 snd_hda_codec_write(codec, speaker_nid, 0,
12164 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12165 snd_hda_codec_write(codec, 0x0f, 0,
12166 AC_VERB_SET_AMP_GAIN_MUTE,
12168 snd_hda_codec_write(codec, 0x10, 0,
12169 AC_VERB_SET_AMP_GAIN_MUTE,
12172 snd_hda_codec_write(codec, 0x0f, 0,
12173 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12174 snd_hda_codec_write(codec, 0x10, 0,
12175 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12178 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12179 if (line_nid == 0x14)
12180 dac_vol2 = AMP_OUT_ZERO;
12181 else if (line_nid == 0x15)
12182 dac_vol1 = AMP_OUT_ZERO;
12183 if (hp_nid == 0x14)
12184 dac_vol2 = AMP_OUT_ZERO;
12185 else if (hp_nid == 0x15)
12186 dac_vol1 = AMP_OUT_ZERO;
12187 if (line_nid != 0x16 || hp_nid != 0x16 ||
12188 spec->autocfg.line_out_pins[1] != 0x16 ||
12189 spec->autocfg.line_out_pins[2] != 0x16)
12190 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12192 snd_hda_codec_write(codec, 0x02, 0,
12193 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12194 snd_hda_codec_write(codec, 0x03, 0,
12195 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12198 /* pcm configuration: identical with ALC880 */
12199 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12200 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12201 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12202 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12205 * BIOS auto configuration
12207 static int alc268_parse_auto_config(struct hda_codec *codec)
12209 struct alc_spec *spec = codec->spec;
12211 static hda_nid_t alc268_ignore[] = { 0 };
12213 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12217 if (!spec->autocfg.line_outs) {
12218 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12219 spec->multiout.max_channels = 2;
12220 spec->no_analog = 1;
12223 return 0; /* can't find valid BIOS pin config */
12225 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12228 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
12232 spec->multiout.max_channels = 2;
12235 /* digital only support output */
12236 if (spec->autocfg.dig_outs) {
12237 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12238 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12240 if (spec->kctls.list)
12241 add_mixer(spec, spec->kctls.list);
12243 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12244 add_mixer(spec, alc268_beep_mixer);
12246 add_verb(spec, alc268_volume_init_verbs);
12247 spec->num_mux_defs = 1;
12248 spec->input_mux = &spec->private_imux[0];
12250 err = alc_auto_add_mic_boost(codec);
12254 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12259 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12260 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12261 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12263 /* init callback for auto-configuration model -- overriding the default init */
12264 static void alc268_auto_init(struct hda_codec *codec)
12266 struct alc_spec *spec = codec->spec;
12267 alc268_auto_init_multi_out(codec);
12268 alc268_auto_init_hp_out(codec);
12269 alc268_auto_init_mono_speaker_out(codec);
12270 alc268_auto_init_analog_input(codec);
12271 if (spec->unsol_event)
12272 alc_inithook(codec);
12276 * configuration and preset
12278 static const char *alc268_models[ALC268_MODEL_LAST] = {
12279 [ALC267_QUANTA_IL1] = "quanta-il1",
12280 [ALC268_3ST] = "3stack",
12281 [ALC268_TOSHIBA] = "toshiba",
12282 [ALC268_ACER] = "acer",
12283 [ALC268_ACER_DMIC] = "acer-dmic",
12284 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12285 [ALC268_DELL] = "dell",
12286 [ALC268_ZEPTO] = "zepto",
12287 #ifdef CONFIG_SND_DEBUG
12288 [ALC268_TEST] = "test",
12290 [ALC268_AUTO] = "auto",
12293 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12294 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12295 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12296 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12297 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12298 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12299 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12300 ALC268_ACER_ASPIRE_ONE),
12301 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12302 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12303 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12305 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12306 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12307 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12309 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12310 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12311 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12312 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12316 static struct alc_config_preset alc268_presets[] = {
12317 [ALC267_QUANTA_IL1] = {
12318 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12319 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12320 alc267_quanta_il1_verbs },
12321 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12322 .dac_nids = alc268_dac_nids,
12323 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12324 .adc_nids = alc268_adc_nids_alt,
12326 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12327 .channel_mode = alc268_modes,
12328 .input_mux = &alc268_capture_source,
12329 .unsol_event = alc267_quanta_il1_unsol_event,
12330 .init_hook = alc267_quanta_il1_init_hook,
12333 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12334 alc268_beep_mixer },
12335 .init_verbs = { alc268_base_init_verbs },
12336 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12337 .dac_nids = alc268_dac_nids,
12338 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12339 .adc_nids = alc268_adc_nids_alt,
12340 .capsrc_nids = alc268_capsrc_nids,
12342 .dig_out_nid = ALC268_DIGOUT_NID,
12343 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12344 .channel_mode = alc268_modes,
12345 .input_mux = &alc268_capture_source,
12347 [ALC268_TOSHIBA] = {
12348 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12349 alc268_beep_mixer },
12350 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12351 alc268_toshiba_verbs },
12352 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12353 .dac_nids = alc268_dac_nids,
12354 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12355 .adc_nids = alc268_adc_nids_alt,
12356 .capsrc_nids = alc268_capsrc_nids,
12358 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12359 .channel_mode = alc268_modes,
12360 .input_mux = &alc268_capture_source,
12361 .unsol_event = alc268_toshiba_unsol_event,
12362 .init_hook = alc268_toshiba_init_hook,
12365 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12366 alc268_beep_mixer },
12367 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12368 alc268_acer_verbs },
12369 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12370 .dac_nids = alc268_dac_nids,
12371 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12372 .adc_nids = alc268_adc_nids_alt,
12373 .capsrc_nids = alc268_capsrc_nids,
12375 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12376 .channel_mode = alc268_modes,
12377 .input_mux = &alc268_acer_capture_source,
12378 .unsol_event = alc268_acer_unsol_event,
12379 .init_hook = alc268_acer_init_hook,
12381 [ALC268_ACER_DMIC] = {
12382 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12383 alc268_beep_mixer },
12384 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12385 alc268_acer_verbs },
12386 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12387 .dac_nids = alc268_dac_nids,
12388 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12389 .adc_nids = alc268_adc_nids_alt,
12390 .capsrc_nids = alc268_capsrc_nids,
12392 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12393 .channel_mode = alc268_modes,
12394 .input_mux = &alc268_acer_dmic_capture_source,
12395 .unsol_event = alc268_acer_unsol_event,
12396 .init_hook = alc268_acer_init_hook,
12398 [ALC268_ACER_ASPIRE_ONE] = {
12399 .mixers = { alc268_acer_aspire_one_mixer,
12401 alc268_capture_alt_mixer },
12402 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12403 alc268_acer_aspire_one_verbs },
12404 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12405 .dac_nids = alc268_dac_nids,
12406 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12407 .adc_nids = alc268_adc_nids_alt,
12408 .capsrc_nids = alc268_capsrc_nids,
12410 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12411 .channel_mode = alc268_modes,
12412 .input_mux = &alc268_acer_lc_capture_source,
12413 .unsol_event = alc268_acer_lc_unsol_event,
12414 .init_hook = alc268_acer_lc_init_hook,
12417 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12418 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12419 alc268_dell_verbs },
12420 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12421 .dac_nids = alc268_dac_nids,
12423 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12424 .channel_mode = alc268_modes,
12425 .unsol_event = alc_sku_unsol_event,
12426 .init_hook = alc268_dell_init_hook,
12427 .input_mux = &alc268_capture_source,
12430 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12431 alc268_beep_mixer },
12432 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12433 alc268_toshiba_verbs },
12434 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12435 .dac_nids = alc268_dac_nids,
12436 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12437 .adc_nids = alc268_adc_nids_alt,
12438 .capsrc_nids = alc268_capsrc_nids,
12440 .dig_out_nid = ALC268_DIGOUT_NID,
12441 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12442 .channel_mode = alc268_modes,
12443 .input_mux = &alc268_capture_source,
12444 .unsol_event = alc268_toshiba_unsol_event,
12445 .init_hook = alc268_toshiba_init_hook
12447 #ifdef CONFIG_SND_DEBUG
12449 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12450 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12451 alc268_volume_init_verbs },
12452 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12453 .dac_nids = alc268_dac_nids,
12454 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12455 .adc_nids = alc268_adc_nids_alt,
12456 .capsrc_nids = alc268_capsrc_nids,
12458 .dig_out_nid = ALC268_DIGOUT_NID,
12459 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12460 .channel_mode = alc268_modes,
12461 .input_mux = &alc268_capture_source,
12466 static int patch_alc268(struct hda_codec *codec)
12468 struct alc_spec *spec;
12470 int i, has_beep, err;
12472 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12476 codec->spec = spec;
12478 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12482 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12483 printk(KERN_INFO "hda_codec: Unknown model for %s, "
12484 "trying auto-probe from BIOS...\n", codec->chip_name);
12485 board_config = ALC268_AUTO;
12488 if (board_config == ALC268_AUTO) {
12489 /* automatic parse from the BIOS config */
12490 err = alc268_parse_auto_config(codec);
12496 "hda_codec: Cannot set up configuration "
12497 "from BIOS. Using base mode...\n");
12498 board_config = ALC268_3ST;
12502 if (board_config != ALC268_AUTO)
12503 setup_preset(spec, &alc268_presets[board_config]);
12505 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12506 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12507 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12509 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12512 for (i = 0; i < spec->num_mixers; i++) {
12513 if (spec->mixers[i] == alc268_beep_mixer) {
12520 err = snd_hda_attach_beep_device(codec, 0x1);
12525 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12526 /* override the amp caps for beep generator */
12527 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12528 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12529 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12530 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12531 (0 << AC_AMPCAP_MUTE_SHIFT));
12534 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12535 /* check whether NID 0x07 is valid */
12536 unsigned int wcap = get_wcaps(codec, 0x07);
12540 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12541 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12542 spec->adc_nids = alc268_adc_nids_alt;
12543 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12544 add_mixer(spec, alc268_capture_alt_mixer);
12546 spec->adc_nids = alc268_adc_nids;
12547 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12548 add_mixer(spec, alc268_capture_mixer);
12550 spec->capsrc_nids = alc268_capsrc_nids;
12551 /* set default input source */
12552 for (i = 0; i < spec->num_adc_nids; i++)
12553 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12554 0, AC_VERB_SET_CONNECT_SEL,
12555 spec->input_mux->items[0].index);
12558 spec->vmaster_nid = 0x02;
12560 codec->patch_ops = alc_patch_ops;
12561 if (board_config == ALC268_AUTO)
12562 spec->init_hook = alc268_auto_init;
12564 codec->proc_widget_hook = print_realtek_coef;
12570 * ALC269 channel source setting (2 channel)
12572 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12574 #define alc269_dac_nids alc260_dac_nids
12576 static hda_nid_t alc269_adc_nids[1] = {
12581 static hda_nid_t alc269_capsrc_nids[1] = {
12585 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12589 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12597 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12605 #define alc269_modes alc260_modes
12606 #define alc269_capture_source alc880_lg_lw_capture_source
12608 static struct snd_kcontrol_new alc269_base_mixer[] = {
12609 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12610 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12611 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12612 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12613 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12614 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12615 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12616 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12617 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12618 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12619 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12620 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12624 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12625 /* output mixer control */
12626 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12628 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12629 .name = "Master Playback Switch",
12630 .info = snd_hda_mixer_amp_switch_info,
12631 .get = snd_hda_mixer_amp_switch_get,
12632 .put = alc268_acer_master_sw_put,
12633 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12635 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12636 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12637 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12638 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12639 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12640 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12644 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12645 /* output mixer control */
12646 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12648 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12649 .name = "Master Playback Switch",
12650 .info = snd_hda_mixer_amp_switch_info,
12651 .get = snd_hda_mixer_amp_switch_get,
12652 .put = alc268_acer_master_sw_put,
12653 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12657 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12658 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12659 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12660 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12661 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12662 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12663 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12667 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12668 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12669 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12670 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12671 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12675 /* capture mixer elements */
12676 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12677 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12678 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12679 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12684 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12686 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12687 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12688 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12689 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12690 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12691 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12692 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12696 static struct hda_verb alc269_lifebook_verbs[] = {
12697 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12698 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12699 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12700 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12701 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12702 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12703 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12704 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12705 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12706 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12710 /* toggle speaker-output according to the hp-jack state */
12711 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12713 unsigned int present;
12714 unsigned char bits;
12716 present = snd_hda_codec_read(codec, 0x15, 0,
12717 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12718 bits = present ? AMP_IN_MUTE(0) : 0;
12719 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12720 AMP_IN_MUTE(0), bits);
12721 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12722 AMP_IN_MUTE(0), bits);
12724 snd_hda_codec_write(codec, 0x20, 0,
12725 AC_VERB_SET_COEF_INDEX, 0x0c);
12726 snd_hda_codec_write(codec, 0x20, 0,
12727 AC_VERB_SET_PROC_COEF, 0x680);
12729 snd_hda_codec_write(codec, 0x20, 0,
12730 AC_VERB_SET_COEF_INDEX, 0x0c);
12731 snd_hda_codec_write(codec, 0x20, 0,
12732 AC_VERB_SET_PROC_COEF, 0x480);
12735 /* toggle speaker-output according to the hp-jacks state */
12736 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12738 unsigned int present;
12739 unsigned char bits;
12741 /* Check laptop headphone socket */
12742 present = snd_hda_codec_read(codec, 0x15, 0,
12743 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12745 /* Check port replicator headphone socket */
12746 present |= snd_hda_codec_read(codec, 0x1a, 0,
12747 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12749 bits = present ? AMP_IN_MUTE(0) : 0;
12750 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12751 AMP_IN_MUTE(0), bits);
12752 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12753 AMP_IN_MUTE(0), bits);
12755 snd_hda_codec_write(codec, 0x20, 0,
12756 AC_VERB_SET_COEF_INDEX, 0x0c);
12757 snd_hda_codec_write(codec, 0x20, 0,
12758 AC_VERB_SET_PROC_COEF, 0x680);
12760 snd_hda_codec_write(codec, 0x20, 0,
12761 AC_VERB_SET_COEF_INDEX, 0x0c);
12762 snd_hda_codec_write(codec, 0x20, 0,
12763 AC_VERB_SET_PROC_COEF, 0x480);
12766 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12768 unsigned int present;
12770 present = snd_hda_codec_read(codec, 0x18, 0,
12771 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12772 snd_hda_codec_write(codec, 0x23, 0,
12773 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12776 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12778 unsigned int present_laptop;
12779 unsigned int present_dock;
12781 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12782 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12784 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12785 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12787 /* Laptop mic port overrides dock mic port, design decision */
12789 snd_hda_codec_write(codec, 0x23, 0,
12790 AC_VERB_SET_CONNECT_SEL, 0x3);
12791 if (present_laptop)
12792 snd_hda_codec_write(codec, 0x23, 0,
12793 AC_VERB_SET_CONNECT_SEL, 0x0);
12794 if (!present_dock && !present_laptop)
12795 snd_hda_codec_write(codec, 0x23, 0,
12796 AC_VERB_SET_CONNECT_SEL, 0x1);
12799 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12802 if ((res >> 26) == ALC880_HP_EVENT)
12803 alc269_quanta_fl1_speaker_automute(codec);
12804 if ((res >> 26) == ALC880_MIC_EVENT)
12805 alc269_quanta_fl1_mic_automute(codec);
12808 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12811 if ((res >> 26) == ALC880_HP_EVENT)
12812 alc269_lifebook_speaker_automute(codec);
12813 if ((res >> 26) == ALC880_MIC_EVENT)
12814 alc269_lifebook_mic_autoswitch(codec);
12817 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12819 alc269_quanta_fl1_speaker_automute(codec);
12820 alc269_quanta_fl1_mic_automute(codec);
12823 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12825 alc269_lifebook_speaker_automute(codec);
12826 alc269_lifebook_mic_autoswitch(codec);
12829 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12830 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12831 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12832 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12833 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12834 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12835 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12836 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12840 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12841 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12842 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12843 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12844 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12845 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12846 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12850 /* toggle speaker-output according to the hp-jack state */
12851 static void alc269_speaker_automute(struct hda_codec *codec)
12853 unsigned int present;
12854 unsigned char bits;
12856 present = snd_hda_codec_read(codec, 0x15, 0,
12857 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12858 bits = present ? AMP_IN_MUTE(0) : 0;
12859 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12860 AMP_IN_MUTE(0), bits);
12861 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12862 AMP_IN_MUTE(0), bits);
12865 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12867 unsigned int present;
12869 present = snd_hda_codec_read(codec, 0x18, 0,
12870 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12871 snd_hda_codec_write(codec, 0x23, 0,
12872 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12875 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12877 unsigned int present;
12879 present = snd_hda_codec_read(codec, 0x18, 0,
12880 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12881 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12882 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12883 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12884 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12887 /* unsolicited event for HP jack sensing */
12888 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12891 if ((res >> 26) == ALC880_HP_EVENT)
12892 alc269_speaker_automute(codec);
12894 if ((res >> 26) == ALC880_MIC_EVENT)
12895 alc269_eeepc_dmic_automute(codec);
12898 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12900 alc269_speaker_automute(codec);
12901 alc269_eeepc_dmic_automute(codec);
12904 /* unsolicited event for HP jack sensing */
12905 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12908 if ((res >> 26) == ALC880_HP_EVENT)
12909 alc269_speaker_automute(codec);
12911 if ((res >> 26) == ALC880_MIC_EVENT)
12912 alc269_eeepc_amic_automute(codec);
12915 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12917 alc269_speaker_automute(codec);
12918 alc269_eeepc_amic_automute(codec);
12922 * generic initialization of ADC, input mixers and output mixers
12924 static struct hda_verb alc269_init_verbs[] = {
12926 * Unmute ADC0 and set the default input to mic-in
12928 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12930 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12931 * analog-loopback mixer widget
12932 * Note: PASD motherboards uses the Line In 2 as the input for
12933 * front panel mic (mic 2)
12935 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12936 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12937 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12938 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12939 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12940 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12943 * Set up output mixers (0x0c - 0x0e)
12945 /* set vol=0 to output mixers */
12946 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12947 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12949 /* set up input amps for analog loopback */
12950 /* Amp Indices: DAC = 0, mixer = 1 */
12951 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12952 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12953 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12954 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12955 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12956 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12958 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12959 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12960 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12961 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12962 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12963 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12964 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12966 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12967 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12968 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12969 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12970 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12971 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12972 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12974 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12975 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12977 /* FIXME: use matrix-type input source selection */
12978 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12979 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12980 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12981 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12982 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12983 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12986 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12987 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12991 /* add playback controls from the parsed DAC table */
12992 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12993 const struct auto_pin_cfg *cfg)
12998 spec->multiout.num_dacs = 1; /* only use one dac */
12999 spec->multiout.dac_nids = spec->private_dac_nids;
13000 spec->multiout.dac_nids[0] = 2;
13002 nid = cfg->line_out_pins[0];
13004 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13005 "Front Playback Volume",
13006 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
13009 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13010 "Front Playback Switch",
13011 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13016 nid = cfg->speaker_pins[0];
13018 if (!cfg->line_out_pins[0]) {
13019 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13020 "Speaker Playback Volume",
13021 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13027 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13028 "Speaker Playback Switch",
13029 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13034 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13035 "Speaker Playback Switch",
13036 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13042 nid = cfg->hp_pins[0];
13044 /* spec->multiout.hp_nid = 2; */
13045 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
13046 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13047 "Headphone Playback Volume",
13048 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13054 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13055 "Headphone Playback Switch",
13056 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13061 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13062 "Headphone Playback Switch",
13063 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13072 #define alc269_auto_create_analog_input_ctls \
13073 alc262_auto_create_analog_input_ctls
13075 #ifdef CONFIG_SND_HDA_POWER_SAVE
13076 #define alc269_loopbacks alc880_loopbacks
13079 /* pcm configuration: identical with ALC880 */
13080 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13081 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13082 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13083 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13085 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13089 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13090 /* NID is set in alc_build_pcms */
13092 .open = alc880_playback_pcm_open,
13093 .prepare = alc880_playback_pcm_prepare,
13094 .cleanup = alc880_playback_pcm_cleanup
13098 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13102 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13103 /* NID is set in alc_build_pcms */
13107 * BIOS auto configuration
13109 static int alc269_parse_auto_config(struct hda_codec *codec)
13111 struct alc_spec *spec = codec->spec;
13113 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13115 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13120 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13123 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
13127 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13129 if (spec->autocfg.dig_outs)
13130 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13132 if (spec->kctls.list)
13133 add_mixer(spec, spec->kctls.list);
13135 add_verb(spec, alc269_init_verbs);
13136 spec->num_mux_defs = 1;
13137 spec->input_mux = &spec->private_imux[0];
13138 /* set default input source */
13139 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13140 0, AC_VERB_SET_CONNECT_SEL,
13141 spec->input_mux->items[0].index);
13143 err = alc_auto_add_mic_boost(codec);
13147 if (!spec->cap_mixer && !spec->no_analog)
13148 set_capture_mixer(spec);
13150 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13155 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13156 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13157 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13160 /* init callback for auto-configuration model -- overriding the default init */
13161 static void alc269_auto_init(struct hda_codec *codec)
13163 struct alc_spec *spec = codec->spec;
13164 alc269_auto_init_multi_out(codec);
13165 alc269_auto_init_hp_out(codec);
13166 alc269_auto_init_analog_input(codec);
13167 if (spec->unsol_event)
13168 alc_inithook(codec);
13172 * configuration and preset
13174 static const char *alc269_models[ALC269_MODEL_LAST] = {
13175 [ALC269_BASIC] = "basic",
13176 [ALC269_QUANTA_FL1] = "quanta",
13177 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13178 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13179 [ALC269_FUJITSU] = "fujitsu",
13180 [ALC269_LIFEBOOK] = "lifebook"
13183 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13184 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13185 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13186 ALC269_ASUS_EEEPC_P703),
13187 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13188 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13189 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13190 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13191 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13192 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13193 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13194 ALC269_ASUS_EEEPC_P901),
13195 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13196 ALC269_ASUS_EEEPC_P901),
13197 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13198 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13199 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13203 static struct alc_config_preset alc269_presets[] = {
13205 .mixers = { alc269_base_mixer },
13206 .init_verbs = { alc269_init_verbs },
13207 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13208 .dac_nids = alc269_dac_nids,
13210 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13211 .channel_mode = alc269_modes,
13212 .input_mux = &alc269_capture_source,
13214 [ALC269_QUANTA_FL1] = {
13215 .mixers = { alc269_quanta_fl1_mixer },
13216 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13217 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13218 .dac_nids = alc269_dac_nids,
13220 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13221 .channel_mode = alc269_modes,
13222 .input_mux = &alc269_capture_source,
13223 .unsol_event = alc269_quanta_fl1_unsol_event,
13224 .init_hook = alc269_quanta_fl1_init_hook,
13226 [ALC269_ASUS_EEEPC_P703] = {
13227 .mixers = { alc269_eeepc_mixer },
13228 .cap_mixer = alc269_epc_capture_mixer,
13229 .init_verbs = { alc269_init_verbs,
13230 alc269_eeepc_amic_init_verbs },
13231 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13232 .dac_nids = alc269_dac_nids,
13234 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13235 .channel_mode = alc269_modes,
13236 .input_mux = &alc269_eeepc_amic_capture_source,
13237 .unsol_event = alc269_eeepc_amic_unsol_event,
13238 .init_hook = alc269_eeepc_amic_inithook,
13240 [ALC269_ASUS_EEEPC_P901] = {
13241 .mixers = { alc269_eeepc_mixer },
13242 .cap_mixer = alc269_epc_capture_mixer,
13243 .init_verbs = { alc269_init_verbs,
13244 alc269_eeepc_dmic_init_verbs },
13245 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13246 .dac_nids = alc269_dac_nids,
13248 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13249 .channel_mode = alc269_modes,
13250 .input_mux = &alc269_eeepc_dmic_capture_source,
13251 .unsol_event = alc269_eeepc_dmic_unsol_event,
13252 .init_hook = alc269_eeepc_dmic_inithook,
13254 [ALC269_FUJITSU] = {
13255 .mixers = { alc269_fujitsu_mixer },
13256 .cap_mixer = alc269_epc_capture_mixer,
13257 .init_verbs = { alc269_init_verbs,
13258 alc269_eeepc_dmic_init_verbs },
13259 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13260 .dac_nids = alc269_dac_nids,
13262 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13263 .channel_mode = alc269_modes,
13264 .input_mux = &alc269_eeepc_dmic_capture_source,
13265 .unsol_event = alc269_eeepc_dmic_unsol_event,
13266 .init_hook = alc269_eeepc_dmic_inithook,
13268 [ALC269_LIFEBOOK] = {
13269 .mixers = { alc269_lifebook_mixer },
13270 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13271 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13272 .dac_nids = alc269_dac_nids,
13274 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13275 .channel_mode = alc269_modes,
13276 .input_mux = &alc269_capture_source,
13277 .unsol_event = alc269_lifebook_unsol_event,
13278 .init_hook = alc269_lifebook_init_hook,
13282 static int patch_alc269(struct hda_codec *codec)
13284 struct alc_spec *spec;
13288 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13292 codec->spec = spec;
13294 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13296 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13300 if (board_config < 0) {
13301 printk(KERN_INFO "hda_codec: Unknown model for %s, "
13302 "trying auto-probe from BIOS...\n", codec->chip_name);
13303 board_config = ALC269_AUTO;
13306 if (board_config == ALC269_AUTO) {
13307 /* automatic parse from the BIOS config */
13308 err = alc269_parse_auto_config(codec);
13314 "hda_codec: Cannot set up configuration "
13315 "from BIOS. Using base mode...\n");
13316 board_config = ALC269_BASIC;
13320 err = snd_hda_attach_beep_device(codec, 0x1);
13326 if (board_config != ALC269_AUTO)
13327 setup_preset(spec, &alc269_presets[board_config]);
13329 if (codec->subsystem_id == 0x17aa3bf8) {
13330 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13331 * fix the sample rate of analog I/O to 44.1kHz
13333 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13334 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13336 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13337 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13339 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13340 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13342 spec->adc_nids = alc269_adc_nids;
13343 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13344 spec->capsrc_nids = alc269_capsrc_nids;
13345 if (!spec->cap_mixer)
13346 set_capture_mixer(spec);
13347 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13349 codec->patch_ops = alc_patch_ops;
13350 if (board_config == ALC269_AUTO)
13351 spec->init_hook = alc269_auto_init;
13352 #ifdef CONFIG_SND_HDA_POWER_SAVE
13353 if (!spec->loopback.amplist)
13354 spec->loopback.amplist = alc269_loopbacks;
13356 codec->proc_widget_hook = print_realtek_coef;
13362 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13366 * set the path ways for 2 channel output
13367 * need to set the codec line out and mic 1 pin widgets to inputs
13369 static struct hda_verb alc861_threestack_ch2_init[] = {
13370 /* set pin widget 1Ah (line in) for input */
13371 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13372 /* set pin widget 18h (mic1/2) for input, for mic also enable
13375 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13377 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13379 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13380 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13386 * need to set the codec line out and mic 1 pin widgets to outputs
13388 static struct hda_verb alc861_threestack_ch6_init[] = {
13389 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13390 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13391 /* set pin widget 18h (mic1) for output (CLFE)*/
13392 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13394 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13395 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13397 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13399 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13400 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13405 static struct hda_channel_mode alc861_threestack_modes[2] = {
13406 { 2, alc861_threestack_ch2_init },
13407 { 6, alc861_threestack_ch6_init },
13409 /* Set mic1 as input and unmute the mixer */
13410 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13411 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13412 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13415 /* Set mic1 as output and mute mixer */
13416 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13417 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13418 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13422 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13423 { 2, alc861_uniwill_m31_ch2_init },
13424 { 4, alc861_uniwill_m31_ch4_init },
13427 /* Set mic1 and line-in as input and unmute the mixer */
13428 static struct hda_verb alc861_asus_ch2_init[] = {
13429 /* set pin widget 1Ah (line in) for input */
13430 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13431 /* set pin widget 18h (mic1/2) for input, for mic also enable
13434 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13436 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13438 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13439 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13443 /* Set mic1 nad line-in as output and mute mixer */
13444 static struct hda_verb alc861_asus_ch6_init[] = {
13445 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13446 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13447 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13448 /* set pin widget 18h (mic1) for output (CLFE)*/
13449 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13450 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13451 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13452 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13454 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13456 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13457 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13462 static struct hda_channel_mode alc861_asus_modes[2] = {
13463 { 2, alc861_asus_ch2_init },
13464 { 6, alc861_asus_ch6_init },
13469 static struct snd_kcontrol_new alc861_base_mixer[] = {
13470 /* output mixer control */
13471 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13472 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13473 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13474 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13475 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13477 /*Input mixer control */
13478 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13479 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13480 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13481 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13482 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13483 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13484 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13485 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13486 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13487 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13492 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13493 /* output mixer control */
13494 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13495 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13496 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13497 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13498 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13500 /* Input mixer control */
13501 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13502 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13503 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13504 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13505 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13506 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13507 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13508 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13509 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13510 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13513 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13514 .name = "Channel Mode",
13515 .info = alc_ch_mode_info,
13516 .get = alc_ch_mode_get,
13517 .put = alc_ch_mode_put,
13518 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13523 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13524 /* output mixer control */
13525 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13526 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13527 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13532 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13533 /* output mixer control */
13534 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13535 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13536 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13537 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13538 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13540 /* Input mixer control */
13541 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13542 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13543 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13544 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13545 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13546 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13547 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13548 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13549 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13550 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13553 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13554 .name = "Channel Mode",
13555 .info = alc_ch_mode_info,
13556 .get = alc_ch_mode_get,
13557 .put = alc_ch_mode_put,
13558 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13563 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13564 /* output mixer control */
13565 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13566 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13567 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13568 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13569 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13571 /* Input mixer control */
13572 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13573 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13574 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13575 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13576 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13577 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13578 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13579 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13580 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13581 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13584 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13585 .name = "Channel Mode",
13586 .info = alc_ch_mode_info,
13587 .get = alc_ch_mode_get,
13588 .put = alc_ch_mode_put,
13589 .private_value = ARRAY_SIZE(alc861_asus_modes),
13594 /* additional mixer */
13595 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13596 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13597 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13602 * generic initialization of ADC, input mixers and output mixers
13604 static struct hda_verb alc861_base_init_verbs[] = {
13606 * Unmute ADC0 and set the default input to mic-in
13608 /* port-A for surround (rear panel) */
13609 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13610 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13611 /* port-B for mic-in (rear panel) with vref */
13612 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13613 /* port-C for line-in (rear panel) */
13614 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13615 /* port-D for Front */
13616 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13617 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13618 /* port-E for HP out (front panel) */
13619 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13620 /* route front PCM to HP */
13621 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13622 /* port-F for mic-in (front panel) with vref */
13623 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13624 /* port-G for CLFE (rear panel) */
13625 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13626 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13627 /* port-H for side (rear panel) */
13628 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13629 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13631 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13632 /* route front mic to ADC1*/
13633 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13634 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13636 /* Unmute DAC0~3 & spdif out*/
13637 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13638 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13639 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13640 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13641 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13643 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13644 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13645 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13646 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13647 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13649 /* Unmute Stereo Mixer 15 */
13650 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13651 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13652 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13653 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13655 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13656 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13657 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13658 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13659 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13660 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13661 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13662 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13663 /* hp used DAC 3 (Front) */
13664 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13665 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13670 static struct hda_verb alc861_threestack_init_verbs[] = {
13672 * Unmute ADC0 and set the default input to mic-in
13674 /* port-A for surround (rear panel) */
13675 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13676 /* port-B for mic-in (rear panel) with vref */
13677 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13678 /* port-C for line-in (rear panel) */
13679 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13680 /* port-D for Front */
13681 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13682 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13683 /* port-E for HP out (front panel) */
13684 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13685 /* route front PCM to HP */
13686 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13687 /* port-F for mic-in (front panel) with vref */
13688 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13689 /* port-G for CLFE (rear panel) */
13690 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13691 /* port-H for side (rear panel) */
13692 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13694 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13695 /* route front mic to ADC1*/
13696 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13697 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13698 /* Unmute DAC0~3 & spdif out*/
13699 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13700 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13701 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13702 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13703 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13705 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13706 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13707 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13708 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13709 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13711 /* Unmute Stereo Mixer 15 */
13712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13713 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13714 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13715 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13717 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13718 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13719 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13720 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13721 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13722 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13723 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13724 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13725 /* hp used DAC 3 (Front) */
13726 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13727 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13731 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13733 * Unmute ADC0 and set the default input to mic-in
13735 /* port-A for surround (rear panel) */
13736 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13737 /* port-B for mic-in (rear panel) with vref */
13738 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13739 /* port-C for line-in (rear panel) */
13740 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13741 /* port-D for Front */
13742 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13743 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13744 /* port-E for HP out (front panel) */
13745 /* this has to be set to VREF80 */
13746 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13747 /* route front PCM to HP */
13748 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13749 /* port-F for mic-in (front panel) with vref */
13750 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13751 /* port-G for CLFE (rear panel) */
13752 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13753 /* port-H for side (rear panel) */
13754 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13756 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13757 /* route front mic to ADC1*/
13758 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13759 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13760 /* Unmute DAC0~3 & spdif out*/
13761 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13762 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13763 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13764 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13765 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13767 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13768 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13769 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13770 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13771 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13773 /* Unmute Stereo Mixer 15 */
13774 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13775 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13776 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13777 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13779 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13780 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13781 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13782 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13783 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13784 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13785 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13786 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13787 /* hp used DAC 3 (Front) */
13788 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13789 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13793 static struct hda_verb alc861_asus_init_verbs[] = {
13795 * Unmute ADC0 and set the default input to mic-in
13797 /* port-A for surround (rear panel)
13798 * according to codec#0 this is the HP jack
13800 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13801 /* route front PCM to HP */
13802 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13803 /* port-B for mic-in (rear panel) with vref */
13804 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13805 /* port-C for line-in (rear panel) */
13806 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13807 /* port-D for Front */
13808 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13809 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13810 /* port-E for HP out (front panel) */
13811 /* this has to be set to VREF80 */
13812 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13813 /* route front PCM to HP */
13814 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13815 /* port-F for mic-in (front panel) with vref */
13816 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13817 /* port-G for CLFE (rear panel) */
13818 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13819 /* port-H for side (rear panel) */
13820 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13822 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13823 /* route front mic to ADC1*/
13824 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13825 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13826 /* Unmute DAC0~3 & spdif out*/
13827 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13828 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13829 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13830 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13831 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13832 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13833 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13834 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13835 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13836 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13838 /* Unmute Stereo Mixer 15 */
13839 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13840 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13841 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13842 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13844 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13845 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13846 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13847 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13848 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13849 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13850 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13851 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13852 /* hp used DAC 3 (Front) */
13853 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13854 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13858 /* additional init verbs for ASUS laptops */
13859 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13860 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13861 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13866 * generic initialization of ADC, input mixers and output mixers
13868 static struct hda_verb alc861_auto_init_verbs[] = {
13870 * Unmute ADC0 and set the default input to mic-in
13872 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13873 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13875 /* Unmute DAC0~3 & spdif out*/
13876 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13877 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13878 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13879 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13880 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13882 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13883 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13884 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13885 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13886 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13888 /* Unmute Stereo Mixer 15 */
13889 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13890 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13891 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13892 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13894 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13895 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13896 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13897 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13898 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13899 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13900 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13901 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13903 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13904 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13905 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13906 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13907 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13908 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13909 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13910 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13912 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13917 static struct hda_verb alc861_toshiba_init_verbs[] = {
13918 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13923 /* toggle speaker-output according to the hp-jack state */
13924 static void alc861_toshiba_automute(struct hda_codec *codec)
13926 unsigned int present;
13928 present = snd_hda_codec_read(codec, 0x0f, 0,
13929 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13930 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13931 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13932 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13933 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13936 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13939 if ((res >> 26) == ALC880_HP_EVENT)
13940 alc861_toshiba_automute(codec);
13943 /* pcm configuration: identical with ALC880 */
13944 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13945 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13946 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13947 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13950 #define ALC861_DIGOUT_NID 0x07
13952 static struct hda_channel_mode alc861_8ch_modes[1] = {
13956 static hda_nid_t alc861_dac_nids[4] = {
13957 /* front, surround, clfe, side */
13958 0x03, 0x06, 0x05, 0x04
13961 static hda_nid_t alc660_dac_nids[3] = {
13962 /* front, clfe, surround */
13966 static hda_nid_t alc861_adc_nids[1] = {
13971 static struct hda_input_mux alc861_capture_source = {
13975 { "Front Mic", 0x3 },
13982 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
13984 struct alc_spec *spec = codec->spec;
13985 hda_nid_t mix, srcs[5];
13988 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
13990 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
13993 for (i = 0; i < num; i++) {
13995 type = (get_wcaps(codec, srcs[i]) & AC_WCAP_TYPE)
13996 >> AC_WCAP_TYPE_SHIFT;
13997 if (type != AC_WID_AUD_OUT)
13999 for (j = 0; j < spec->multiout.num_dacs; j++)
14000 if (spec->multiout.dac_nids[j] == srcs[i])
14002 if (j >= spec->multiout.num_dacs)
14008 /* fill in the dac_nids table from the parsed pin configuration */
14009 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14010 const struct auto_pin_cfg *cfg)
14012 struct alc_spec *spec = codec->spec;
14014 hda_nid_t nid, dac;
14016 spec->multiout.dac_nids = spec->private_dac_nids;
14017 for (i = 0; i < cfg->line_outs; i++) {
14018 nid = cfg->line_out_pins[i];
14019 dac = alc861_look_for_dac(codec, nid);
14022 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14027 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14028 hda_nid_t nid, unsigned int chs)
14031 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
14032 return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name,
14033 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14036 /* add playback controls from the parsed DAC table */
14037 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14038 const struct auto_pin_cfg *cfg)
14040 struct alc_spec *spec = codec->spec;
14041 static const char *chname[4] = {
14042 "Front", "Surround", NULL /*CLFE*/, "Side"
14047 if (cfg->line_outs == 1) {
14048 const char *pfx = NULL;
14051 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14054 nid = spec->multiout.dac_nids[0];
14055 return alc861_create_out_sw(codec, pfx, nid, 3);
14059 for (i = 0; i < cfg->line_outs; i++) {
14060 nid = spec->multiout.dac_nids[i];
14065 err = alc861_create_out_sw(codec, "Center", nid, 1);
14068 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14072 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14080 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14082 struct alc_spec *spec = codec->spec;
14089 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14090 nid = alc861_look_for_dac(codec, pin);
14092 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14095 spec->multiout.hp_nid = nid;
14101 /* create playback/capture controls for input pins */
14102 static int alc861_auto_create_analog_input_ctls(struct hda_codec *codec,
14103 const struct auto_pin_cfg *cfg)
14105 struct alc_spec *spec = codec->spec;
14106 struct hda_input_mux *imux = &spec->private_imux[0];
14107 int i, err, idx, idx1;
14109 for (i = 0; i < AUTO_PIN_LAST; i++) {
14110 switch (cfg->input_pins[i]) {
14113 idx = 2; /* Line In */
14117 idx = 2; /* Line In */
14121 idx = 1; /* Mic In */
14125 idx = 1; /* Mic In */
14135 err = new_analog_input(spec, cfg->input_pins[i],
14136 auto_pin_cfg_labels[i], idx, 0x15);
14140 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
14141 imux->items[imux->num_items].index = idx1;
14147 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14149 int pin_type, hda_nid_t dac)
14151 hda_nid_t mix, srcs[5];
14154 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14156 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14158 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14160 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14163 for (i = 0; i < num; i++) {
14165 if (srcs[i] == dac || srcs[i] == 0x15)
14166 mute = AMP_IN_UNMUTE(i);
14168 mute = AMP_IN_MUTE(i);
14169 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14174 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14176 struct alc_spec *spec = codec->spec;
14179 for (i = 0; i < spec->autocfg.line_outs; i++) {
14180 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14181 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14183 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14184 spec->multiout.dac_nids[i]);
14188 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14190 struct alc_spec *spec = codec->spec;
14193 pin = spec->autocfg.hp_pins[0];
14195 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14196 spec->multiout.hp_nid);
14197 pin = spec->autocfg.speaker_pins[0];
14199 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT,
14200 spec->multiout.dac_nids[0]);
14203 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14205 struct alc_spec *spec = codec->spec;
14208 for (i = 0; i < AUTO_PIN_LAST; i++) {
14209 hda_nid_t nid = spec->autocfg.input_pins[i];
14210 if (nid >= 0x0c && nid <= 0x11)
14211 alc_set_input_pin(codec, nid, i);
14215 /* parse the BIOS configuration and set up the alc_spec */
14216 /* return 1 if successful, 0 if the proper config is not found,
14217 * or a negative error code
14219 static int alc861_parse_auto_config(struct hda_codec *codec)
14221 struct alc_spec *spec = codec->spec;
14223 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14225 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14229 if (!spec->autocfg.line_outs)
14230 return 0; /* can't find valid BIOS pin config */
14232 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14235 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14238 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14241 err = alc861_auto_create_analog_input_ctls(codec, &spec->autocfg);
14245 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14247 if (spec->autocfg.dig_outs)
14248 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14250 if (spec->kctls.list)
14251 add_mixer(spec, spec->kctls.list);
14253 add_verb(spec, alc861_auto_init_verbs);
14255 spec->num_mux_defs = 1;
14256 spec->input_mux = &spec->private_imux[0];
14258 spec->adc_nids = alc861_adc_nids;
14259 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14260 set_capture_mixer(spec);
14262 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14267 /* additional initialization for auto-configuration model */
14268 static void alc861_auto_init(struct hda_codec *codec)
14270 struct alc_spec *spec = codec->spec;
14271 alc861_auto_init_multi_out(codec);
14272 alc861_auto_init_hp_out(codec);
14273 alc861_auto_init_analog_input(codec);
14274 if (spec->unsol_event)
14275 alc_inithook(codec);
14278 #ifdef CONFIG_SND_HDA_POWER_SAVE
14279 static struct hda_amp_list alc861_loopbacks[] = {
14280 { 0x15, HDA_INPUT, 0 },
14281 { 0x15, HDA_INPUT, 1 },
14282 { 0x15, HDA_INPUT, 2 },
14283 { 0x15, HDA_INPUT, 3 },
14290 * configuration and preset
14292 static const char *alc861_models[ALC861_MODEL_LAST] = {
14293 [ALC861_3ST] = "3stack",
14294 [ALC660_3ST] = "3stack-660",
14295 [ALC861_3ST_DIG] = "3stack-dig",
14296 [ALC861_6ST_DIG] = "6stack-dig",
14297 [ALC861_UNIWILL_M31] = "uniwill-m31",
14298 [ALC861_TOSHIBA] = "toshiba",
14299 [ALC861_ASUS] = "asus",
14300 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14301 [ALC861_AUTO] = "auto",
14304 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14305 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14306 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14307 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14308 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14309 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14310 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14311 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14312 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14313 * Any other models that need this preset?
14315 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14316 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14317 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14318 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14319 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14320 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14321 /* FIXME: the below seems conflict */
14322 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14323 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14324 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14328 static struct alc_config_preset alc861_presets[] = {
14330 .mixers = { alc861_3ST_mixer },
14331 .init_verbs = { alc861_threestack_init_verbs },
14332 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14333 .dac_nids = alc861_dac_nids,
14334 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14335 .channel_mode = alc861_threestack_modes,
14337 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14338 .adc_nids = alc861_adc_nids,
14339 .input_mux = &alc861_capture_source,
14341 [ALC861_3ST_DIG] = {
14342 .mixers = { alc861_base_mixer },
14343 .init_verbs = { alc861_threestack_init_verbs },
14344 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14345 .dac_nids = alc861_dac_nids,
14346 .dig_out_nid = ALC861_DIGOUT_NID,
14347 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14348 .channel_mode = alc861_threestack_modes,
14350 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14351 .adc_nids = alc861_adc_nids,
14352 .input_mux = &alc861_capture_source,
14354 [ALC861_6ST_DIG] = {
14355 .mixers = { alc861_base_mixer },
14356 .init_verbs = { alc861_base_init_verbs },
14357 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14358 .dac_nids = alc861_dac_nids,
14359 .dig_out_nid = ALC861_DIGOUT_NID,
14360 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14361 .channel_mode = alc861_8ch_modes,
14362 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14363 .adc_nids = alc861_adc_nids,
14364 .input_mux = &alc861_capture_source,
14367 .mixers = { alc861_3ST_mixer },
14368 .init_verbs = { alc861_threestack_init_verbs },
14369 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14370 .dac_nids = alc660_dac_nids,
14371 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14372 .channel_mode = alc861_threestack_modes,
14374 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14375 .adc_nids = alc861_adc_nids,
14376 .input_mux = &alc861_capture_source,
14378 [ALC861_UNIWILL_M31] = {
14379 .mixers = { alc861_uniwill_m31_mixer },
14380 .init_verbs = { alc861_uniwill_m31_init_verbs },
14381 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14382 .dac_nids = alc861_dac_nids,
14383 .dig_out_nid = ALC861_DIGOUT_NID,
14384 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14385 .channel_mode = alc861_uniwill_m31_modes,
14387 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14388 .adc_nids = alc861_adc_nids,
14389 .input_mux = &alc861_capture_source,
14391 [ALC861_TOSHIBA] = {
14392 .mixers = { alc861_toshiba_mixer },
14393 .init_verbs = { alc861_base_init_verbs,
14394 alc861_toshiba_init_verbs },
14395 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14396 .dac_nids = alc861_dac_nids,
14397 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14398 .channel_mode = alc883_3ST_2ch_modes,
14399 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14400 .adc_nids = alc861_adc_nids,
14401 .input_mux = &alc861_capture_source,
14402 .unsol_event = alc861_toshiba_unsol_event,
14403 .init_hook = alc861_toshiba_automute,
14406 .mixers = { alc861_asus_mixer },
14407 .init_verbs = { alc861_asus_init_verbs },
14408 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14409 .dac_nids = alc861_dac_nids,
14410 .dig_out_nid = ALC861_DIGOUT_NID,
14411 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14412 .channel_mode = alc861_asus_modes,
14415 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14416 .adc_nids = alc861_adc_nids,
14417 .input_mux = &alc861_capture_source,
14419 [ALC861_ASUS_LAPTOP] = {
14420 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14421 .init_verbs = { alc861_asus_init_verbs,
14422 alc861_asus_laptop_init_verbs },
14423 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14424 .dac_nids = alc861_dac_nids,
14425 .dig_out_nid = ALC861_DIGOUT_NID,
14426 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14427 .channel_mode = alc883_3ST_2ch_modes,
14429 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14430 .adc_nids = alc861_adc_nids,
14431 .input_mux = &alc861_capture_source,
14436 static int patch_alc861(struct hda_codec *codec)
14438 struct alc_spec *spec;
14442 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14446 codec->spec = spec;
14448 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14452 if (board_config < 0) {
14453 printk(KERN_INFO "hda_codec: Unknown model for %s, "
14454 "trying auto-probe from BIOS...\n", codec->chip_name);
14455 board_config = ALC861_AUTO;
14458 if (board_config == ALC861_AUTO) {
14459 /* automatic parse from the BIOS config */
14460 err = alc861_parse_auto_config(codec);
14466 "hda_codec: Cannot set up configuration "
14467 "from BIOS. Using base mode...\n");
14468 board_config = ALC861_3ST_DIG;
14472 err = snd_hda_attach_beep_device(codec, 0x23);
14478 if (board_config != ALC861_AUTO)
14479 setup_preset(spec, &alc861_presets[board_config]);
14481 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14482 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14484 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14485 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14487 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14489 spec->vmaster_nid = 0x03;
14491 codec->patch_ops = alc_patch_ops;
14492 if (board_config == ALC861_AUTO)
14493 spec->init_hook = alc861_auto_init;
14494 #ifdef CONFIG_SND_HDA_POWER_SAVE
14495 if (!spec->loopback.amplist)
14496 spec->loopback.amplist = alc861_loopbacks;
14498 codec->proc_widget_hook = print_realtek_coef;
14504 * ALC861-VD support
14508 * In addition, an independent DAC
14510 #define ALC861VD_DIGOUT_NID 0x06
14512 static hda_nid_t alc861vd_dac_nids[4] = {
14513 /* front, surr, clfe, side surr */
14514 0x02, 0x03, 0x04, 0x05
14517 /* dac_nids for ALC660vd are in a different order - according to
14518 * Realtek's driver.
14519 * This should probably result in a different mixer for 6stack models
14520 * of ALC660vd codecs, but for now there is only 3stack mixer
14521 * - and it is the same as in 861vd.
14522 * adc_nids in ALC660vd are (is) the same as in 861vd
14524 static hda_nid_t alc660vd_dac_nids[3] = {
14525 /* front, rear, clfe, rear_surr */
14529 static hda_nid_t alc861vd_adc_nids[1] = {
14534 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14537 /* FIXME: should be a matrix-type input source selection */
14538 static struct hda_input_mux alc861vd_capture_source = {
14542 { "Front Mic", 0x1 },
14548 static struct hda_input_mux alc861vd_dallas_capture_source = {
14551 { "Ext Mic", 0x0 },
14552 { "Int Mic", 0x1 },
14556 static struct hda_input_mux alc861vd_hp_capture_source = {
14559 { "Front Mic", 0x0 },
14560 { "ATAPI Mic", 0x1 },
14567 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14574 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14575 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14576 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14577 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14578 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14585 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14586 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14587 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14588 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14589 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14593 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14594 { 6, alc861vd_6stack_ch6_init },
14595 { 8, alc861vd_6stack_ch8_init },
14598 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14600 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14601 .name = "Channel Mode",
14602 .info = alc_ch_mode_info,
14603 .get = alc_ch_mode_get,
14604 .put = alc_ch_mode_put,
14609 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14610 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14612 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14613 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14614 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14616 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14617 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14619 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14621 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14623 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14624 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14626 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14627 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14629 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14631 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14632 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14633 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14635 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14636 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14637 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14639 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14640 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14642 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14643 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14648 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14649 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14650 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14652 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14654 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14658 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14659 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14660 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14662 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14663 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14665 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14666 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14671 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14672 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14673 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14674 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14676 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14678 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14682 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14683 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14684 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14686 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14687 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14692 /* Pin assignment: Speaker=0x14, HP = 0x15,
14693 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14695 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14696 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14697 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14698 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14699 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14700 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14701 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14702 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14703 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14704 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14705 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14709 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14710 * Front Mic=0x18, ATAPI Mic = 0x19,
14712 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14713 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14714 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14715 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14716 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14717 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14718 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14719 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14720 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14726 * generic initialization of ADC, input mixers and output mixers
14728 static struct hda_verb alc861vd_volume_init_verbs[] = {
14730 * Unmute ADC0 and set the default input to mic-in
14732 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14733 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14735 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14736 * the analog-loopback mixer widget
14738 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14739 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14740 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14741 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14742 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14743 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14745 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14746 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14747 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14748 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14749 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14752 * Set up output mixers (0x02 - 0x05)
14754 /* set vol=0 to output mixers */
14755 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14756 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14757 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14758 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14760 /* set up input amps for analog loopback */
14761 /* Amp Indices: DAC = 0, mixer = 1 */
14762 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14763 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14764 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14765 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14766 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14767 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14768 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14769 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14775 * 3-stack pin configuration:
14776 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14778 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14780 * Set pin mode and muting
14782 /* set front pin widgets 0x14 for output */
14783 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14784 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14785 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14787 /* Mic (rear) pin: input vref at 80% */
14788 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14789 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14790 /* Front Mic pin: input vref at 80% */
14791 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14792 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14793 /* Line In pin: input */
14794 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14795 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14796 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14797 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14798 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14799 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14800 /* CD pin widget for input */
14801 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14807 * 6-stack pin configuration:
14809 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14811 * Set pin mode and muting
14813 /* set front pin widgets 0x14 for output */
14814 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14815 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14816 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14818 /* Rear Pin: output 1 (0x0d) */
14819 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14820 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14821 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14822 /* CLFE Pin: output 2 (0x0e) */
14823 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14824 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14825 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14826 /* Side Pin: output 3 (0x0f) */
14827 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14828 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14829 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14831 /* Mic (rear) pin: input vref at 80% */
14832 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14833 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14834 /* Front Mic pin: input vref at 80% */
14835 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14836 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14837 /* Line In pin: input */
14838 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14839 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14840 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14841 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14842 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14843 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14844 /* CD pin widget for input */
14845 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14850 static struct hda_verb alc861vd_eapd_verbs[] = {
14851 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14855 static struct hda_verb alc660vd_eapd_verbs[] = {
14856 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14857 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14861 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14862 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14864 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14865 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14866 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14870 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14872 unsigned int present;
14873 unsigned char bits;
14875 present = snd_hda_codec_read(codec, 0x18, 0,
14876 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14877 bits = present ? HDA_AMP_MUTE : 0;
14878 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14879 HDA_AMP_MUTE, bits);
14882 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14884 struct alc_spec *spec = codec->spec;
14886 spec->autocfg.hp_pins[0] = 0x1b;
14887 spec->autocfg.speaker_pins[0] = 0x14;
14888 alc_automute_amp(codec);
14889 alc861vd_lenovo_mic_automute(codec);
14892 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14895 switch (res >> 26) {
14896 case ALC880_MIC_EVENT:
14897 alc861vd_lenovo_mic_automute(codec);
14900 alc_automute_amp_unsol_event(codec, res);
14905 static struct hda_verb alc861vd_dallas_verbs[] = {
14906 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14907 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14908 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14909 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14911 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14912 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14913 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14914 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14915 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14916 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14917 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14918 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14920 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14921 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14922 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14923 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14924 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14925 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14926 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14927 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14929 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14930 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14931 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14932 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14933 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14934 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14935 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14936 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14938 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14939 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14940 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14941 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14943 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14944 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14945 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14950 /* toggle speaker-output according to the hp-jack state */
14951 static void alc861vd_dallas_init_hook(struct hda_codec *codec)
14953 struct alc_spec *spec = codec->spec;
14955 spec->autocfg.hp_pins[0] = 0x15;
14956 spec->autocfg.speaker_pins[0] = 0x14;
14957 alc_automute_amp(codec);
14960 #ifdef CONFIG_SND_HDA_POWER_SAVE
14961 #define alc861vd_loopbacks alc880_loopbacks
14964 /* pcm configuration: identical with ALC880 */
14965 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14966 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14967 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14968 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14971 * configuration and preset
14973 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14974 [ALC660VD_3ST] = "3stack-660",
14975 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14976 [ALC660VD_ASUS_V1S] = "asus-v1s",
14977 [ALC861VD_3ST] = "3stack",
14978 [ALC861VD_3ST_DIG] = "3stack-digout",
14979 [ALC861VD_6ST_DIG] = "6stack-digout",
14980 [ALC861VD_LENOVO] = "lenovo",
14981 [ALC861VD_DALLAS] = "dallas",
14982 [ALC861VD_HP] = "hp",
14983 [ALC861VD_AUTO] = "auto",
14986 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14987 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14988 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14989 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14990 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14991 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14992 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14993 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14994 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14995 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14996 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14997 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14998 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14999 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15000 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15001 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15005 static struct alc_config_preset alc861vd_presets[] = {
15007 .mixers = { alc861vd_3st_mixer },
15008 .init_verbs = { alc861vd_volume_init_verbs,
15009 alc861vd_3stack_init_verbs },
15010 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15011 .dac_nids = alc660vd_dac_nids,
15012 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15013 .channel_mode = alc861vd_3stack_2ch_modes,
15014 .input_mux = &alc861vd_capture_source,
15016 [ALC660VD_3ST_DIG] = {
15017 .mixers = { alc861vd_3st_mixer },
15018 .init_verbs = { alc861vd_volume_init_verbs,
15019 alc861vd_3stack_init_verbs },
15020 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15021 .dac_nids = alc660vd_dac_nids,
15022 .dig_out_nid = ALC861VD_DIGOUT_NID,
15023 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15024 .channel_mode = alc861vd_3stack_2ch_modes,
15025 .input_mux = &alc861vd_capture_source,
15028 .mixers = { alc861vd_3st_mixer },
15029 .init_verbs = { alc861vd_volume_init_verbs,
15030 alc861vd_3stack_init_verbs },
15031 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15032 .dac_nids = alc861vd_dac_nids,
15033 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15034 .channel_mode = alc861vd_3stack_2ch_modes,
15035 .input_mux = &alc861vd_capture_source,
15037 [ALC861VD_3ST_DIG] = {
15038 .mixers = { alc861vd_3st_mixer },
15039 .init_verbs = { alc861vd_volume_init_verbs,
15040 alc861vd_3stack_init_verbs },
15041 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15042 .dac_nids = alc861vd_dac_nids,
15043 .dig_out_nid = ALC861VD_DIGOUT_NID,
15044 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15045 .channel_mode = alc861vd_3stack_2ch_modes,
15046 .input_mux = &alc861vd_capture_source,
15048 [ALC861VD_6ST_DIG] = {
15049 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15050 .init_verbs = { alc861vd_volume_init_verbs,
15051 alc861vd_6stack_init_verbs },
15052 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15053 .dac_nids = alc861vd_dac_nids,
15054 .dig_out_nid = ALC861VD_DIGOUT_NID,
15055 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15056 .channel_mode = alc861vd_6stack_modes,
15057 .input_mux = &alc861vd_capture_source,
15059 [ALC861VD_LENOVO] = {
15060 .mixers = { alc861vd_lenovo_mixer },
15061 .init_verbs = { alc861vd_volume_init_verbs,
15062 alc861vd_3stack_init_verbs,
15063 alc861vd_eapd_verbs,
15064 alc861vd_lenovo_unsol_verbs },
15065 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15066 .dac_nids = alc660vd_dac_nids,
15067 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15068 .channel_mode = alc861vd_3stack_2ch_modes,
15069 .input_mux = &alc861vd_capture_source,
15070 .unsol_event = alc861vd_lenovo_unsol_event,
15071 .init_hook = alc861vd_lenovo_init_hook,
15073 [ALC861VD_DALLAS] = {
15074 .mixers = { alc861vd_dallas_mixer },
15075 .init_verbs = { alc861vd_dallas_verbs },
15076 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15077 .dac_nids = alc861vd_dac_nids,
15078 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15079 .channel_mode = alc861vd_3stack_2ch_modes,
15080 .input_mux = &alc861vd_dallas_capture_source,
15081 .unsol_event = alc_automute_amp_unsol_event,
15082 .init_hook = alc861vd_dallas_init_hook,
15085 .mixers = { alc861vd_hp_mixer },
15086 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15087 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15088 .dac_nids = alc861vd_dac_nids,
15089 .dig_out_nid = ALC861VD_DIGOUT_NID,
15090 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15091 .channel_mode = alc861vd_3stack_2ch_modes,
15092 .input_mux = &alc861vd_hp_capture_source,
15093 .unsol_event = alc_automute_amp_unsol_event,
15094 .init_hook = alc861vd_dallas_init_hook,
15096 [ALC660VD_ASUS_V1S] = {
15097 .mixers = { alc861vd_lenovo_mixer },
15098 .init_verbs = { alc861vd_volume_init_verbs,
15099 alc861vd_3stack_init_verbs,
15100 alc861vd_eapd_verbs,
15101 alc861vd_lenovo_unsol_verbs },
15102 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15103 .dac_nids = alc660vd_dac_nids,
15104 .dig_out_nid = ALC861VD_DIGOUT_NID,
15105 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15106 .channel_mode = alc861vd_3stack_2ch_modes,
15107 .input_mux = &alc861vd_capture_source,
15108 .unsol_event = alc861vd_lenovo_unsol_event,
15109 .init_hook = alc861vd_lenovo_init_hook,
15114 * BIOS auto configuration
15116 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15117 hda_nid_t nid, int pin_type, int dac_idx)
15119 alc_set_pin_output(codec, nid, pin_type);
15122 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15124 struct alc_spec *spec = codec->spec;
15127 for (i = 0; i <= HDA_SIDE; i++) {
15128 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15129 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15131 alc861vd_auto_set_output_and_unmute(codec, nid,
15137 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15139 struct alc_spec *spec = codec->spec;
15142 pin = spec->autocfg.hp_pins[0];
15143 if (pin) /* connect to front and use dac 0 */
15144 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15145 pin = spec->autocfg.speaker_pins[0];
15147 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15150 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
15151 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15153 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15155 struct alc_spec *spec = codec->spec;
15158 for (i = 0; i < AUTO_PIN_LAST; i++) {
15159 hda_nid_t nid = spec->autocfg.input_pins[i];
15160 if (alc861vd_is_input_pin(nid)) {
15161 alc_set_input_pin(codec, nid, i);
15162 if (nid != ALC861VD_PIN_CD_NID &&
15163 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15164 snd_hda_codec_write(codec, nid, 0,
15165 AC_VERB_SET_AMP_GAIN_MUTE,
15171 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15173 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15174 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15176 /* add playback controls from the parsed DAC table */
15177 /* Based on ALC880 version. But ALC861VD has separate,
15178 * different NIDs for mute/unmute switch and volume control */
15179 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15180 const struct auto_pin_cfg *cfg)
15183 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15184 hda_nid_t nid_v, nid_s;
15187 for (i = 0; i < cfg->line_outs; i++) {
15188 if (!spec->multiout.dac_nids[i])
15190 nid_v = alc861vd_idx_to_mixer_vol(
15192 spec->multiout.dac_nids[i]));
15193 nid_s = alc861vd_idx_to_mixer_switch(
15195 spec->multiout.dac_nids[i]));
15199 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15200 "Center Playback Volume",
15201 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15205 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15206 "LFE Playback Volume",
15207 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15211 err = add_control(spec, ALC_CTL_BIND_MUTE,
15212 "Center Playback Switch",
15213 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15217 err = add_control(spec, ALC_CTL_BIND_MUTE,
15218 "LFE Playback Switch",
15219 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15224 sprintf(name, "%s Playback Volume", chname[i]);
15225 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15226 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15230 sprintf(name, "%s Playback Switch", chname[i]);
15231 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15232 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15241 /* add playback controls for speaker and HP outputs */
15242 /* Based on ALC880 version. But ALC861VD has separate,
15243 * different NIDs for mute/unmute switch and volume control */
15244 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15245 hda_nid_t pin, const char *pfx)
15247 hda_nid_t nid_v, nid_s;
15254 if (alc880_is_fixed_pin(pin)) {
15255 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15256 /* specify the DAC as the extra output */
15257 if (!spec->multiout.hp_nid)
15258 spec->multiout.hp_nid = nid_v;
15260 spec->multiout.extra_out_nid[0] = nid_v;
15261 /* control HP volume/switch on the output mixer amp */
15262 nid_v = alc861vd_idx_to_mixer_vol(
15263 alc880_fixed_pin_idx(pin));
15264 nid_s = alc861vd_idx_to_mixer_switch(
15265 alc880_fixed_pin_idx(pin));
15267 sprintf(name, "%s Playback Volume", pfx);
15268 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15269 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15272 sprintf(name, "%s Playback Switch", pfx);
15273 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15274 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15277 } else if (alc880_is_multi_pin(pin)) {
15278 /* set manual connection */
15279 /* we have only a switch on HP-out PIN */
15280 sprintf(name, "%s Playback Switch", pfx);
15281 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15282 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15289 /* parse the BIOS configuration and set up the alc_spec
15290 * return 1 if successful, 0 if the proper config is not found,
15291 * or a negative error code
15292 * Based on ALC880 version - had to change it to override
15293 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15294 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15296 struct alc_spec *spec = codec->spec;
15298 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15300 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15304 if (!spec->autocfg.line_outs)
15305 return 0; /* can't find valid BIOS pin config */
15307 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15310 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15313 err = alc861vd_auto_create_extra_out(spec,
15314 spec->autocfg.speaker_pins[0],
15318 err = alc861vd_auto_create_extra_out(spec,
15319 spec->autocfg.hp_pins[0],
15323 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15327 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15329 if (spec->autocfg.dig_outs)
15330 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15332 if (spec->kctls.list)
15333 add_mixer(spec, spec->kctls.list);
15335 add_verb(spec, alc861vd_volume_init_verbs);
15337 spec->num_mux_defs = 1;
15338 spec->input_mux = &spec->private_imux[0];
15340 err = alc_auto_add_mic_boost(codec);
15344 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15349 /* additional initialization for auto-configuration model */
15350 static void alc861vd_auto_init(struct hda_codec *codec)
15352 struct alc_spec *spec = codec->spec;
15353 alc861vd_auto_init_multi_out(codec);
15354 alc861vd_auto_init_hp_out(codec);
15355 alc861vd_auto_init_analog_input(codec);
15356 alc861vd_auto_init_input_src(codec);
15357 if (spec->unsol_event)
15358 alc_inithook(codec);
15361 static int patch_alc861vd(struct hda_codec *codec)
15363 struct alc_spec *spec;
15364 int err, board_config;
15366 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15370 codec->spec = spec;
15372 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15376 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15377 printk(KERN_INFO "hda_codec: Unknown model for %s, "
15378 "trying auto-probe from BIOS...\n", codec->chip_name);
15379 board_config = ALC861VD_AUTO;
15382 if (board_config == ALC861VD_AUTO) {
15383 /* automatic parse from the BIOS config */
15384 err = alc861vd_parse_auto_config(codec);
15390 "hda_codec: Cannot set up configuration "
15391 "from BIOS. Using base mode...\n");
15392 board_config = ALC861VD_3ST;
15396 err = snd_hda_attach_beep_device(codec, 0x23);
15402 if (board_config != ALC861VD_AUTO)
15403 setup_preset(spec, &alc861vd_presets[board_config]);
15405 if (codec->vendor_id == 0x10ec0660) {
15406 /* always turn on EAPD */
15407 add_verb(spec, alc660vd_eapd_verbs);
15410 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15411 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15413 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15414 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15416 spec->adc_nids = alc861vd_adc_nids;
15417 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15418 spec->capsrc_nids = alc861vd_capsrc_nids;
15420 set_capture_mixer(spec);
15421 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15423 spec->vmaster_nid = 0x02;
15425 codec->patch_ops = alc_patch_ops;
15427 if (board_config == ALC861VD_AUTO)
15428 spec->init_hook = alc861vd_auto_init;
15429 #ifdef CONFIG_SND_HDA_POWER_SAVE
15430 if (!spec->loopback.amplist)
15431 spec->loopback.amplist = alc861vd_loopbacks;
15433 codec->proc_widget_hook = print_realtek_coef;
15441 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15442 * configuration. Each pin widget can choose any input DACs and a mixer.
15443 * Each ADC is connected from a mixer of all inputs. This makes possible
15444 * 6-channel independent captures.
15446 * In addition, an independent DAC for the multi-playback (not used in this
15449 #define ALC662_DIGOUT_NID 0x06
15450 #define ALC662_DIGIN_NID 0x0a
15452 static hda_nid_t alc662_dac_nids[4] = {
15453 /* front, rear, clfe, rear_surr */
15457 static hda_nid_t alc272_dac_nids[2] = {
15461 static hda_nid_t alc662_adc_nids[1] = {
15466 static hda_nid_t alc272_adc_nids[1] = {
15471 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15472 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15476 /* FIXME: should be a matrix-type input source selection */
15477 static struct hda_input_mux alc662_capture_source = {
15481 { "Front Mic", 0x1 },
15487 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15495 static struct hda_input_mux alc662_eeepc_capture_source = {
15503 static struct hda_input_mux alc663_capture_source = {
15507 { "Front Mic", 0x1 },
15512 static struct hda_input_mux alc663_m51va_capture_source = {
15515 { "Ext-Mic", 0x0 },
15520 #if 1 /* set to 0 for testing other input sources below */
15521 static struct hda_input_mux alc272_nc10_capture_source = {
15524 { "Autoselect Mic", 0x0 },
15525 { "Internal Mic", 0x1 },
15529 static struct hda_input_mux alc272_nc10_capture_source = {
15532 { "Autoselect Mic", 0x0 },
15533 { "Internal Mic", 0x1 },
15534 { "In-0x02", 0x2 },
15535 { "In-0x03", 0x3 },
15536 { "In-0x04", 0x4 },
15537 { "In-0x05", 0x5 },
15538 { "In-0x06", 0x6 },
15539 { "In-0x07", 0x7 },
15540 { "In-0x08", 0x8 },
15541 { "In-0x09", 0x9 },
15542 { "In-0x0a", 0x0a },
15543 { "In-0x0b", 0x0b },
15544 { "In-0x0c", 0x0c },
15545 { "In-0x0d", 0x0d },
15546 { "In-0x0e", 0x0e },
15547 { "In-0x0f", 0x0f },
15555 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15562 static struct hda_verb alc662_3ST_ch2_init[] = {
15563 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15564 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15565 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15566 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15573 static struct hda_verb alc662_3ST_ch6_init[] = {
15574 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15575 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15576 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15577 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15578 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15579 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15583 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15584 { 2, alc662_3ST_ch2_init },
15585 { 6, alc662_3ST_ch6_init },
15591 static struct hda_verb alc662_sixstack_ch6_init[] = {
15592 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15593 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15594 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15601 static struct hda_verb alc662_sixstack_ch8_init[] = {
15602 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15603 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15604 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15608 static struct hda_channel_mode alc662_5stack_modes[2] = {
15609 { 2, alc662_sixstack_ch6_init },
15610 { 6, alc662_sixstack_ch8_init },
15613 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15614 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15617 static struct snd_kcontrol_new alc662_base_mixer[] = {
15618 /* output mixer control */
15619 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15620 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15621 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15622 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15623 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15624 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15625 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15626 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15627 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15629 /*Input mixer control */
15630 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15631 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15632 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15633 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15634 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15635 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15636 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15637 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15641 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15642 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15643 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15644 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15645 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15646 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15647 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15648 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15649 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15650 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15651 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15652 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15656 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15657 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15658 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15659 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15660 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15661 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15662 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15663 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15664 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15665 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15666 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15667 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15668 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15669 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15670 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15671 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15672 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15673 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15677 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15678 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15679 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15680 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15681 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15682 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15683 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15684 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15685 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15686 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15690 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15691 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15692 ALC262_HIPPO_MASTER_SWITCH,
15694 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15695 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15696 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15698 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15699 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15700 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15704 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15705 ALC262_HIPPO_MASTER_SWITCH,
15706 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15707 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15708 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15709 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15710 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15711 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15712 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15713 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15714 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15718 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15719 .ops = &snd_hda_bind_vol,
15721 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15722 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15727 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15728 .ops = &snd_hda_bind_sw,
15730 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15731 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15736 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15737 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15738 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15739 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15740 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15744 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15745 .ops = &snd_hda_bind_sw,
15747 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15748 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15749 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15754 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15755 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15756 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15757 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15758 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15759 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15760 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15765 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15766 .ops = &snd_hda_bind_sw,
15768 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15769 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15770 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15775 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15776 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15777 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15778 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15780 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15781 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15785 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15786 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15787 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15788 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15789 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15790 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15791 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15792 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15796 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15797 .ops = &snd_hda_bind_vol,
15799 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15800 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15805 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15806 .ops = &snd_hda_bind_sw,
15808 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15809 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15814 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15815 HDA_BIND_VOL("Master Playback Volume",
15816 &alc663_asus_two_bind_master_vol),
15817 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15818 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15819 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15820 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15821 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15825 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15826 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15827 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15828 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15829 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15830 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15831 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15835 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15836 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15837 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15838 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15839 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15840 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15842 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15843 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15844 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15845 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15849 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15850 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15851 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15852 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15854 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15855 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15856 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15857 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15858 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15859 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15863 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15865 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15866 .name = "Channel Mode",
15867 .info = alc_ch_mode_info,
15868 .get = alc_ch_mode_get,
15869 .put = alc_ch_mode_put,
15874 static struct hda_verb alc662_init_verbs[] = {
15875 /* ADC: mute amp left and right */
15876 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15877 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15878 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15881 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15882 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15883 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15884 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15886 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15888 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15889 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15890 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15891 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15893 /* Front Pin: output 0 (0x0c) */
15894 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15895 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15897 /* Rear Pin: output 1 (0x0d) */
15898 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15899 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15901 /* CLFE Pin: output 2 (0x0e) */
15902 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15903 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15905 /* Mic (rear) pin: input vref at 80% */
15906 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15907 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15908 /* Front Mic pin: input vref at 80% */
15909 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15910 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15911 /* Line In pin: input */
15912 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15913 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15914 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15915 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15916 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15917 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15918 /* CD pin widget for input */
15919 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15921 /* FIXME: use matrix-type input source selection */
15922 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15924 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15925 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15927 /* always trun on EAPD */
15928 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15929 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15934 static struct hda_verb alc662_sue_init_verbs[] = {
15935 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15936 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15940 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15941 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15942 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15946 /* Set Unsolicited Event*/
15947 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15948 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15949 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15954 * generic initialization of ADC, input mixers and output mixers
15956 static struct hda_verb alc662_auto_init_verbs[] = {
15958 * Unmute ADC and set the default input to mic-in
15960 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15961 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15963 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15965 * Note: PASD motherboards uses the Line In 2 as the input for front
15966 * panel mic (mic 2)
15968 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15969 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15970 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15971 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15972 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15973 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15976 * Set up output mixers (0x0c - 0x0f)
15978 /* set vol=0 to output mixers */
15979 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15980 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15981 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15983 /* set up input amps for analog loopback */
15984 /* Amp Indices: DAC = 0, mixer = 1 */
15985 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15986 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15987 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15988 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15989 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15990 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15993 /* FIXME: use matrix-type input source selection */
15994 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15996 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15997 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16001 /* additional verbs for ALC663 */
16002 static struct hda_verb alc663_auto_init_verbs[] = {
16003 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16004 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16008 static struct hda_verb alc663_m51va_init_verbs[] = {
16009 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16010 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16011 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16012 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16013 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16014 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16015 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16016 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16017 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16021 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16022 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16023 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16024 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16025 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16026 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16027 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16028 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16032 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16033 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16034 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16035 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16036 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16039 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16040 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16044 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16045 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16046 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16047 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16048 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16049 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16050 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16051 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16055 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16056 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16057 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16058 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16059 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16060 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16061 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16062 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16064 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16065 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16066 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16067 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16071 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16072 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16073 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16074 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16075 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16076 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16077 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16078 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16081 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16082 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16083 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16087 static struct hda_verb alc663_g71v_init_verbs[] = {
16088 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16089 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16090 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16092 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16093 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16094 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16096 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16097 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16098 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16102 static struct hda_verb alc663_g50v_init_verbs[] = {
16103 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16104 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16105 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16107 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16108 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16112 static struct hda_verb alc662_ecs_init_verbs[] = {
16113 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16114 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16115 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16116 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16120 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16121 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16122 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16123 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16124 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16125 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16126 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16127 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16128 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16129 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16130 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16131 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16135 static struct hda_verb alc272_dell_init_verbs[] = {
16136 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16137 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16138 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16139 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16140 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16141 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16142 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16143 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16144 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16145 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16146 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16150 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16151 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16152 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16156 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16157 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16158 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16162 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16164 unsigned int present;
16165 unsigned char bits;
16167 present = snd_hda_codec_read(codec, 0x14, 0,
16168 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16169 bits = present ? HDA_AMP_MUTE : 0;
16170 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16171 HDA_AMP_MUTE, bits);
16174 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16176 unsigned int present;
16177 unsigned char bits;
16179 present = snd_hda_codec_read(codec, 0x1b, 0,
16180 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16181 bits = present ? HDA_AMP_MUTE : 0;
16182 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16183 HDA_AMP_MUTE, bits);
16184 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16185 HDA_AMP_MUTE, bits);
16188 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16191 if ((res >> 26) == ALC880_HP_EVENT)
16192 alc662_lenovo_101e_all_automute(codec);
16193 if ((res >> 26) == ALC880_FRONT_EVENT)
16194 alc662_lenovo_101e_ispeaker_automute(codec);
16197 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
16199 unsigned int present;
16201 present = snd_hda_codec_read(codec, 0x18, 0,
16202 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16203 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16204 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16205 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16206 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16207 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16208 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16209 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16210 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16213 /* unsolicited event for HP jack sensing */
16214 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16217 if ((res >> 26) == ALC880_MIC_EVENT)
16218 alc662_eeepc_mic_automute(codec);
16220 alc262_hippo_unsol_event(codec, res);
16223 static void alc662_eeepc_inithook(struct hda_codec *codec)
16225 alc262_hippo1_init_hook(codec);
16226 alc662_eeepc_mic_automute(codec);
16229 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
16231 struct alc_spec *spec = codec->spec;
16233 spec->autocfg.hp_pins[0] = 0x14;
16234 spec->autocfg.speaker_pins[0] = 0x1b;
16235 alc262_hippo_master_update(codec);
16238 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16240 unsigned int present;
16241 unsigned char bits;
16243 present = snd_hda_codec_read(codec, 0x21, 0,
16244 AC_VERB_GET_PIN_SENSE, 0)
16245 & AC_PINSENSE_PRESENCE;
16246 bits = present ? HDA_AMP_MUTE : 0;
16247 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16248 AMP_IN_MUTE(0), bits);
16249 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16250 AMP_IN_MUTE(0), bits);
16253 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16255 unsigned int present;
16256 unsigned char bits;
16258 present = snd_hda_codec_read(codec, 0x21, 0,
16259 AC_VERB_GET_PIN_SENSE, 0)
16260 & AC_PINSENSE_PRESENCE;
16261 bits = present ? HDA_AMP_MUTE : 0;
16262 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16263 AMP_IN_MUTE(0), bits);
16264 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16265 AMP_IN_MUTE(0), bits);
16266 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16267 AMP_IN_MUTE(0), bits);
16268 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16269 AMP_IN_MUTE(0), bits);
16272 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16274 unsigned int present;
16275 unsigned char bits;
16277 present = snd_hda_codec_read(codec, 0x15, 0,
16278 AC_VERB_GET_PIN_SENSE, 0)
16279 & AC_PINSENSE_PRESENCE;
16280 bits = present ? HDA_AMP_MUTE : 0;
16281 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16282 AMP_IN_MUTE(0), bits);
16283 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16284 AMP_IN_MUTE(0), bits);
16285 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16286 AMP_IN_MUTE(0), bits);
16287 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16288 AMP_IN_MUTE(0), bits);
16291 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16293 unsigned int present;
16294 unsigned char bits;
16296 present = snd_hda_codec_read(codec, 0x1b, 0,
16297 AC_VERB_GET_PIN_SENSE, 0)
16298 & AC_PINSENSE_PRESENCE;
16299 bits = present ? 0 : PIN_OUT;
16300 snd_hda_codec_write(codec, 0x14, 0,
16301 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16304 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16306 unsigned int present1, present2;
16308 present1 = snd_hda_codec_read(codec, 0x21, 0,
16309 AC_VERB_GET_PIN_SENSE, 0)
16310 & AC_PINSENSE_PRESENCE;
16311 present2 = snd_hda_codec_read(codec, 0x15, 0,
16312 AC_VERB_GET_PIN_SENSE, 0)
16313 & AC_PINSENSE_PRESENCE;
16315 if (present1 || present2) {
16316 snd_hda_codec_write_cache(codec, 0x14, 0,
16317 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16319 snd_hda_codec_write_cache(codec, 0x14, 0,
16320 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16324 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16326 unsigned int present1, present2;
16328 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16329 AC_VERB_GET_PIN_SENSE, 0)
16330 & AC_PINSENSE_PRESENCE;
16331 present2 = snd_hda_codec_read(codec, 0x15, 0,
16332 AC_VERB_GET_PIN_SENSE, 0)
16333 & AC_PINSENSE_PRESENCE;
16335 if (present1 || present2) {
16336 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16337 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16338 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16339 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16341 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16342 AMP_IN_MUTE(0), 0);
16343 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16344 AMP_IN_MUTE(0), 0);
16348 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16350 unsigned int present;
16352 present = snd_hda_codec_read(codec, 0x18, 0,
16353 AC_VERB_GET_PIN_SENSE, 0)
16354 & AC_PINSENSE_PRESENCE;
16355 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16356 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16357 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16358 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16359 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16360 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16361 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16362 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16365 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16368 switch (res >> 26) {
16369 case ALC880_HP_EVENT:
16370 alc663_m51va_speaker_automute(codec);
16372 case ALC880_MIC_EVENT:
16373 alc663_m51va_mic_automute(codec);
16378 static void alc663_m51va_inithook(struct hda_codec *codec)
16380 alc663_m51va_speaker_automute(codec);
16381 alc663_m51va_mic_automute(codec);
16384 /* ***************** Mode1 ******************************/
16385 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16388 switch (res >> 26) {
16389 case ALC880_HP_EVENT:
16390 alc663_m51va_speaker_automute(codec);
16392 case ALC880_MIC_EVENT:
16393 alc662_eeepc_mic_automute(codec);
16398 static void alc663_mode1_inithook(struct hda_codec *codec)
16400 alc663_m51va_speaker_automute(codec);
16401 alc662_eeepc_mic_automute(codec);
16403 /* ***************** Mode2 ******************************/
16404 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16407 switch (res >> 26) {
16408 case ALC880_HP_EVENT:
16409 alc662_f5z_speaker_automute(codec);
16411 case ALC880_MIC_EVENT:
16412 alc662_eeepc_mic_automute(codec);
16417 static void alc662_mode2_inithook(struct hda_codec *codec)
16419 alc662_f5z_speaker_automute(codec);
16420 alc662_eeepc_mic_automute(codec);
16422 /* ***************** Mode3 ******************************/
16423 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16426 switch (res >> 26) {
16427 case ALC880_HP_EVENT:
16428 alc663_two_hp_m1_speaker_automute(codec);
16430 case ALC880_MIC_EVENT:
16431 alc662_eeepc_mic_automute(codec);
16436 static void alc663_mode3_inithook(struct hda_codec *codec)
16438 alc663_two_hp_m1_speaker_automute(codec);
16439 alc662_eeepc_mic_automute(codec);
16441 /* ***************** Mode4 ******************************/
16442 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16445 switch (res >> 26) {
16446 case ALC880_HP_EVENT:
16447 alc663_21jd_two_speaker_automute(codec);
16449 case ALC880_MIC_EVENT:
16450 alc662_eeepc_mic_automute(codec);
16455 static void alc663_mode4_inithook(struct hda_codec *codec)
16457 alc663_21jd_two_speaker_automute(codec);
16458 alc662_eeepc_mic_automute(codec);
16460 /* ***************** Mode5 ******************************/
16461 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16464 switch (res >> 26) {
16465 case ALC880_HP_EVENT:
16466 alc663_15jd_two_speaker_automute(codec);
16468 case ALC880_MIC_EVENT:
16469 alc662_eeepc_mic_automute(codec);
16474 static void alc663_mode5_inithook(struct hda_codec *codec)
16476 alc663_15jd_two_speaker_automute(codec);
16477 alc662_eeepc_mic_automute(codec);
16479 /* ***************** Mode6 ******************************/
16480 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16483 switch (res >> 26) {
16484 case ALC880_HP_EVENT:
16485 alc663_two_hp_m2_speaker_automute(codec);
16487 case ALC880_MIC_EVENT:
16488 alc662_eeepc_mic_automute(codec);
16493 static void alc663_mode6_inithook(struct hda_codec *codec)
16495 alc663_two_hp_m2_speaker_automute(codec);
16496 alc662_eeepc_mic_automute(codec);
16499 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16501 unsigned int present;
16502 unsigned char bits;
16504 present = snd_hda_codec_read(codec, 0x21, 0,
16505 AC_VERB_GET_PIN_SENSE, 0)
16506 & AC_PINSENSE_PRESENCE;
16507 bits = present ? HDA_AMP_MUTE : 0;
16508 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16509 HDA_AMP_MUTE, bits);
16510 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16511 HDA_AMP_MUTE, bits);
16514 static void alc663_g71v_front_automute(struct hda_codec *codec)
16516 unsigned int present;
16517 unsigned char bits;
16519 present = snd_hda_codec_read(codec, 0x15, 0,
16520 AC_VERB_GET_PIN_SENSE, 0)
16521 & AC_PINSENSE_PRESENCE;
16522 bits = present ? HDA_AMP_MUTE : 0;
16523 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16524 HDA_AMP_MUTE, bits);
16527 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16530 switch (res >> 26) {
16531 case ALC880_HP_EVENT:
16532 alc663_g71v_hp_automute(codec);
16534 case ALC880_FRONT_EVENT:
16535 alc663_g71v_front_automute(codec);
16537 case ALC880_MIC_EVENT:
16538 alc662_eeepc_mic_automute(codec);
16543 static void alc663_g71v_inithook(struct hda_codec *codec)
16545 alc663_g71v_front_automute(codec);
16546 alc663_g71v_hp_automute(codec);
16547 alc662_eeepc_mic_automute(codec);
16550 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16553 switch (res >> 26) {
16554 case ALC880_HP_EVENT:
16555 alc663_m51va_speaker_automute(codec);
16557 case ALC880_MIC_EVENT:
16558 alc662_eeepc_mic_automute(codec);
16563 static void alc663_g50v_inithook(struct hda_codec *codec)
16565 alc663_m51va_speaker_automute(codec);
16566 alc662_eeepc_mic_automute(codec);
16569 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16570 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16571 ALC262_HIPPO_MASTER_SWITCH,
16573 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16574 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16575 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16577 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16578 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16579 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16583 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16584 /* Master Playback automatically created from Speaker and Headphone */
16585 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16586 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16587 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16588 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16590 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16591 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16592 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16594 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16595 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16596 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16600 #ifdef CONFIG_SND_HDA_POWER_SAVE
16601 #define alc662_loopbacks alc880_loopbacks
16605 /* pcm configuration: identical with ALC880 */
16606 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16607 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16608 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16609 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16612 * configuration and preset
16614 static const char *alc662_models[ALC662_MODEL_LAST] = {
16615 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16616 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16617 [ALC662_3ST_6ch] = "3stack-6ch",
16618 [ALC662_5ST_DIG] = "6stack-dig",
16619 [ALC662_LENOVO_101E] = "lenovo-101e",
16620 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16621 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16622 [ALC662_ECS] = "ecs",
16623 [ALC663_ASUS_M51VA] = "m51va",
16624 [ALC663_ASUS_G71V] = "g71v",
16625 [ALC663_ASUS_H13] = "h13",
16626 [ALC663_ASUS_G50V] = "g50v",
16627 [ALC663_ASUS_MODE1] = "asus-mode1",
16628 [ALC662_ASUS_MODE2] = "asus-mode2",
16629 [ALC663_ASUS_MODE3] = "asus-mode3",
16630 [ALC663_ASUS_MODE4] = "asus-mode4",
16631 [ALC663_ASUS_MODE5] = "asus-mode5",
16632 [ALC663_ASUS_MODE6] = "asus-mode6",
16633 [ALC272_DELL] = "dell",
16634 [ALC272_DELL_ZM1] = "dell-zm1",
16635 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16636 [ALC662_AUTO] = "auto",
16639 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16640 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16641 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16642 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16643 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16644 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16645 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16646 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16647 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16648 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16649 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16650 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16651 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16652 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16653 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16654 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16655 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16656 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16657 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16658 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16659 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16660 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16661 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16662 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16663 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16664 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16665 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16666 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16667 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16668 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16669 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16670 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16671 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16672 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16673 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16674 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16675 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16676 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16677 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16678 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16679 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16680 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16681 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16682 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16683 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16684 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16685 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16686 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16687 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16688 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16689 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16690 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16691 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16692 ALC662_3ST_6ch_DIG),
16693 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16694 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16695 ALC662_3ST_6ch_DIG),
16696 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16697 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16698 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16699 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16700 ALC662_3ST_6ch_DIG),
16701 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16706 static struct alc_config_preset alc662_presets[] = {
16707 [ALC662_3ST_2ch_DIG] = {
16708 .mixers = { alc662_3ST_2ch_mixer },
16709 .init_verbs = { alc662_init_verbs },
16710 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16711 .dac_nids = alc662_dac_nids,
16712 .dig_out_nid = ALC662_DIGOUT_NID,
16713 .dig_in_nid = ALC662_DIGIN_NID,
16714 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16715 .channel_mode = alc662_3ST_2ch_modes,
16716 .input_mux = &alc662_capture_source,
16718 [ALC662_3ST_6ch_DIG] = {
16719 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16720 .init_verbs = { alc662_init_verbs },
16721 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16722 .dac_nids = alc662_dac_nids,
16723 .dig_out_nid = ALC662_DIGOUT_NID,
16724 .dig_in_nid = ALC662_DIGIN_NID,
16725 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16726 .channel_mode = alc662_3ST_6ch_modes,
16728 .input_mux = &alc662_capture_source,
16730 [ALC662_3ST_6ch] = {
16731 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16732 .init_verbs = { alc662_init_verbs },
16733 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16734 .dac_nids = alc662_dac_nids,
16735 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16736 .channel_mode = alc662_3ST_6ch_modes,
16738 .input_mux = &alc662_capture_source,
16740 [ALC662_5ST_DIG] = {
16741 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16742 .init_verbs = { alc662_init_verbs },
16743 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16744 .dac_nids = alc662_dac_nids,
16745 .dig_out_nid = ALC662_DIGOUT_NID,
16746 .dig_in_nid = ALC662_DIGIN_NID,
16747 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16748 .channel_mode = alc662_5stack_modes,
16749 .input_mux = &alc662_capture_source,
16751 [ALC662_LENOVO_101E] = {
16752 .mixers = { alc662_lenovo_101e_mixer },
16753 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16754 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16755 .dac_nids = alc662_dac_nids,
16756 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16757 .channel_mode = alc662_3ST_2ch_modes,
16758 .input_mux = &alc662_lenovo_101e_capture_source,
16759 .unsol_event = alc662_lenovo_101e_unsol_event,
16760 .init_hook = alc662_lenovo_101e_all_automute,
16762 [ALC662_ASUS_EEEPC_P701] = {
16763 .mixers = { alc662_eeepc_p701_mixer },
16764 .init_verbs = { alc662_init_verbs,
16765 alc662_eeepc_sue_init_verbs },
16766 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16767 .dac_nids = alc662_dac_nids,
16768 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16769 .channel_mode = alc662_3ST_2ch_modes,
16770 .input_mux = &alc662_eeepc_capture_source,
16771 .unsol_event = alc662_eeepc_unsol_event,
16772 .init_hook = alc662_eeepc_inithook,
16774 [ALC662_ASUS_EEEPC_EP20] = {
16775 .mixers = { alc662_eeepc_ep20_mixer,
16776 alc662_chmode_mixer },
16777 .init_verbs = { alc662_init_verbs,
16778 alc662_eeepc_ep20_sue_init_verbs },
16779 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16780 .dac_nids = alc662_dac_nids,
16781 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16782 .channel_mode = alc662_3ST_6ch_modes,
16783 .input_mux = &alc662_lenovo_101e_capture_source,
16784 .unsol_event = alc662_eeepc_unsol_event,
16785 .init_hook = alc662_eeepc_ep20_inithook,
16788 .mixers = { alc662_ecs_mixer },
16789 .init_verbs = { alc662_init_verbs,
16790 alc662_ecs_init_verbs },
16791 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16792 .dac_nids = alc662_dac_nids,
16793 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16794 .channel_mode = alc662_3ST_2ch_modes,
16795 .input_mux = &alc662_eeepc_capture_source,
16796 .unsol_event = alc662_eeepc_unsol_event,
16797 .init_hook = alc662_eeepc_inithook,
16799 [ALC663_ASUS_M51VA] = {
16800 .mixers = { alc663_m51va_mixer },
16801 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16802 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16803 .dac_nids = alc662_dac_nids,
16804 .dig_out_nid = ALC662_DIGOUT_NID,
16805 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16806 .channel_mode = alc662_3ST_2ch_modes,
16807 .input_mux = &alc663_m51va_capture_source,
16808 .unsol_event = alc663_m51va_unsol_event,
16809 .init_hook = alc663_m51va_inithook,
16811 [ALC663_ASUS_G71V] = {
16812 .mixers = { alc663_g71v_mixer },
16813 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16814 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16815 .dac_nids = alc662_dac_nids,
16816 .dig_out_nid = ALC662_DIGOUT_NID,
16817 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16818 .channel_mode = alc662_3ST_2ch_modes,
16819 .input_mux = &alc662_eeepc_capture_source,
16820 .unsol_event = alc663_g71v_unsol_event,
16821 .init_hook = alc663_g71v_inithook,
16823 [ALC663_ASUS_H13] = {
16824 .mixers = { alc663_m51va_mixer },
16825 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16826 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16827 .dac_nids = alc662_dac_nids,
16828 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16829 .channel_mode = alc662_3ST_2ch_modes,
16830 .input_mux = &alc663_m51va_capture_source,
16831 .unsol_event = alc663_m51va_unsol_event,
16832 .init_hook = alc663_m51va_inithook,
16834 [ALC663_ASUS_G50V] = {
16835 .mixers = { alc663_g50v_mixer },
16836 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16837 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16838 .dac_nids = alc662_dac_nids,
16839 .dig_out_nid = ALC662_DIGOUT_NID,
16840 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16841 .channel_mode = alc662_3ST_6ch_modes,
16842 .input_mux = &alc663_capture_source,
16843 .unsol_event = alc663_g50v_unsol_event,
16844 .init_hook = alc663_g50v_inithook,
16846 [ALC663_ASUS_MODE1] = {
16847 .mixers = { alc663_m51va_mixer },
16848 .cap_mixer = alc662_auto_capture_mixer,
16849 .init_verbs = { alc662_init_verbs,
16850 alc663_21jd_amic_init_verbs },
16851 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16853 .dac_nids = alc662_dac_nids,
16854 .dig_out_nid = ALC662_DIGOUT_NID,
16855 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16856 .channel_mode = alc662_3ST_2ch_modes,
16857 .input_mux = &alc662_eeepc_capture_source,
16858 .unsol_event = alc663_mode1_unsol_event,
16859 .init_hook = alc663_mode1_inithook,
16861 [ALC662_ASUS_MODE2] = {
16862 .mixers = { alc662_1bjd_mixer },
16863 .cap_mixer = alc662_auto_capture_mixer,
16864 .init_verbs = { alc662_init_verbs,
16865 alc662_1bjd_amic_init_verbs },
16866 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16867 .dac_nids = alc662_dac_nids,
16868 .dig_out_nid = ALC662_DIGOUT_NID,
16869 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16870 .channel_mode = alc662_3ST_2ch_modes,
16871 .input_mux = &alc662_eeepc_capture_source,
16872 .unsol_event = alc662_mode2_unsol_event,
16873 .init_hook = alc662_mode2_inithook,
16875 [ALC663_ASUS_MODE3] = {
16876 .mixers = { alc663_two_hp_m1_mixer },
16877 .cap_mixer = alc662_auto_capture_mixer,
16878 .init_verbs = { alc662_init_verbs,
16879 alc663_two_hp_amic_m1_init_verbs },
16880 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16882 .dac_nids = alc662_dac_nids,
16883 .dig_out_nid = ALC662_DIGOUT_NID,
16884 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16885 .channel_mode = alc662_3ST_2ch_modes,
16886 .input_mux = &alc662_eeepc_capture_source,
16887 .unsol_event = alc663_mode3_unsol_event,
16888 .init_hook = alc663_mode3_inithook,
16890 [ALC663_ASUS_MODE4] = {
16891 .mixers = { alc663_asus_21jd_clfe_mixer },
16892 .cap_mixer = alc662_auto_capture_mixer,
16893 .init_verbs = { alc662_init_verbs,
16894 alc663_21jd_amic_init_verbs},
16895 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16897 .dac_nids = alc662_dac_nids,
16898 .dig_out_nid = ALC662_DIGOUT_NID,
16899 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16900 .channel_mode = alc662_3ST_2ch_modes,
16901 .input_mux = &alc662_eeepc_capture_source,
16902 .unsol_event = alc663_mode4_unsol_event,
16903 .init_hook = alc663_mode4_inithook,
16905 [ALC663_ASUS_MODE5] = {
16906 .mixers = { alc663_asus_15jd_clfe_mixer },
16907 .cap_mixer = alc662_auto_capture_mixer,
16908 .init_verbs = { alc662_init_verbs,
16909 alc663_15jd_amic_init_verbs },
16910 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16912 .dac_nids = alc662_dac_nids,
16913 .dig_out_nid = ALC662_DIGOUT_NID,
16914 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16915 .channel_mode = alc662_3ST_2ch_modes,
16916 .input_mux = &alc662_eeepc_capture_source,
16917 .unsol_event = alc663_mode5_unsol_event,
16918 .init_hook = alc663_mode5_inithook,
16920 [ALC663_ASUS_MODE6] = {
16921 .mixers = { alc663_two_hp_m2_mixer },
16922 .cap_mixer = alc662_auto_capture_mixer,
16923 .init_verbs = { alc662_init_verbs,
16924 alc663_two_hp_amic_m2_init_verbs },
16925 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16927 .dac_nids = alc662_dac_nids,
16928 .dig_out_nid = ALC662_DIGOUT_NID,
16929 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16930 .channel_mode = alc662_3ST_2ch_modes,
16931 .input_mux = &alc662_eeepc_capture_source,
16932 .unsol_event = alc663_mode6_unsol_event,
16933 .init_hook = alc663_mode6_inithook,
16936 .mixers = { alc663_m51va_mixer },
16937 .cap_mixer = alc272_auto_capture_mixer,
16938 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16939 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16940 .dac_nids = alc662_dac_nids,
16941 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16942 .adc_nids = alc272_adc_nids,
16943 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16944 .capsrc_nids = alc272_capsrc_nids,
16945 .channel_mode = alc662_3ST_2ch_modes,
16946 .input_mux = &alc663_m51va_capture_source,
16947 .unsol_event = alc663_m51va_unsol_event,
16948 .init_hook = alc663_m51va_inithook,
16950 [ALC272_DELL_ZM1] = {
16951 .mixers = { alc663_m51va_mixer },
16952 .cap_mixer = alc662_auto_capture_mixer,
16953 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16954 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16955 .dac_nids = alc662_dac_nids,
16956 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16957 .adc_nids = alc662_adc_nids,
16958 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
16959 .capsrc_nids = alc662_capsrc_nids,
16960 .channel_mode = alc662_3ST_2ch_modes,
16961 .input_mux = &alc663_m51va_capture_source,
16962 .unsol_event = alc663_m51va_unsol_event,
16963 .init_hook = alc663_m51va_inithook,
16965 [ALC272_SAMSUNG_NC10] = {
16966 .mixers = { alc272_nc10_mixer },
16967 .init_verbs = { alc662_init_verbs,
16968 alc663_21jd_amic_init_verbs },
16969 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16970 .dac_nids = alc272_dac_nids,
16971 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16972 .channel_mode = alc662_3ST_2ch_modes,
16973 .input_mux = &alc272_nc10_capture_source,
16974 .unsol_event = alc663_mode4_unsol_event,
16975 .init_hook = alc663_mode4_inithook,
16981 * BIOS auto configuration
16984 /* add playback controls from the parsed DAC table */
16985 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16986 const struct auto_pin_cfg *cfg)
16989 static const char *chname[4] = {
16990 "Front", "Surround", NULL /*CLFE*/, "Side"
16995 for (i = 0; i < cfg->line_outs; i++) {
16996 if (!spec->multiout.dac_nids[i])
16998 nid = alc880_idx_to_dac(i);
17001 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17002 "Center Playback Volume",
17003 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
17007 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17008 "LFE Playback Volume",
17009 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
17013 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17014 "Center Playback Switch",
17015 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17019 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17020 "LFE Playback Switch",
17021 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17026 sprintf(name, "%s Playback Volume", chname[i]);
17027 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17028 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
17032 sprintf(name, "%s Playback Switch", chname[i]);
17033 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17034 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
17043 /* add playback controls for speaker and HP outputs */
17044 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17055 /* ALC663 has a mono output pin on 0x17 */
17056 sprintf(name, "%s Playback Switch", pfx);
17057 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17058 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17062 if (alc880_is_fixed_pin(pin)) {
17063 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17064 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17065 /* specify the DAC as the extra output */
17066 if (!spec->multiout.hp_nid)
17067 spec->multiout.hp_nid = nid;
17069 spec->multiout.extra_out_nid[0] = nid;
17070 /* control HP volume/switch on the output mixer amp */
17071 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17072 sprintf(name, "%s Playback Volume", pfx);
17073 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17074 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17077 sprintf(name, "%s Playback Switch", pfx);
17078 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17079 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17082 } else if (alc880_is_multi_pin(pin)) {
17083 /* set manual connection */
17084 /* we have only a switch on HP-out PIN */
17085 sprintf(name, "%s Playback Switch", pfx);
17086 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17087 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17094 /* return the index of the src widget from the connection list of the nid.
17095 * return -1 if not found
17097 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
17100 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
17103 conns = snd_hda_get_connections(codec, nid, conn_list,
17104 ARRAY_SIZE(conn_list));
17107 for (i = 0; i < conns; i++)
17108 if (conn_list[i] == src)
17113 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
17115 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
17116 return (pincap & AC_PINCAP_IN) != 0;
17119 /* create playback/capture controls for input pins */
17120 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
17121 const struct auto_pin_cfg *cfg)
17123 struct alc_spec *spec = codec->spec;
17124 struct hda_input_mux *imux = &spec->private_imux[0];
17127 for (i = 0; i < AUTO_PIN_LAST; i++) {
17128 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
17129 idx = alc662_input_pin_idx(codec, 0x0b,
17130 cfg->input_pins[i]);
17132 err = new_analog_input(spec, cfg->input_pins[i],
17133 auto_pin_cfg_labels[i],
17138 idx = alc662_input_pin_idx(codec, 0x22,
17139 cfg->input_pins[i]);
17141 imux->items[imux->num_items].label =
17142 auto_pin_cfg_labels[i];
17143 imux->items[imux->num_items].index = idx;
17151 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17152 hda_nid_t nid, int pin_type,
17155 alc_set_pin_output(codec, nid, pin_type);
17156 /* need the manual connection? */
17157 if (alc880_is_multi_pin(nid)) {
17158 struct alc_spec *spec = codec->spec;
17159 int idx = alc880_multi_pin_idx(nid);
17160 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17161 AC_VERB_SET_CONNECT_SEL,
17162 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17166 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17168 struct alc_spec *spec = codec->spec;
17171 for (i = 0; i <= HDA_SIDE; i++) {
17172 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17173 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17175 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17180 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17182 struct alc_spec *spec = codec->spec;
17185 pin = spec->autocfg.hp_pins[0];
17186 if (pin) /* connect to front */
17188 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17189 pin = spec->autocfg.speaker_pins[0];
17191 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17194 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17196 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17198 struct alc_spec *spec = codec->spec;
17201 for (i = 0; i < AUTO_PIN_LAST; i++) {
17202 hda_nid_t nid = spec->autocfg.input_pins[i];
17203 if (alc662_is_input_pin(codec, nid)) {
17204 alc_set_input_pin(codec, nid, i);
17205 if (nid != ALC662_PIN_CD_NID &&
17206 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17207 snd_hda_codec_write(codec, nid, 0,
17208 AC_VERB_SET_AMP_GAIN_MUTE,
17214 #define alc662_auto_init_input_src alc882_auto_init_input_src
17216 static int alc662_parse_auto_config(struct hda_codec *codec)
17218 struct alc_spec *spec = codec->spec;
17220 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17222 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17226 if (!spec->autocfg.line_outs)
17227 return 0; /* can't find valid BIOS pin config */
17229 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17232 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17235 err = alc662_auto_create_extra_out(spec,
17236 spec->autocfg.speaker_pins[0],
17240 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17244 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
17248 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17250 if (spec->autocfg.dig_outs)
17251 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17253 if (spec->kctls.list)
17254 add_mixer(spec, spec->kctls.list);
17256 spec->num_mux_defs = 1;
17257 spec->input_mux = &spec->private_imux[0];
17259 add_verb(spec, alc662_auto_init_verbs);
17260 if (codec->vendor_id == 0x10ec0663)
17261 add_verb(spec, alc663_auto_init_verbs);
17263 err = alc_auto_add_mic_boost(codec);
17267 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17272 /* additional initialization for auto-configuration model */
17273 static void alc662_auto_init(struct hda_codec *codec)
17275 struct alc_spec *spec = codec->spec;
17276 alc662_auto_init_multi_out(codec);
17277 alc662_auto_init_hp_out(codec);
17278 alc662_auto_init_analog_input(codec);
17279 alc662_auto_init_input_src(codec);
17280 if (spec->unsol_event)
17281 alc_inithook(codec);
17284 static int patch_alc662(struct hda_codec *codec)
17286 struct alc_spec *spec;
17287 int err, board_config;
17289 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17293 codec->spec = spec;
17295 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17297 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17300 if (board_config < 0) {
17301 printk(KERN_INFO "hda_codec: Unknown model for %s, "
17302 "trying auto-probe from BIOS...\n", codec->chip_name);
17303 board_config = ALC662_AUTO;
17306 if (board_config == ALC662_AUTO) {
17307 /* automatic parse from the BIOS config */
17308 err = alc662_parse_auto_config(codec);
17314 "hda_codec: Cannot set up configuration "
17315 "from BIOS. Using base mode...\n");
17316 board_config = ALC662_3ST_2ch_DIG;
17320 err = snd_hda_attach_beep_device(codec, 0x1);
17326 if (board_config != ALC662_AUTO)
17327 setup_preset(spec, &alc662_presets[board_config]);
17329 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17330 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17332 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17333 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17335 spec->adc_nids = alc662_adc_nids;
17336 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17337 spec->capsrc_nids = alc662_capsrc_nids;
17339 if (!spec->cap_mixer)
17340 set_capture_mixer(spec);
17341 if (codec->vendor_id == 0x10ec0662)
17342 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17344 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17346 spec->vmaster_nid = 0x02;
17348 codec->patch_ops = alc_patch_ops;
17349 if (board_config == ALC662_AUTO)
17350 spec->init_hook = alc662_auto_init;
17351 #ifdef CONFIG_SND_HDA_POWER_SAVE
17352 if (!spec->loopback.amplist)
17353 spec->loopback.amplist = alc662_loopbacks;
17355 codec->proc_widget_hook = print_realtek_coef;
17363 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17364 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17365 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17366 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17367 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17368 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17369 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17370 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17371 .patch = patch_alc861 },
17372 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17373 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17374 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17375 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17376 .patch = patch_alc882 },
17377 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17378 .patch = patch_alc662 },
17379 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17380 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17381 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17382 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17383 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17384 .patch = patch_alc882 },
17385 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17386 .patch = patch_alc882 },
17387 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17388 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17389 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17390 .patch = patch_alc882 },
17391 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17392 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17393 {} /* terminator */
17396 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17398 MODULE_LICENSE("GPL");
17399 MODULE_DESCRIPTION("Realtek HD-audio codec");
17401 static struct hda_codec_preset_list realtek_list = {
17402 .preset = snd_hda_preset_realtek,
17403 .owner = THIS_MODULE,
17406 static int __init patch_realtek_init(void)
17408 return snd_hda_add_codec_preset(&realtek_list);
17411 static void __exit patch_realtek_exit(void)
17413 snd_hda_delete_codec_preset(&realtek_list);
17416 module_init(patch_realtek_init)
17417 module_exit(patch_realtek_exit)