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[32]; /* 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[32]; /* 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_type(get_wcaps(codec, nid));
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 (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
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 alc889_automute_init(struct hda_codec *codec)
1441 struct alc_spec *spec = codec->spec;
1443 spec->autocfg.hp_pins[0] = 0x15;
1444 spec->autocfg.speaker_pins[0] = 0x14;
1445 spec->autocfg.speaker_pins[1] = 0x16;
1446 spec->autocfg.speaker_pins[2] = 0x17;
1447 spec->autocfg.speaker_pins[3] = 0x19;
1448 spec->autocfg.speaker_pins[4] = 0x1a;
1449 alc_automute_amp(codec);
1452 static void alc889_intel_init_hook(struct hda_codec *codec)
1454 alc889_coef_init(codec);
1455 alc889_automute_init(codec);
1458 static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec)
1460 struct alc_spec *spec = codec->spec;
1462 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1463 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1464 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1465 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1466 alc_automute_amp(codec);
1470 * ALC888 Acer Aspire 4930G model
1473 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1474 /* Front Mic: set to PIN_IN (empty by default) */
1475 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1476 /* Unselect Front Mic by default in input mixer 3 */
1477 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1478 /* Enable unsolicited event for HP jack */
1479 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1480 /* Connect Internal HP to front */
1481 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1482 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1483 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1484 /* Connect HP out to front */
1485 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1486 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1487 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1492 * ALC888 Acer Aspire 6530G model
1495 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1496 /* Bias voltage on for external mic port */
1497 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1498 /* Front Mic: set to PIN_IN (empty by default) */
1499 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1500 /* Unselect Front Mic by default in input mixer 3 */
1501 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1502 /* Enable unsolicited event for HP jack */
1503 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1504 /* Enable speaker output */
1505 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1506 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1507 /* Enable headphone output */
1508 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1509 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1510 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1515 * ALC889 Acer Aspire 8930G model
1518 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1519 /* Front Mic: set to PIN_IN (empty by default) */
1520 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1521 /* Unselect Front Mic by default in input mixer 3 */
1522 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1523 /* Enable unsolicited event for HP jack */
1524 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1525 /* Connect Internal Front to Front */
1526 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1527 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1528 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1529 /* Connect Internal Rear to Rear */
1530 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1531 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1532 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1533 /* Connect Internal CLFE to CLFE */
1534 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1535 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1536 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1537 /* Connect HP out to Front */
1538 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1539 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1540 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1541 /* Enable all DACs */
1542 /* DAC DISABLE/MUTE 1? */
1543 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1544 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1545 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1546 /* DAC DISABLE/MUTE 2? */
1547 /* some bit here disables the other DACs. Init=0x4900 */
1548 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1549 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1550 /* Enable amplifiers */
1551 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1552 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1554 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1555 * which makes the stereo useless. However, either the mic or the ALC889
1556 * makes the signal become a difference/sum signal instead of standard
1557 * stereo, which is annoying. So instead we flip this bit which makes the
1558 * codec replicate the sum signal to both channels, turning it into a
1561 /* DMIC_CONTROL? Init value = 0x0001 */
1562 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1563 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1567 static struct hda_input_mux alc888_2_capture_sources[2] = {
1568 /* Front mic only available on one ADC */
1575 { "Front Mic", 0xb },
1588 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1589 /* Interal mic only available on one ADC */
1596 { "Input Mix", 0xa },
1606 { "Input Mix", 0xa },
1611 static struct hda_input_mux alc889_capture_sources[3] = {
1612 /* Digital mic only available on first "ADC" */
1619 { "Front Mic", 0xb },
1620 { "Input Mix", 0xa },
1629 { "Input Mix", 0xa },
1638 { "Input Mix", 0xa },
1643 static struct snd_kcontrol_new alc888_base_mixer[] = {
1644 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1645 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1646 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1647 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1648 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1650 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1651 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1652 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1653 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1654 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1655 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1656 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1657 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1658 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1660 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1661 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1665 static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec)
1667 struct alc_spec *spec = codec->spec;
1669 spec->autocfg.hp_pins[0] = 0x15;
1670 spec->autocfg.speaker_pins[0] = 0x14;
1671 alc_automute_amp(codec);
1674 static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec)
1676 struct alc_spec *spec = codec->spec;
1678 spec->autocfg.hp_pins[0] = 0x15;
1679 spec->autocfg.speaker_pins[0] = 0x14;
1680 spec->autocfg.speaker_pins[1] = 0x16;
1681 spec->autocfg.speaker_pins[2] = 0x17;
1682 alc_automute_amp(codec);
1685 static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec)
1687 struct alc_spec *spec = codec->spec;
1689 spec->autocfg.hp_pins[0] = 0x15;
1690 spec->autocfg.speaker_pins[0] = 0x14;
1691 spec->autocfg.speaker_pins[1] = 0x16;
1692 spec->autocfg.speaker_pins[2] = 0x1b;
1693 alc_automute_amp(codec);
1697 * ALC880 3-stack model
1699 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1700 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1701 * F-Mic = 0x1b, HP = 0x19
1704 static hda_nid_t alc880_dac_nids[4] = {
1705 /* front, rear, clfe, rear_surr */
1706 0x02, 0x05, 0x04, 0x03
1709 static hda_nid_t alc880_adc_nids[3] = {
1714 /* The datasheet says the node 0x07 is connected from inputs,
1715 * but it shows zero connection in the real implementation on some devices.
1716 * Note: this is a 915GAV bug, fixed on 915GLV
1718 static hda_nid_t alc880_adc_nids_alt[2] = {
1723 #define ALC880_DIGOUT_NID 0x06
1724 #define ALC880_DIGIN_NID 0x0a
1726 static struct hda_input_mux alc880_capture_source = {
1730 { "Front Mic", 0x3 },
1736 /* channel source setting (2/6 channel selection for 3-stack) */
1738 static struct hda_verb alc880_threestack_ch2_init[] = {
1739 /* set line-in to input, mute it */
1740 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1741 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1742 /* set mic-in to input vref 80%, mute it */
1743 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1744 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1749 static struct hda_verb alc880_threestack_ch6_init[] = {
1750 /* set line-in to output, unmute it */
1751 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1752 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1753 /* set mic-in to output, unmute it */
1754 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1755 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1759 static struct hda_channel_mode alc880_threestack_modes[2] = {
1760 { 2, alc880_threestack_ch2_init },
1761 { 6, alc880_threestack_ch6_init },
1764 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1765 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1766 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1767 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1768 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1769 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1770 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1771 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1772 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1773 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1774 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1775 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1776 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1778 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1779 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1780 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1781 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1783 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1784 .name = "Channel Mode",
1785 .info = alc_ch_mode_info,
1786 .get = alc_ch_mode_get,
1787 .put = alc_ch_mode_put,
1792 /* capture mixer elements */
1793 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1794 struct snd_ctl_elem_info *uinfo)
1796 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1797 struct alc_spec *spec = codec->spec;
1800 mutex_lock(&codec->control_mutex);
1801 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1803 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1804 mutex_unlock(&codec->control_mutex);
1808 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1809 unsigned int size, unsigned int __user *tlv)
1811 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1812 struct alc_spec *spec = codec->spec;
1815 mutex_lock(&codec->control_mutex);
1816 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1818 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1819 mutex_unlock(&codec->control_mutex);
1823 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1824 struct snd_ctl_elem_value *ucontrol);
1826 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1827 struct snd_ctl_elem_value *ucontrol,
1830 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1831 struct alc_spec *spec = codec->spec;
1832 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1835 mutex_lock(&codec->control_mutex);
1836 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1838 err = func(kcontrol, ucontrol);
1839 mutex_unlock(&codec->control_mutex);
1843 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1844 struct snd_ctl_elem_value *ucontrol)
1846 return alc_cap_getput_caller(kcontrol, ucontrol,
1847 snd_hda_mixer_amp_volume_get);
1850 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1851 struct snd_ctl_elem_value *ucontrol)
1853 return alc_cap_getput_caller(kcontrol, ucontrol,
1854 snd_hda_mixer_amp_volume_put);
1857 /* capture mixer elements */
1858 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1860 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1861 struct snd_ctl_elem_value *ucontrol)
1863 return alc_cap_getput_caller(kcontrol, ucontrol,
1864 snd_hda_mixer_amp_switch_get);
1867 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1868 struct snd_ctl_elem_value *ucontrol)
1870 return alc_cap_getput_caller(kcontrol, ucontrol,
1871 snd_hda_mixer_amp_switch_put);
1874 #define _DEFINE_CAPMIX(num) \
1876 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1877 .name = "Capture Switch", \
1878 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1880 .info = alc_cap_sw_info, \
1881 .get = alc_cap_sw_get, \
1882 .put = alc_cap_sw_put, \
1885 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1886 .name = "Capture Volume", \
1887 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1888 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1889 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1891 .info = alc_cap_vol_info, \
1892 .get = alc_cap_vol_get, \
1893 .put = alc_cap_vol_put, \
1894 .tlv = { .c = alc_cap_vol_tlv }, \
1897 #define _DEFINE_CAPSRC(num) \
1899 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1900 /* .name = "Capture Source", */ \
1901 .name = "Input Source", \
1903 .info = alc_mux_enum_info, \
1904 .get = alc_mux_enum_get, \
1905 .put = alc_mux_enum_put, \
1908 #define DEFINE_CAPMIX(num) \
1909 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1910 _DEFINE_CAPMIX(num), \
1911 _DEFINE_CAPSRC(num), \
1915 #define DEFINE_CAPMIX_NOSRC(num) \
1916 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1917 _DEFINE_CAPMIX(num), \
1921 /* up to three ADCs */
1925 DEFINE_CAPMIX_NOSRC(1);
1926 DEFINE_CAPMIX_NOSRC(2);
1927 DEFINE_CAPMIX_NOSRC(3);
1930 * ALC880 5-stack model
1932 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1934 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1935 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1938 /* additional mixers to alc880_three_stack_mixer */
1939 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1940 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1941 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1945 /* channel source setting (6/8 channel selection for 5-stack) */
1947 static struct hda_verb alc880_fivestack_ch6_init[] = {
1948 /* set line-in to input, mute it */
1949 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1950 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1955 static struct hda_verb alc880_fivestack_ch8_init[] = {
1956 /* set line-in to output, unmute it */
1957 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1958 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1962 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1963 { 6, alc880_fivestack_ch6_init },
1964 { 8, alc880_fivestack_ch8_init },
1969 * ALC880 6-stack model
1971 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1972 * Side = 0x05 (0x0f)
1973 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1974 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1977 static hda_nid_t alc880_6st_dac_nids[4] = {
1978 /* front, rear, clfe, rear_surr */
1979 0x02, 0x03, 0x04, 0x05
1982 static struct hda_input_mux alc880_6stack_capture_source = {
1986 { "Front Mic", 0x1 },
1992 /* fixed 8-channels */
1993 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1997 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1998 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1999 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2000 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2001 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2002 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2003 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2004 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2005 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2006 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2007 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2008 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2009 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2010 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2011 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2013 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2014 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2015 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2017 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2018 .name = "Channel Mode",
2019 .info = alc_ch_mode_info,
2020 .get = alc_ch_mode_get,
2021 .put = alc_ch_mode_put,
2030 * W810 has rear IO for:
2033 * Center/LFE (DAC 04)
2036 * The system also has a pair of internal speakers, and a headphone jack.
2037 * These are both connected to Line2 on the codec, hence to DAC 02.
2039 * There is a variable resistor to control the speaker or headphone
2040 * volume. This is a hardware-only device without a software API.
2042 * Plugging headphones in will disable the internal speakers. This is
2043 * implemented in hardware, not via the driver using jack sense. In
2044 * a similar fashion, plugging into the rear socket marked "front" will
2045 * disable both the speakers and headphones.
2047 * For input, there's a microphone jack, and an "audio in" jack.
2048 * These may not do anything useful with this driver yet, because I
2049 * haven't setup any initialization verbs for these yet...
2052 static hda_nid_t alc880_w810_dac_nids[3] = {
2053 /* front, rear/surround, clfe */
2057 /* fixed 6 channels */
2058 static struct hda_channel_mode alc880_w810_modes[1] = {
2062 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2063 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2064 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2065 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2066 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2067 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2068 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2069 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2070 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2071 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2072 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2080 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2081 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2085 static hda_nid_t alc880_z71v_dac_nids[1] = {
2088 #define ALC880_Z71V_HP_DAC 0x03
2090 /* fixed 2 channels */
2091 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2095 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2096 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2097 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2098 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2099 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2100 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2101 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2102 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2103 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2109 * ALC880 F1734 model
2111 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2112 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2115 static hda_nid_t alc880_f1734_dac_nids[1] = {
2118 #define ALC880_F1734_HP_DAC 0x02
2120 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2121 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2122 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2123 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2124 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2125 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2126 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2127 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2132 static struct hda_input_mux alc880_f1734_capture_source = {
2144 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2145 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2146 * Mic = 0x18, Line = 0x1a
2149 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2150 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2152 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2153 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2154 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2155 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2156 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2157 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2158 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2159 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2160 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2161 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2162 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2163 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2164 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2165 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2166 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2168 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2169 .name = "Channel Mode",
2170 .info = alc_ch_mode_info,
2171 .get = alc_ch_mode_get,
2172 .put = alc_ch_mode_put,
2178 * ALC880 ASUS W1V model
2180 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2181 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2182 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2185 /* additional mixers to alc880_asus_mixer */
2186 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2187 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2188 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2193 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2194 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2195 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2196 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
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("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2200 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2201 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2202 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2207 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2208 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2209 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2210 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2211 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2212 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2213 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2214 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2215 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2216 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2217 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2218 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2219 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2221 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2222 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2223 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2225 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2226 .name = "Channel Mode",
2227 .info = alc_ch_mode_info,
2228 .get = alc_ch_mode_get,
2229 .put = alc_ch_mode_put,
2234 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2235 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2236 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2237 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2238 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2239 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2240 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2241 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2242 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2243 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2244 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2248 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2249 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2250 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2251 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2252 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2259 * virtual master controls
2263 * slave controls for virtual master
2265 static const char *alc_slave_vols[] = {
2266 "Front Playback Volume",
2267 "Surround Playback Volume",
2268 "Center Playback Volume",
2269 "LFE Playback Volume",
2270 "Side Playback Volume",
2271 "Headphone Playback Volume",
2272 "Speaker Playback Volume",
2273 "Mono Playback Volume",
2274 "Line-Out Playback Volume",
2275 "PCM Playback Volume",
2279 static const char *alc_slave_sws[] = {
2280 "Front Playback Switch",
2281 "Surround Playback Switch",
2282 "Center Playback Switch",
2283 "LFE Playback Switch",
2284 "Side Playback Switch",
2285 "Headphone Playback Switch",
2286 "Speaker Playback Switch",
2287 "Mono Playback Switch",
2288 "IEC958 Playback Switch",
2293 * build control elements
2296 static void alc_free_kctls(struct hda_codec *codec);
2298 /* additional beep mixers; the actual parameters are overwritten at build */
2299 static struct snd_kcontrol_new alc_beep_mixer[] = {
2300 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2301 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2305 static int alc_build_controls(struct hda_codec *codec)
2307 struct alc_spec *spec = codec->spec;
2311 for (i = 0; i < spec->num_mixers; i++) {
2312 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2316 if (spec->cap_mixer) {
2317 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2321 if (spec->multiout.dig_out_nid) {
2322 err = snd_hda_create_spdif_out_ctls(codec,
2323 spec->multiout.dig_out_nid);
2326 if (!spec->no_analog) {
2327 err = snd_hda_create_spdif_share_sw(codec,
2331 spec->multiout.share_spdif = 1;
2334 if (spec->dig_in_nid) {
2335 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2340 /* create beep controls if needed */
2341 if (spec->beep_amp) {
2342 struct snd_kcontrol_new *knew;
2343 for (knew = alc_beep_mixer; knew->name; knew++) {
2344 struct snd_kcontrol *kctl;
2345 kctl = snd_ctl_new1(knew, codec);
2348 kctl->private_value = spec->beep_amp;
2349 err = snd_hda_ctl_add(codec, kctl);
2355 /* if we have no master control, let's create it */
2356 if (!spec->no_analog &&
2357 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2358 unsigned int vmaster_tlv[4];
2359 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2360 HDA_OUTPUT, vmaster_tlv);
2361 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2362 vmaster_tlv, alc_slave_vols);
2366 if (!spec->no_analog &&
2367 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2368 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2369 NULL, alc_slave_sws);
2374 alc_free_kctls(codec); /* no longer needed */
2380 * initialize the codec volumes, etc
2384 * generic initialization of ADC, input mixers and output mixers
2386 static struct hda_verb alc880_volume_init_verbs[] = {
2388 * Unmute ADC0-2 and set the default input to mic-in
2390 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2391 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2392 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2393 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2394 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2395 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2397 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2399 * Note: PASD motherboards uses the Line In 2 as the input for front
2402 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2403 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2404 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2405 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2406 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2407 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2408 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2409 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2412 * Set up output mixers (0x0c - 0x0f)
2414 /* set vol=0 to output mixers */
2415 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2416 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2417 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2418 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2419 /* set up input amps for analog loopback */
2420 /* Amp Indices: DAC = 0, mixer = 1 */
2421 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2422 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2423 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2424 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2425 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2426 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2427 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2428 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2434 * 3-stack pin configuration:
2435 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2437 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2439 * preset connection lists of input pins
2440 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2442 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2443 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2444 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2447 * Set pin mode and muting
2449 /* set front pin widgets 0x14 for output */
2450 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2451 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2452 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2453 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2454 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2455 /* Mic2 (as headphone out) for HP output */
2456 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2457 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2458 /* Line In pin widget for input */
2459 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2460 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2461 /* Line2 (as front mic) pin widget for input and vref at 80% */
2462 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2463 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2464 /* CD pin widget for input */
2465 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2471 * 5-stack pin configuration:
2472 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2473 * line-in/side = 0x1a, f-mic = 0x1b
2475 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2477 * preset connection lists of input pins
2478 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2480 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2481 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2484 * Set pin mode and muting
2486 /* set pin widgets 0x14-0x17 for output */
2487 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2488 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2489 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2490 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2491 /* unmute pins for output (no gain on this amp) */
2492 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2493 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2494 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2495 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2497 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2498 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2499 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2500 /* Mic2 (as headphone out) for HP output */
2501 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2502 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2503 /* Line In pin widget for input */
2504 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2505 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2506 /* Line2 (as front mic) pin widget for input and vref at 80% */
2507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2508 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2509 /* CD pin widget for input */
2510 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2516 * W810 pin configuration:
2517 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2519 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2520 /* hphone/speaker input selector: front DAC */
2521 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2523 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2524 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2525 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2526 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2527 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2528 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2530 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2531 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2537 * Z71V pin configuration:
2538 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2540 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2541 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2542 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2543 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2544 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2546 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2547 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2548 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2549 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2555 * 6-stack pin configuration:
2556 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2557 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2559 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2560 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2562 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2563 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2564 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2565 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2566 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2567 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2568 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2569 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2571 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2572 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2573 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2574 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2575 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2576 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2577 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2578 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2579 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2585 * Uniwill pin configuration:
2586 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2589 static struct hda_verb alc880_uniwill_init_verbs[] = {
2590 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2592 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2593 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2594 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2595 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2596 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2597 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2598 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2599 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2600 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2601 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2602 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2603 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2604 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2605 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2607 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2608 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2609 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2610 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2611 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2612 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2613 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2614 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2615 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2617 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2618 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2625 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2627 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2628 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2630 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2631 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2632 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2633 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2634 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2635 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2636 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2637 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2638 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2639 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2640 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2641 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2643 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2644 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2645 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2646 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2647 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2648 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2650 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2651 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2656 static struct hda_verb alc880_beep_init_verbs[] = {
2657 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2661 /* auto-toggle front mic */
2662 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2664 unsigned int present;
2667 present = snd_hda_codec_read(codec, 0x18, 0,
2668 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2669 bits = present ? HDA_AMP_MUTE : 0;
2670 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2673 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2675 struct alc_spec *spec = codec->spec;
2677 spec->autocfg.hp_pins[0] = 0x14;
2678 spec->autocfg.speaker_pins[0] = 0x15;
2679 spec->autocfg.speaker_pins[0] = 0x16;
2680 alc_automute_amp(codec);
2681 alc880_uniwill_mic_automute(codec);
2684 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2687 /* Looks like the unsol event is incompatible with the standard
2688 * definition. 4bit tag is placed at 28 bit!
2690 switch (res >> 28) {
2691 case ALC880_MIC_EVENT:
2692 alc880_uniwill_mic_automute(codec);
2695 alc_automute_amp_unsol_event(codec, res);
2700 static void alc880_uniwill_p53_init_hook(struct hda_codec *codec)
2702 struct alc_spec *spec = codec->spec;
2704 spec->autocfg.hp_pins[0] = 0x14;
2705 spec->autocfg.speaker_pins[0] = 0x15;
2706 alc_automute_amp(codec);
2709 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2711 unsigned int present;
2713 present = snd_hda_codec_read(codec, 0x21, 0,
2714 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2715 present &= HDA_AMP_VOLMASK;
2716 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2717 HDA_AMP_VOLMASK, present);
2718 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2719 HDA_AMP_VOLMASK, present);
2722 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2725 /* Looks like the unsol event is incompatible with the standard
2726 * definition. 4bit tag is placed at 28 bit!
2728 if ((res >> 28) == ALC880_DCVOL_EVENT)
2729 alc880_uniwill_p53_dcvol_automute(codec);
2731 alc_automute_amp_unsol_event(codec, res);
2735 * F1734 pin configuration:
2736 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2738 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2739 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2740 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2741 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2742 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2743 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2745 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2746 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2747 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2748 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2750 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2751 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2752 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2753 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2754 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2755 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2756 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2757 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2758 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2760 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2761 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2767 * ASUS pin configuration:
2768 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2770 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2771 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2772 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2773 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2774 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2776 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2777 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2778 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2779 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2780 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2781 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2782 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2783 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2785 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2786 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2787 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2788 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2789 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2790 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2791 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2792 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2793 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2798 /* Enable GPIO mask and set output */
2799 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2800 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2801 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2803 /* Clevo m520g init */
2804 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2805 /* headphone output */
2806 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2808 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2809 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2811 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2812 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2814 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2815 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2816 /* Mic1 (rear panel) */
2817 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2818 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2819 /* Mic2 (front panel) */
2820 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2821 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2823 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2824 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2825 /* change to EAPD mode */
2826 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2827 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2832 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2833 /* change to EAPD mode */
2834 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2835 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2837 /* Headphone output */
2838 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2840 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2841 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2843 /* Line In pin widget for input */
2844 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2845 /* CD pin widget for input */
2846 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2847 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2848 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2850 /* change to EAPD mode */
2851 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2852 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2858 * LG m1 express dual
2861 * Rear Line-In/Out (blue): 0x14
2862 * Build-in Mic-In: 0x15
2864 * HP-Out (green): 0x1b
2865 * Mic-In/Out (red): 0x19
2869 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2870 static hda_nid_t alc880_lg_dac_nids[3] = {
2874 /* seems analog CD is not working */
2875 static struct hda_input_mux alc880_lg_capture_source = {
2880 { "Internal Mic", 0x6 },
2884 /* 2,4,6 channel modes */
2885 static struct hda_verb alc880_lg_ch2_init[] = {
2886 /* set line-in and mic-in to input */
2887 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2888 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2892 static struct hda_verb alc880_lg_ch4_init[] = {
2893 /* set line-in to out and mic-in to input */
2894 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2895 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2899 static struct hda_verb alc880_lg_ch6_init[] = {
2900 /* set line-in and mic-in to output */
2901 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2902 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2906 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2907 { 2, alc880_lg_ch2_init },
2908 { 4, alc880_lg_ch4_init },
2909 { 6, alc880_lg_ch6_init },
2912 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2913 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2914 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2915 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2916 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2917 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2918 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2919 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2920 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2921 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2922 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2923 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2924 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2925 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2926 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2928 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2929 .name = "Channel Mode",
2930 .info = alc_ch_mode_info,
2931 .get = alc_ch_mode_get,
2932 .put = alc_ch_mode_put,
2937 static struct hda_verb alc880_lg_init_verbs[] = {
2938 /* set capture source to mic-in */
2939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2940 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2941 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2942 /* mute all amp mixer inputs */
2943 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2944 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2945 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2946 /* line-in to input */
2947 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2948 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2950 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2951 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2953 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2954 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2955 /* mic-in to input */
2956 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2957 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2958 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2960 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2961 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2962 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2964 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2968 /* toggle speaker-output according to the hp-jack state */
2969 static void alc880_lg_init_hook(struct hda_codec *codec)
2971 struct alc_spec *spec = codec->spec;
2973 spec->autocfg.hp_pins[0] = 0x1b;
2974 spec->autocfg.speaker_pins[0] = 0x17;
2975 alc_automute_amp(codec);
2984 * Built-in Mic-In: 0x19
2990 static struct hda_input_mux alc880_lg_lw_capture_source = {
2994 { "Internal Mic", 0x1 },
2999 #define alc880_lg_lw_modes alc880_threestack_modes
3001 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3002 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3003 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3004 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3005 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3006 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3007 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3008 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3009 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3010 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3011 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3013 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3014 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3015 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3017 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3018 .name = "Channel Mode",
3019 .info = alc_ch_mode_info,
3020 .get = alc_ch_mode_get,
3021 .put = alc_ch_mode_put,
3026 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3027 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3028 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3029 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3031 /* set capture source to mic-in */
3032 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3033 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3034 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3035 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3037 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3038 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3040 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3041 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3042 /* mic-in to input */
3043 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3044 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3046 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3047 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3049 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3053 /* toggle speaker-output according to the hp-jack state */
3054 static void alc880_lg_lw_init_hook(struct hda_codec *codec)
3056 struct alc_spec *spec = codec->spec;
3058 spec->autocfg.hp_pins[0] = 0x1b;
3059 spec->autocfg.speaker_pins[0] = 0x14;
3060 alc_automute_amp(codec);
3063 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3064 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3065 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3067 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3068 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3069 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3073 static struct hda_input_mux alc880_medion_rim_capture_source = {
3077 { "Internal Mic", 0x1 },
3081 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3082 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3084 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3085 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3087 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3088 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3089 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3090 /* Mic2 (as headphone out) for HP output */
3091 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3092 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3093 /* Internal Speaker */
3094 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3095 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3097 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3098 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3100 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3104 /* toggle speaker-output according to the hp-jack state */
3105 static void alc880_medion_rim_automute(struct hda_codec *codec)
3107 struct alc_spec *spec = codec->spec;
3108 alc_automute_amp(codec);
3110 if (spec->jack_present)
3111 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3113 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3116 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3119 /* Looks like the unsol event is incompatible with the standard
3120 * definition. 4bit tag is placed at 28 bit!
3122 if ((res >> 28) == ALC880_HP_EVENT)
3123 alc880_medion_rim_automute(codec);
3126 static void alc880_medion_rim_init_hook(struct hda_codec *codec)
3128 struct alc_spec *spec = codec->spec;
3130 spec->autocfg.hp_pins[0] = 0x14;
3131 spec->autocfg.speaker_pins[0] = 0x1b;
3132 alc880_medion_rim_automute(codec);
3135 #ifdef CONFIG_SND_HDA_POWER_SAVE
3136 static struct hda_amp_list alc880_loopbacks[] = {
3137 { 0x0b, HDA_INPUT, 0 },
3138 { 0x0b, HDA_INPUT, 1 },
3139 { 0x0b, HDA_INPUT, 2 },
3140 { 0x0b, HDA_INPUT, 3 },
3141 { 0x0b, HDA_INPUT, 4 },
3145 static struct hda_amp_list alc880_lg_loopbacks[] = {
3146 { 0x0b, HDA_INPUT, 1 },
3147 { 0x0b, HDA_INPUT, 6 },
3148 { 0x0b, HDA_INPUT, 7 },
3157 static int alc_init(struct hda_codec *codec)
3159 struct alc_spec *spec = codec->spec;
3163 alc_auto_init_amp(codec, spec->init_amp);
3165 for (i = 0; i < spec->num_init_verbs; i++)
3166 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3168 if (spec->init_hook)
3169 spec->init_hook(codec);
3174 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3176 struct alc_spec *spec = codec->spec;
3178 if (spec->unsol_event)
3179 spec->unsol_event(codec, res);
3182 #ifdef CONFIG_SND_HDA_POWER_SAVE
3183 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3185 struct alc_spec *spec = codec->spec;
3186 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3191 * Analog playback callbacks
3193 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3194 struct hda_codec *codec,
3195 struct snd_pcm_substream *substream)
3197 struct alc_spec *spec = codec->spec;
3198 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3202 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3203 struct hda_codec *codec,
3204 unsigned int stream_tag,
3205 unsigned int format,
3206 struct snd_pcm_substream *substream)
3208 struct alc_spec *spec = codec->spec;
3209 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3210 stream_tag, format, substream);
3213 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3214 struct hda_codec *codec,
3215 struct snd_pcm_substream *substream)
3217 struct alc_spec *spec = codec->spec;
3218 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3224 static int alc880_dig_playback_pcm_open(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_open(codec, &spec->multiout);
3232 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3233 struct hda_codec *codec,
3234 unsigned int stream_tag,
3235 unsigned int format,
3236 struct snd_pcm_substream *substream)
3238 struct alc_spec *spec = codec->spec;
3239 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3240 stream_tag, format, substream);
3243 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3244 struct hda_codec *codec,
3245 struct snd_pcm_substream *substream)
3247 struct alc_spec *spec = codec->spec;
3248 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3251 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3252 struct hda_codec *codec,
3253 struct snd_pcm_substream *substream)
3255 struct alc_spec *spec = codec->spec;
3256 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3262 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3263 struct hda_codec *codec,
3264 unsigned int stream_tag,
3265 unsigned int format,
3266 struct snd_pcm_substream *substream)
3268 struct alc_spec *spec = codec->spec;
3270 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3271 stream_tag, 0, format);
3275 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3276 struct hda_codec *codec,
3277 struct snd_pcm_substream *substream)
3279 struct alc_spec *spec = codec->spec;
3281 snd_hda_codec_cleanup_stream(codec,
3282 spec->adc_nids[substream->number + 1]);
3289 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3293 /* NID is set in alc_build_pcms */
3295 .open = alc880_playback_pcm_open,
3296 .prepare = alc880_playback_pcm_prepare,
3297 .cleanup = alc880_playback_pcm_cleanup
3301 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3305 /* NID is set in alc_build_pcms */
3308 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3312 /* NID is set in alc_build_pcms */
3315 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3316 .substreams = 2, /* can be overridden */
3319 /* NID is set in alc_build_pcms */
3321 .prepare = alc880_alt_capture_pcm_prepare,
3322 .cleanup = alc880_alt_capture_pcm_cleanup
3326 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3330 /* NID is set in alc_build_pcms */
3332 .open = alc880_dig_playback_pcm_open,
3333 .close = alc880_dig_playback_pcm_close,
3334 .prepare = alc880_dig_playback_pcm_prepare,
3335 .cleanup = alc880_dig_playback_pcm_cleanup
3339 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3343 /* NID is set in alc_build_pcms */
3346 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3347 static struct hda_pcm_stream alc_pcm_null_stream = {
3353 static int alc_build_pcms(struct hda_codec *codec)
3355 struct alc_spec *spec = codec->spec;
3356 struct hda_pcm *info = spec->pcm_rec;
3359 codec->num_pcms = 1;
3360 codec->pcm_info = info;
3362 if (spec->no_analog)
3365 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3366 "%s Analog", codec->chip_name);
3367 info->name = spec->stream_name_analog;
3369 if (spec->stream_analog_playback) {
3370 if (snd_BUG_ON(!spec->multiout.dac_nids))
3372 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3373 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3375 if (spec->stream_analog_capture) {
3376 if (snd_BUG_ON(!spec->adc_nids))
3378 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3379 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3382 if (spec->channel_mode) {
3383 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3384 for (i = 0; i < spec->num_channel_mode; i++) {
3385 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3386 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3392 /* SPDIF for stream index #1 */
3393 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3394 snprintf(spec->stream_name_digital,
3395 sizeof(spec->stream_name_digital),
3396 "%s Digital", codec->chip_name);
3397 codec->num_pcms = 2;
3398 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3399 info = spec->pcm_rec + 1;
3400 info->name = spec->stream_name_digital;
3401 if (spec->dig_out_type)
3402 info->pcm_type = spec->dig_out_type;
3404 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3405 if (spec->multiout.dig_out_nid &&
3406 spec->stream_digital_playback) {
3407 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3408 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3410 if (spec->dig_in_nid &&
3411 spec->stream_digital_capture) {
3412 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3413 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3415 /* FIXME: do we need this for all Realtek codec models? */
3416 codec->spdif_status_reset = 1;
3419 if (spec->no_analog)
3422 /* If the use of more than one ADC is requested for the current
3423 * model, configure a second analog capture-only PCM.
3425 /* Additional Analaog capture for index #2 */
3426 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3427 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3428 codec->num_pcms = 3;
3429 info = spec->pcm_rec + 2;
3430 info->name = spec->stream_name_analog;
3431 if (spec->alt_dac_nid) {
3432 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3433 *spec->stream_analog_alt_playback;
3434 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3437 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3438 alc_pcm_null_stream;
3439 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3441 if (spec->num_adc_nids > 1) {
3442 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3443 *spec->stream_analog_alt_capture;
3444 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3446 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3447 spec->num_adc_nids - 1;
3449 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3450 alc_pcm_null_stream;
3451 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3458 static void alc_free_kctls(struct hda_codec *codec)
3460 struct alc_spec *spec = codec->spec;
3462 if (spec->kctls.list) {
3463 struct snd_kcontrol_new *kctl = spec->kctls.list;
3465 for (i = 0; i < spec->kctls.used; i++)
3466 kfree(kctl[i].name);
3468 snd_array_free(&spec->kctls);
3471 static void alc_free(struct hda_codec *codec)
3473 struct alc_spec *spec = codec->spec;
3478 alc_free_kctls(codec);
3480 snd_hda_detach_beep_device(codec);
3483 #ifdef SND_HDA_NEEDS_RESUME
3484 static int alc_resume(struct hda_codec *codec)
3486 codec->patch_ops.init(codec);
3487 snd_hda_codec_resume_amp(codec);
3488 snd_hda_codec_resume_cache(codec);
3495 static struct hda_codec_ops alc_patch_ops = {
3496 .build_controls = alc_build_controls,
3497 .build_pcms = alc_build_pcms,
3500 .unsol_event = alc_unsol_event,
3501 #ifdef SND_HDA_NEEDS_RESUME
3502 .resume = alc_resume,
3504 #ifdef CONFIG_SND_HDA_POWER_SAVE
3505 .check_power_status = alc_check_power_status,
3511 * Test configuration for debugging
3513 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3516 #ifdef CONFIG_SND_DEBUG
3517 static hda_nid_t alc880_test_dac_nids[4] = {
3518 0x02, 0x03, 0x04, 0x05
3521 static struct hda_input_mux alc880_test_capture_source = {
3530 { "Surround", 0x6 },
3534 static struct hda_channel_mode alc880_test_modes[4] = {
3541 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3542 struct snd_ctl_elem_info *uinfo)
3544 static char *texts[] = {
3545 "N/A", "Line Out", "HP Out",
3546 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3548 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3550 uinfo->value.enumerated.items = 8;
3551 if (uinfo->value.enumerated.item >= 8)
3552 uinfo->value.enumerated.item = 7;
3553 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3557 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3558 struct snd_ctl_elem_value *ucontrol)
3560 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3561 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3562 unsigned int pin_ctl, item = 0;
3564 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3565 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3566 if (pin_ctl & AC_PINCTL_OUT_EN) {
3567 if (pin_ctl & AC_PINCTL_HP_EN)
3571 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3572 switch (pin_ctl & AC_PINCTL_VREFEN) {
3573 case AC_PINCTL_VREF_HIZ: item = 3; break;
3574 case AC_PINCTL_VREF_50: item = 4; break;
3575 case AC_PINCTL_VREF_GRD: item = 5; break;
3576 case AC_PINCTL_VREF_80: item = 6; break;
3577 case AC_PINCTL_VREF_100: item = 7; break;
3580 ucontrol->value.enumerated.item[0] = item;
3584 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3585 struct snd_ctl_elem_value *ucontrol)
3587 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3588 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3589 static unsigned int ctls[] = {
3590 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3591 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3592 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3593 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3594 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3595 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3597 unsigned int old_ctl, new_ctl;
3599 old_ctl = snd_hda_codec_read(codec, nid, 0,
3600 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3601 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3602 if (old_ctl != new_ctl) {
3604 snd_hda_codec_write_cache(codec, nid, 0,
3605 AC_VERB_SET_PIN_WIDGET_CONTROL,
3607 val = ucontrol->value.enumerated.item[0] >= 3 ?
3609 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3616 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3617 struct snd_ctl_elem_info *uinfo)
3619 static char *texts[] = {
3620 "Front", "Surround", "CLFE", "Side"
3622 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3624 uinfo->value.enumerated.items = 4;
3625 if (uinfo->value.enumerated.item >= 4)
3626 uinfo->value.enumerated.item = 3;
3627 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3631 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3632 struct snd_ctl_elem_value *ucontrol)
3634 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3635 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3638 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3639 ucontrol->value.enumerated.item[0] = sel & 3;
3643 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3644 struct snd_ctl_elem_value *ucontrol)
3646 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3647 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3650 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3651 if (ucontrol->value.enumerated.item[0] != sel) {
3652 sel = ucontrol->value.enumerated.item[0] & 3;
3653 snd_hda_codec_write_cache(codec, nid, 0,
3654 AC_VERB_SET_CONNECT_SEL, sel);
3660 #define PIN_CTL_TEST(xname,nid) { \
3661 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3663 .info = alc_test_pin_ctl_info, \
3664 .get = alc_test_pin_ctl_get, \
3665 .put = alc_test_pin_ctl_put, \
3666 .private_value = nid \
3669 #define PIN_SRC_TEST(xname,nid) { \
3670 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3672 .info = alc_test_pin_src_info, \
3673 .get = alc_test_pin_src_get, \
3674 .put = alc_test_pin_src_put, \
3675 .private_value = nid \
3678 static struct snd_kcontrol_new alc880_test_mixer[] = {
3679 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3680 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3681 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3682 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3683 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3684 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3685 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3686 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3687 PIN_CTL_TEST("Front Pin Mode", 0x14),
3688 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3689 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3690 PIN_CTL_TEST("Side Pin Mode", 0x17),
3691 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3692 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3693 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3694 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3695 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3696 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3697 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3698 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3699 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3700 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3701 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3702 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3703 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3704 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3705 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3706 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3707 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3708 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3710 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3711 .name = "Channel Mode",
3712 .info = alc_ch_mode_info,
3713 .get = alc_ch_mode_get,
3714 .put = alc_ch_mode_put,
3719 static struct hda_verb alc880_test_init_verbs[] = {
3720 /* Unmute inputs of 0x0c - 0x0f */
3721 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3722 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3723 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3724 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3725 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3726 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3727 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3728 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3729 /* Vol output for 0x0c-0x0f */
3730 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3731 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3732 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3733 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3734 /* Set output pins 0x14-0x17 */
3735 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3736 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3737 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3738 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3739 /* Unmute output pins 0x14-0x17 */
3740 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3742 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3743 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3744 /* Set input pins 0x18-0x1c */
3745 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3746 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3747 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3748 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3749 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3750 /* Mute input pins 0x18-0x1b */
3751 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3752 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3753 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3754 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3756 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3757 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3758 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3759 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3760 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3761 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3762 /* Analog input/passthru */
3763 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3764 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3765 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3766 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3767 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3775 static const char *alc880_models[ALC880_MODEL_LAST] = {
3776 [ALC880_3ST] = "3stack",
3777 [ALC880_TCL_S700] = "tcl",
3778 [ALC880_3ST_DIG] = "3stack-digout",
3779 [ALC880_CLEVO] = "clevo",
3780 [ALC880_5ST] = "5stack",
3781 [ALC880_5ST_DIG] = "5stack-digout",
3782 [ALC880_W810] = "w810",
3783 [ALC880_Z71V] = "z71v",
3784 [ALC880_6ST] = "6stack",
3785 [ALC880_6ST_DIG] = "6stack-digout",
3786 [ALC880_ASUS] = "asus",
3787 [ALC880_ASUS_W1V] = "asus-w1v",
3788 [ALC880_ASUS_DIG] = "asus-dig",
3789 [ALC880_ASUS_DIG2] = "asus-dig2",
3790 [ALC880_UNIWILL_DIG] = "uniwill",
3791 [ALC880_UNIWILL_P53] = "uniwill-p53",
3792 [ALC880_FUJITSU] = "fujitsu",
3793 [ALC880_F1734] = "F1734",
3795 [ALC880_LG_LW] = "lg-lw",
3796 [ALC880_MEDION_RIM] = "medion",
3797 #ifdef CONFIG_SND_DEBUG
3798 [ALC880_TEST] = "test",
3800 [ALC880_AUTO] = "auto",
3803 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3804 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3805 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3806 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3807 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3808 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3809 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3810 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3811 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3812 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3813 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3814 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3815 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3816 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3817 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3818 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3819 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3820 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3821 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3822 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3823 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3824 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3825 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3826 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3827 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3828 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3829 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3830 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3831 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3832 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3833 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3834 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3835 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3836 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3837 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3838 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3839 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3840 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3841 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3842 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3843 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3844 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3845 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3846 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3847 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3848 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3849 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3850 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3851 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3852 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3853 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3854 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3855 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3856 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3857 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3858 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3859 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3860 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3861 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3862 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3863 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3864 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3865 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3866 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3867 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3868 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3869 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3870 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3871 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3873 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3874 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3875 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3880 * ALC880 codec presets
3882 static struct alc_config_preset alc880_presets[] = {
3884 .mixers = { alc880_three_stack_mixer },
3885 .init_verbs = { alc880_volume_init_verbs,
3886 alc880_pin_3stack_init_verbs },
3887 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3888 .dac_nids = alc880_dac_nids,
3889 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3890 .channel_mode = alc880_threestack_modes,
3892 .input_mux = &alc880_capture_source,
3894 [ALC880_3ST_DIG] = {
3895 .mixers = { alc880_three_stack_mixer },
3896 .init_verbs = { alc880_volume_init_verbs,
3897 alc880_pin_3stack_init_verbs },
3898 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3899 .dac_nids = alc880_dac_nids,
3900 .dig_out_nid = ALC880_DIGOUT_NID,
3901 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3902 .channel_mode = alc880_threestack_modes,
3904 .input_mux = &alc880_capture_source,
3906 [ALC880_TCL_S700] = {
3907 .mixers = { alc880_tcl_s700_mixer },
3908 .init_verbs = { alc880_volume_init_verbs,
3909 alc880_pin_tcl_S700_init_verbs,
3910 alc880_gpio2_init_verbs },
3911 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3912 .dac_nids = alc880_dac_nids,
3913 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3914 .num_adc_nids = 1, /* single ADC */
3916 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3917 .channel_mode = alc880_2_jack_modes,
3918 .input_mux = &alc880_capture_source,
3921 .mixers = { alc880_three_stack_mixer,
3922 alc880_five_stack_mixer},
3923 .init_verbs = { alc880_volume_init_verbs,
3924 alc880_pin_5stack_init_verbs },
3925 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3926 .dac_nids = alc880_dac_nids,
3927 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3928 .channel_mode = alc880_fivestack_modes,
3929 .input_mux = &alc880_capture_source,
3931 [ALC880_5ST_DIG] = {
3932 .mixers = { alc880_three_stack_mixer,
3933 alc880_five_stack_mixer },
3934 .init_verbs = { alc880_volume_init_verbs,
3935 alc880_pin_5stack_init_verbs },
3936 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3937 .dac_nids = alc880_dac_nids,
3938 .dig_out_nid = ALC880_DIGOUT_NID,
3939 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3940 .channel_mode = alc880_fivestack_modes,
3941 .input_mux = &alc880_capture_source,
3944 .mixers = { alc880_six_stack_mixer },
3945 .init_verbs = { alc880_volume_init_verbs,
3946 alc880_pin_6stack_init_verbs },
3947 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3948 .dac_nids = alc880_6st_dac_nids,
3949 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3950 .channel_mode = alc880_sixstack_modes,
3951 .input_mux = &alc880_6stack_capture_source,
3953 [ALC880_6ST_DIG] = {
3954 .mixers = { alc880_six_stack_mixer },
3955 .init_verbs = { alc880_volume_init_verbs,
3956 alc880_pin_6stack_init_verbs },
3957 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3958 .dac_nids = alc880_6st_dac_nids,
3959 .dig_out_nid = ALC880_DIGOUT_NID,
3960 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3961 .channel_mode = alc880_sixstack_modes,
3962 .input_mux = &alc880_6stack_capture_source,
3965 .mixers = { alc880_w810_base_mixer },
3966 .init_verbs = { alc880_volume_init_verbs,
3967 alc880_pin_w810_init_verbs,
3968 alc880_gpio2_init_verbs },
3969 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3970 .dac_nids = alc880_w810_dac_nids,
3971 .dig_out_nid = ALC880_DIGOUT_NID,
3972 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3973 .channel_mode = alc880_w810_modes,
3974 .input_mux = &alc880_capture_source,
3977 .mixers = { alc880_z71v_mixer },
3978 .init_verbs = { alc880_volume_init_verbs,
3979 alc880_pin_z71v_init_verbs },
3980 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3981 .dac_nids = alc880_z71v_dac_nids,
3982 .dig_out_nid = ALC880_DIGOUT_NID,
3984 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3985 .channel_mode = alc880_2_jack_modes,
3986 .input_mux = &alc880_capture_source,
3989 .mixers = { alc880_f1734_mixer },
3990 .init_verbs = { alc880_volume_init_verbs,
3991 alc880_pin_f1734_init_verbs },
3992 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3993 .dac_nids = alc880_f1734_dac_nids,
3995 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3996 .channel_mode = alc880_2_jack_modes,
3997 .input_mux = &alc880_f1734_capture_source,
3998 .unsol_event = alc880_uniwill_p53_unsol_event,
3999 .init_hook = alc880_uniwill_p53_init_hook,
4002 .mixers = { alc880_asus_mixer },
4003 .init_verbs = { alc880_volume_init_verbs,
4004 alc880_pin_asus_init_verbs,
4005 alc880_gpio1_init_verbs },
4006 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4007 .dac_nids = alc880_asus_dac_nids,
4008 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4009 .channel_mode = alc880_asus_modes,
4011 .input_mux = &alc880_capture_source,
4013 [ALC880_ASUS_DIG] = {
4014 .mixers = { alc880_asus_mixer },
4015 .init_verbs = { alc880_volume_init_verbs,
4016 alc880_pin_asus_init_verbs,
4017 alc880_gpio1_init_verbs },
4018 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4019 .dac_nids = alc880_asus_dac_nids,
4020 .dig_out_nid = ALC880_DIGOUT_NID,
4021 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4022 .channel_mode = alc880_asus_modes,
4024 .input_mux = &alc880_capture_source,
4026 [ALC880_ASUS_DIG2] = {
4027 .mixers = { alc880_asus_mixer },
4028 .init_verbs = { alc880_volume_init_verbs,
4029 alc880_pin_asus_init_verbs,
4030 alc880_gpio2_init_verbs }, /* use GPIO2 */
4031 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4032 .dac_nids = alc880_asus_dac_nids,
4033 .dig_out_nid = ALC880_DIGOUT_NID,
4034 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4035 .channel_mode = alc880_asus_modes,
4037 .input_mux = &alc880_capture_source,
4039 [ALC880_ASUS_W1V] = {
4040 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4041 .init_verbs = { alc880_volume_init_verbs,
4042 alc880_pin_asus_init_verbs,
4043 alc880_gpio1_init_verbs },
4044 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4045 .dac_nids = alc880_asus_dac_nids,
4046 .dig_out_nid = ALC880_DIGOUT_NID,
4047 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4048 .channel_mode = alc880_asus_modes,
4050 .input_mux = &alc880_capture_source,
4052 [ALC880_UNIWILL_DIG] = {
4053 .mixers = { alc880_asus_mixer },
4054 .init_verbs = { alc880_volume_init_verbs,
4055 alc880_pin_asus_init_verbs },
4056 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4057 .dac_nids = alc880_asus_dac_nids,
4058 .dig_out_nid = ALC880_DIGOUT_NID,
4059 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4060 .channel_mode = alc880_asus_modes,
4062 .input_mux = &alc880_capture_source,
4064 [ALC880_UNIWILL] = {
4065 .mixers = { alc880_uniwill_mixer },
4066 .init_verbs = { alc880_volume_init_verbs,
4067 alc880_uniwill_init_verbs },
4068 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4069 .dac_nids = alc880_asus_dac_nids,
4070 .dig_out_nid = ALC880_DIGOUT_NID,
4071 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4072 .channel_mode = alc880_threestack_modes,
4074 .input_mux = &alc880_capture_source,
4075 .unsol_event = alc880_uniwill_unsol_event,
4076 .init_hook = alc880_uniwill_init_hook,
4078 [ALC880_UNIWILL_P53] = {
4079 .mixers = { alc880_uniwill_p53_mixer },
4080 .init_verbs = { alc880_volume_init_verbs,
4081 alc880_uniwill_p53_init_verbs },
4082 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4083 .dac_nids = alc880_asus_dac_nids,
4084 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4085 .channel_mode = alc880_threestack_modes,
4086 .input_mux = &alc880_capture_source,
4087 .unsol_event = alc880_uniwill_p53_unsol_event,
4088 .init_hook = alc880_uniwill_p53_init_hook,
4090 [ALC880_FUJITSU] = {
4091 .mixers = { alc880_fujitsu_mixer },
4092 .init_verbs = { alc880_volume_init_verbs,
4093 alc880_uniwill_p53_init_verbs,
4094 alc880_beep_init_verbs },
4095 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4096 .dac_nids = alc880_dac_nids,
4097 .dig_out_nid = ALC880_DIGOUT_NID,
4098 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4099 .channel_mode = alc880_2_jack_modes,
4100 .input_mux = &alc880_capture_source,
4101 .unsol_event = alc880_uniwill_p53_unsol_event,
4102 .init_hook = alc880_uniwill_p53_init_hook,
4105 .mixers = { alc880_three_stack_mixer },
4106 .init_verbs = { alc880_volume_init_verbs,
4107 alc880_pin_clevo_init_verbs },
4108 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4109 .dac_nids = alc880_dac_nids,
4111 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4112 .channel_mode = alc880_threestack_modes,
4114 .input_mux = &alc880_capture_source,
4117 .mixers = { alc880_lg_mixer },
4118 .init_verbs = { alc880_volume_init_verbs,
4119 alc880_lg_init_verbs },
4120 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4121 .dac_nids = alc880_lg_dac_nids,
4122 .dig_out_nid = ALC880_DIGOUT_NID,
4123 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4124 .channel_mode = alc880_lg_ch_modes,
4126 .input_mux = &alc880_lg_capture_source,
4127 .unsol_event = alc_automute_amp_unsol_event,
4128 .init_hook = alc880_lg_init_hook,
4129 #ifdef CONFIG_SND_HDA_POWER_SAVE
4130 .loopbacks = alc880_lg_loopbacks,
4134 .mixers = { alc880_lg_lw_mixer },
4135 .init_verbs = { alc880_volume_init_verbs,
4136 alc880_lg_lw_init_verbs },
4137 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4138 .dac_nids = alc880_dac_nids,
4139 .dig_out_nid = ALC880_DIGOUT_NID,
4140 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4141 .channel_mode = alc880_lg_lw_modes,
4142 .input_mux = &alc880_lg_lw_capture_source,
4143 .unsol_event = alc_automute_amp_unsol_event,
4144 .init_hook = alc880_lg_lw_init_hook,
4146 [ALC880_MEDION_RIM] = {
4147 .mixers = { alc880_medion_rim_mixer },
4148 .init_verbs = { alc880_volume_init_verbs,
4149 alc880_medion_rim_init_verbs,
4150 alc_gpio2_init_verbs },
4151 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4152 .dac_nids = alc880_dac_nids,
4153 .dig_out_nid = ALC880_DIGOUT_NID,
4154 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4155 .channel_mode = alc880_2_jack_modes,
4156 .input_mux = &alc880_medion_rim_capture_source,
4157 .unsol_event = alc880_medion_rim_unsol_event,
4158 .init_hook = alc880_medion_rim_init_hook,
4160 #ifdef CONFIG_SND_DEBUG
4162 .mixers = { alc880_test_mixer },
4163 .init_verbs = { alc880_test_init_verbs },
4164 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4165 .dac_nids = alc880_test_dac_nids,
4166 .dig_out_nid = ALC880_DIGOUT_NID,
4167 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4168 .channel_mode = alc880_test_modes,
4169 .input_mux = &alc880_test_capture_source,
4175 * Automatic parse of I/O pins from the BIOS configuration
4180 ALC_CTL_WIDGET_MUTE,
4183 static struct snd_kcontrol_new alc880_control_templates[] = {
4184 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4185 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4186 HDA_BIND_MUTE(NULL, 0, 0, 0),
4189 /* add dynamic controls */
4190 static int add_control(struct alc_spec *spec, int type, const char *name,
4193 struct snd_kcontrol_new *knew;
4195 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4196 knew = snd_array_new(&spec->kctls);
4199 *knew = alc880_control_templates[type];
4200 knew->name = kstrdup(name, GFP_KERNEL);
4203 knew->private_value = val;
4207 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4208 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4209 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4210 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4211 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4212 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4213 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4214 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4215 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4216 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4217 #define ALC880_PIN_CD_NID 0x1c
4219 /* fill in the dac_nids table from the parsed pin configuration */
4220 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4221 const struct auto_pin_cfg *cfg)
4227 memset(assigned, 0, sizeof(assigned));
4228 spec->multiout.dac_nids = spec->private_dac_nids;
4230 /* check the pins hardwired to audio widget */
4231 for (i = 0; i < cfg->line_outs; i++) {
4232 nid = cfg->line_out_pins[i];
4233 if (alc880_is_fixed_pin(nid)) {
4234 int idx = alc880_fixed_pin_idx(nid);
4235 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4239 /* left pins can be connect to any audio widget */
4240 for (i = 0; i < cfg->line_outs; i++) {
4241 nid = cfg->line_out_pins[i];
4242 if (alc880_is_fixed_pin(nid))
4244 /* search for an empty channel */
4245 for (j = 0; j < cfg->line_outs; j++) {
4247 spec->multiout.dac_nids[i] =
4248 alc880_idx_to_dac(j);
4254 spec->multiout.num_dacs = cfg->line_outs;
4258 /* add playback controls from the parsed DAC table */
4259 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4260 const struct auto_pin_cfg *cfg)
4263 static const char *chname[4] = {
4264 "Front", "Surround", NULL /*CLFE*/, "Side"
4269 for (i = 0; i < cfg->line_outs; i++) {
4270 if (!spec->multiout.dac_nids[i])
4272 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4275 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4276 "Center Playback Volume",
4277 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4281 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4282 "LFE Playback Volume",
4283 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4287 err = add_control(spec, ALC_CTL_BIND_MUTE,
4288 "Center Playback Switch",
4289 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4293 err = add_control(spec, ALC_CTL_BIND_MUTE,
4294 "LFE Playback Switch",
4295 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4300 sprintf(name, "%s Playback Volume", chname[i]);
4301 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4302 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4306 sprintf(name, "%s Playback Switch", chname[i]);
4307 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4308 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4317 /* add playback controls for speaker and HP outputs */
4318 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4328 if (alc880_is_fixed_pin(pin)) {
4329 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4330 /* specify the DAC as the extra output */
4331 if (!spec->multiout.hp_nid)
4332 spec->multiout.hp_nid = nid;
4334 spec->multiout.extra_out_nid[0] = nid;
4335 /* control HP volume/switch on the output mixer amp */
4336 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4337 sprintf(name, "%s Playback Volume", pfx);
4338 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4339 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4342 sprintf(name, "%s Playback Switch", pfx);
4343 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4344 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4347 } else if (alc880_is_multi_pin(pin)) {
4348 /* set manual connection */
4349 /* we have only a switch on HP-out PIN */
4350 sprintf(name, "%s Playback Switch", pfx);
4351 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4352 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4359 /* create input playback/capture controls for the given pin */
4360 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4361 const char *ctlname,
4362 int idx, hda_nid_t mix_nid)
4367 sprintf(name, "%s Playback Volume", ctlname);
4368 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4369 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4372 sprintf(name, "%s Playback Switch", ctlname);
4373 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4374 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4380 /* create playback/capture controls for input pins */
4381 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4382 const struct auto_pin_cfg *cfg)
4384 struct hda_input_mux *imux = &spec->private_imux[0];
4387 for (i = 0; i < AUTO_PIN_LAST; i++) {
4388 if (alc880_is_input_pin(cfg->input_pins[i])) {
4389 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4390 err = new_analog_input(spec, cfg->input_pins[i],
4391 auto_pin_cfg_labels[i],
4395 imux->items[imux->num_items].label =
4396 auto_pin_cfg_labels[i];
4397 imux->items[imux->num_items].index =
4398 alc880_input_pin_idx(cfg->input_pins[i]);
4405 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4406 unsigned int pin_type)
4408 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4411 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4415 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4416 hda_nid_t nid, int pin_type,
4419 alc_set_pin_output(codec, nid, pin_type);
4420 /* need the manual connection? */
4421 if (alc880_is_multi_pin(nid)) {
4422 struct alc_spec *spec = codec->spec;
4423 int idx = alc880_multi_pin_idx(nid);
4424 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4425 AC_VERB_SET_CONNECT_SEL,
4426 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4430 static int get_pin_type(int line_out_type)
4432 if (line_out_type == AUTO_PIN_HP_OUT)
4438 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4440 struct alc_spec *spec = codec->spec;
4443 for (i = 0; i < spec->autocfg.line_outs; i++) {
4444 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4445 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4446 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4450 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4452 struct alc_spec *spec = codec->spec;
4455 pin = spec->autocfg.speaker_pins[0];
4456 if (pin) /* connect to front */
4457 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4458 pin = spec->autocfg.hp_pins[0];
4459 if (pin) /* connect to front */
4460 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4463 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4465 struct alc_spec *spec = codec->spec;
4468 for (i = 0; i < AUTO_PIN_LAST; i++) {
4469 hda_nid_t nid = spec->autocfg.input_pins[i];
4470 if (alc880_is_input_pin(nid)) {
4471 alc_set_input_pin(codec, nid, i);
4472 if (nid != ALC880_PIN_CD_NID &&
4473 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4474 snd_hda_codec_write(codec, nid, 0,
4475 AC_VERB_SET_AMP_GAIN_MUTE,
4481 /* parse the BIOS configuration and set up the alc_spec */
4482 /* return 1 if successful, 0 if the proper config is not found,
4483 * or a negative error code
4485 static int alc880_parse_auto_config(struct hda_codec *codec)
4487 struct alc_spec *spec = codec->spec;
4489 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4491 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4495 if (!spec->autocfg.line_outs)
4496 return 0; /* can't find valid BIOS pin config */
4498 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4501 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4504 err = alc880_auto_create_extra_out(spec,
4505 spec->autocfg.speaker_pins[0],
4509 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4513 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4517 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4519 /* check multiple SPDIF-out (for recent codecs) */
4520 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4522 err = snd_hda_get_connections(codec,
4523 spec->autocfg.dig_out_pins[i],
4528 spec->multiout.dig_out_nid = dig_nid;
4530 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4531 spec->slave_dig_outs[i - 1] = dig_nid;
4532 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4536 if (spec->autocfg.dig_in_pin)
4537 spec->dig_in_nid = ALC880_DIGIN_NID;
4539 if (spec->kctls.list)
4540 add_mixer(spec, spec->kctls.list);
4542 add_verb(spec, alc880_volume_init_verbs);
4544 spec->num_mux_defs = 1;
4545 spec->input_mux = &spec->private_imux[0];
4547 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4552 /* additional initialization for auto-configuration model */
4553 static void alc880_auto_init(struct hda_codec *codec)
4555 struct alc_spec *spec = codec->spec;
4556 alc880_auto_init_multi_out(codec);
4557 alc880_auto_init_extra_out(codec);
4558 alc880_auto_init_analog_input(codec);
4559 if (spec->unsol_event)
4560 alc_inithook(codec);
4563 static void set_capture_mixer(struct alc_spec *spec)
4565 static struct snd_kcontrol_new *caps[2][3] = {
4566 { alc_capture_mixer_nosrc1,
4567 alc_capture_mixer_nosrc2,
4568 alc_capture_mixer_nosrc3 },
4569 { alc_capture_mixer1,
4571 alc_capture_mixer3 },
4573 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4575 if (spec->input_mux && spec->input_mux->num_items > 1)
4579 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4583 #define set_beep_amp(spec, nid, idx, dir) \
4584 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4587 * OK, here we have finally the patch for ALC880
4590 static int patch_alc880(struct hda_codec *codec)
4592 struct alc_spec *spec;
4596 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4602 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4605 if (board_config < 0) {
4606 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4608 board_config = ALC880_AUTO;
4611 if (board_config == ALC880_AUTO) {
4612 /* automatic parse from the BIOS config */
4613 err = alc880_parse_auto_config(codec);
4619 "hda_codec: Cannot set up configuration "
4620 "from BIOS. Using 3-stack mode...\n");
4621 board_config = ALC880_3ST;
4625 err = snd_hda_attach_beep_device(codec, 0x1);
4631 if (board_config != ALC880_AUTO)
4632 setup_preset(spec, &alc880_presets[board_config]);
4634 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4635 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4636 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4638 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4639 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4641 if (!spec->adc_nids && spec->input_mux) {
4642 /* check whether NID 0x07 is valid */
4643 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4645 wcap = get_wcaps_type(wcap);
4646 if (wcap != AC_WID_AUD_IN) {
4647 spec->adc_nids = alc880_adc_nids_alt;
4648 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4650 spec->adc_nids = alc880_adc_nids;
4651 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4654 set_capture_mixer(spec);
4655 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4657 spec->vmaster_nid = 0x0c;
4659 codec->patch_ops = alc_patch_ops;
4660 if (board_config == ALC880_AUTO)
4661 spec->init_hook = alc880_auto_init;
4662 #ifdef CONFIG_SND_HDA_POWER_SAVE
4663 if (!spec->loopback.amplist)
4664 spec->loopback.amplist = alc880_loopbacks;
4666 codec->proc_widget_hook = print_realtek_coef;
4676 static hda_nid_t alc260_dac_nids[1] = {
4681 static hda_nid_t alc260_adc_nids[1] = {
4686 static hda_nid_t alc260_adc_nids_alt[1] = {
4691 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4692 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4694 static hda_nid_t alc260_dual_adc_nids[2] = {
4699 #define ALC260_DIGOUT_NID 0x03
4700 #define ALC260_DIGIN_NID 0x06
4702 static struct hda_input_mux alc260_capture_source = {
4706 { "Front Mic", 0x1 },
4712 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4713 * headphone jack and the internal CD lines since these are the only pins at
4714 * which audio can appear. For flexibility, also allow the option of
4715 * recording the mixer output on the second ADC (ADC0 doesn't have a
4716 * connection to the mixer output).
4718 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4722 { "Mic/Line", 0x0 },
4724 { "Headphone", 0x2 },
4730 { "Mic/Line", 0x0 },
4732 { "Headphone", 0x2 },
4739 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4740 * the Fujitsu S702x, but jacks are marked differently.
4742 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4749 { "Headphone", 0x5 },
4758 { "Headphone", 0x6 },
4764 /* Maxdata Favorit 100XS */
4765 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4769 { "Line/Mic", 0x0 },
4776 { "Line/Mic", 0x0 },
4784 * This is just place-holder, so there's something for alc_build_pcms to look
4785 * at when it calculates the maximum number of channels. ALC260 has no mixer
4786 * element which allows changing the channel mode, so the verb list is
4789 static struct hda_channel_mode alc260_modes[1] = {
4794 /* Mixer combinations
4796 * basic: base_output + input + pc_beep + capture
4797 * HP: base_output + input + capture_alt
4798 * HP_3013: hp_3013 + input + capture
4799 * fujitsu: fujitsu + capture
4800 * acer: acer + capture
4803 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4804 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4805 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4806 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4807 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4808 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4809 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4813 static struct snd_kcontrol_new alc260_input_mixer[] = {
4814 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4815 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4816 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4817 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4818 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4819 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4820 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4821 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4825 /* update HP, line and mono out pins according to the master switch */
4826 static void alc260_hp_master_update(struct hda_codec *codec,
4827 hda_nid_t hp, hda_nid_t line,
4830 struct alc_spec *spec = codec->spec;
4831 unsigned int val = spec->master_sw ? PIN_HP : 0;
4832 /* change HP and line-out pins */
4833 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4835 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4837 /* mono (speaker) depending on the HP jack sense */
4838 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4839 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4843 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4844 struct snd_ctl_elem_value *ucontrol)
4846 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4847 struct alc_spec *spec = codec->spec;
4848 *ucontrol->value.integer.value = spec->master_sw;
4852 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4853 struct snd_ctl_elem_value *ucontrol)
4855 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4856 struct alc_spec *spec = codec->spec;
4857 int val = !!*ucontrol->value.integer.value;
4858 hda_nid_t hp, line, mono;
4860 if (val == spec->master_sw)
4862 spec->master_sw = val;
4863 hp = (kcontrol->private_value >> 16) & 0xff;
4864 line = (kcontrol->private_value >> 8) & 0xff;
4865 mono = kcontrol->private_value & 0xff;
4866 alc260_hp_master_update(codec, hp, line, mono);
4870 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4872 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4873 .name = "Master Playback Switch",
4874 .info = snd_ctl_boolean_mono_info,
4875 .get = alc260_hp_master_sw_get,
4876 .put = alc260_hp_master_sw_put,
4877 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4879 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4880 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4881 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4882 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4883 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4885 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4889 static struct hda_verb alc260_hp_unsol_verbs[] = {
4890 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4894 static void alc260_hp_automute(struct hda_codec *codec)
4896 struct alc_spec *spec = codec->spec;
4897 unsigned int present;
4899 present = snd_hda_codec_read(codec, 0x10, 0,
4900 AC_VERB_GET_PIN_SENSE, 0);
4901 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4902 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4905 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4907 if ((res >> 26) == ALC880_HP_EVENT)
4908 alc260_hp_automute(codec);
4911 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4913 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4914 .name = "Master Playback Switch",
4915 .info = snd_ctl_boolean_mono_info,
4916 .get = alc260_hp_master_sw_get,
4917 .put = alc260_hp_master_sw_put,
4918 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4920 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4921 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4922 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4923 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4924 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4926 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4927 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4931 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4932 .ops = &snd_hda_bind_vol,
4934 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4935 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4936 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4941 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4942 .ops = &snd_hda_bind_sw,
4944 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4945 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4950 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4951 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4952 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4953 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4954 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4958 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4959 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4963 static void alc260_hp_3013_automute(struct hda_codec *codec)
4965 struct alc_spec *spec = codec->spec;
4966 unsigned int present;
4968 present = snd_hda_codec_read(codec, 0x15, 0,
4969 AC_VERB_GET_PIN_SENSE, 0);
4970 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4971 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4974 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4977 if ((res >> 26) == ALC880_HP_EVENT)
4978 alc260_hp_3013_automute(codec);
4981 static void alc260_hp_3012_automute(struct hda_codec *codec)
4983 unsigned int present, bits;
4985 present = snd_hda_codec_read(codec, 0x10, 0,
4986 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4988 bits = present ? 0 : PIN_OUT;
4989 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4991 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4993 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4997 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5000 if ((res >> 26) == ALC880_HP_EVENT)
5001 alc260_hp_3012_automute(codec);
5004 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5005 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5007 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5008 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5009 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5010 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5011 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5012 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5013 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5014 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5015 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5016 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5017 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5021 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5022 * versions of the ALC260 don't act on requests to enable mic bias from NID
5023 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5024 * datasheet doesn't mention this restriction. At this stage it's not clear
5025 * whether this behaviour is intentional or is a hardware bug in chip
5026 * revisions available in early 2006. Therefore for now allow the
5027 * "Headphone Jack Mode" control to span all choices, but if it turns out
5028 * that the lack of mic bias for this NID is intentional we could change the
5029 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5031 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5032 * don't appear to make the mic bias available from the "line" jack, even
5033 * though the NID used for this jack (0x14) can supply it. The theory is
5034 * that perhaps Acer have included blocking capacitors between the ALC260
5035 * and the output jack. If this turns out to be the case for all such
5036 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5037 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5039 * The C20x Tablet series have a mono internal speaker which is controlled
5040 * via the chip's Mono sum widget and pin complex, so include the necessary
5041 * controls for such models. On models without a "mono speaker" the control
5042 * won't do anything.
5044 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5045 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5046 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5047 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5048 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5050 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5052 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5053 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5054 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5055 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5056 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5057 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5058 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5059 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5063 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5065 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5066 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5067 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5068 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5069 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5070 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5071 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5075 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5076 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5078 static struct snd_kcontrol_new alc260_will_mixer[] = {
5079 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5080 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5081 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5082 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5083 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
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),
5087 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5088 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5092 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5093 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5095 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5096 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5097 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5098 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5099 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5100 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5101 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5102 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5103 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5104 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5105 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5110 * initialization verbs
5112 static struct hda_verb alc260_init_verbs[] = {
5113 /* Line In pin widget for input */
5114 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5115 /* CD pin widget for input */
5116 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5117 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5118 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5119 /* Mic2 (front panel) pin widget for input and vref at 80% */
5120 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5121 /* LINE-2 is used for line-out in rear */
5122 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5123 /* select line-out */
5124 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5126 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5128 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5130 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5131 /* mute capture amp left and right */
5132 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5133 /* set connection select to line in (default select for this ADC) */
5134 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5135 /* mute capture amp left and right */
5136 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5137 /* set connection select to line in (default select for this ADC) */
5138 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5139 /* set vol=0 Line-Out mixer amp left and right */
5140 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5141 /* unmute pin widget amp left and right (no gain on this amp) */
5142 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5143 /* set vol=0 HP mixer amp left and right */
5144 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5145 /* unmute pin widget amp left and right (no gain on this amp) */
5146 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5147 /* set vol=0 Mono mixer amp left and right */
5148 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5149 /* unmute pin widget amp left and right (no gain on this amp) */
5150 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5151 /* unmute LINE-2 out pin */
5152 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5153 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5156 /* mute analog inputs */
5157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5158 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5159 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5161 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5162 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5163 /* mute Front out path */
5164 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5165 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5166 /* mute Headphone out path */
5167 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5168 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5169 /* mute Mono out path */
5170 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5171 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5175 #if 0 /* should be identical with alc260_init_verbs? */
5176 static struct hda_verb alc260_hp_init_verbs[] = {
5177 /* Headphone and output */
5178 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5180 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5181 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5182 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5183 /* Mic2 (front panel) pin widget for input and vref at 80% */
5184 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5185 /* Line In pin widget for input */
5186 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5187 /* Line-2 pin widget for output */
5188 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5189 /* CD pin widget for input */
5190 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5191 /* unmute amp left and right */
5192 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5193 /* set connection select to line in (default select for this ADC) */
5194 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5195 /* unmute Line-Out mixer amp left and right (volume = 0) */
5196 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5197 /* mute pin widget amp left and right (no gain on this amp) */
5198 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5199 /* unmute HP mixer amp left and right (volume = 0) */
5200 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5201 /* mute pin widget amp left and right (no gain on this amp) */
5202 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5203 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5206 /* mute analog inputs */
5207 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5208 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5209 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5210 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5211 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5212 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5213 /* Unmute Front out path */
5214 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5215 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5216 /* Unmute Headphone out path */
5217 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5218 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5219 /* Unmute Mono out path */
5220 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5221 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5226 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5227 /* Line out and output */
5228 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5230 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5231 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5232 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5233 /* Mic2 (front panel) pin widget for input and vref at 80% */
5234 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5235 /* Line In pin widget for input */
5236 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5237 /* Headphone pin widget for output */
5238 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5239 /* CD pin widget for input */
5240 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5241 /* unmute amp left and right */
5242 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5243 /* set connection select to line in (default select for this ADC) */
5244 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5245 /* unmute Line-Out mixer amp left and right (volume = 0) */
5246 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5247 /* mute pin widget amp left and right (no gain on this amp) */
5248 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5249 /* unmute HP mixer amp left and right (volume = 0) */
5250 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5251 /* mute pin widget amp left and right (no gain on this amp) */
5252 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5253 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5256 /* mute analog inputs */
5257 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5258 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5259 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5260 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5261 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5262 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5263 /* Unmute Front out path */
5264 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5265 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5266 /* Unmute Headphone out path */
5267 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5268 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5269 /* Unmute Mono out path */
5270 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5271 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5275 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5276 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5277 * audio = 0x16, internal speaker = 0x10.
5279 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5280 /* Disable all GPIOs */
5281 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5282 /* Internal speaker is connected to headphone pin */
5283 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5284 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5285 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5286 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5287 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5288 /* Ensure all other unused pins are disabled and muted. */
5289 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5290 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5291 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5292 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5293 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5294 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5295 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5296 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5298 /* Disable digital (SPDIF) pins */
5299 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5300 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5302 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5303 * when acting as an output.
5305 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5307 /* Start with output sum widgets muted and their output gains at min */
5308 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5309 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5310 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5311 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5312 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5313 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5314 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5315 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5316 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5318 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5319 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5320 /* Unmute Line1 pin widget output buffer since it starts as an output.
5321 * If the pin mode is changed by the user the pin mode control will
5322 * take care of enabling the pin's input/output buffers as needed.
5323 * Therefore there's no need to enable the input buffer at this
5326 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5327 /* Unmute input buffer of pin widget used for Line-in (no equiv
5330 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5332 /* Mute capture amp left and right */
5333 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5334 /* Set ADC connection select to match default mixer setting - line
5337 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5339 /* Do the same for the second ADC: mute capture input amp and
5340 * set ADC connection to line in (on mic1 pin)
5342 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5343 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5345 /* Mute all inputs to mixer widget (even unconnected ones) */
5346 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5347 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5348 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5349 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5350 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5351 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5352 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5353 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5358 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5359 * similar laptops (adapted from Fujitsu init verbs).
5361 static struct hda_verb alc260_acer_init_verbs[] = {
5362 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5363 * the headphone jack. Turn this on and rely on the standard mute
5364 * methods whenever the user wants to turn these outputs off.
5366 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5367 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5368 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5369 /* Internal speaker/Headphone jack is connected to Line-out pin */
5370 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5371 /* Internal microphone/Mic jack is connected to Mic1 pin */
5372 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5373 /* Line In jack is connected to Line1 pin */
5374 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5375 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5376 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5377 /* Ensure all other unused pins are disabled and muted. */
5378 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5379 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5380 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5381 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5382 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5383 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5384 /* Disable digital (SPDIF) pins */
5385 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5386 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5388 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5389 * bus when acting as outputs.
5391 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5392 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5394 /* Start with output sum widgets muted and their output gains at min */
5395 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5396 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5397 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5398 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5399 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5400 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5401 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5402 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5403 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5405 /* Unmute Line-out pin widget amp left and right
5406 * (no equiv mixer ctrl)
5408 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5409 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5410 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5411 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5412 * inputs. If the pin mode is changed by the user the pin mode control
5413 * will take care of enabling the pin's input/output buffers as needed.
5414 * Therefore there's no need to enable the input buffer at this
5417 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5418 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5420 /* Mute capture amp left and right */
5421 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5422 /* Set ADC connection select to match default mixer setting - mic
5425 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5427 /* Do similar with the second ADC: mute capture input amp and
5428 * set ADC connection to mic to match ALSA's default state.
5430 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5431 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5433 /* Mute all inputs to mixer widget (even unconnected ones) */
5434 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5435 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5436 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5437 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5438 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5439 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5440 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5441 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5446 /* Initialisation sequence for Maxdata Favorit 100XS
5447 * (adapted from Acer init verbs).
5449 static struct hda_verb alc260_favorit100_init_verbs[] = {
5450 /* GPIO 0 enables the output jack.
5451 * Turn this on and rely on the standard mute
5452 * methods whenever the user wants to turn these outputs off.
5454 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5455 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5456 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5457 /* Line/Mic input jack is connected to Mic1 pin */
5458 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5459 /* Ensure all other unused pins are disabled and muted. */
5460 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5461 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5462 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5463 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5464 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5465 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5466 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5467 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5469 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5470 /* Disable digital (SPDIF) pins */
5471 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5472 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5474 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5475 * bus when acting as outputs.
5477 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5478 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5480 /* Start with output sum widgets muted and their output gains at min */
5481 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5482 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5483 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5484 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5485 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5486 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5487 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5488 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5489 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5491 /* Unmute Line-out pin widget amp left and right
5492 * (no equiv mixer ctrl)
5494 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5495 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5496 * inputs. If the pin mode is changed by the user the pin mode control
5497 * will take care of enabling the pin's input/output buffers as needed.
5498 * Therefore there's no need to enable the input buffer at this
5501 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5503 /* Mute capture amp left and right */
5504 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5505 /* Set ADC connection select to match default mixer setting - mic
5508 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5510 /* Do similar with the second ADC: mute capture input amp and
5511 * set ADC connection to mic to match ALSA's default state.
5513 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5514 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5516 /* Mute all inputs to mixer widget (even unconnected ones) */
5517 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5518 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5519 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5520 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5521 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5522 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5523 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5524 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5529 static struct hda_verb alc260_will_verbs[] = {
5530 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5531 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5532 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5533 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5534 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5535 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5539 static struct hda_verb alc260_replacer_672v_verbs[] = {
5540 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5541 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5542 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5544 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5545 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5546 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5548 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5552 /* toggle speaker-output according to the hp-jack state */
5553 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5555 unsigned int present;
5557 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5558 present = snd_hda_codec_read(codec, 0x0f, 0,
5559 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5561 snd_hda_codec_write_cache(codec, 0x01, 0,
5562 AC_VERB_SET_GPIO_DATA, 1);
5563 snd_hda_codec_write_cache(codec, 0x0f, 0,
5564 AC_VERB_SET_PIN_WIDGET_CONTROL,
5567 snd_hda_codec_write_cache(codec, 0x01, 0,
5568 AC_VERB_SET_GPIO_DATA, 0);
5569 snd_hda_codec_write_cache(codec, 0x0f, 0,
5570 AC_VERB_SET_PIN_WIDGET_CONTROL,
5575 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5578 if ((res >> 26) == ALC880_HP_EVENT)
5579 alc260_replacer_672v_automute(codec);
5582 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5583 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5584 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5585 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5586 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5587 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5588 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5589 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5590 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5591 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5592 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5596 /* Test configuration for debugging, modelled after the ALC880 test
5599 #ifdef CONFIG_SND_DEBUG
5600 static hda_nid_t alc260_test_dac_nids[1] = {
5603 static hda_nid_t alc260_test_adc_nids[2] = {
5606 /* For testing the ALC260, each input MUX needs its own definition since
5607 * the signal assignments are different. This assumes that the first ADC
5610 static struct hda_input_mux alc260_test_capture_sources[2] = {
5614 { "MIC1 pin", 0x0 },
5615 { "MIC2 pin", 0x1 },
5616 { "LINE1 pin", 0x2 },
5617 { "LINE2 pin", 0x3 },
5619 { "LINE-OUT pin", 0x5 },
5620 { "HP-OUT pin", 0x6 },
5626 { "MIC1 pin", 0x0 },
5627 { "MIC2 pin", 0x1 },
5628 { "LINE1 pin", 0x2 },
5629 { "LINE2 pin", 0x3 },
5632 { "LINE-OUT pin", 0x6 },
5633 { "HP-OUT pin", 0x7 },
5637 static struct snd_kcontrol_new alc260_test_mixer[] = {
5638 /* Output driver widgets */
5639 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5640 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5641 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5642 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5643 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5644 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5646 /* Modes for retasking pin widgets
5647 * Note: the ALC260 doesn't seem to act on requests to enable mic
5648 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5649 * mention this restriction. At this stage it's not clear whether
5650 * this behaviour is intentional or is a hardware bug in chip
5651 * revisions available at least up until early 2006. Therefore for
5652 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5653 * choices, but if it turns out that the lack of mic bias for these
5654 * NIDs is intentional we could change their modes from
5655 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5657 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5658 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5659 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5660 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5661 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5662 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5664 /* Loopback mixer controls */
5665 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5666 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5667 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5668 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5669 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5670 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5671 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5672 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5673 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5674 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5675 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5676 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5677 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5678 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5680 /* Controls for GPIO pins, assuming they are configured as outputs */
5681 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5682 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5683 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5684 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5686 /* Switches to allow the digital IO pins to be enabled. The datasheet
5687 * is ambigious as to which NID is which; testing on laptops which
5688 * make this output available should provide clarification.
5690 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5691 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5693 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5694 * this output to turn on an external amplifier.
5696 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5697 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5701 static struct hda_verb alc260_test_init_verbs[] = {
5702 /* Enable all GPIOs as outputs with an initial value of 0 */
5703 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5704 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5705 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5707 /* Enable retasking pins as output, initially without power amp */
5708 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5709 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5710 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5711 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5712 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5713 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5715 /* Disable digital (SPDIF) pins initially, but users can enable
5716 * them via a mixer switch. In the case of SPDIF-out, this initverb
5717 * payload also sets the generation to 0, output to be in "consumer"
5718 * PCM format, copyright asserted, no pre-emphasis and no validity
5721 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5722 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5724 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5725 * OUT1 sum bus when acting as an output.
5727 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5728 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5729 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5730 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5732 /* Start with output sum widgets muted and their output gains at min */
5733 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5734 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5735 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5736 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5737 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5738 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5739 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5740 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5741 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5743 /* Unmute retasking pin widget output buffers since the default
5744 * state appears to be output. As the pin mode is changed by the
5745 * user the pin mode control will take care of enabling the pin's
5746 * input/output buffers as needed.
5748 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5749 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5750 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5751 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5752 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5753 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5754 /* Also unmute the mono-out pin widget */
5755 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5757 /* Mute capture amp left and right */
5758 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5759 /* Set ADC connection select to match default mixer setting (mic1
5762 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5764 /* Do the same for the second ADC: mute capture input amp and
5765 * set ADC connection to mic1 pin
5767 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5768 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5770 /* Mute all inputs to mixer widget (even unconnected ones) */
5771 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5772 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5773 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5774 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5775 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5776 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5777 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5778 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5784 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5785 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5787 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5788 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5791 * for BIOS auto-configuration
5794 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5795 const char *pfx, int *vol_bits)
5798 unsigned long vol_val, sw_val;
5802 if (nid >= 0x0f && nid < 0x11) {
5803 nid_vol = nid - 0x7;
5804 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5805 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5806 } else if (nid == 0x11) {
5807 nid_vol = nid - 0x7;
5808 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5809 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5810 } else if (nid >= 0x12 && nid <= 0x15) {
5812 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5813 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5817 if (!(*vol_bits & (1 << nid_vol))) {
5818 /* first control for the volume widget */
5819 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5820 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5823 *vol_bits |= (1 << nid_vol);
5825 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5826 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5832 /* add playback controls from the parsed DAC table */
5833 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5834 const struct auto_pin_cfg *cfg)
5840 spec->multiout.num_dacs = 1;
5841 spec->multiout.dac_nids = spec->private_dac_nids;
5842 spec->multiout.dac_nids[0] = 0x02;
5844 nid = cfg->line_out_pins[0];
5846 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5851 nid = cfg->speaker_pins[0];
5853 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5858 nid = cfg->hp_pins[0];
5860 err = alc260_add_playback_controls(spec, nid, "Headphone",
5868 /* create playback/capture controls for input pins */
5869 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5870 const struct auto_pin_cfg *cfg)
5872 struct hda_input_mux *imux = &spec->private_imux[0];
5875 for (i = 0; i < AUTO_PIN_LAST; i++) {
5876 if (cfg->input_pins[i] >= 0x12) {
5877 idx = cfg->input_pins[i] - 0x12;
5878 err = new_analog_input(spec, cfg->input_pins[i],
5879 auto_pin_cfg_labels[i], idx,
5883 imux->items[imux->num_items].label =
5884 auto_pin_cfg_labels[i];
5885 imux->items[imux->num_items].index = idx;
5888 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5889 idx = cfg->input_pins[i] - 0x09;
5890 err = new_analog_input(spec, cfg->input_pins[i],
5891 auto_pin_cfg_labels[i], idx,
5895 imux->items[imux->num_items].label =
5896 auto_pin_cfg_labels[i];
5897 imux->items[imux->num_items].index = idx;
5904 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5905 hda_nid_t nid, int pin_type,
5908 alc_set_pin_output(codec, nid, pin_type);
5909 /* need the manual connection? */
5911 int idx = nid - 0x12;
5912 snd_hda_codec_write(codec, idx + 0x0b, 0,
5913 AC_VERB_SET_CONNECT_SEL, sel_idx);
5917 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5919 struct alc_spec *spec = codec->spec;
5922 nid = spec->autocfg.line_out_pins[0];
5924 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5925 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5928 nid = spec->autocfg.speaker_pins[0];
5930 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5932 nid = spec->autocfg.hp_pins[0];
5934 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5937 #define ALC260_PIN_CD_NID 0x16
5938 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5940 struct alc_spec *spec = codec->spec;
5943 for (i = 0; i < AUTO_PIN_LAST; i++) {
5944 hda_nid_t nid = spec->autocfg.input_pins[i];
5946 alc_set_input_pin(codec, nid, i);
5947 if (nid != ALC260_PIN_CD_NID &&
5948 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5949 snd_hda_codec_write(codec, nid, 0,
5950 AC_VERB_SET_AMP_GAIN_MUTE,
5957 * generic initialization of ADC, input mixers and output mixers
5959 static struct hda_verb alc260_volume_init_verbs[] = {
5961 * Unmute ADC0-1 and set the default input to mic-in
5963 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5964 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5965 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5966 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5968 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5970 * Note: PASD motherboards uses the Line In 2 as the input for
5971 * front panel mic (mic 2)
5973 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5974 /* mute analog inputs */
5975 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5976 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5977 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5978 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5979 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5982 * Set up output mixers (0x08 - 0x0a)
5984 /* set vol=0 to output mixers */
5985 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5986 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5987 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5988 /* set up input amps for analog loopback */
5989 /* Amp Indices: DAC = 0, mixer = 1 */
5990 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5991 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5992 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5993 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5994 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5995 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6000 static int alc260_parse_auto_config(struct hda_codec *codec)
6002 struct alc_spec *spec = codec->spec;
6004 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6006 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6010 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6013 if (!spec->kctls.list)
6014 return 0; /* can't find valid BIOS pin config */
6015 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
6019 spec->multiout.max_channels = 2;
6021 if (spec->autocfg.dig_outs)
6022 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6023 if (spec->kctls.list)
6024 add_mixer(spec, spec->kctls.list);
6026 add_verb(spec, alc260_volume_init_verbs);
6028 spec->num_mux_defs = 1;
6029 spec->input_mux = &spec->private_imux[0];
6031 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6036 /* additional initialization for auto-configuration model */
6037 static void alc260_auto_init(struct hda_codec *codec)
6039 struct alc_spec *spec = codec->spec;
6040 alc260_auto_init_multi_out(codec);
6041 alc260_auto_init_analog_input(codec);
6042 if (spec->unsol_event)
6043 alc_inithook(codec);
6046 #ifdef CONFIG_SND_HDA_POWER_SAVE
6047 static struct hda_amp_list alc260_loopbacks[] = {
6048 { 0x07, HDA_INPUT, 0 },
6049 { 0x07, HDA_INPUT, 1 },
6050 { 0x07, HDA_INPUT, 2 },
6051 { 0x07, HDA_INPUT, 3 },
6052 { 0x07, HDA_INPUT, 4 },
6058 * ALC260 configurations
6060 static const char *alc260_models[ALC260_MODEL_LAST] = {
6061 [ALC260_BASIC] = "basic",
6063 [ALC260_HP_3013] = "hp-3013",
6064 [ALC260_HP_DC7600] = "hp-dc7600",
6065 [ALC260_FUJITSU_S702X] = "fujitsu",
6066 [ALC260_ACER] = "acer",
6067 [ALC260_WILL] = "will",
6068 [ALC260_REPLACER_672V] = "replacer",
6069 [ALC260_FAVORIT100] = "favorit100",
6070 #ifdef CONFIG_SND_DEBUG
6071 [ALC260_TEST] = "test",
6073 [ALC260_AUTO] = "auto",
6076 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6077 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6078 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6079 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6080 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6081 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6082 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6083 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6084 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6085 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6086 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6087 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6088 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6089 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6090 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6091 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6092 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6093 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6094 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6095 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6099 static struct alc_config_preset alc260_presets[] = {
6101 .mixers = { alc260_base_output_mixer,
6102 alc260_input_mixer },
6103 .init_verbs = { alc260_init_verbs },
6104 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6105 .dac_nids = alc260_dac_nids,
6106 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6107 .adc_nids = alc260_adc_nids,
6108 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6109 .channel_mode = alc260_modes,
6110 .input_mux = &alc260_capture_source,
6113 .mixers = { alc260_hp_output_mixer,
6114 alc260_input_mixer },
6115 .init_verbs = { alc260_init_verbs,
6116 alc260_hp_unsol_verbs },
6117 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6118 .dac_nids = alc260_dac_nids,
6119 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6120 .adc_nids = alc260_adc_nids_alt,
6121 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6122 .channel_mode = alc260_modes,
6123 .input_mux = &alc260_capture_source,
6124 .unsol_event = alc260_hp_unsol_event,
6125 .init_hook = alc260_hp_automute,
6127 [ALC260_HP_DC7600] = {
6128 .mixers = { alc260_hp_dc7600_mixer,
6129 alc260_input_mixer },
6130 .init_verbs = { alc260_init_verbs,
6131 alc260_hp_dc7600_verbs },
6132 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6133 .dac_nids = alc260_dac_nids,
6134 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6135 .adc_nids = alc260_adc_nids_alt,
6136 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6137 .channel_mode = alc260_modes,
6138 .input_mux = &alc260_capture_source,
6139 .unsol_event = alc260_hp_3012_unsol_event,
6140 .init_hook = alc260_hp_3012_automute,
6142 [ALC260_HP_3013] = {
6143 .mixers = { alc260_hp_3013_mixer,
6144 alc260_input_mixer },
6145 .init_verbs = { alc260_hp_3013_init_verbs,
6146 alc260_hp_3013_unsol_verbs },
6147 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6148 .dac_nids = alc260_dac_nids,
6149 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6150 .adc_nids = alc260_adc_nids_alt,
6151 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6152 .channel_mode = alc260_modes,
6153 .input_mux = &alc260_capture_source,
6154 .unsol_event = alc260_hp_3013_unsol_event,
6155 .init_hook = alc260_hp_3013_automute,
6157 [ALC260_FUJITSU_S702X] = {
6158 .mixers = { alc260_fujitsu_mixer },
6159 .init_verbs = { alc260_fujitsu_init_verbs },
6160 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6161 .dac_nids = alc260_dac_nids,
6162 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6163 .adc_nids = alc260_dual_adc_nids,
6164 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6165 .channel_mode = alc260_modes,
6166 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6167 .input_mux = alc260_fujitsu_capture_sources,
6170 .mixers = { alc260_acer_mixer },
6171 .init_verbs = { alc260_acer_init_verbs },
6172 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6173 .dac_nids = alc260_dac_nids,
6174 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6175 .adc_nids = alc260_dual_adc_nids,
6176 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6177 .channel_mode = alc260_modes,
6178 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6179 .input_mux = alc260_acer_capture_sources,
6181 [ALC260_FAVORIT100] = {
6182 .mixers = { alc260_favorit100_mixer },
6183 .init_verbs = { alc260_favorit100_init_verbs },
6184 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6185 .dac_nids = alc260_dac_nids,
6186 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6187 .adc_nids = alc260_dual_adc_nids,
6188 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6189 .channel_mode = alc260_modes,
6190 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6191 .input_mux = alc260_favorit100_capture_sources,
6194 .mixers = { alc260_will_mixer },
6195 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6196 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6197 .dac_nids = alc260_dac_nids,
6198 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6199 .adc_nids = alc260_adc_nids,
6200 .dig_out_nid = ALC260_DIGOUT_NID,
6201 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6202 .channel_mode = alc260_modes,
6203 .input_mux = &alc260_capture_source,
6205 [ALC260_REPLACER_672V] = {
6206 .mixers = { alc260_replacer_672v_mixer },
6207 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6208 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6209 .dac_nids = alc260_dac_nids,
6210 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6211 .adc_nids = alc260_adc_nids,
6212 .dig_out_nid = ALC260_DIGOUT_NID,
6213 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6214 .channel_mode = alc260_modes,
6215 .input_mux = &alc260_capture_source,
6216 .unsol_event = alc260_replacer_672v_unsol_event,
6217 .init_hook = alc260_replacer_672v_automute,
6219 #ifdef CONFIG_SND_DEBUG
6221 .mixers = { alc260_test_mixer },
6222 .init_verbs = { alc260_test_init_verbs },
6223 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6224 .dac_nids = alc260_test_dac_nids,
6225 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6226 .adc_nids = alc260_test_adc_nids,
6227 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6228 .channel_mode = alc260_modes,
6229 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6230 .input_mux = alc260_test_capture_sources,
6235 static int patch_alc260(struct hda_codec *codec)
6237 struct alc_spec *spec;
6238 int err, board_config;
6240 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6246 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6249 if (board_config < 0) {
6250 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6252 board_config = ALC260_AUTO;
6255 if (board_config == ALC260_AUTO) {
6256 /* automatic parse from the BIOS config */
6257 err = alc260_parse_auto_config(codec);
6263 "hda_codec: Cannot set up configuration "
6264 "from BIOS. Using base mode...\n");
6265 board_config = ALC260_BASIC;
6269 err = snd_hda_attach_beep_device(codec, 0x1);
6275 if (board_config != ALC260_AUTO)
6276 setup_preset(spec, &alc260_presets[board_config]);
6278 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6279 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6281 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6282 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6284 if (!spec->adc_nids && spec->input_mux) {
6285 /* check whether NID 0x04 is valid */
6286 unsigned int wcap = get_wcaps(codec, 0x04);
6287 wcap = get_wcaps_type(wcap);
6289 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6290 spec->adc_nids = alc260_adc_nids_alt;
6291 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6293 spec->adc_nids = alc260_adc_nids;
6294 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6297 set_capture_mixer(spec);
6298 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6300 spec->vmaster_nid = 0x08;
6302 codec->patch_ops = alc_patch_ops;
6303 if (board_config == ALC260_AUTO)
6304 spec->init_hook = alc260_auto_init;
6305 #ifdef CONFIG_SND_HDA_POWER_SAVE
6306 if (!spec->loopback.amplist)
6307 spec->loopback.amplist = alc260_loopbacks;
6309 codec->proc_widget_hook = print_realtek_coef;
6316 * ALC882/883/885/888/889 support
6318 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6319 * configuration. Each pin widget can choose any input DACs and a mixer.
6320 * Each ADC is connected from a mixer of all inputs. This makes possible
6321 * 6-channel independent captures.
6323 * In addition, an independent DAC for the multi-playback (not used in this
6326 #define ALC882_DIGOUT_NID 0x06
6327 #define ALC882_DIGIN_NID 0x0a
6328 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6329 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6330 #define ALC1200_DIGOUT_NID 0x10
6333 static struct hda_channel_mode alc882_ch_modes[1] = {
6338 static hda_nid_t alc882_dac_nids[4] = {
6339 /* front, rear, clfe, rear_surr */
6340 0x02, 0x03, 0x04, 0x05
6342 #define alc883_dac_nids alc882_dac_nids
6345 #define alc882_adc_nids alc880_adc_nids
6346 #define alc882_adc_nids_alt alc880_adc_nids_alt
6347 #define alc883_adc_nids alc882_adc_nids_alt
6348 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6349 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6350 #define alc889_adc_nids alc880_adc_nids
6352 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6353 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6354 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6355 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6356 #define alc889_capsrc_nids alc882_capsrc_nids
6359 /* FIXME: should be a matrix-type input source selection */
6361 static struct hda_input_mux alc882_capture_source = {
6365 { "Front Mic", 0x1 },
6371 #define alc883_capture_source alc882_capture_source
6373 static struct hda_input_mux alc889_capture_source = {
6376 { "Front Mic", 0x0 },
6382 static struct hda_input_mux mb5_capture_source = {
6391 static struct hda_input_mux alc883_3stack_6ch_intel = {
6395 { "Front Mic", 0x0 },
6401 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6409 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6419 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6427 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6431 { "Front Mic", 0x1 },
6436 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6444 static struct hda_input_mux alc889A_mb31_capture_source = {
6448 /* Front Mic (0x01) unused */
6450 /* Line 2 (0x03) unused */
6451 /* CD (0x04) unsused? */
6458 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6465 static struct hda_verb alc882_3ST_ch2_init[] = {
6466 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6467 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6468 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6469 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6476 static struct hda_verb alc882_3ST_ch4_init[] = {
6477 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6478 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6479 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6480 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6481 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6488 static struct hda_verb alc882_3ST_ch6_init[] = {
6489 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6490 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6491 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6492 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6493 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6494 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6498 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6499 { 2, alc882_3ST_ch2_init },
6500 { 4, alc882_3ST_ch4_init },
6501 { 6, alc882_3ST_ch6_init },
6504 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6509 static struct hda_verb alc882_sixstack_ch6_init[] = {
6510 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6511 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6512 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6513 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6520 static struct hda_verb alc882_sixstack_ch8_init[] = {
6521 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6522 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6523 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6524 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6528 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6529 { 6, alc882_sixstack_ch6_init },
6530 { 8, alc882_sixstack_ch8_init },
6534 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6540 static struct hda_verb alc885_mbp_ch2_init[] = {
6541 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6542 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6543 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6550 static struct hda_verb alc885_mbp_ch6_init[] = {
6551 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6552 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6553 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6554 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6555 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6559 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6560 { 2, alc885_mbp_ch2_init },
6561 { 6, alc885_mbp_ch6_init },
6566 * Speakers/Woofer/HP = Front
6569 static struct hda_verb alc885_mb5_ch2_init[] = {
6570 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6571 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6577 * Speakers/HP = Front
6581 static struct hda_verb alc885_mb5_ch6_init[] = {
6582 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6583 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6584 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6588 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6589 { 2, alc885_mb5_ch2_init },
6590 { 6, alc885_mb5_ch6_init },
6597 static struct hda_verb alc883_4ST_ch2_init[] = {
6598 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6599 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6600 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6601 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6602 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6603 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6610 static struct hda_verb alc883_4ST_ch4_init[] = {
6611 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6612 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6613 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6614 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6615 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6616 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6617 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6624 static struct hda_verb alc883_4ST_ch6_init[] = {
6625 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6626 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6627 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6628 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6629 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6630 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6631 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6632 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6639 static struct hda_verb alc883_4ST_ch8_init[] = {
6640 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6641 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6642 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6643 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6644 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6645 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6646 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6647 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6648 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6652 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6653 { 2, alc883_4ST_ch2_init },
6654 { 4, alc883_4ST_ch4_init },
6655 { 6, alc883_4ST_ch6_init },
6656 { 8, alc883_4ST_ch8_init },
6663 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6664 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6665 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6666 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6667 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6674 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6675 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6676 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6677 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6678 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6679 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6686 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6687 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6688 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6689 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6690 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6691 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6692 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6696 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6697 { 2, alc883_3ST_ch2_intel_init },
6698 { 4, alc883_3ST_ch4_intel_init },
6699 { 6, alc883_3ST_ch6_intel_init },
6705 static struct hda_verb alc889_ch2_intel_init[] = {
6706 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6707 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6708 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6709 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6710 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6711 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6718 static struct hda_verb alc889_ch6_intel_init[] = {
6719 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6720 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6721 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6722 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6723 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6724 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6731 static struct hda_verb alc889_ch8_intel_init[] = {
6732 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6733 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6734 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6735 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6736 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6737 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6738 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6742 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6743 { 2, alc889_ch2_intel_init },
6744 { 6, alc889_ch6_intel_init },
6745 { 8, alc889_ch8_intel_init },
6751 static struct hda_verb alc883_sixstack_ch6_init[] = {
6752 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6753 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6754 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6755 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6762 static struct hda_verb alc883_sixstack_ch8_init[] = {
6763 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6764 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6765 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6766 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6770 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6771 { 6, alc883_sixstack_ch6_init },
6772 { 8, alc883_sixstack_ch8_init },
6776 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6777 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6779 static struct snd_kcontrol_new alc882_base_mixer[] = {
6780 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6781 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6782 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6783 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6784 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6785 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6786 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6787 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6788 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6789 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6790 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6791 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6792 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6793 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6794 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6796 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6797 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6798 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6799 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6800 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6804 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6805 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6806 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6807 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6808 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6809 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6810 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6811 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6812 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6813 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6814 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6818 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6819 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6820 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6821 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6822 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6823 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6824 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6825 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6826 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6827 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6828 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6829 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6830 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6831 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6832 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6836 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6837 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6838 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6839 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6840 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6841 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6842 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6843 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6844 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6845 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6849 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6850 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6851 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6852 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6853 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6854 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6855 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6856 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6857 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6858 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6859 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6860 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6861 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6862 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6866 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6867 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6869 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6870 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6871 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6872 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6873 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6874 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6875 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6876 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6877 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6878 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6879 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6880 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6881 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6882 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6886 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6887 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6888 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6889 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6890 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6891 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6892 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6893 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6894 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6895 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6900 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6902 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6903 .name = "Channel Mode",
6904 .info = alc_ch_mode_info,
6905 .get = alc_ch_mode_get,
6906 .put = alc_ch_mode_put,
6911 static struct hda_verb alc882_base_init_verbs[] = {
6912 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6913 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6914 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6915 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6917 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6918 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6919 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6921 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6922 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6923 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6925 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6926 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6927 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6929 /* mute analog input loopbacks */
6930 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6932 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6936 /* Front Pin: output 0 (0x0c) */
6937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6938 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6939 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6940 /* Rear Pin: output 1 (0x0d) */
6941 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6942 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6943 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6944 /* CLFE Pin: output 2 (0x0e) */
6945 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6946 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6947 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6948 /* Side Pin: output 3 (0x0f) */
6949 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6950 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6951 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6952 /* Mic (rear) pin: input vref at 80% */
6953 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6954 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6955 /* Front Mic pin: input vref at 80% */
6956 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6957 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6958 /* Line In pin: input */
6959 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6960 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6961 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6962 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6963 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6964 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6965 /* CD pin widget for input */
6966 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6968 /* FIXME: use matrix-type input source selection */
6969 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6971 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6972 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6973 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6974 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6976 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6977 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6978 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6979 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6980 /* ADC2: mute amp left and right */
6981 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6982 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6983 /* ADC3: mute amp left and right */
6984 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6985 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6990 static struct hda_verb alc882_adc1_init_verbs[] = {
6991 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6992 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6993 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6994 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6995 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6996 /* ADC1: mute amp left and right */
6997 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6998 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7002 static struct hda_verb alc882_eapd_verbs[] = {
7003 /* change to EAPD mode */
7004 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7005 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7009 static struct hda_verb alc889_eapd_verbs[] = {
7010 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7011 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7015 static struct hda_verb alc_hp15_unsol_verbs[] = {
7016 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7017 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7021 static struct hda_verb alc885_init_verbs[] = {
7022 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7024 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7025 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7027 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7028 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7029 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7031 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7032 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7033 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7035 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7036 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7037 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7039 /* mute analog input loopbacks */
7040 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7041 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7042 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7044 /* Front HP Pin: output 0 (0x0c) */
7045 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7046 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7047 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7048 /* Front Pin: output 0 (0x0c) */
7049 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7050 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7051 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7052 /* Rear Pin: output 1 (0x0d) */
7053 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7054 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7055 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7056 /* CLFE Pin: output 2 (0x0e) */
7057 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7058 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7059 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7060 /* Side Pin: output 3 (0x0f) */
7061 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7062 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7063 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7064 /* Mic (rear) pin: input vref at 80% */
7065 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7066 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7067 /* Front Mic pin: input vref at 80% */
7068 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7069 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7070 /* Line In pin: input */
7071 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7072 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7074 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7076 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7077 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7078 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7080 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7081 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7082 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7084 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7085 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7087 /* ADC2: mute amp left and right */
7088 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7089 /* ADC3: mute amp left and right */
7090 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7095 static struct hda_verb alc885_init_input_verbs[] = {
7096 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7097 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7098 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7103 /* Unmute Selector 24h and set the default input to front mic */
7104 static struct hda_verb alc889_init_input_verbs[] = {
7105 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7106 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7111 #define alc883_init_verbs alc882_base_init_verbs
7114 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7115 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7116 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7117 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7118 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7119 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7120 /* FIXME: this looks suspicious...
7121 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7122 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7127 static struct hda_verb alc882_macpro_init_verbs[] = {
7128 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7129 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7130 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7131 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7132 /* Front Pin: output 0 (0x0c) */
7133 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7134 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7135 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7136 /* Front Mic pin: input vref at 80% */
7137 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7138 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7139 /* Speaker: output */
7140 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7141 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7142 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7143 /* Headphone output (output 0 - 0x0c) */
7144 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7145 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7146 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7148 /* FIXME: use matrix-type input source selection */
7149 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7150 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7151 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7152 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7153 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7154 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7156 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7157 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7158 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7159 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7161 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7162 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7163 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7164 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7165 /* ADC1: mute amp left and right */
7166 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7167 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7168 /* ADC2: mute amp left and right */
7169 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7170 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7171 /* ADC3: mute amp left and right */
7172 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7173 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7179 static struct hda_verb alc885_mb5_init_verbs[] = {
7181 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7182 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7183 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7184 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7186 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7187 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7189 /* Surround mixer */
7190 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7191 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7192 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7194 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7195 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7196 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7198 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7199 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7200 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7201 /* Front Pin (0x0c) */
7202 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7203 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7204 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7205 /* LFE Pin (0x0e) */
7206 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7207 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7208 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7210 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7211 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7212 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7213 /* Front Mic pin: input vref at 80% */
7214 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7215 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7217 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7218 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7220 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7221 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7222 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7223 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7227 /* Macbook Pro rev3 */
7228 static struct hda_verb alc885_mbp3_init_verbs[] = {
7229 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7230 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7231 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7232 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7234 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7235 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7236 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7237 /* Front Pin: output 0 (0x0c) */
7238 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7239 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7240 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7241 /* HP Pin: output 0 (0x0d) */
7242 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7243 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7244 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7245 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7246 /* Mic (rear) pin: input vref at 80% */
7247 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7248 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7249 /* Front Mic pin: input vref at 80% */
7250 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7251 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7252 /* Line In pin: use output 1 when in LineOut mode */
7253 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7254 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7255 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7257 /* FIXME: use matrix-type input source selection */
7258 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7259 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7260 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7261 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7262 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7263 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7265 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7266 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7267 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7268 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7270 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7271 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7272 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7273 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7274 /* ADC1: mute amp left and right */
7275 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7276 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7277 /* ADC2: mute amp left and right */
7278 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7279 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7280 /* ADC3: mute amp left and right */
7281 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7282 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7287 /* iMac 24 mixer. */
7288 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7289 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7290 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7294 /* iMac 24 init verbs. */
7295 static struct hda_verb alc885_imac24_init_verbs[] = {
7296 /* Internal speakers: output 0 (0x0c) */
7297 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7298 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7299 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7300 /* Internal speakers: output 0 (0x0c) */
7301 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7302 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7303 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7304 /* Headphone: output 0 (0x0c) */
7305 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7306 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7307 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7308 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7309 /* Front Mic: input vref at 80% */
7310 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7311 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7315 /* Toggle speaker-output according to the hp-jack state */
7316 static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
7318 struct alc_spec *spec = codec->spec;
7320 spec->autocfg.hp_pins[0] = 0x14;
7321 spec->autocfg.speaker_pins[0] = 0x18;
7322 spec->autocfg.speaker_pins[1] = 0x1a;
7323 alc_automute_amp(codec);
7326 static void alc885_mbp3_init_hook(struct hda_codec *codec)
7328 struct alc_spec *spec = codec->spec;
7330 spec->autocfg.hp_pins[0] = 0x15;
7331 spec->autocfg.speaker_pins[0] = 0x14;
7332 alc_automute_amp(codec);
7336 static struct hda_verb alc882_targa_verbs[] = {
7337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7338 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7340 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7341 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7343 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7344 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7345 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7347 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7351 /* toggle speaker-output according to the hp-jack state */
7352 static void alc882_targa_automute(struct hda_codec *codec)
7354 struct alc_spec *spec = codec->spec;
7355 alc_automute_amp(codec);
7356 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7357 spec->jack_present ? 1 : 3);
7360 static void alc882_targa_init_hook(struct hda_codec *codec)
7362 struct alc_spec *spec = codec->spec;
7364 spec->autocfg.hp_pins[0] = 0x14;
7365 spec->autocfg.speaker_pins[0] = 0x1b;
7366 alc882_targa_automute(codec);
7369 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7371 if ((res >> 26) == ALC880_HP_EVENT)
7372 alc882_targa_automute(codec);
7375 static struct hda_verb alc882_asus_a7j_verbs[] = {
7376 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7377 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7380 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7381 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7383 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7384 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7385 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7387 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7388 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7389 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7393 static struct hda_verb alc882_asus_a7m_verbs[] = {
7394 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7395 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7397 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7398 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7399 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7401 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7402 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7403 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7405 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7406 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7407 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7411 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7413 unsigned int gpiostate, gpiomask, gpiodir;
7415 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7416 AC_VERB_GET_GPIO_DATA, 0);
7419 gpiostate |= (1 << pin);
7421 gpiostate &= ~(1 << pin);
7423 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7424 AC_VERB_GET_GPIO_MASK, 0);
7425 gpiomask |= (1 << pin);
7427 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7428 AC_VERB_GET_GPIO_DIRECTION, 0);
7429 gpiodir |= (1 << pin);
7432 snd_hda_codec_write(codec, codec->afg, 0,
7433 AC_VERB_SET_GPIO_MASK, gpiomask);
7434 snd_hda_codec_write(codec, codec->afg, 0,
7435 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7439 snd_hda_codec_write(codec, codec->afg, 0,
7440 AC_VERB_SET_GPIO_DATA, gpiostate);
7443 /* set up GPIO at initialization */
7444 static void alc885_macpro_init_hook(struct hda_codec *codec)
7446 alc882_gpio_mute(codec, 0, 0);
7447 alc882_gpio_mute(codec, 1, 0);
7450 /* set up GPIO and update auto-muting at initialization */
7451 static void alc885_imac24_init_hook(struct hda_codec *codec)
7453 alc885_macpro_init_hook(codec);
7454 alc885_imac24_automute_init_hook(codec);
7458 * generic initialization of ADC, input mixers and output mixers
7460 static struct hda_verb alc883_auto_init_verbs[] = {
7462 * Unmute ADC0-2 and set the default input to mic-in
7464 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7465 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7466 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7467 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7469 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7471 * Note: PASD motherboards uses the Line In 2 as the input for
7472 * front panel mic (mic 2)
7474 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7475 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7476 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7477 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7478 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7479 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7482 * Set up output mixers (0x0c - 0x0f)
7484 /* set vol=0 to output mixers */
7485 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7486 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7487 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7488 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7489 /* set up input amps for analog loopback */
7490 /* Amp Indices: DAC = 0, mixer = 1 */
7491 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7492 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7493 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7494 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7495 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7496 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7497 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7498 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7499 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7500 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7502 /* FIXME: use matrix-type input source selection */
7503 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7505 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7506 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7507 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7508 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7510 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7511 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7512 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7518 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7519 static struct hda_verb alc889A_mb31_ch2_init[] = {
7520 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7521 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7522 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7523 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7527 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7528 static struct hda_verb alc889A_mb31_ch4_init[] = {
7529 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7530 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7531 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7532 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7536 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7537 static struct hda_verb alc889A_mb31_ch5_init[] = {
7538 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7539 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7540 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7541 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7545 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7546 static struct hda_verb alc889A_mb31_ch6_init[] = {
7547 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7548 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7549 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7550 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7554 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7555 { 2, alc889A_mb31_ch2_init },
7556 { 4, alc889A_mb31_ch4_init },
7557 { 5, alc889A_mb31_ch5_init },
7558 { 6, alc889A_mb31_ch6_init },
7561 static struct hda_verb alc883_medion_eapd_verbs[] = {
7562 /* eanable EAPD on medion laptop */
7563 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7564 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7568 #define alc883_base_mixer alc882_base_mixer
7570 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7571 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7572 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7573 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7574 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7575 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7576 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7577 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7578 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7579 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7580 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7581 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7582 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7583 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7587 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7588 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7589 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7590 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7591 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7592 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7593 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7594 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7595 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7596 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7597 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7601 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7602 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7603 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7604 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7605 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7606 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7607 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7608 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7609 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7610 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7611 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7615 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7616 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7617 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7618 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7619 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7620 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7621 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7622 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7623 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7624 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7625 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7626 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7627 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7628 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7632 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7633 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7634 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7635 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7636 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7637 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7638 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7639 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7640 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7641 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7642 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7643 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7644 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7645 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7646 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7647 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7648 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7649 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7650 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7651 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7655 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7656 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7657 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7658 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7659 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7660 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7662 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7663 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7664 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7665 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7666 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7667 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7668 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7669 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7670 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7671 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7673 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7674 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7675 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7679 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7680 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7681 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7682 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7683 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7684 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7686 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7687 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7688 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7689 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7690 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7691 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7692 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7693 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7694 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7695 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7697 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7698 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7699 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7703 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7704 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7705 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7706 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7707 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7708 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7709 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7710 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7711 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7712 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7713 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7714 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7715 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7716 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7717 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7718 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7719 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7720 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7721 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7722 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7726 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7727 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7728 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7729 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7730 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7731 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7732 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7733 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7734 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7735 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7736 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7737 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7738 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7739 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7740 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7741 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7742 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7746 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7747 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7748 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7749 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7750 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7751 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7752 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7753 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7754 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7755 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7756 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7757 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7761 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7762 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7763 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7764 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7765 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7766 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7767 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7768 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7769 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7773 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7774 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7775 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7776 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7777 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7778 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7780 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7781 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7782 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7786 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7787 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7788 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7789 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7790 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7791 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7792 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7793 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7794 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7795 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7799 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7800 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7801 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7802 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7803 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7804 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7805 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7806 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7807 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7811 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
7812 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7813 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7814 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7815 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
7816 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7817 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7818 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7819 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7820 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7821 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7822 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7826 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7827 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7828 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7829 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7830 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7831 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7832 0x0d, 1, 0x0, HDA_OUTPUT),
7833 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7834 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7835 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7836 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7837 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7838 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7839 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7840 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7841 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7842 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7843 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7844 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7845 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7846 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7847 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7851 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
7853 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7854 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7855 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7856 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7857 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
7859 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
7860 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
7861 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
7862 /* Output switches */
7863 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
7864 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
7865 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
7867 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7868 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7870 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7871 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7872 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7873 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7877 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
7878 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7879 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7880 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7881 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7882 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7883 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7887 static struct hda_bind_ctls alc883_bind_cap_vol = {
7888 .ops = &snd_hda_bind_vol,
7890 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7891 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7896 static struct hda_bind_ctls alc883_bind_cap_switch = {
7897 .ops = &snd_hda_bind_sw,
7899 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7900 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7905 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7906 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7907 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7908 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7909 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7910 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7911 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7912 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7913 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7917 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7918 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7919 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7921 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7922 /* .name = "Capture Source", */
7923 .name = "Input Source",
7925 .info = alc_mux_enum_info,
7926 .get = alc_mux_enum_get,
7927 .put = alc_mux_enum_put,
7932 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7934 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7935 .name = "Channel Mode",
7936 .info = alc_ch_mode_info,
7937 .get = alc_ch_mode_get,
7938 .put = alc_ch_mode_put,
7943 /* toggle speaker-output according to the hp-jack state */
7944 static void alc883_mitac_init_hook(struct hda_codec *codec)
7946 struct alc_spec *spec = codec->spec;
7948 spec->autocfg.hp_pins[0] = 0x15;
7949 spec->autocfg.speaker_pins[0] = 0x14;
7950 spec->autocfg.speaker_pins[1] = 0x17;
7951 alc_automute_amp(codec);
7954 /* auto-toggle front mic */
7956 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7958 unsigned int present;
7961 present = snd_hda_codec_read(codec, 0x18, 0,
7962 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7963 bits = present ? HDA_AMP_MUTE : 0;
7964 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7968 static struct hda_verb alc883_mitac_verbs[] = {
7970 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7971 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7973 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7974 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7976 /* enable unsolicited event */
7977 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7978 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7983 static struct hda_verb alc883_clevo_m720_verbs[] = {
7985 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7986 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7988 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7989 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7991 /* enable unsolicited event */
7992 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7993 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7998 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8000 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8001 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8003 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8004 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8006 /* enable unsolicited event */
8007 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8012 static struct hda_verb alc883_targa_verbs[] = {
8013 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8014 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8016 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8017 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8019 /* Connect Line-Out side jack (SPDIF) to Side */
8020 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8021 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8022 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8023 /* Connect Mic jack to CLFE */
8024 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8025 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8026 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8027 /* Connect Line-in jack to Surround */
8028 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8029 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8030 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8031 /* Connect HP out jack to Front */
8032 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8033 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8034 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8036 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8041 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8042 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8043 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8044 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8048 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8049 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8050 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8051 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8052 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8056 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8057 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8059 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8060 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8061 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8065 static struct hda_verb alc883_haier_w66_verbs[] = {
8066 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8067 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8069 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8071 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8072 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8073 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8074 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8078 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8079 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8080 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8081 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8082 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8083 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8084 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8085 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8086 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8090 static struct hda_verb alc888_6st_dell_verbs[] = {
8091 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8095 static struct hda_verb alc883_vaiott_verbs[] = {
8097 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8098 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8100 /* enable unsolicited event */
8101 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8106 static void alc888_3st_hp_init_hook(struct hda_codec *codec)
8108 struct alc_spec *spec = codec->spec;
8110 spec->autocfg.hp_pins[0] = 0x1b;
8111 spec->autocfg.speaker_pins[0] = 0x14;
8112 spec->autocfg.speaker_pins[1] = 0x16;
8113 spec->autocfg.speaker_pins[2] = 0x18;
8114 alc_automute_amp(codec);
8117 static struct hda_verb alc888_3st_hp_verbs[] = {
8118 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8119 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8120 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8121 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8128 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8129 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8130 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8131 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8132 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8139 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8140 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8141 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8142 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8143 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8144 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8151 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8152 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8153 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8154 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8155 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8156 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8157 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8161 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8162 { 2, alc888_3st_hp_2ch_init },
8163 { 4, alc888_3st_hp_4ch_init },
8164 { 6, alc888_3st_hp_6ch_init },
8167 /* toggle front-jack and RCA according to the hp-jack state */
8168 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8170 unsigned int present;
8172 present = snd_hda_codec_read(codec, 0x1b, 0,
8173 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8174 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8175 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8176 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8177 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8180 /* toggle RCA according to the front-jack state */
8181 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8183 unsigned int present;
8185 present = snd_hda_codec_read(codec, 0x14, 0,
8186 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8187 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8188 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8191 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8194 if ((res >> 26) == ALC880_HP_EVENT)
8195 alc888_lenovo_ms7195_front_automute(codec);
8196 if ((res >> 26) == ALC880_FRONT_EVENT)
8197 alc888_lenovo_ms7195_rca_automute(codec);
8200 static struct hda_verb alc883_medion_md2_verbs[] = {
8201 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8202 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8204 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8206 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8210 /* toggle speaker-output according to the hp-jack state */
8211 static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8213 struct alc_spec *spec = codec->spec;
8215 spec->autocfg.hp_pins[0] = 0x14;
8216 spec->autocfg.speaker_pins[0] = 0x15;
8217 alc_automute_amp(codec);
8220 /* toggle speaker-output according to the hp-jack state */
8221 #define alc883_targa_init_hook alc882_targa_init_hook
8222 #define alc883_targa_unsol_event alc882_targa_unsol_event
8224 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8226 unsigned int present;
8228 present = snd_hda_codec_read(codec, 0x18, 0,
8229 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8230 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8231 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8234 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8236 struct alc_spec *spec = codec->spec;
8238 spec->autocfg.hp_pins[0] = 0x15;
8239 spec->autocfg.speaker_pins[0] = 0x14;
8240 alc_automute_amp(codec);
8241 alc883_clevo_m720_mic_automute(codec);
8244 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8247 switch (res >> 26) {
8248 case ALC880_MIC_EVENT:
8249 alc883_clevo_m720_mic_automute(codec);
8252 alc_automute_amp_unsol_event(codec, res);
8257 /* toggle speaker-output according to the hp-jack state */
8258 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec)
8260 struct alc_spec *spec = codec->spec;
8262 spec->autocfg.hp_pins[0] = 0x14;
8263 spec->autocfg.speaker_pins[0] = 0x15;
8264 alc_automute_amp(codec);
8267 static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8269 struct alc_spec *spec = codec->spec;
8271 spec->autocfg.hp_pins[0] = 0x1b;
8272 spec->autocfg.speaker_pins[0] = 0x14;
8273 alc_automute_amp(codec);
8276 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8278 unsigned int present;
8281 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8282 & AC_PINSENSE_PRESENCE;
8283 bits = present ? HDA_AMP_MUTE : 0;
8284 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8285 HDA_AMP_MUTE, bits);
8288 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8290 unsigned int present;
8293 present = snd_hda_codec_read(codec, 0x1b, 0,
8294 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8295 bits = present ? HDA_AMP_MUTE : 0;
8296 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8297 HDA_AMP_MUTE, bits);
8298 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8299 HDA_AMP_MUTE, bits);
8302 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8305 if ((res >> 26) == ALC880_HP_EVENT)
8306 alc883_lenovo_101e_all_automute(codec);
8307 if ((res >> 26) == ALC880_FRONT_EVENT)
8308 alc883_lenovo_101e_ispeaker_automute(codec);
8311 /* toggle speaker-output according to the hp-jack state */
8312 static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8314 struct alc_spec *spec = codec->spec;
8316 spec->autocfg.hp_pins[0] = 0x14;
8317 spec->autocfg.speaker_pins[0] = 0x15;
8318 spec->autocfg.speaker_pins[1] = 0x16;
8319 alc_automute_amp(codec);
8322 static struct hda_verb alc883_acer_eapd_verbs[] = {
8323 /* HP Pin: output 0 (0x0c) */
8324 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8325 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8326 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8327 /* Front Pin: output 0 (0x0c) */
8328 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8329 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8330 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8331 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8332 /* eanable EAPD on medion laptop */
8333 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8334 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8335 /* enable unsolicited event */
8336 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8340 static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8342 struct alc_spec *spec = codec->spec;
8344 spec->autocfg.hp_pins[0] = 0x1b;
8345 spec->autocfg.speaker_pins[0] = 0x14;
8346 spec->autocfg.speaker_pins[1] = 0x15;
8347 spec->autocfg.speaker_pins[2] = 0x16;
8348 spec->autocfg.speaker_pins[3] = 0x17;
8349 alc_automute_amp(codec);
8352 static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8354 struct alc_spec *spec = codec->spec;
8356 spec->autocfg.hp_pins[0] = 0x1b;
8357 spec->autocfg.speaker_pins[0] = 0x14;
8358 spec->autocfg.speaker_pins[1] = 0x15;
8359 spec->autocfg.speaker_pins[2] = 0x16;
8360 spec->autocfg.speaker_pins[3] = 0x17;
8361 spec->autocfg.speaker_pins[4] = 0x1a;
8362 alc_automute_amp(codec);
8365 static void alc883_vaiott_init_hook(struct hda_codec *codec)
8367 struct alc_spec *spec = codec->spec;
8369 spec->autocfg.hp_pins[0] = 0x15;
8370 spec->autocfg.speaker_pins[0] = 0x14;
8371 spec->autocfg.speaker_pins[1] = 0x17;
8372 alc_automute_amp(codec);
8375 static struct hda_verb alc888_asus_m90v_verbs[] = {
8376 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8379 /* enable unsolicited event */
8380 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8381 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8385 static void alc883_nb_mic_automute(struct hda_codec *codec)
8387 unsigned int present;
8389 present = snd_hda_codec_read(codec, 0x18, 0,
8390 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8391 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8392 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8393 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8394 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8397 static void alc883_M90V_init_hook(struct hda_codec *codec)
8399 struct alc_spec *spec = codec->spec;
8401 spec->autocfg.hp_pins[0] = 0x1b;
8402 spec->autocfg.speaker_pins[0] = 0x14;
8403 spec->autocfg.speaker_pins[1] = 0x15;
8404 spec->autocfg.speaker_pins[2] = 0x16;
8405 alc_automute_pin(codec);
8408 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8411 switch (res >> 26) {
8412 case ALC880_MIC_EVENT:
8413 alc883_nb_mic_automute(codec);
8416 alc_sku_unsol_event(codec, res);
8421 static void alc883_mode2_inithook(struct hda_codec *codec)
8423 alc883_M90V_init_hook(codec);
8424 alc883_nb_mic_automute(codec);
8427 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8428 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8429 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8430 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8431 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8432 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8433 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8434 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8435 /* enable unsolicited event */
8436 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8440 static void alc883_eee1601_inithook(struct hda_codec *codec)
8442 struct alc_spec *spec = codec->spec;
8444 spec->autocfg.hp_pins[0] = 0x14;
8445 spec->autocfg.speaker_pins[0] = 0x1b;
8446 alc_automute_pin(codec);
8449 static struct hda_verb alc889A_mb31_verbs[] = {
8450 /* Init rear pin (used as headphone output) */
8451 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8452 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8453 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8454 /* Init line pin (used as output in 4ch and 6ch mode) */
8455 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8456 /* Init line 2 pin (used as headphone out by default) */
8457 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8458 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8462 /* Mute speakers according to the headphone jack state */
8463 static void alc889A_mb31_automute(struct hda_codec *codec)
8465 unsigned int present;
8467 /* Mute only in 2ch or 4ch mode */
8468 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8470 present = snd_hda_codec_read(codec, 0x15, 0,
8471 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8472 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8473 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8474 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8475 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8479 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8481 if ((res >> 26) == ALC880_HP_EVENT)
8482 alc889A_mb31_automute(codec);
8486 #ifdef CONFIG_SND_HDA_POWER_SAVE
8487 #define alc882_loopbacks alc880_loopbacks
8490 /* pcm configuration: identical with ALC880 */
8491 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8492 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8493 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8494 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8496 static hda_nid_t alc883_slave_dig_outs[] = {
8497 ALC1200_DIGOUT_NID, 0,
8500 static hda_nid_t alc1200_slave_dig_outs[] = {
8501 ALC883_DIGOUT_NID, 0,
8505 * configuration and preset
8507 static const char *alc882_models[ALC882_MODEL_LAST] = {
8508 [ALC882_3ST_DIG] = "3stack-dig",
8509 [ALC882_6ST_DIG] = "6stack-dig",
8510 [ALC882_ARIMA] = "arima",
8511 [ALC882_W2JC] = "w2jc",
8512 [ALC882_TARGA] = "targa",
8513 [ALC882_ASUS_A7J] = "asus-a7j",
8514 [ALC882_ASUS_A7M] = "asus-a7m",
8515 [ALC885_MACPRO] = "macpro",
8516 [ALC885_MB5] = "mb5",
8517 [ALC885_MBP3] = "mbp3",
8518 [ALC885_IMAC24] = "imac24",
8519 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8520 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8521 [ALC883_3ST_6ch] = "3stack-6ch",
8522 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8523 [ALC883_TARGA_DIG] = "targa-dig",
8524 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8525 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8526 [ALC883_ACER] = "acer",
8527 [ALC883_ACER_ASPIRE] = "acer-aspire",
8528 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8529 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8530 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8531 [ALC883_MEDION] = "medion",
8532 [ALC883_MEDION_MD2] = "medion-md2",
8533 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8534 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8535 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8536 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8537 [ALC888_LENOVO_SKY] = "lenovo-sky",
8538 [ALC883_HAIER_W66] = "haier-w66",
8539 [ALC888_3ST_HP] = "3stack-hp",
8540 [ALC888_6ST_DELL] = "6stack-dell",
8541 [ALC883_MITAC] = "mitac",
8542 [ALC883_CLEVO_M720] = "clevo-m720",
8543 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8544 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8545 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8546 [ALC889A_INTEL] = "intel-alc889a",
8547 [ALC889_INTEL] = "intel-x58",
8548 [ALC1200_ASUS_P5Q] = "asus-p5q",
8549 [ALC889A_MB31] = "mb31",
8550 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8551 [ALC882_AUTO] = "auto",
8554 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8555 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8557 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8558 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8559 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8560 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8561 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8562 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8563 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8564 ALC888_ACER_ASPIRE_4930G),
8565 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8566 ALC888_ACER_ASPIRE_4930G),
8567 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8568 ALC888_ACER_ASPIRE_8930G),
8569 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8570 ALC888_ACER_ASPIRE_8930G),
8571 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8572 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8573 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8574 ALC888_ACER_ASPIRE_6530G),
8575 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8576 ALC888_ACER_ASPIRE_6530G),
8577 /* default Acer -- disabled as it causes more problems.
8578 * model=auto should work fine now
8580 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8582 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8584 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8585 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8586 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8587 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8588 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8589 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8591 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8592 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8593 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8594 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8595 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8596 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8597 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8598 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8599 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8600 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8601 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8603 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8604 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8605 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8606 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8607 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8608 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8609 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8610 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8611 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8613 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8614 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8615 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8616 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8617 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8618 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8619 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8620 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8621 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8622 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8623 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8624 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8625 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8626 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8627 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8628 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8629 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8630 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8631 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8632 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8633 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8634 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8635 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8636 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8637 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8638 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8639 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8640 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8641 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8643 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8644 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8645 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8646 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8647 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8648 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8649 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8650 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8651 ALC883_FUJITSU_PI2515),
8652 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8653 ALC888_FUJITSU_XA3530),
8654 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8655 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8656 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8657 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8658 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8659 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8660 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8661 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8662 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8664 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8665 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8666 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8667 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8668 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8669 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8670 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8675 /* codec SSID table for Intel Mac */
8676 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8677 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8678 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8679 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8680 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8681 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8682 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8683 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8684 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8685 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8686 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8687 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8688 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8689 * no perfect solution yet
8691 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8695 static struct alc_config_preset alc882_presets[] = {
8696 [ALC882_3ST_DIG] = {
8697 .mixers = { alc882_base_mixer },
8698 .init_verbs = { alc882_base_init_verbs,
8699 alc882_adc1_init_verbs },
8700 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8701 .dac_nids = alc882_dac_nids,
8702 .dig_out_nid = ALC882_DIGOUT_NID,
8703 .dig_in_nid = ALC882_DIGIN_NID,
8704 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8705 .channel_mode = alc882_ch_modes,
8707 .input_mux = &alc882_capture_source,
8709 [ALC882_6ST_DIG] = {
8710 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8711 .init_verbs = { alc882_base_init_verbs,
8712 alc882_adc1_init_verbs },
8713 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8714 .dac_nids = alc882_dac_nids,
8715 .dig_out_nid = ALC882_DIGOUT_NID,
8716 .dig_in_nid = ALC882_DIGIN_NID,
8717 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8718 .channel_mode = alc882_sixstack_modes,
8719 .input_mux = &alc882_capture_source,
8722 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8723 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8724 alc882_eapd_verbs },
8725 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8726 .dac_nids = alc882_dac_nids,
8727 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8728 .channel_mode = alc882_sixstack_modes,
8729 .input_mux = &alc882_capture_source,
8732 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8733 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8734 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8735 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8736 .dac_nids = alc882_dac_nids,
8737 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8738 .channel_mode = alc880_threestack_modes,
8740 .input_mux = &alc882_capture_source,
8741 .dig_out_nid = ALC882_DIGOUT_NID,
8744 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8745 .init_verbs = { alc885_mbp3_init_verbs,
8746 alc880_gpio1_init_verbs },
8747 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8748 .dac_nids = alc882_dac_nids,
8749 .channel_mode = alc885_mbp_6ch_modes,
8750 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
8751 .input_mux = &alc882_capture_source,
8752 .dig_out_nid = ALC882_DIGOUT_NID,
8753 .dig_in_nid = ALC882_DIGIN_NID,
8754 .unsol_event = alc_automute_amp_unsol_event,
8755 .init_hook = alc885_mbp3_init_hook,
8758 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8759 .init_verbs = { alc885_mb5_init_verbs,
8760 alc880_gpio1_init_verbs },
8761 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8762 .dac_nids = alc882_dac_nids,
8763 .channel_mode = alc885_mb5_6ch_modes,
8764 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8765 .input_mux = &mb5_capture_source,
8766 .dig_out_nid = ALC882_DIGOUT_NID,
8767 .dig_in_nid = ALC882_DIGIN_NID,
8770 .mixers = { alc882_macpro_mixer },
8771 .init_verbs = { alc882_macpro_init_verbs },
8772 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8773 .dac_nids = alc882_dac_nids,
8774 .dig_out_nid = ALC882_DIGOUT_NID,
8775 .dig_in_nid = ALC882_DIGIN_NID,
8776 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8777 .channel_mode = alc882_ch_modes,
8778 .input_mux = &alc882_capture_source,
8779 .init_hook = alc885_macpro_init_hook,
8782 .mixers = { alc885_imac24_mixer },
8783 .init_verbs = { alc885_imac24_init_verbs },
8784 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8785 .dac_nids = alc882_dac_nids,
8786 .dig_out_nid = ALC882_DIGOUT_NID,
8787 .dig_in_nid = ALC882_DIGIN_NID,
8788 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8789 .channel_mode = alc882_ch_modes,
8790 .input_mux = &alc882_capture_source,
8791 .unsol_event = alc_automute_amp_unsol_event,
8792 .init_hook = alc885_imac24_init_hook,
8795 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
8796 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8797 alc880_gpio3_init_verbs, alc882_targa_verbs},
8798 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8799 .dac_nids = alc882_dac_nids,
8800 .dig_out_nid = ALC882_DIGOUT_NID,
8801 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8802 .adc_nids = alc882_adc_nids,
8803 .capsrc_nids = alc882_capsrc_nids,
8804 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8805 .channel_mode = alc882_3ST_6ch_modes,
8807 .input_mux = &alc882_capture_source,
8808 .unsol_event = alc882_targa_unsol_event,
8809 .init_hook = alc882_targa_init_hook,
8811 [ALC882_ASUS_A7J] = {
8812 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
8813 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8814 alc882_asus_a7j_verbs},
8815 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8816 .dac_nids = alc882_dac_nids,
8817 .dig_out_nid = ALC882_DIGOUT_NID,
8818 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8819 .adc_nids = alc882_adc_nids,
8820 .capsrc_nids = alc882_capsrc_nids,
8821 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8822 .channel_mode = alc882_3ST_6ch_modes,
8824 .input_mux = &alc882_capture_source,
8826 [ALC882_ASUS_A7M] = {
8827 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
8828 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8829 alc882_eapd_verbs, alc880_gpio1_init_verbs,
8830 alc882_asus_a7m_verbs },
8831 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8832 .dac_nids = alc882_dac_nids,
8833 .dig_out_nid = ALC882_DIGOUT_NID,
8834 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8835 .channel_mode = alc880_threestack_modes,
8837 .input_mux = &alc882_capture_source,
8839 [ALC883_3ST_2ch_DIG] = {
8840 .mixers = { alc883_3ST_2ch_mixer },
8841 .init_verbs = { alc883_init_verbs },
8842 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8843 .dac_nids = alc883_dac_nids,
8844 .dig_out_nid = ALC883_DIGOUT_NID,
8845 .dig_in_nid = ALC883_DIGIN_NID,
8846 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8847 .channel_mode = alc883_3ST_2ch_modes,
8848 .input_mux = &alc883_capture_source,
8850 [ALC883_3ST_6ch_DIG] = {
8851 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8852 .init_verbs = { alc883_init_verbs },
8853 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8854 .dac_nids = alc883_dac_nids,
8855 .dig_out_nid = ALC883_DIGOUT_NID,
8856 .dig_in_nid = ALC883_DIGIN_NID,
8857 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8858 .channel_mode = alc883_3ST_6ch_modes,
8860 .input_mux = &alc883_capture_source,
8862 [ALC883_3ST_6ch] = {
8863 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8864 .init_verbs = { alc883_init_verbs },
8865 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8866 .dac_nids = alc883_dac_nids,
8867 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8868 .channel_mode = alc883_3ST_6ch_modes,
8870 .input_mux = &alc883_capture_source,
8872 [ALC883_3ST_6ch_INTEL] = {
8873 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8874 .init_verbs = { alc883_init_verbs },
8875 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8876 .dac_nids = alc883_dac_nids,
8877 .dig_out_nid = ALC883_DIGOUT_NID,
8878 .dig_in_nid = ALC883_DIGIN_NID,
8879 .slave_dig_outs = alc883_slave_dig_outs,
8880 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8881 .channel_mode = alc883_3ST_6ch_intel_modes,
8883 .input_mux = &alc883_3stack_6ch_intel,
8886 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
8887 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
8888 alc_hp15_unsol_verbs },
8889 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8890 .dac_nids = alc883_dac_nids,
8891 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
8892 .adc_nids = alc889_adc_nids,
8893 .dig_out_nid = ALC883_DIGOUT_NID,
8894 .dig_in_nid = ALC883_DIGIN_NID,
8895 .slave_dig_outs = alc883_slave_dig_outs,
8896 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
8897 .channel_mode = alc889_8ch_intel_modes,
8898 .capsrc_nids = alc889_capsrc_nids,
8899 .input_mux = &alc889_capture_source,
8900 .init_hook = alc889_automute_init,
8901 .unsol_event = alc_automute_amp_unsol_event,
8905 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
8906 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
8907 alc889_eapd_verbs, alc_hp15_unsol_verbs},
8908 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8909 .dac_nids = alc883_dac_nids,
8910 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
8911 .adc_nids = alc889_adc_nids,
8912 .dig_out_nid = ALC883_DIGOUT_NID,
8913 .dig_in_nid = ALC883_DIGIN_NID,
8914 .slave_dig_outs = alc883_slave_dig_outs,
8915 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
8916 .channel_mode = alc889_8ch_intel_modes,
8917 .capsrc_nids = alc889_capsrc_nids,
8918 .input_mux = &alc889_capture_source,
8919 .init_hook = alc889_intel_init_hook,
8920 .unsol_event = alc_automute_amp_unsol_event,
8923 [ALC883_6ST_DIG] = {
8924 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8925 .init_verbs = { alc883_init_verbs },
8926 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8927 .dac_nids = alc883_dac_nids,
8928 .dig_out_nid = ALC883_DIGOUT_NID,
8929 .dig_in_nid = ALC883_DIGIN_NID,
8930 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8931 .channel_mode = alc883_sixstack_modes,
8932 .input_mux = &alc883_capture_source,
8934 [ALC883_TARGA_DIG] = {
8935 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
8936 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
8937 alc883_targa_verbs},
8938 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8939 .dac_nids = alc883_dac_nids,
8940 .dig_out_nid = ALC883_DIGOUT_NID,
8941 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8942 .channel_mode = alc883_3ST_6ch_modes,
8944 .input_mux = &alc883_capture_source,
8945 .unsol_event = alc883_targa_unsol_event,
8946 .init_hook = alc883_targa_init_hook,
8948 [ALC883_TARGA_2ch_DIG] = {
8949 .mixers = { alc883_targa_2ch_mixer},
8950 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
8951 alc883_targa_verbs},
8952 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8953 .dac_nids = alc883_dac_nids,
8954 .adc_nids = alc883_adc_nids_alt,
8955 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8956 .dig_out_nid = ALC883_DIGOUT_NID,
8957 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8958 .channel_mode = alc883_3ST_2ch_modes,
8959 .input_mux = &alc883_capture_source,
8960 .unsol_event = alc883_targa_unsol_event,
8961 .init_hook = alc883_targa_init_hook,
8963 [ALC883_TARGA_8ch_DIG] = {
8964 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8965 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
8966 alc883_targa_verbs },
8967 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8968 .dac_nids = alc883_dac_nids,
8969 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8970 .adc_nids = alc883_adc_nids_rev,
8971 .capsrc_nids = alc883_capsrc_nids_rev,
8972 .dig_out_nid = ALC883_DIGOUT_NID,
8973 .dig_in_nid = ALC883_DIGIN_NID,
8974 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
8975 .channel_mode = alc883_4ST_8ch_modes,
8977 .input_mux = &alc883_capture_source,
8978 .unsol_event = alc883_targa_unsol_event,
8979 .init_hook = alc883_targa_init_hook,
8982 .mixers = { alc883_base_mixer },
8983 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8984 * and the headphone jack. Turn this on and rely on the
8985 * standard mute methods whenever the user wants to turn
8986 * these outputs off.
8988 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8989 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8990 .dac_nids = alc883_dac_nids,
8991 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8992 .channel_mode = alc883_3ST_2ch_modes,
8993 .input_mux = &alc883_capture_source,
8995 [ALC883_ACER_ASPIRE] = {
8996 .mixers = { alc883_acer_aspire_mixer },
8997 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8998 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8999 .dac_nids = alc883_dac_nids,
9000 .dig_out_nid = ALC883_DIGOUT_NID,
9001 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9002 .channel_mode = alc883_3ST_2ch_modes,
9003 .input_mux = &alc883_capture_source,
9004 .unsol_event = alc_automute_amp_unsol_event,
9005 .init_hook = alc883_acer_aspire_init_hook,
9007 [ALC888_ACER_ASPIRE_4930G] = {
9008 .mixers = { alc888_base_mixer,
9009 alc883_chmode_mixer },
9010 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9011 alc888_acer_aspire_4930g_verbs },
9012 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9013 .dac_nids = alc883_dac_nids,
9014 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9015 .adc_nids = alc883_adc_nids_rev,
9016 .capsrc_nids = alc883_capsrc_nids_rev,
9017 .dig_out_nid = ALC883_DIGOUT_NID,
9018 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9019 .channel_mode = alc883_3ST_6ch_modes,
9022 ARRAY_SIZE(alc888_2_capture_sources),
9023 .input_mux = alc888_2_capture_sources,
9024 .unsol_event = alc_automute_amp_unsol_event,
9025 .init_hook = alc888_acer_aspire_4930g_init_hook,
9027 [ALC888_ACER_ASPIRE_6530G] = {
9028 .mixers = { alc888_acer_aspire_6530_mixer },
9029 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9030 alc888_acer_aspire_6530g_verbs },
9031 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9032 .dac_nids = alc883_dac_nids,
9033 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9034 .adc_nids = alc883_adc_nids_rev,
9035 .capsrc_nids = alc883_capsrc_nids_rev,
9036 .dig_out_nid = ALC883_DIGOUT_NID,
9037 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9038 .channel_mode = alc883_3ST_2ch_modes,
9040 ARRAY_SIZE(alc888_2_capture_sources),
9041 .input_mux = alc888_acer_aspire_6530_sources,
9042 .unsol_event = alc_automute_amp_unsol_event,
9043 .init_hook = alc888_acer_aspire_6530g_init_hook,
9045 [ALC888_ACER_ASPIRE_8930G] = {
9046 .mixers = { alc888_base_mixer,
9047 alc883_chmode_mixer },
9048 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9049 alc889_acer_aspire_8930g_verbs },
9050 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9051 .dac_nids = alc883_dac_nids,
9052 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9053 .adc_nids = alc889_adc_nids,
9054 .capsrc_nids = alc889_capsrc_nids,
9055 .dig_out_nid = ALC883_DIGOUT_NID,
9056 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9057 .channel_mode = alc883_3ST_6ch_modes,
9059 .const_channel_count = 6,
9061 ARRAY_SIZE(alc889_capture_sources),
9062 .input_mux = alc889_capture_sources,
9063 .unsol_event = alc_automute_amp_unsol_event,
9064 .init_hook = alc889_acer_aspire_8930g_init_hook,
9067 .mixers = { alc883_fivestack_mixer,
9068 alc883_chmode_mixer },
9069 .init_verbs = { alc883_init_verbs,
9070 alc883_medion_eapd_verbs },
9071 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9072 .dac_nids = alc883_dac_nids,
9073 .adc_nids = alc883_adc_nids_alt,
9074 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9075 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9076 .channel_mode = alc883_sixstack_modes,
9077 .input_mux = &alc883_capture_source,
9079 [ALC883_MEDION_MD2] = {
9080 .mixers = { alc883_medion_md2_mixer},
9081 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9082 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9083 .dac_nids = alc883_dac_nids,
9084 .dig_out_nid = ALC883_DIGOUT_NID,
9085 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9086 .channel_mode = alc883_3ST_2ch_modes,
9087 .input_mux = &alc883_capture_source,
9088 .unsol_event = alc_automute_amp_unsol_event,
9089 .init_hook = alc883_medion_md2_init_hook,
9091 [ALC883_LAPTOP_EAPD] = {
9092 .mixers = { alc883_base_mixer },
9093 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9094 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9095 .dac_nids = alc883_dac_nids,
9096 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9097 .channel_mode = alc883_3ST_2ch_modes,
9098 .input_mux = &alc883_capture_source,
9100 [ALC883_CLEVO_M720] = {
9101 .mixers = { alc883_clevo_m720_mixer },
9102 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9103 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9104 .dac_nids = alc883_dac_nids,
9105 .dig_out_nid = ALC883_DIGOUT_NID,
9106 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9107 .channel_mode = alc883_3ST_2ch_modes,
9108 .input_mux = &alc883_capture_source,
9109 .unsol_event = alc883_clevo_m720_unsol_event,
9110 .init_hook = alc883_clevo_m720_init_hook,
9112 [ALC883_LENOVO_101E_2ch] = {
9113 .mixers = { alc883_lenovo_101e_2ch_mixer},
9114 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9115 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9116 .dac_nids = alc883_dac_nids,
9117 .adc_nids = alc883_adc_nids_alt,
9118 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9119 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9120 .channel_mode = alc883_3ST_2ch_modes,
9121 .input_mux = &alc883_lenovo_101e_capture_source,
9122 .unsol_event = alc883_lenovo_101e_unsol_event,
9123 .init_hook = alc883_lenovo_101e_all_automute,
9125 [ALC883_LENOVO_NB0763] = {
9126 .mixers = { alc883_lenovo_nb0763_mixer },
9127 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9128 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9129 .dac_nids = alc883_dac_nids,
9130 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9131 .channel_mode = alc883_3ST_2ch_modes,
9133 .input_mux = &alc883_lenovo_nb0763_capture_source,
9134 .unsol_event = alc_automute_amp_unsol_event,
9135 .init_hook = alc883_medion_md2_init_hook,
9137 [ALC888_LENOVO_MS7195_DIG] = {
9138 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9139 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9140 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9141 .dac_nids = alc883_dac_nids,
9142 .dig_out_nid = ALC883_DIGOUT_NID,
9143 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9144 .channel_mode = alc883_3ST_6ch_modes,
9146 .input_mux = &alc883_capture_source,
9147 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9148 .init_hook = alc888_lenovo_ms7195_front_automute,
9150 [ALC883_HAIER_W66] = {
9151 .mixers = { alc883_targa_2ch_mixer},
9152 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9153 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9154 .dac_nids = alc883_dac_nids,
9155 .dig_out_nid = ALC883_DIGOUT_NID,
9156 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9157 .channel_mode = alc883_3ST_2ch_modes,
9158 .input_mux = &alc883_capture_source,
9159 .unsol_event = alc_automute_amp_unsol_event,
9160 .init_hook = alc883_haier_w66_init_hook,
9163 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9164 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9165 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9166 .dac_nids = alc883_dac_nids,
9167 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9168 .channel_mode = alc888_3st_hp_modes,
9170 .input_mux = &alc883_capture_source,
9171 .unsol_event = alc_automute_amp_unsol_event,
9172 .init_hook = alc888_3st_hp_init_hook,
9174 [ALC888_6ST_DELL] = {
9175 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9176 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9177 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9178 .dac_nids = alc883_dac_nids,
9179 .dig_out_nid = ALC883_DIGOUT_NID,
9180 .dig_in_nid = ALC883_DIGIN_NID,
9181 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9182 .channel_mode = alc883_sixstack_modes,
9183 .input_mux = &alc883_capture_source,
9184 .unsol_event = alc_automute_amp_unsol_event,
9185 .init_hook = alc888_6st_dell_init_hook,
9188 .mixers = { alc883_mitac_mixer },
9189 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9190 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9191 .dac_nids = alc883_dac_nids,
9192 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9193 .channel_mode = alc883_3ST_2ch_modes,
9194 .input_mux = &alc883_capture_source,
9195 .unsol_event = alc_automute_amp_unsol_event,
9196 .init_hook = alc883_mitac_init_hook,
9198 [ALC883_FUJITSU_PI2515] = {
9199 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9200 .init_verbs = { alc883_init_verbs,
9201 alc883_2ch_fujitsu_pi2515_verbs},
9202 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9203 .dac_nids = alc883_dac_nids,
9204 .dig_out_nid = ALC883_DIGOUT_NID,
9205 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9206 .channel_mode = alc883_3ST_2ch_modes,
9207 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9208 .unsol_event = alc_automute_amp_unsol_event,
9209 .init_hook = alc883_2ch_fujitsu_pi2515_init_hook,
9211 [ALC888_FUJITSU_XA3530] = {
9212 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9213 .init_verbs = { alc883_init_verbs,
9214 alc888_fujitsu_xa3530_verbs },
9215 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9216 .dac_nids = alc883_dac_nids,
9217 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9218 .adc_nids = alc883_adc_nids_rev,
9219 .capsrc_nids = alc883_capsrc_nids_rev,
9220 .dig_out_nid = ALC883_DIGOUT_NID,
9221 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9222 .channel_mode = alc888_4ST_8ch_intel_modes,
9224 ARRAY_SIZE(alc888_2_capture_sources),
9225 .input_mux = alc888_2_capture_sources,
9226 .unsol_event = alc_automute_amp_unsol_event,
9227 .init_hook = alc888_fujitsu_xa3530_init_hook,
9229 [ALC888_LENOVO_SKY] = {
9230 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9231 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9232 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9233 .dac_nids = alc883_dac_nids,
9234 .dig_out_nid = ALC883_DIGOUT_NID,
9235 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9236 .channel_mode = alc883_sixstack_modes,
9238 .input_mux = &alc883_lenovo_sky_capture_source,
9239 .unsol_event = alc_automute_amp_unsol_event,
9240 .init_hook = alc888_lenovo_sky_init_hook,
9242 [ALC888_ASUS_M90V] = {
9243 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9244 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9245 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9246 .dac_nids = alc883_dac_nids,
9247 .dig_out_nid = ALC883_DIGOUT_NID,
9248 .dig_in_nid = ALC883_DIGIN_NID,
9249 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9250 .channel_mode = alc883_3ST_6ch_modes,
9252 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9253 .unsol_event = alc883_mode2_unsol_event,
9254 .init_hook = alc883_mode2_inithook,
9256 [ALC888_ASUS_EEE1601] = {
9257 .mixers = { alc883_asus_eee1601_mixer },
9258 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9259 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9260 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9261 .dac_nids = alc883_dac_nids,
9262 .dig_out_nid = ALC883_DIGOUT_NID,
9263 .dig_in_nid = ALC883_DIGIN_NID,
9264 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9265 .channel_mode = alc883_3ST_2ch_modes,
9267 .input_mux = &alc883_asus_eee1601_capture_source,
9268 .unsol_event = alc_sku_unsol_event,
9269 .init_hook = alc883_eee1601_inithook,
9271 [ALC1200_ASUS_P5Q] = {
9272 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9273 .init_verbs = { alc883_init_verbs },
9274 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9275 .dac_nids = alc883_dac_nids,
9276 .dig_out_nid = ALC1200_DIGOUT_NID,
9277 .dig_in_nid = ALC883_DIGIN_NID,
9278 .slave_dig_outs = alc1200_slave_dig_outs,
9279 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9280 .channel_mode = alc883_sixstack_modes,
9281 .input_mux = &alc883_capture_source,
9284 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9285 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9286 alc880_gpio1_init_verbs },
9287 .adc_nids = alc883_adc_nids,
9288 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9289 .dac_nids = alc883_dac_nids,
9290 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9291 .channel_mode = alc889A_mb31_6ch_modes,
9292 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9293 .input_mux = &alc889A_mb31_capture_source,
9294 .dig_out_nid = ALC883_DIGOUT_NID,
9295 .unsol_event = alc889A_mb31_unsol_event,
9296 .init_hook = alc889A_mb31_automute,
9298 [ALC883_SONY_VAIO_TT] = {
9299 .mixers = { alc883_vaiott_mixer },
9300 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9301 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9302 .dac_nids = alc883_dac_nids,
9303 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9304 .channel_mode = alc883_3ST_2ch_modes,
9305 .input_mux = &alc883_capture_source,
9306 .unsol_event = alc_automute_amp_unsol_event,
9307 .init_hook = alc883_vaiott_init_hook,
9316 PINFIX_ABIT_AW9D_MAX
9319 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9320 { 0x15, 0x01080104 }, /* side */
9321 { 0x16, 0x01011012 }, /* rear */
9322 { 0x17, 0x01016011 }, /* clfe */
9326 static const struct alc_pincfg *alc882_pin_fixes[] = {
9327 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
9330 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
9331 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9336 * BIOS auto configuration
9338 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9339 hda_nid_t nid, int pin_type,
9343 struct alc_spec *spec = codec->spec;
9346 alc_set_pin_output(codec, nid, pin_type);
9347 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9350 idx = spec->multiout.dac_nids[dac_idx] - 2;
9351 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9355 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9357 struct alc_spec *spec = codec->spec;
9360 for (i = 0; i <= HDA_SIDE; i++) {
9361 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9362 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9364 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9369 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9371 struct alc_spec *spec = codec->spec;
9374 pin = spec->autocfg.hp_pins[0];
9375 if (pin) /* connect to front */
9377 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9378 pin = spec->autocfg.speaker_pins[0];
9380 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9383 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9385 struct alc_spec *spec = codec->spec;
9388 for (i = 0; i < AUTO_PIN_LAST; i++) {
9389 hda_nid_t nid = spec->autocfg.input_pins[i];
9392 alc_set_input_pin(codec, nid, i);
9393 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9394 snd_hda_codec_write(codec, nid, 0,
9395 AC_VERB_SET_AMP_GAIN_MUTE,
9400 static void alc882_auto_init_input_src(struct hda_codec *codec)
9402 struct alc_spec *spec = codec->spec;
9405 for (c = 0; c < spec->num_adc_nids; c++) {
9406 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9407 hda_nid_t nid = spec->capsrc_nids[c];
9408 unsigned int mux_idx;
9409 const struct hda_input_mux *imux;
9410 int conns, mute, idx, item;
9412 conns = snd_hda_get_connections(codec, nid, conn_list,
9413 ARRAY_SIZE(conn_list));
9416 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9417 imux = &spec->input_mux[mux_idx];
9418 for (idx = 0; idx < conns; idx++) {
9419 /* if the current connection is the selected one,
9420 * unmute it as default - otherwise mute it
9422 mute = AMP_IN_MUTE(idx);
9423 for (item = 0; item < imux->num_items; item++) {
9424 if (imux->items[item].index == idx) {
9425 if (spec->cur_mux[c] == item)
9426 mute = AMP_IN_UNMUTE(idx);
9430 /* check if we have a selector or mixer
9431 * we could check for the widget type instead, but
9432 * just check for Amp-In presence (in case of mixer
9433 * without amp-in there is something wrong, this
9434 * function shouldn't be used or capsrc nid is wrong)
9436 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9437 snd_hda_codec_write(codec, nid, 0,
9438 AC_VERB_SET_AMP_GAIN_MUTE,
9440 else if (mute != AMP_IN_MUTE(idx))
9441 snd_hda_codec_write(codec, nid, 0,
9442 AC_VERB_SET_CONNECT_SEL,
9448 /* add mic boosts if needed */
9449 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9451 struct alc_spec *spec = codec->spec;
9455 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9456 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9457 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9459 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9463 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9464 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9465 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9467 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9474 /* almost identical with ALC880 parser... */
9475 static int alc882_parse_auto_config(struct hda_codec *codec)
9477 struct alc_spec *spec = codec->spec;
9478 struct auto_pin_cfg *autocfg = &spec->autocfg;
9481 int err = alc880_parse_auto_config(codec);
9486 return 0; /* no config found */
9488 err = alc_auto_add_mic_boost(codec);
9492 /* hack - override the init verbs */
9493 spec->init_verbs[0] = alc883_auto_init_verbs;
9494 /* if ADC 0x07 is available, initialize it, too */
9495 wcap = get_wcaps(codec, 0x07);
9496 wcap = get_wcaps_type(wcap);
9497 if (wcap == AC_WID_AUD_IN)
9498 add_verb(spec, alc882_adc1_init_verbs);
9500 /* digital-mic input pin is excluded in alc880_auto_create..()
9501 * because it's under 0x18
9503 if (autocfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9504 autocfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9505 struct hda_input_mux *imux = &spec->private_imux[0];
9506 for (i = 1; i < 3; i++)
9507 memcpy(&spec->private_imux[i],
9508 &spec->private_imux[0],
9509 sizeof(spec->private_imux[0]));
9510 imux->items[imux->num_items].label = "Int DMic";
9511 imux->items[imux->num_items].index = 0x0b;
9513 spec->num_mux_defs = 3;
9514 spec->input_mux = spec->private_imux;
9517 return 1; /* config found */
9520 /* additional initialization for auto-configuration model */
9521 static void alc882_auto_init(struct hda_codec *codec)
9523 struct alc_spec *spec = codec->spec;
9524 alc882_auto_init_multi_out(codec);
9525 alc882_auto_init_hp_out(codec);
9526 alc882_auto_init_analog_input(codec);
9527 alc882_auto_init_input_src(codec);
9528 if (spec->unsol_event)
9529 alc_inithook(codec);
9532 static int patch_alc882(struct hda_codec *codec)
9534 struct alc_spec *spec;
9535 int err, board_config;
9537 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9543 switch (codec->vendor_id) {
9548 /* ALC883 and variants */
9549 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9553 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9557 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9558 board_config = snd_hda_check_board_codec_sid_config(codec,
9559 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9561 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9562 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9564 board_config = ALC882_AUTO;
9567 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
9569 if (board_config == ALC882_AUTO) {
9570 /* automatic parse from the BIOS config */
9571 err = alc882_parse_auto_config(codec);
9577 "hda_codec: Cannot set up configuration "
9578 "from BIOS. Using base mode...\n");
9579 board_config = ALC882_3ST_DIG;
9583 err = snd_hda_attach_beep_device(codec, 0x1);
9589 if (board_config != ALC882_AUTO)
9590 setup_preset(spec, &alc882_presets[board_config]);
9592 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9593 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9594 /* FIXME: setup DAC5 */
9595 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9596 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9598 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9599 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9601 if (codec->vendor_id == 0x10ec0888)
9602 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9604 if (!spec->adc_nids && spec->input_mux) {
9606 spec->num_adc_nids = 0;
9607 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9609 hda_nid_t nid = alc882_adc_nids[i];
9610 unsigned int wcap = get_wcaps(codec, nid);
9612 wcap = get_wcaps_type(wcap);
9613 if (wcap != AC_WID_AUD_IN)
9615 spec->private_adc_nids[spec->num_adc_nids] = nid;
9616 err = snd_hda_get_connections(codec, nid, &cap, 1);
9619 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9620 spec->num_adc_nids++;
9622 spec->adc_nids = spec->private_adc_nids;
9623 spec->capsrc_nids = spec->private_capsrc_nids;
9626 set_capture_mixer(spec);
9627 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9629 spec->vmaster_nid = 0x0c;
9631 codec->patch_ops = alc_patch_ops;
9632 if (board_config == ALC882_AUTO)
9633 spec->init_hook = alc882_auto_init;
9634 #ifdef CONFIG_SND_HDA_POWER_SAVE
9635 if (!spec->loopback.amplist)
9636 spec->loopback.amplist = alc882_loopbacks;
9638 codec->proc_widget_hook = print_realtek_coef;
9648 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9649 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9651 #define alc262_dac_nids alc260_dac_nids
9652 #define alc262_adc_nids alc882_adc_nids
9653 #define alc262_adc_nids_alt alc882_adc_nids_alt
9654 #define alc262_capsrc_nids alc882_capsrc_nids
9655 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9657 #define alc262_modes alc260_modes
9658 #define alc262_capture_source alc882_capture_source
9660 static hda_nid_t alc262_dmic_adc_nids[1] = {
9665 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9667 static struct snd_kcontrol_new alc262_base_mixer[] = {
9668 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9669 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9670 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9671 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9672 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9673 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9674 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9675 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9676 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9677 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9678 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9679 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9680 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9681 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9682 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9683 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9687 /* update HP, line and mono-out pins according to the master switch */
9688 static void alc262_hp_master_update(struct hda_codec *codec)
9690 struct alc_spec *spec = codec->spec;
9691 int val = spec->master_sw;
9694 snd_hda_codec_write_cache(codec, 0x1b, 0,
9695 AC_VERB_SET_PIN_WIDGET_CONTROL,
9697 snd_hda_codec_write_cache(codec, 0x15, 0,
9698 AC_VERB_SET_PIN_WIDGET_CONTROL,
9700 /* mono (speaker) depending on the HP jack sense */
9701 val = val && !spec->jack_present;
9702 snd_hda_codec_write_cache(codec, 0x16, 0,
9703 AC_VERB_SET_PIN_WIDGET_CONTROL,
9707 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9709 struct alc_spec *spec = codec->spec;
9710 unsigned int presence;
9711 presence = snd_hda_codec_read(codec, 0x1b, 0,
9712 AC_VERB_GET_PIN_SENSE, 0);
9713 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9714 alc262_hp_master_update(codec);
9717 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9719 if ((res >> 26) != ALC880_HP_EVENT)
9721 alc262_hp_bpc_automute(codec);
9724 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9726 struct alc_spec *spec = codec->spec;
9727 unsigned int presence;
9728 presence = snd_hda_codec_read(codec, 0x15, 0,
9729 AC_VERB_GET_PIN_SENSE, 0);
9730 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9731 alc262_hp_master_update(codec);
9734 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9737 if ((res >> 26) != ALC880_HP_EVENT)
9739 alc262_hp_wildwest_automute(codec);
9742 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9744 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9745 struct snd_ctl_elem_value *ucontrol)
9747 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9748 struct alc_spec *spec = codec->spec;
9749 int val = !!*ucontrol->value.integer.value;
9751 if (val == spec->master_sw)
9753 spec->master_sw = val;
9754 alc262_hp_master_update(codec);
9758 #define ALC262_HP_MASTER_SWITCH \
9760 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9761 .name = "Master Playback Switch", \
9762 .info = snd_ctl_boolean_mono_info, \
9763 .get = alc262_hp_master_sw_get, \
9764 .put = alc262_hp_master_sw_put, \
9767 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9768 ALC262_HP_MASTER_SWITCH,
9769 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9770 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9771 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9772 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9774 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9776 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9777 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9778 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9779 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9780 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9781 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9782 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9783 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9784 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9785 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9786 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9787 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9791 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9792 ALC262_HP_MASTER_SWITCH,
9793 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9794 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9795 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9796 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9797 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9799 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9801 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9802 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9803 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9804 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9805 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9806 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9807 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9811 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9812 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9813 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9814 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9818 /* mute/unmute internal speaker according to the hp jack and mute state */
9819 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9821 struct alc_spec *spec = codec->spec;
9823 spec->autocfg.hp_pins[0] = 0x15;
9824 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9825 alc_automute_amp(codec);
9828 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9829 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9830 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9831 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9832 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9833 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9835 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9839 static struct hda_verb alc262_hp_t5735_verbs[] = {
9840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9841 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9843 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9847 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9848 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9849 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9850 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9851 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9852 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9853 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9857 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9858 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9859 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9860 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9861 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9862 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9863 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9864 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9865 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9866 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9867 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9871 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9878 /* bind hp and internal speaker mute (with plug check) as master switch */
9879 static void alc262_hippo_master_update(struct hda_codec *codec)
9881 struct alc_spec *spec = codec->spec;
9882 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9883 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9884 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9888 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
9889 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
9890 HDA_AMP_MUTE, mute);
9891 /* mute internal speaker per jack sense */
9892 if (spec->jack_present)
9893 mute = HDA_AMP_MUTE;
9895 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
9896 HDA_AMP_MUTE, mute);
9897 if (speaker_nid && speaker_nid != line_nid)
9898 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
9899 HDA_AMP_MUTE, mute);
9902 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
9904 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
9905 struct snd_ctl_elem_value *ucontrol)
9907 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9908 struct alc_spec *spec = codec->spec;
9909 int val = !!*ucontrol->value.integer.value;
9911 if (val == spec->master_sw)
9913 spec->master_sw = val;
9914 alc262_hippo_master_update(codec);
9918 #define ALC262_HIPPO_MASTER_SWITCH \
9920 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9921 .name = "Master Playback Switch", \
9922 .info = snd_ctl_boolean_mono_info, \
9923 .get = alc262_hippo_master_sw_get, \
9924 .put = alc262_hippo_master_sw_put, \
9927 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
9928 ALC262_HIPPO_MASTER_SWITCH,
9929 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9930 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9931 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9932 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9933 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9934 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9935 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9936 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9937 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9938 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9939 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9940 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9944 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9945 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9946 ALC262_HIPPO_MASTER_SWITCH,
9947 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9948 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9949 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9950 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9951 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9952 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9953 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9954 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9955 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9956 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9960 /* mute/unmute internal speaker according to the hp jack and mute state */
9961 static void alc262_hippo_automute(struct hda_codec *codec)
9963 struct alc_spec *spec = codec->spec;
9964 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9965 unsigned int present;
9967 /* need to execute and sync at first */
9968 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
9969 present = snd_hda_codec_read(codec, hp_nid, 0,
9970 AC_VERB_GET_PIN_SENSE, 0);
9971 spec->jack_present = (present & 0x80000000) != 0;
9972 alc262_hippo_master_update(codec);
9975 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
9977 if ((res >> 26) != ALC880_HP_EVENT)
9979 alc262_hippo_automute(codec);
9982 static void alc262_hippo_init_hook(struct hda_codec *codec)
9984 struct alc_spec *spec = codec->spec;
9986 spec->autocfg.hp_pins[0] = 0x15;
9987 spec->autocfg.speaker_pins[0] = 0x14;
9988 alc262_hippo_automute(codec);
9991 static void alc262_hippo1_init_hook(struct hda_codec *codec)
9993 struct alc_spec *spec = codec->spec;
9995 spec->autocfg.hp_pins[0] = 0x1b;
9996 spec->autocfg.speaker_pins[0] = 0x14;
9997 alc262_hippo_automute(codec);
10001 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10002 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10003 ALC262_HIPPO_MASTER_SWITCH,
10004 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10005 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10006 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10007 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10011 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10012 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10013 ALC262_HIPPO_MASTER_SWITCH,
10014 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10015 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10016 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10017 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10018 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10022 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10023 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10024 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10025 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10026 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10027 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10028 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10029 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10030 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10031 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10032 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10033 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10034 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10038 static struct hda_verb alc262_tyan_verbs[] = {
10039 /* Headphone automute */
10040 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10041 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10042 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10044 /* P11 AUX_IN, white 4-pin connector */
10045 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10046 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10047 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10048 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10053 /* unsolicited event for HP jack sensing */
10054 static void alc262_tyan_init_hook(struct hda_codec *codec)
10056 struct alc_spec *spec = codec->spec;
10058 spec->autocfg.hp_pins[0] = 0x1b;
10059 spec->autocfg.speaker_pins[0] = 0x15;
10060 alc_automute_amp(codec);
10064 #define alc262_capture_mixer alc882_capture_mixer
10065 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10068 * generic initialization of ADC, input mixers and output mixers
10070 static struct hda_verb alc262_init_verbs[] = {
10072 * Unmute ADC0-2 and set the default input to mic-in
10074 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10075 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10076 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10077 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10078 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10079 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10081 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10083 * Note: PASD motherboards uses the Line In 2 as the input for
10084 * front panel mic (mic 2)
10086 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10088 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10089 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10090 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10091 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10094 * Set up output mixers (0x0c - 0x0e)
10096 /* set vol=0 to output mixers */
10097 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10098 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10099 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10100 /* set up input amps for analog loopback */
10101 /* Amp Indices: DAC = 0, mixer = 1 */
10102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10103 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10104 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10105 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10106 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10107 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10109 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10110 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10111 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10112 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10113 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10114 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10116 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10117 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10118 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10119 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10120 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10122 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10123 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10125 /* FIXME: use matrix-type input source selection */
10126 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10127 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10128 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10129 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10130 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10131 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10133 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10134 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10135 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10136 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10138 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10139 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10140 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10141 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10146 static struct hda_verb alc262_eapd_verbs[] = {
10147 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10148 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10152 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10153 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10154 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10155 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10157 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10158 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10162 static struct hda_verb alc262_sony_unsol_verbs[] = {
10163 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10164 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10165 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10167 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10168 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10172 static struct hda_input_mux alc262_dmic_capture_source = {
10175 { "Int DMic", 0x9 },
10180 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10181 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10182 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10184 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10185 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10189 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10190 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10191 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10192 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10193 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10194 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10195 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10196 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10197 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10201 static void alc262_dmic_automute(struct hda_codec *codec)
10203 unsigned int present;
10205 present = snd_hda_codec_read(codec, 0x18, 0,
10206 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10207 snd_hda_codec_write(codec, 0x22, 0,
10208 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
10212 /* unsolicited event for HP jack sensing */
10213 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
10216 if ((res >> 26) == ALC880_MIC_EVENT)
10217 alc262_dmic_automute(codec);
10219 alc_sku_unsol_event(codec, res);
10222 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
10224 struct alc_spec *spec = codec->spec;
10226 spec->autocfg.hp_pins[0] = 0x15;
10227 spec->autocfg.speaker_pins[0] = 0x14;
10228 alc_automute_pin(codec);
10229 alc262_dmic_automute(codec);
10235 * 0x16 = internal speaker
10236 * 0x18 = external mic
10239 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10240 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10241 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10243 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10244 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10245 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10247 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10248 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10252 static struct hda_verb alc262_nec_verbs[] = {
10253 /* Unmute Speaker */
10254 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10257 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10258 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10260 /* External mic to headphone */
10261 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10262 /* External mic to speaker */
10263 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10269 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10270 * 0x1b = port replicator headphone out
10273 #define ALC_HP_EVENT 0x37
10275 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10276 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10277 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10278 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10279 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10283 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10284 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10285 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10289 static struct hda_input_mux alc262_fujitsu_capture_source = {
10293 { "Int Mic", 0x1 },
10298 static struct hda_input_mux alc262_HP_capture_source = {
10302 { "Front Mic", 0x1 },
10309 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10313 { "Front Mic", 0x2 },
10319 /* mute/unmute internal speaker according to the hp jacks and mute state */
10320 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10322 struct alc_spec *spec = codec->spec;
10325 if (force || !spec->sense_updated) {
10326 unsigned int present;
10327 /* need to execute and sync at first */
10328 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10329 /* check laptop HP jack */
10330 present = snd_hda_codec_read(codec, 0x14, 0,
10331 AC_VERB_GET_PIN_SENSE, 0);
10332 /* need to execute and sync at first */
10333 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10334 /* check docking HP jack */
10335 present |= snd_hda_codec_read(codec, 0x1b, 0,
10336 AC_VERB_GET_PIN_SENSE, 0);
10337 if (present & AC_PINSENSE_PRESENCE)
10338 spec->jack_present = 1;
10340 spec->jack_present = 0;
10341 spec->sense_updated = 1;
10343 /* unmute internal speaker only if both HPs are unplugged and
10344 * master switch is on
10346 if (spec->jack_present)
10347 mute = HDA_AMP_MUTE;
10349 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10350 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10351 HDA_AMP_MUTE, mute);
10354 /* unsolicited event for HP jack sensing */
10355 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10358 if ((res >> 26) != ALC_HP_EVENT)
10360 alc262_fujitsu_automute(codec, 1);
10363 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10365 alc262_fujitsu_automute(codec, 1);
10368 /* bind volumes of both NID 0x0c and 0x0d */
10369 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10370 .ops = &snd_hda_bind_vol,
10372 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10373 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10378 /* mute/unmute internal speaker according to the hp jack and mute state */
10379 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10381 struct alc_spec *spec = codec->spec;
10384 if (force || !spec->sense_updated) {
10385 unsigned int present_int_hp;
10386 /* need to execute and sync at first */
10387 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10388 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10389 AC_VERB_GET_PIN_SENSE, 0);
10390 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10391 spec->sense_updated = 1;
10393 if (spec->jack_present) {
10394 /* mute internal speaker */
10395 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10396 HDA_AMP_MUTE, HDA_AMP_MUTE);
10397 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10398 HDA_AMP_MUTE, HDA_AMP_MUTE);
10400 /* unmute internal speaker if necessary */
10401 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10402 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10403 HDA_AMP_MUTE, mute);
10404 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10405 HDA_AMP_MUTE, mute);
10409 /* unsolicited event for HP jack sensing */
10410 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10413 if ((res >> 26) != ALC_HP_EVENT)
10415 alc262_lenovo_3000_automute(codec, 1);
10418 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10419 int dir, int idx, long *valp)
10423 for (i = 0; i < 2; i++, valp++)
10424 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10426 *valp ? 0 : HDA_AMP_MUTE);
10430 /* bind hp and internal speaker mute (with plug check) */
10431 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10432 struct snd_ctl_elem_value *ucontrol)
10434 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10435 long *valp = ucontrol->value.integer.value;
10438 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10439 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10441 alc262_fujitsu_automute(codec, 0);
10445 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10446 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10448 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10449 .name = "Master Playback Switch",
10450 .info = snd_hda_mixer_amp_switch_info,
10451 .get = snd_hda_mixer_amp_switch_get,
10452 .put = alc262_fujitsu_master_sw_put,
10453 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10455 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10456 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10457 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10458 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10459 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10460 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10461 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10462 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10466 /* bind hp and internal speaker mute (with plug check) */
10467 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10468 struct snd_ctl_elem_value *ucontrol)
10470 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10471 long *valp = ucontrol->value.integer.value;
10474 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10476 alc262_lenovo_3000_automute(codec, 0);
10480 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10481 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10483 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10484 .name = "Master Playback Switch",
10485 .info = snd_hda_mixer_amp_switch_info,
10486 .get = snd_hda_mixer_amp_switch_get,
10487 .put = alc262_lenovo_3000_master_sw_put,
10488 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10490 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10491 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10492 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10493 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10494 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10495 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10496 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10497 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10501 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10502 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10503 ALC262_HIPPO_MASTER_SWITCH,
10504 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10505 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10506 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10507 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10508 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10509 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10513 /* additional init verbs for Benq laptops */
10514 static struct hda_verb alc262_EAPD_verbs[] = {
10515 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10516 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10520 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10521 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10522 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10524 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10525 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10529 /* Samsung Q1 Ultra Vista model setup */
10530 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10531 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10532 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10533 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10534 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10535 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10536 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10540 static struct hda_verb alc262_ultra_verbs[] = {
10542 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10543 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10546 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10548 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10549 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10551 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10552 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10553 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10554 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10555 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10557 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10558 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10559 /* ADC, choose mic */
10560 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10561 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10562 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10563 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10564 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10565 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10566 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10567 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10568 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10569 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10573 /* mute/unmute internal speaker according to the hp jack and mute state */
10574 static void alc262_ultra_automute(struct hda_codec *codec)
10576 struct alc_spec *spec = codec->spec;
10580 /* auto-mute only when HP is used as HP */
10581 if (!spec->cur_mux[0]) {
10582 unsigned int present;
10583 /* need to execute and sync at first */
10584 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10585 present = snd_hda_codec_read(codec, 0x15, 0,
10586 AC_VERB_GET_PIN_SENSE, 0);
10587 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10588 if (spec->jack_present)
10589 mute = HDA_AMP_MUTE;
10591 /* mute/unmute internal speaker */
10592 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10593 HDA_AMP_MUTE, mute);
10594 /* mute/unmute HP */
10595 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10596 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10599 /* unsolicited event for HP jack sensing */
10600 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10603 if ((res >> 26) != ALC880_HP_EVENT)
10605 alc262_ultra_automute(codec);
10608 static struct hda_input_mux alc262_ultra_capture_source = {
10612 { "Headphone", 0x7 },
10616 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10617 struct snd_ctl_elem_value *ucontrol)
10619 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10620 struct alc_spec *spec = codec->spec;
10623 ret = alc_mux_enum_put(kcontrol, ucontrol);
10626 /* reprogram the HP pin as mic or HP according to the input source */
10627 snd_hda_codec_write_cache(codec, 0x15, 0,
10628 AC_VERB_SET_PIN_WIDGET_CONTROL,
10629 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10630 alc262_ultra_automute(codec); /* mute/unmute HP */
10634 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10635 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10636 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10638 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10639 .name = "Capture Source",
10640 .info = alc_mux_enum_info,
10641 .get = alc_mux_enum_get,
10642 .put = alc262_ultra_mux_enum_put,
10647 /* add playback controls from the parsed DAC table */
10648 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10649 const struct auto_pin_cfg *cfg)
10654 spec->multiout.num_dacs = 1; /* only use one dac */
10655 spec->multiout.dac_nids = spec->private_dac_nids;
10656 spec->multiout.dac_nids[0] = 2;
10658 nid = cfg->line_out_pins[0];
10660 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10661 "Front Playback Volume",
10662 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10665 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10666 "Front Playback Switch",
10667 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10672 nid = cfg->speaker_pins[0];
10675 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10676 "Speaker Playback Volume",
10677 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10681 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10682 "Speaker Playback Switch",
10683 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10688 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10689 "Speaker Playback Switch",
10690 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10696 nid = cfg->hp_pins[0];
10698 /* spec->multiout.hp_nid = 2; */
10700 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10701 "Headphone Playback Volume",
10702 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10706 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10707 "Headphone Playback Switch",
10708 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10713 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10714 "Headphone Playback Switch",
10715 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10724 static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec,
10725 const struct auto_pin_cfg *cfg)
10729 err = alc880_auto_create_analog_input_ctls(spec, cfg);
10732 /* digital-mic input pin is excluded in alc880_auto_create..()
10733 * because it's under 0x18
10735 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
10736 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
10737 struct hda_input_mux *imux = &spec->private_imux[0];
10738 imux->items[imux->num_items].label = "Int Mic";
10739 imux->items[imux->num_items].index = 0x09;
10747 * generic initialization of ADC, input mixers and output mixers
10749 static struct hda_verb alc262_volume_init_verbs[] = {
10751 * Unmute ADC0-2 and set the default input to mic-in
10753 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10754 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10755 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10756 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10757 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10758 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10760 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10762 * Note: PASD motherboards uses the Line In 2 as the input for
10763 * front panel mic (mic 2)
10765 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10766 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10767 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10768 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10769 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10770 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10773 * Set up output mixers (0x0c - 0x0f)
10775 /* set vol=0 to output mixers */
10776 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10777 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10778 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10780 /* set up input amps for analog loopback */
10781 /* Amp Indices: DAC = 0, mixer = 1 */
10782 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10783 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10784 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10785 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10786 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10787 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10789 /* FIXME: use matrix-type input source selection */
10790 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10791 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10792 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10793 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10794 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10795 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10797 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10798 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10799 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10800 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10802 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10803 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10804 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10805 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10810 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10812 * Unmute ADC0-2 and set the default input to mic-in
10814 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10815 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10816 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10817 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10818 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10819 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10821 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10823 * Note: PASD motherboards uses the Line In 2 as the input for
10824 * front panel mic (mic 2)
10826 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10827 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10828 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10829 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10830 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10831 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10832 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10836 * Set up output mixers (0x0c - 0x0e)
10838 /* set vol=0 to output mixers */
10839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10840 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10841 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10843 /* set up input amps for analog loopback */
10844 /* Amp Indices: DAC = 0, mixer = 1 */
10845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10846 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10847 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10848 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10849 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10850 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10852 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10854 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10856 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10857 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10859 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10860 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10862 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10863 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10864 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10865 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10866 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10868 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10869 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10870 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10871 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10872 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10873 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10876 /* FIXME: use matrix-type input source selection */
10877 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
10878 /* Input mixer1: only unmute Mic */
10879 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10880 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10881 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10882 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10883 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10884 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10885 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10886 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10887 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10889 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10890 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10891 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10892 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10893 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10894 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10895 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10896 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10897 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10899 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10900 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10901 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10902 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10903 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10904 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10905 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10906 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10907 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10909 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10914 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10916 * Unmute ADC0-2 and set the default input to mic-in
10918 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10920 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10921 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10922 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10923 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10925 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10927 * Note: PASD motherboards uses the Line In 2 as the input for front
10928 * panel mic (mic 2)
10930 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10932 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10936 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10937 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10938 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10940 * Set up output mixers (0x0c - 0x0e)
10942 /* set vol=0 to output mixers */
10943 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10944 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10945 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10947 /* set up input amps for analog loopback */
10948 /* Amp Indices: DAC = 0, mixer = 1 */
10949 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10950 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10951 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10952 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10953 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10954 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10958 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10959 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10960 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10961 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10962 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10963 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10965 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10966 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10968 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10969 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10971 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10972 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10973 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10974 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10975 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10976 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10978 /* FIXME: use matrix-type input source selection */
10979 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10980 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10981 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10982 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10983 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10984 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10985 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10986 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10987 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10989 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10990 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10991 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10992 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10993 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10994 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10995 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10997 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10998 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10999 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11000 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11001 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11002 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11003 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11005 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11010 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11012 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11013 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11014 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11016 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11017 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11018 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11019 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11021 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11022 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11023 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11028 #ifdef CONFIG_SND_HDA_POWER_SAVE
11029 #define alc262_loopbacks alc880_loopbacks
11032 /* pcm configuration: identical with ALC880 */
11033 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11034 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11035 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11036 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11039 * BIOS auto configuration
11041 static int alc262_parse_auto_config(struct hda_codec *codec)
11043 struct alc_spec *spec = codec->spec;
11045 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11047 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11051 if (!spec->autocfg.line_outs) {
11052 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11053 spec->multiout.max_channels = 2;
11054 spec->no_analog = 1;
11057 return 0; /* can't find valid BIOS pin config */
11059 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11062 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
11066 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11069 if (spec->autocfg.dig_outs) {
11070 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11071 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11073 if (spec->autocfg.dig_in_pin)
11074 spec->dig_in_nid = ALC262_DIGIN_NID;
11076 if (spec->kctls.list)
11077 add_mixer(spec, spec->kctls.list);
11079 add_verb(spec, alc262_volume_init_verbs);
11080 spec->num_mux_defs = 1;
11081 spec->input_mux = &spec->private_imux[0];
11083 err = alc_auto_add_mic_boost(codec);
11087 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11092 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11093 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11094 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11095 #define alc262_auto_init_input_src alc882_auto_init_input_src
11098 /* init callback for auto-configuration model -- overriding the default init */
11099 static void alc262_auto_init(struct hda_codec *codec)
11101 struct alc_spec *spec = codec->spec;
11102 alc262_auto_init_multi_out(codec);
11103 alc262_auto_init_hp_out(codec);
11104 alc262_auto_init_analog_input(codec);
11105 alc262_auto_init_input_src(codec);
11106 if (spec->unsol_event)
11107 alc_inithook(codec);
11111 * configuration and preset
11113 static const char *alc262_models[ALC262_MODEL_LAST] = {
11114 [ALC262_BASIC] = "basic",
11115 [ALC262_HIPPO] = "hippo",
11116 [ALC262_HIPPO_1] = "hippo_1",
11117 [ALC262_FUJITSU] = "fujitsu",
11118 [ALC262_HP_BPC] = "hp-bpc",
11119 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11120 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11121 [ALC262_HP_RP5700] = "hp-rp5700",
11122 [ALC262_BENQ_ED8] = "benq",
11123 [ALC262_BENQ_T31] = "benq-t31",
11124 [ALC262_SONY_ASSAMD] = "sony-assamd",
11125 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11126 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11127 [ALC262_ULTRA] = "ultra",
11128 [ALC262_LENOVO_3000] = "lenovo-3000",
11129 [ALC262_NEC] = "nec",
11130 [ALC262_TYAN] = "tyan",
11131 [ALC262_AUTO] = "auto",
11134 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11135 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11136 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11137 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11139 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11141 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11143 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11144 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11145 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11146 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11147 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11148 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11149 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11150 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11151 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11152 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11153 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11154 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11155 ALC262_HP_TC_T5735),
11156 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11157 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11158 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11159 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11160 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11161 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11162 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11163 ALC262_SONY_ASSAMD),
11164 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11165 ALC262_TOSHIBA_RX1),
11166 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11167 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11168 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11169 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11170 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11172 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11173 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11174 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11175 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11176 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11180 static struct alc_config_preset alc262_presets[] = {
11182 .mixers = { alc262_base_mixer },
11183 .init_verbs = { alc262_init_verbs },
11184 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11185 .dac_nids = alc262_dac_nids,
11187 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11188 .channel_mode = alc262_modes,
11189 .input_mux = &alc262_capture_source,
11192 .mixers = { alc262_hippo_mixer },
11193 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11194 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11195 .dac_nids = alc262_dac_nids,
11197 .dig_out_nid = ALC262_DIGOUT_NID,
11198 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11199 .channel_mode = alc262_modes,
11200 .input_mux = &alc262_capture_source,
11201 .unsol_event = alc262_hippo_unsol_event,
11202 .init_hook = alc262_hippo_init_hook,
11204 [ALC262_HIPPO_1] = {
11205 .mixers = { alc262_hippo1_mixer },
11206 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11207 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11208 .dac_nids = alc262_dac_nids,
11210 .dig_out_nid = ALC262_DIGOUT_NID,
11211 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11212 .channel_mode = alc262_modes,
11213 .input_mux = &alc262_capture_source,
11214 .unsol_event = alc262_hippo_unsol_event,
11215 .init_hook = alc262_hippo1_init_hook,
11217 [ALC262_FUJITSU] = {
11218 .mixers = { alc262_fujitsu_mixer },
11219 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11220 alc262_fujitsu_unsol_verbs },
11221 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11222 .dac_nids = alc262_dac_nids,
11224 .dig_out_nid = ALC262_DIGOUT_NID,
11225 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11226 .channel_mode = alc262_modes,
11227 .input_mux = &alc262_fujitsu_capture_source,
11228 .unsol_event = alc262_fujitsu_unsol_event,
11229 .init_hook = alc262_fujitsu_init_hook,
11231 [ALC262_HP_BPC] = {
11232 .mixers = { alc262_HP_BPC_mixer },
11233 .init_verbs = { alc262_HP_BPC_init_verbs },
11234 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11235 .dac_nids = alc262_dac_nids,
11237 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11238 .channel_mode = alc262_modes,
11239 .input_mux = &alc262_HP_capture_source,
11240 .unsol_event = alc262_hp_bpc_unsol_event,
11241 .init_hook = alc262_hp_bpc_automute,
11243 [ALC262_HP_BPC_D7000_WF] = {
11244 .mixers = { alc262_HP_BPC_WildWest_mixer },
11245 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11246 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11247 .dac_nids = alc262_dac_nids,
11249 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11250 .channel_mode = alc262_modes,
11251 .input_mux = &alc262_HP_D7000_capture_source,
11252 .unsol_event = alc262_hp_wildwest_unsol_event,
11253 .init_hook = alc262_hp_wildwest_automute,
11255 [ALC262_HP_BPC_D7000_WL] = {
11256 .mixers = { alc262_HP_BPC_WildWest_mixer,
11257 alc262_HP_BPC_WildWest_option_mixer },
11258 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11259 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11260 .dac_nids = alc262_dac_nids,
11262 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11263 .channel_mode = alc262_modes,
11264 .input_mux = &alc262_HP_D7000_capture_source,
11265 .unsol_event = alc262_hp_wildwest_unsol_event,
11266 .init_hook = alc262_hp_wildwest_automute,
11268 [ALC262_HP_TC_T5735] = {
11269 .mixers = { alc262_hp_t5735_mixer },
11270 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11271 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11272 .dac_nids = alc262_dac_nids,
11274 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11275 .channel_mode = alc262_modes,
11276 .input_mux = &alc262_capture_source,
11277 .unsol_event = alc_automute_amp_unsol_event,
11278 .init_hook = alc262_hp_t5735_init_hook,
11280 [ALC262_HP_RP5700] = {
11281 .mixers = { alc262_hp_rp5700_mixer },
11282 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11283 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11284 .dac_nids = alc262_dac_nids,
11285 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11286 .channel_mode = alc262_modes,
11287 .input_mux = &alc262_hp_rp5700_capture_source,
11289 [ALC262_BENQ_ED8] = {
11290 .mixers = { alc262_base_mixer },
11291 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11292 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11293 .dac_nids = alc262_dac_nids,
11295 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11296 .channel_mode = alc262_modes,
11297 .input_mux = &alc262_capture_source,
11299 [ALC262_SONY_ASSAMD] = {
11300 .mixers = { alc262_sony_mixer },
11301 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11302 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11303 .dac_nids = alc262_dac_nids,
11305 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11306 .channel_mode = alc262_modes,
11307 .input_mux = &alc262_capture_source,
11308 .unsol_event = alc262_hippo_unsol_event,
11309 .init_hook = alc262_hippo_init_hook,
11311 [ALC262_BENQ_T31] = {
11312 .mixers = { alc262_benq_t31_mixer },
11313 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11314 alc_hp15_unsol_verbs },
11315 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11316 .dac_nids = alc262_dac_nids,
11318 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11319 .channel_mode = alc262_modes,
11320 .input_mux = &alc262_capture_source,
11321 .unsol_event = alc262_hippo_unsol_event,
11322 .init_hook = alc262_hippo_init_hook,
11325 .mixers = { alc262_ultra_mixer },
11326 .cap_mixer = alc262_ultra_capture_mixer,
11327 .init_verbs = { alc262_ultra_verbs },
11328 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11329 .dac_nids = alc262_dac_nids,
11330 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11331 .channel_mode = alc262_modes,
11332 .input_mux = &alc262_ultra_capture_source,
11333 .adc_nids = alc262_adc_nids, /* ADC0 */
11334 .capsrc_nids = alc262_capsrc_nids,
11335 .num_adc_nids = 1, /* single ADC */
11336 .unsol_event = alc262_ultra_unsol_event,
11337 .init_hook = alc262_ultra_automute,
11339 [ALC262_LENOVO_3000] = {
11340 .mixers = { alc262_lenovo_3000_mixer },
11341 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11342 alc262_lenovo_3000_unsol_verbs },
11343 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11344 .dac_nids = alc262_dac_nids,
11346 .dig_out_nid = ALC262_DIGOUT_NID,
11347 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11348 .channel_mode = alc262_modes,
11349 .input_mux = &alc262_fujitsu_capture_source,
11350 .unsol_event = alc262_lenovo_3000_unsol_event,
11353 .mixers = { alc262_nec_mixer },
11354 .init_verbs = { alc262_nec_verbs },
11355 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11356 .dac_nids = alc262_dac_nids,
11358 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11359 .channel_mode = alc262_modes,
11360 .input_mux = &alc262_capture_source,
11362 [ALC262_TOSHIBA_S06] = {
11363 .mixers = { alc262_toshiba_s06_mixer },
11364 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11365 alc262_eapd_verbs },
11366 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11367 .capsrc_nids = alc262_dmic_capsrc_nids,
11368 .dac_nids = alc262_dac_nids,
11369 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11370 .num_adc_nids = 1, /* single ADC */
11371 .dig_out_nid = ALC262_DIGOUT_NID,
11372 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11373 .channel_mode = alc262_modes,
11374 .input_mux = &alc262_dmic_capture_source,
11375 .unsol_event = alc262_toshiba_s06_unsol_event,
11376 .init_hook = alc262_toshiba_s06_init_hook,
11378 [ALC262_TOSHIBA_RX1] = {
11379 .mixers = { alc262_toshiba_rx1_mixer },
11380 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11381 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11382 .dac_nids = alc262_dac_nids,
11384 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11385 .channel_mode = alc262_modes,
11386 .input_mux = &alc262_capture_source,
11387 .unsol_event = alc262_hippo_unsol_event,
11388 .init_hook = alc262_hippo_init_hook,
11391 .mixers = { alc262_tyan_mixer },
11392 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11393 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11394 .dac_nids = alc262_dac_nids,
11396 .dig_out_nid = ALC262_DIGOUT_NID,
11397 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11398 .channel_mode = alc262_modes,
11399 .input_mux = &alc262_capture_source,
11400 .unsol_event = alc_automute_amp_unsol_event,
11401 .init_hook = alc262_tyan_init_hook,
11405 static int patch_alc262(struct hda_codec *codec)
11407 struct alc_spec *spec;
11411 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11415 codec->spec = spec;
11417 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11422 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11423 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11424 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11425 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11429 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11431 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11435 if (board_config < 0) {
11436 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11438 board_config = ALC262_AUTO;
11441 if (board_config == ALC262_AUTO) {
11442 /* automatic parse from the BIOS config */
11443 err = alc262_parse_auto_config(codec);
11449 "hda_codec: Cannot set up configuration "
11450 "from BIOS. Using base mode...\n");
11451 board_config = ALC262_BASIC;
11455 if (!spec->no_analog) {
11456 err = snd_hda_attach_beep_device(codec, 0x1);
11463 if (board_config != ALC262_AUTO)
11464 setup_preset(spec, &alc262_presets[board_config]);
11466 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11467 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11469 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11470 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11472 if (!spec->adc_nids && spec->input_mux) {
11474 /* check whether the digital-mic has to be supported */
11475 for (i = 0; i < spec->input_mux->num_items; i++) {
11476 if (spec->input_mux->items[i].index >= 9)
11479 if (i < spec->input_mux->num_items) {
11480 /* use only ADC0 */
11481 spec->adc_nids = alc262_dmic_adc_nids;
11482 spec->num_adc_nids = 1;
11483 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11485 /* all analog inputs */
11486 /* check whether NID 0x07 is valid */
11487 unsigned int wcap = get_wcaps(codec, 0x07);
11490 wcap = get_wcaps_type(wcap);
11491 if (wcap != AC_WID_AUD_IN) {
11492 spec->adc_nids = alc262_adc_nids_alt;
11493 spec->num_adc_nids =
11494 ARRAY_SIZE(alc262_adc_nids_alt);
11495 spec->capsrc_nids = alc262_capsrc_nids_alt;
11497 spec->adc_nids = alc262_adc_nids;
11498 spec->num_adc_nids =
11499 ARRAY_SIZE(alc262_adc_nids);
11500 spec->capsrc_nids = alc262_capsrc_nids;
11504 if (!spec->cap_mixer && !spec->no_analog)
11505 set_capture_mixer(spec);
11506 if (!spec->no_analog)
11507 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11509 spec->vmaster_nid = 0x0c;
11511 codec->patch_ops = alc_patch_ops;
11512 if (board_config == ALC262_AUTO)
11513 spec->init_hook = alc262_auto_init;
11514 #ifdef CONFIG_SND_HDA_POWER_SAVE
11515 if (!spec->loopback.amplist)
11516 spec->loopback.amplist = alc262_loopbacks;
11518 codec->proc_widget_hook = print_realtek_coef;
11524 * ALC268 channel source setting (2 channel)
11526 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11527 #define alc268_modes alc260_modes
11529 static hda_nid_t alc268_dac_nids[2] = {
11534 static hda_nid_t alc268_adc_nids[2] = {
11539 static hda_nid_t alc268_adc_nids_alt[1] = {
11544 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11546 static struct snd_kcontrol_new alc268_base_mixer[] = {
11547 /* output mixer control */
11548 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11549 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11550 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11551 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11552 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11553 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11554 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11558 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11559 /* output mixer control */
11560 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11561 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11562 ALC262_HIPPO_MASTER_SWITCH,
11563 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11564 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11565 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11569 /* bind Beep switches of both NID 0x0f and 0x10 */
11570 static struct hda_bind_ctls alc268_bind_beep_sw = {
11571 .ops = &snd_hda_bind_sw,
11573 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11574 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11579 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11580 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11581 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11585 static struct hda_verb alc268_eapd_verbs[] = {
11586 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11587 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11591 /* Toshiba specific */
11592 static struct hda_verb alc268_toshiba_verbs[] = {
11593 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11597 static struct hda_input_mux alc268_acer_lc_capture_source = {
11605 /* Acer specific */
11606 /* bind volumes of both NID 0x02 and 0x03 */
11607 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11608 .ops = &snd_hda_bind_vol,
11610 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11611 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11616 /* mute/unmute internal speaker according to the hp jack and mute state */
11617 static void alc268_acer_automute(struct hda_codec *codec, int force)
11619 struct alc_spec *spec = codec->spec;
11622 if (force || !spec->sense_updated) {
11623 unsigned int present;
11624 present = snd_hda_codec_read(codec, 0x14, 0,
11625 AC_VERB_GET_PIN_SENSE, 0);
11626 spec->jack_present = (present & 0x80000000) != 0;
11627 spec->sense_updated = 1;
11629 if (spec->jack_present)
11630 mute = HDA_AMP_MUTE; /* mute internal speaker */
11631 else /* unmute internal speaker if necessary */
11632 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11633 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11634 HDA_AMP_MUTE, mute);
11638 /* bind hp and internal speaker mute (with plug check) */
11639 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11640 struct snd_ctl_elem_value *ucontrol)
11642 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11643 long *valp = ucontrol->value.integer.value;
11646 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11648 alc268_acer_automute(codec, 0);
11652 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11653 /* output mixer control */
11654 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11656 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11657 .name = "Master Playback Switch",
11658 .info = snd_hda_mixer_amp_switch_info,
11659 .get = snd_hda_mixer_amp_switch_get,
11660 .put = alc268_acer_master_sw_put,
11661 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11663 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11667 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11668 /* output mixer control */
11669 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11671 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11672 .name = "Master Playback Switch",
11673 .info = snd_hda_mixer_amp_switch_info,
11674 .get = snd_hda_mixer_amp_switch_get,
11675 .put = alc268_acer_master_sw_put,
11676 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11678 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11679 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11680 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11684 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11685 /* output mixer control */
11686 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11688 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11689 .name = "Master Playback Switch",
11690 .info = snd_hda_mixer_amp_switch_info,
11691 .get = snd_hda_mixer_amp_switch_get,
11692 .put = alc268_acer_master_sw_put,
11693 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11695 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11696 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11700 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11701 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11702 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11703 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11704 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11705 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11706 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11710 static struct hda_verb alc268_acer_verbs[] = {
11711 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11712 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11713 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11714 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11715 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11716 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11717 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11721 /* unsolicited event for HP jack sensing */
11722 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11723 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11725 static void alc268_acer_unsol_event(struct hda_codec *codec,
11728 if ((res >> 26) != ALC880_HP_EVENT)
11730 alc268_acer_automute(codec, 1);
11733 static void alc268_acer_init_hook(struct hda_codec *codec)
11735 alc268_acer_automute(codec, 1);
11738 /* toggle speaker-output according to the hp-jack state */
11739 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11741 unsigned int present;
11742 unsigned char bits;
11744 present = snd_hda_codec_read(codec, 0x15, 0,
11745 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11746 bits = present ? AMP_IN_MUTE(0) : 0;
11747 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11748 AMP_IN_MUTE(0), bits);
11749 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11750 AMP_IN_MUTE(0), bits);
11754 static void alc268_acer_mic_automute(struct hda_codec *codec)
11756 unsigned int present;
11758 present = snd_hda_codec_read(codec, 0x18, 0,
11759 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11760 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11761 present ? 0x0 : 0x6);
11764 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11767 if ((res >> 26) == ALC880_HP_EVENT)
11768 alc268_aspire_one_speaker_automute(codec);
11769 if ((res >> 26) == ALC880_MIC_EVENT)
11770 alc268_acer_mic_automute(codec);
11773 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11775 alc268_aspire_one_speaker_automute(codec);
11776 alc268_acer_mic_automute(codec);
11779 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11780 /* output mixer control */
11781 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11782 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11783 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11784 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11785 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11786 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11790 static struct hda_verb alc268_dell_verbs[] = {
11791 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11792 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11793 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11797 /* mute/unmute internal speaker according to the hp jack and mute state */
11798 static void alc268_dell_init_hook(struct hda_codec *codec)
11800 struct alc_spec *spec = codec->spec;
11802 spec->autocfg.hp_pins[0] = 0x15;
11803 spec->autocfg.speaker_pins[0] = 0x14;
11804 alc_automute_pin(codec);
11807 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11808 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11809 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11810 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11811 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11812 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11813 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11814 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11815 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11819 static struct hda_verb alc267_quanta_il1_verbs[] = {
11820 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11821 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11825 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11827 unsigned int present;
11829 present = snd_hda_codec_read(codec, 0x18, 0,
11830 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11831 snd_hda_codec_write(codec, 0x23, 0,
11832 AC_VERB_SET_CONNECT_SEL,
11833 present ? 0x00 : 0x01);
11836 static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
11838 struct alc_spec *spec = codec->spec;
11840 spec->autocfg.hp_pins[0] = 0x15;
11841 spec->autocfg.speaker_pins[0] = 0x14;
11842 alc_automute_pin(codec);
11843 alc267_quanta_il1_mic_automute(codec);
11846 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11849 switch (res >> 26) {
11850 case ALC880_MIC_EVENT:
11851 alc267_quanta_il1_mic_automute(codec);
11854 alc_sku_unsol_event(codec, res);
11860 * generic initialization of ADC, input mixers and output mixers
11862 static struct hda_verb alc268_base_init_verbs[] = {
11863 /* Unmute DAC0-1 and set vol = 0 */
11864 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11865 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11868 * Set up output mixers (0x0c - 0x0e)
11870 /* set vol=0 to output mixers */
11871 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11872 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11874 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11875 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11877 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11878 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11879 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11880 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11881 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11882 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11883 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11884 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11886 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11887 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11888 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11889 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11890 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11892 /* set PCBEEP vol = 0, mute connections */
11893 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11894 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11895 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11897 /* Unmute Selector 23h,24h and set the default input to mic-in */
11899 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11900 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11901 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11902 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11908 * generic initialization of ADC, input mixers and output mixers
11910 static struct hda_verb alc268_volume_init_verbs[] = {
11911 /* set output DAC */
11912 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11913 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11915 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11916 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11917 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11918 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11919 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11921 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11922 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11923 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11925 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11926 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11928 /* set PCBEEP vol = 0, mute connections */
11929 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11930 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11931 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11936 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11937 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11938 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11940 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11941 /* The multiple "Capture Source" controls confuse alsamixer
11942 * So call somewhat different..
11944 /* .name = "Capture Source", */
11945 .name = "Input Source",
11947 .info = alc_mux_enum_info,
11948 .get = alc_mux_enum_get,
11949 .put = alc_mux_enum_put,
11954 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11955 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11956 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11957 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11958 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11960 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11961 /* The multiple "Capture Source" controls confuse alsamixer
11962 * So call somewhat different..
11964 /* .name = "Capture Source", */
11965 .name = "Input Source",
11967 .info = alc_mux_enum_info,
11968 .get = alc_mux_enum_get,
11969 .put = alc_mux_enum_put,
11974 static struct hda_input_mux alc268_capture_source = {
11978 { "Front Mic", 0x1 },
11984 static struct hda_input_mux alc268_acer_capture_source = {
11988 { "Internal Mic", 0x1 },
11993 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11997 { "Internal Mic", 0x6 },
12002 #ifdef CONFIG_SND_DEBUG
12003 static struct snd_kcontrol_new alc268_test_mixer[] = {
12004 /* Volume widgets */
12005 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12006 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12007 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12008 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12009 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12010 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12011 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12012 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12013 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12014 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12015 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12016 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12017 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12018 /* The below appears problematic on some hardwares */
12019 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12020 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12021 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12022 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12023 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12025 /* Modes for retasking pin widgets */
12026 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12027 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12028 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12029 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12031 /* Controls for GPIO pins, assuming they are configured as outputs */
12032 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12033 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12034 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12035 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12037 /* Switches to allow the digital SPDIF output pin to be enabled.
12038 * The ALC268 does not have an SPDIF input.
12040 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12042 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12043 * this output to turn on an external amplifier.
12045 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12046 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12052 /* create input playback/capture controls for the given pin */
12053 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12054 const char *ctlname, int idx)
12060 sprintf(name, "%s Playback Volume", ctlname);
12072 if (spec->multiout.dac_nids[0] != dac &&
12073 spec->multiout.dac_nids[1] != dac) {
12074 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12075 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12079 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12082 sprintf(name, "%s Playback Switch", ctlname);
12084 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12085 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12087 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12088 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12094 /* add playback controls from the parsed DAC table */
12095 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12096 const struct auto_pin_cfg *cfg)
12101 spec->multiout.dac_nids = spec->private_dac_nids;
12103 nid = cfg->line_out_pins[0];
12106 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12110 err = alc268_new_analog_output(spec, nid, name, 0);
12115 nid = cfg->speaker_pins[0];
12117 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12118 "Speaker Playback Volume",
12119 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12123 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12127 nid = cfg->hp_pins[0];
12129 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12134 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12136 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12137 "Mono Playback Switch",
12138 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12145 /* create playback/capture controls for input pins */
12146 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
12147 const struct auto_pin_cfg *cfg)
12149 struct hda_input_mux *imux = &spec->private_imux[0];
12152 for (i = 0; i < AUTO_PIN_LAST; i++) {
12153 switch(cfg->input_pins[i]) {
12155 idx1 = 0; /* Mic 1 */
12158 idx1 = 1; /* Mic 2 */
12161 idx1 = 2; /* Line In */
12168 idx1 = 6; /* digital mics */
12173 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12174 imux->items[imux->num_items].index = idx1;
12180 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12182 struct alc_spec *spec = codec->spec;
12183 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12184 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12185 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12186 unsigned int dac_vol1, dac_vol2;
12189 snd_hda_codec_write(codec, speaker_nid, 0,
12190 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12191 snd_hda_codec_write(codec, 0x0f, 0,
12192 AC_VERB_SET_AMP_GAIN_MUTE,
12194 snd_hda_codec_write(codec, 0x10, 0,
12195 AC_VERB_SET_AMP_GAIN_MUTE,
12198 snd_hda_codec_write(codec, 0x0f, 0,
12199 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12200 snd_hda_codec_write(codec, 0x10, 0,
12201 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12204 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12205 if (line_nid == 0x14)
12206 dac_vol2 = AMP_OUT_ZERO;
12207 else if (line_nid == 0x15)
12208 dac_vol1 = AMP_OUT_ZERO;
12209 if (hp_nid == 0x14)
12210 dac_vol2 = AMP_OUT_ZERO;
12211 else if (hp_nid == 0x15)
12212 dac_vol1 = AMP_OUT_ZERO;
12213 if (line_nid != 0x16 || hp_nid != 0x16 ||
12214 spec->autocfg.line_out_pins[1] != 0x16 ||
12215 spec->autocfg.line_out_pins[2] != 0x16)
12216 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12218 snd_hda_codec_write(codec, 0x02, 0,
12219 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12220 snd_hda_codec_write(codec, 0x03, 0,
12221 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12224 /* pcm configuration: identical with ALC880 */
12225 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12226 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12227 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12228 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12231 * BIOS auto configuration
12233 static int alc268_parse_auto_config(struct hda_codec *codec)
12235 struct alc_spec *spec = codec->spec;
12237 static hda_nid_t alc268_ignore[] = { 0 };
12239 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12243 if (!spec->autocfg.line_outs) {
12244 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12245 spec->multiout.max_channels = 2;
12246 spec->no_analog = 1;
12249 return 0; /* can't find valid BIOS pin config */
12251 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12254 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
12258 spec->multiout.max_channels = 2;
12261 /* digital only support output */
12262 if (spec->autocfg.dig_outs) {
12263 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12264 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12266 if (spec->kctls.list)
12267 add_mixer(spec, spec->kctls.list);
12269 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12270 add_mixer(spec, alc268_beep_mixer);
12272 add_verb(spec, alc268_volume_init_verbs);
12273 spec->num_mux_defs = 1;
12274 spec->input_mux = &spec->private_imux[0];
12276 err = alc_auto_add_mic_boost(codec);
12280 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12285 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12286 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12287 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12289 /* init callback for auto-configuration model -- overriding the default init */
12290 static void alc268_auto_init(struct hda_codec *codec)
12292 struct alc_spec *spec = codec->spec;
12293 alc268_auto_init_multi_out(codec);
12294 alc268_auto_init_hp_out(codec);
12295 alc268_auto_init_mono_speaker_out(codec);
12296 alc268_auto_init_analog_input(codec);
12297 if (spec->unsol_event)
12298 alc_inithook(codec);
12302 * configuration and preset
12304 static const char *alc268_models[ALC268_MODEL_LAST] = {
12305 [ALC267_QUANTA_IL1] = "quanta-il1",
12306 [ALC268_3ST] = "3stack",
12307 [ALC268_TOSHIBA] = "toshiba",
12308 [ALC268_ACER] = "acer",
12309 [ALC268_ACER_DMIC] = "acer-dmic",
12310 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12311 [ALC268_DELL] = "dell",
12312 [ALC268_ZEPTO] = "zepto",
12313 #ifdef CONFIG_SND_DEBUG
12314 [ALC268_TEST] = "test",
12316 [ALC268_AUTO] = "auto",
12319 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12320 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12321 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12322 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12323 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12324 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12325 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12326 ALC268_ACER_ASPIRE_ONE),
12327 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12328 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12329 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12331 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12332 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12333 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12335 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12336 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12337 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12338 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12342 static struct alc_config_preset alc268_presets[] = {
12343 [ALC267_QUANTA_IL1] = {
12344 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12345 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12346 alc267_quanta_il1_verbs },
12347 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12348 .dac_nids = alc268_dac_nids,
12349 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12350 .adc_nids = alc268_adc_nids_alt,
12352 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12353 .channel_mode = alc268_modes,
12354 .input_mux = &alc268_capture_source,
12355 .unsol_event = alc267_quanta_il1_unsol_event,
12356 .init_hook = alc267_quanta_il1_init_hook,
12359 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12360 alc268_beep_mixer },
12361 .init_verbs = { alc268_base_init_verbs },
12362 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12363 .dac_nids = alc268_dac_nids,
12364 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12365 .adc_nids = alc268_adc_nids_alt,
12366 .capsrc_nids = alc268_capsrc_nids,
12368 .dig_out_nid = ALC268_DIGOUT_NID,
12369 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12370 .channel_mode = alc268_modes,
12371 .input_mux = &alc268_capture_source,
12373 [ALC268_TOSHIBA] = {
12374 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12375 alc268_beep_mixer },
12376 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12377 alc268_toshiba_verbs },
12378 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12379 .dac_nids = alc268_dac_nids,
12380 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12381 .adc_nids = alc268_adc_nids_alt,
12382 .capsrc_nids = alc268_capsrc_nids,
12384 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12385 .channel_mode = alc268_modes,
12386 .input_mux = &alc268_capture_source,
12387 .unsol_event = alc268_toshiba_unsol_event,
12388 .init_hook = alc268_toshiba_init_hook,
12391 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12392 alc268_beep_mixer },
12393 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12394 alc268_acer_verbs },
12395 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12396 .dac_nids = alc268_dac_nids,
12397 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12398 .adc_nids = alc268_adc_nids_alt,
12399 .capsrc_nids = alc268_capsrc_nids,
12401 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12402 .channel_mode = alc268_modes,
12403 .input_mux = &alc268_acer_capture_source,
12404 .unsol_event = alc268_acer_unsol_event,
12405 .init_hook = alc268_acer_init_hook,
12407 [ALC268_ACER_DMIC] = {
12408 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12409 alc268_beep_mixer },
12410 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12411 alc268_acer_verbs },
12412 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12413 .dac_nids = alc268_dac_nids,
12414 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12415 .adc_nids = alc268_adc_nids_alt,
12416 .capsrc_nids = alc268_capsrc_nids,
12418 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12419 .channel_mode = alc268_modes,
12420 .input_mux = &alc268_acer_dmic_capture_source,
12421 .unsol_event = alc268_acer_unsol_event,
12422 .init_hook = alc268_acer_init_hook,
12424 [ALC268_ACER_ASPIRE_ONE] = {
12425 .mixers = { alc268_acer_aspire_one_mixer,
12427 alc268_capture_alt_mixer },
12428 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12429 alc268_acer_aspire_one_verbs },
12430 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12431 .dac_nids = alc268_dac_nids,
12432 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12433 .adc_nids = alc268_adc_nids_alt,
12434 .capsrc_nids = alc268_capsrc_nids,
12436 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12437 .channel_mode = alc268_modes,
12438 .input_mux = &alc268_acer_lc_capture_source,
12439 .unsol_event = alc268_acer_lc_unsol_event,
12440 .init_hook = alc268_acer_lc_init_hook,
12443 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12444 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12445 alc268_dell_verbs },
12446 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12447 .dac_nids = alc268_dac_nids,
12449 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12450 .channel_mode = alc268_modes,
12451 .unsol_event = alc_sku_unsol_event,
12452 .init_hook = alc268_dell_init_hook,
12453 .input_mux = &alc268_capture_source,
12456 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12457 alc268_beep_mixer },
12458 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12459 alc268_toshiba_verbs },
12460 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12461 .dac_nids = alc268_dac_nids,
12462 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12463 .adc_nids = alc268_adc_nids_alt,
12464 .capsrc_nids = alc268_capsrc_nids,
12466 .dig_out_nid = ALC268_DIGOUT_NID,
12467 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12468 .channel_mode = alc268_modes,
12469 .input_mux = &alc268_capture_source,
12470 .unsol_event = alc268_toshiba_unsol_event,
12471 .init_hook = alc268_toshiba_init_hook
12473 #ifdef CONFIG_SND_DEBUG
12475 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12476 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12477 alc268_volume_init_verbs },
12478 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12479 .dac_nids = alc268_dac_nids,
12480 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12481 .adc_nids = alc268_adc_nids_alt,
12482 .capsrc_nids = alc268_capsrc_nids,
12484 .dig_out_nid = ALC268_DIGOUT_NID,
12485 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12486 .channel_mode = alc268_modes,
12487 .input_mux = &alc268_capture_source,
12492 static int patch_alc268(struct hda_codec *codec)
12494 struct alc_spec *spec;
12496 int i, has_beep, err;
12498 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12502 codec->spec = spec;
12504 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12508 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12509 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12511 board_config = ALC268_AUTO;
12514 if (board_config == ALC268_AUTO) {
12515 /* automatic parse from the BIOS config */
12516 err = alc268_parse_auto_config(codec);
12522 "hda_codec: Cannot set up configuration "
12523 "from BIOS. Using base mode...\n");
12524 board_config = ALC268_3ST;
12528 if (board_config != ALC268_AUTO)
12529 setup_preset(spec, &alc268_presets[board_config]);
12531 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12532 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12533 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12535 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12538 for (i = 0; i < spec->num_mixers; i++) {
12539 if (spec->mixers[i] == alc268_beep_mixer) {
12546 err = snd_hda_attach_beep_device(codec, 0x1);
12551 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12552 /* override the amp caps for beep generator */
12553 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12554 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12555 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12556 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12557 (0 << AC_AMPCAP_MUTE_SHIFT));
12560 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12561 /* check whether NID 0x07 is valid */
12562 unsigned int wcap = get_wcaps(codec, 0x07);
12566 wcap = get_wcaps_type(wcap);
12567 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12568 spec->adc_nids = alc268_adc_nids_alt;
12569 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12570 add_mixer(spec, alc268_capture_alt_mixer);
12572 spec->adc_nids = alc268_adc_nids;
12573 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12574 add_mixer(spec, alc268_capture_mixer);
12576 spec->capsrc_nids = alc268_capsrc_nids;
12577 /* set default input source */
12578 for (i = 0; i < spec->num_adc_nids; i++)
12579 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12580 0, AC_VERB_SET_CONNECT_SEL,
12581 spec->input_mux->items[0].index);
12584 spec->vmaster_nid = 0x02;
12586 codec->patch_ops = alc_patch_ops;
12587 if (board_config == ALC268_AUTO)
12588 spec->init_hook = alc268_auto_init;
12590 codec->proc_widget_hook = print_realtek_coef;
12596 * ALC269 channel source setting (2 channel)
12598 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12600 #define alc269_dac_nids alc260_dac_nids
12602 static hda_nid_t alc269_adc_nids[1] = {
12607 static hda_nid_t alc269_capsrc_nids[1] = {
12611 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12615 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12623 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12631 #define alc269_modes alc260_modes
12632 #define alc269_capture_source alc880_lg_lw_capture_source
12634 static struct snd_kcontrol_new alc269_base_mixer[] = {
12635 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12636 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12637 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12638 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12639 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12640 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12641 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12642 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12643 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12644 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12645 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12646 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12650 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12651 /* output mixer control */
12652 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12654 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12655 .name = "Master Playback Switch",
12656 .info = snd_hda_mixer_amp_switch_info,
12657 .get = snd_hda_mixer_amp_switch_get,
12658 .put = alc268_acer_master_sw_put,
12659 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12661 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12662 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12663 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12664 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12665 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12666 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12670 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12671 /* output mixer control */
12672 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12674 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12675 .name = "Master Playback Switch",
12676 .info = snd_hda_mixer_amp_switch_info,
12677 .get = snd_hda_mixer_amp_switch_get,
12678 .put = alc268_acer_master_sw_put,
12679 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12681 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12682 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12683 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12684 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12685 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12686 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12687 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12688 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12689 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12693 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12694 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12695 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12696 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12697 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12701 /* capture mixer elements */
12702 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12703 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12704 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12705 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12710 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12712 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12713 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12714 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12715 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12716 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12717 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12718 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12722 static struct hda_verb alc269_lifebook_verbs[] = {
12723 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12724 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12725 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12726 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12727 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12728 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12729 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12730 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12731 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12732 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12736 /* toggle speaker-output according to the hp-jack state */
12737 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12739 unsigned int present;
12740 unsigned char bits;
12742 present = snd_hda_codec_read(codec, 0x15, 0,
12743 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12744 bits = present ? AMP_IN_MUTE(0) : 0;
12745 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12746 AMP_IN_MUTE(0), bits);
12747 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12748 AMP_IN_MUTE(0), bits);
12750 snd_hda_codec_write(codec, 0x20, 0,
12751 AC_VERB_SET_COEF_INDEX, 0x0c);
12752 snd_hda_codec_write(codec, 0x20, 0,
12753 AC_VERB_SET_PROC_COEF, 0x680);
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, 0x480);
12761 /* toggle speaker-output according to the hp-jacks state */
12762 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12764 unsigned int present;
12765 unsigned char bits;
12767 /* Check laptop headphone socket */
12768 present = snd_hda_codec_read(codec, 0x15, 0,
12769 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12771 /* Check port replicator headphone socket */
12772 present |= snd_hda_codec_read(codec, 0x1a, 0,
12773 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12775 bits = present ? AMP_IN_MUTE(0) : 0;
12776 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12777 AMP_IN_MUTE(0), bits);
12778 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12779 AMP_IN_MUTE(0), bits);
12781 snd_hda_codec_write(codec, 0x20, 0,
12782 AC_VERB_SET_COEF_INDEX, 0x0c);
12783 snd_hda_codec_write(codec, 0x20, 0,
12784 AC_VERB_SET_PROC_COEF, 0x680);
12786 snd_hda_codec_write(codec, 0x20, 0,
12787 AC_VERB_SET_COEF_INDEX, 0x0c);
12788 snd_hda_codec_write(codec, 0x20, 0,
12789 AC_VERB_SET_PROC_COEF, 0x480);
12792 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12794 unsigned int present;
12796 present = snd_hda_codec_read(codec, 0x18, 0,
12797 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12798 snd_hda_codec_write(codec, 0x23, 0,
12799 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12802 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12804 unsigned int present_laptop;
12805 unsigned int present_dock;
12807 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12808 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12810 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12811 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12813 /* Laptop mic port overrides dock mic port, design decision */
12815 snd_hda_codec_write(codec, 0x23, 0,
12816 AC_VERB_SET_CONNECT_SEL, 0x3);
12817 if (present_laptop)
12818 snd_hda_codec_write(codec, 0x23, 0,
12819 AC_VERB_SET_CONNECT_SEL, 0x0);
12820 if (!present_dock && !present_laptop)
12821 snd_hda_codec_write(codec, 0x23, 0,
12822 AC_VERB_SET_CONNECT_SEL, 0x1);
12825 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12828 if ((res >> 26) == ALC880_HP_EVENT)
12829 alc269_quanta_fl1_speaker_automute(codec);
12830 if ((res >> 26) == ALC880_MIC_EVENT)
12831 alc269_quanta_fl1_mic_automute(codec);
12834 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12837 if ((res >> 26) == ALC880_HP_EVENT)
12838 alc269_lifebook_speaker_automute(codec);
12839 if ((res >> 26) == ALC880_MIC_EVENT)
12840 alc269_lifebook_mic_autoswitch(codec);
12843 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12845 alc269_quanta_fl1_speaker_automute(codec);
12846 alc269_quanta_fl1_mic_automute(codec);
12849 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12851 alc269_lifebook_speaker_automute(codec);
12852 alc269_lifebook_mic_autoswitch(codec);
12855 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12856 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12857 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12858 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12859 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12860 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12861 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12862 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12866 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12867 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12868 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12869 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12870 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12871 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12872 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12876 /* toggle speaker-output according to the hp-jack state */
12877 static void alc269_speaker_automute(struct hda_codec *codec)
12879 unsigned int present;
12880 unsigned char bits;
12882 present = snd_hda_codec_read(codec, 0x15, 0,
12883 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12884 bits = present ? AMP_IN_MUTE(0) : 0;
12885 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12886 AMP_IN_MUTE(0), bits);
12887 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12888 AMP_IN_MUTE(0), bits);
12891 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12893 unsigned int present;
12895 present = snd_hda_codec_read(codec, 0x18, 0,
12896 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12897 snd_hda_codec_write(codec, 0x23, 0,
12898 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12901 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12903 unsigned int present;
12905 present = snd_hda_codec_read(codec, 0x18, 0,
12906 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12907 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12908 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12909 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12910 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12913 /* unsolicited event for HP jack sensing */
12914 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12917 if ((res >> 26) == ALC880_HP_EVENT)
12918 alc269_speaker_automute(codec);
12920 if ((res >> 26) == ALC880_MIC_EVENT)
12921 alc269_eeepc_dmic_automute(codec);
12924 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12926 alc269_speaker_automute(codec);
12927 alc269_eeepc_dmic_automute(codec);
12930 /* unsolicited event for HP jack sensing */
12931 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12934 if ((res >> 26) == ALC880_HP_EVENT)
12935 alc269_speaker_automute(codec);
12937 if ((res >> 26) == ALC880_MIC_EVENT)
12938 alc269_eeepc_amic_automute(codec);
12941 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12943 alc269_speaker_automute(codec);
12944 alc269_eeepc_amic_automute(codec);
12948 * generic initialization of ADC, input mixers and output mixers
12950 static struct hda_verb alc269_init_verbs[] = {
12952 * Unmute ADC0 and set the default input to mic-in
12954 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12956 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12957 * analog-loopback mixer widget
12958 * Note: PASD motherboards uses the Line In 2 as the input for
12959 * front panel mic (mic 2)
12961 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12962 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12963 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12964 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12965 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12966 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12969 * Set up output mixers (0x0c - 0x0e)
12971 /* set vol=0 to output mixers */
12972 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12973 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12975 /* set up input amps for analog loopback */
12976 /* Amp Indices: DAC = 0, mixer = 1 */
12977 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12978 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12979 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12980 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12981 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12982 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12984 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12985 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12986 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12987 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12988 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12989 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12990 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12992 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12993 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12994 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12995 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12996 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12997 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12998 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13000 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13001 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13003 /* FIXME: use matrix-type input source selection */
13004 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13005 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13006 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13007 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13008 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13009 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13012 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13013 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13017 /* add playback controls from the parsed DAC table */
13018 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
13019 const struct auto_pin_cfg *cfg)
13024 spec->multiout.num_dacs = 1; /* only use one dac */
13025 spec->multiout.dac_nids = spec->private_dac_nids;
13026 spec->multiout.dac_nids[0] = 2;
13028 nid = cfg->line_out_pins[0];
13030 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13031 "Front Playback Volume",
13032 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
13035 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13036 "Front Playback Switch",
13037 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13042 nid = cfg->speaker_pins[0];
13044 if (!cfg->line_out_pins[0]) {
13045 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13046 "Speaker Playback Volume",
13047 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13053 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13054 "Speaker Playback Switch",
13055 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13060 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13061 "Speaker Playback Switch",
13062 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13068 nid = cfg->hp_pins[0];
13070 /* spec->multiout.hp_nid = 2; */
13071 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
13072 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13073 "Headphone Playback Volume",
13074 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13080 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13081 "Headphone Playback Switch",
13082 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13087 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13088 "Headphone Playback Switch",
13089 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13098 #define alc269_auto_create_analog_input_ctls \
13099 alc262_auto_create_analog_input_ctls
13101 #ifdef CONFIG_SND_HDA_POWER_SAVE
13102 #define alc269_loopbacks alc880_loopbacks
13105 /* pcm configuration: identical with ALC880 */
13106 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13107 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13108 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13109 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13111 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13115 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13116 /* NID is set in alc_build_pcms */
13118 .open = alc880_playback_pcm_open,
13119 .prepare = alc880_playback_pcm_prepare,
13120 .cleanup = alc880_playback_pcm_cleanup
13124 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13128 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13129 /* NID is set in alc_build_pcms */
13133 * BIOS auto configuration
13135 static int alc269_parse_auto_config(struct hda_codec *codec)
13137 struct alc_spec *spec = codec->spec;
13139 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13141 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13146 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13149 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
13153 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13155 if (spec->autocfg.dig_outs)
13156 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13158 if (spec->kctls.list)
13159 add_mixer(spec, spec->kctls.list);
13161 add_verb(spec, alc269_init_verbs);
13162 spec->num_mux_defs = 1;
13163 spec->input_mux = &spec->private_imux[0];
13164 /* set default input source */
13165 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13166 0, AC_VERB_SET_CONNECT_SEL,
13167 spec->input_mux->items[0].index);
13169 err = alc_auto_add_mic_boost(codec);
13173 if (!spec->cap_mixer && !spec->no_analog)
13174 set_capture_mixer(spec);
13176 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13181 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13182 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13183 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13186 /* init callback for auto-configuration model -- overriding the default init */
13187 static void alc269_auto_init(struct hda_codec *codec)
13189 struct alc_spec *spec = codec->spec;
13190 alc269_auto_init_multi_out(codec);
13191 alc269_auto_init_hp_out(codec);
13192 alc269_auto_init_analog_input(codec);
13193 if (spec->unsol_event)
13194 alc_inithook(codec);
13198 * configuration and preset
13200 static const char *alc269_models[ALC269_MODEL_LAST] = {
13201 [ALC269_BASIC] = "basic",
13202 [ALC269_QUANTA_FL1] = "quanta",
13203 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13204 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13205 [ALC269_FUJITSU] = "fujitsu",
13206 [ALC269_LIFEBOOK] = "lifebook"
13209 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13210 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13211 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13212 ALC269_ASUS_EEEPC_P703),
13213 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13214 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13215 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13216 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13217 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13218 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13219 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13220 ALC269_ASUS_EEEPC_P901),
13221 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13222 ALC269_ASUS_EEEPC_P901),
13223 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13224 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13225 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13229 static struct alc_config_preset alc269_presets[] = {
13231 .mixers = { alc269_base_mixer },
13232 .init_verbs = { alc269_init_verbs },
13233 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13234 .dac_nids = alc269_dac_nids,
13236 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13237 .channel_mode = alc269_modes,
13238 .input_mux = &alc269_capture_source,
13240 [ALC269_QUANTA_FL1] = {
13241 .mixers = { alc269_quanta_fl1_mixer },
13242 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13243 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13244 .dac_nids = alc269_dac_nids,
13246 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13247 .channel_mode = alc269_modes,
13248 .input_mux = &alc269_capture_source,
13249 .unsol_event = alc269_quanta_fl1_unsol_event,
13250 .init_hook = alc269_quanta_fl1_init_hook,
13252 [ALC269_ASUS_EEEPC_P703] = {
13253 .mixers = { alc269_eeepc_mixer },
13254 .cap_mixer = alc269_epc_capture_mixer,
13255 .init_verbs = { alc269_init_verbs,
13256 alc269_eeepc_amic_init_verbs },
13257 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13258 .dac_nids = alc269_dac_nids,
13260 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13261 .channel_mode = alc269_modes,
13262 .input_mux = &alc269_eeepc_amic_capture_source,
13263 .unsol_event = alc269_eeepc_amic_unsol_event,
13264 .init_hook = alc269_eeepc_amic_inithook,
13266 [ALC269_ASUS_EEEPC_P901] = {
13267 .mixers = { alc269_eeepc_mixer },
13268 .cap_mixer = alc269_epc_capture_mixer,
13269 .init_verbs = { alc269_init_verbs,
13270 alc269_eeepc_dmic_init_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_eeepc_dmic_capture_source,
13277 .unsol_event = alc269_eeepc_dmic_unsol_event,
13278 .init_hook = alc269_eeepc_dmic_inithook,
13280 [ALC269_FUJITSU] = {
13281 .mixers = { alc269_fujitsu_mixer },
13282 .cap_mixer = alc269_epc_capture_mixer,
13283 .init_verbs = { alc269_init_verbs,
13284 alc269_eeepc_dmic_init_verbs },
13285 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13286 .dac_nids = alc269_dac_nids,
13288 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13289 .channel_mode = alc269_modes,
13290 .input_mux = &alc269_eeepc_dmic_capture_source,
13291 .unsol_event = alc269_eeepc_dmic_unsol_event,
13292 .init_hook = alc269_eeepc_dmic_inithook,
13294 [ALC269_LIFEBOOK] = {
13295 .mixers = { alc269_lifebook_mixer },
13296 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13297 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13298 .dac_nids = alc269_dac_nids,
13300 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13301 .channel_mode = alc269_modes,
13302 .input_mux = &alc269_capture_source,
13303 .unsol_event = alc269_lifebook_unsol_event,
13304 .init_hook = alc269_lifebook_init_hook,
13308 static int patch_alc269(struct hda_codec *codec)
13310 struct alc_spec *spec;
13314 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13318 codec->spec = spec;
13320 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13322 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13326 if (board_config < 0) {
13327 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13329 board_config = ALC269_AUTO;
13332 if (board_config == ALC269_AUTO) {
13333 /* automatic parse from the BIOS config */
13334 err = alc269_parse_auto_config(codec);
13340 "hda_codec: Cannot set up configuration "
13341 "from BIOS. Using base mode...\n");
13342 board_config = ALC269_BASIC;
13346 err = snd_hda_attach_beep_device(codec, 0x1);
13352 if (board_config != ALC269_AUTO)
13353 setup_preset(spec, &alc269_presets[board_config]);
13355 if (codec->subsystem_id == 0x17aa3bf8) {
13356 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13357 * fix the sample rate of analog I/O to 44.1kHz
13359 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13360 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13362 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13363 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13365 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13366 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13368 spec->adc_nids = alc269_adc_nids;
13369 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13370 spec->capsrc_nids = alc269_capsrc_nids;
13371 if (!spec->cap_mixer)
13372 set_capture_mixer(spec);
13373 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13375 codec->patch_ops = alc_patch_ops;
13376 if (board_config == ALC269_AUTO)
13377 spec->init_hook = alc269_auto_init;
13378 #ifdef CONFIG_SND_HDA_POWER_SAVE
13379 if (!spec->loopback.amplist)
13380 spec->loopback.amplist = alc269_loopbacks;
13382 codec->proc_widget_hook = print_realtek_coef;
13388 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13392 * set the path ways for 2 channel output
13393 * need to set the codec line out and mic 1 pin widgets to inputs
13395 static struct hda_verb alc861_threestack_ch2_init[] = {
13396 /* set pin widget 1Ah (line in) for input */
13397 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13398 /* set pin widget 18h (mic1/2) for input, for mic also enable
13401 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13403 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13405 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13406 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13412 * need to set the codec line out and mic 1 pin widgets to outputs
13414 static struct hda_verb alc861_threestack_ch6_init[] = {
13415 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13416 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13417 /* set pin widget 18h (mic1) for output (CLFE)*/
13418 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13420 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13421 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13423 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13425 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13426 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13431 static struct hda_channel_mode alc861_threestack_modes[2] = {
13432 { 2, alc861_threestack_ch2_init },
13433 { 6, alc861_threestack_ch6_init },
13435 /* Set mic1 as input and unmute the mixer */
13436 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13437 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13438 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13441 /* Set mic1 as output and mute mixer */
13442 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13443 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13444 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13448 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13449 { 2, alc861_uniwill_m31_ch2_init },
13450 { 4, alc861_uniwill_m31_ch4_init },
13453 /* Set mic1 and line-in as input and unmute the mixer */
13454 static struct hda_verb alc861_asus_ch2_init[] = {
13455 /* set pin widget 1Ah (line in) for input */
13456 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13457 /* set pin widget 18h (mic1/2) for input, for mic also enable
13460 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13462 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13464 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13465 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13469 /* Set mic1 nad line-in as output and mute mixer */
13470 static struct hda_verb alc861_asus_ch6_init[] = {
13471 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13472 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13473 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13474 /* set pin widget 18h (mic1) for output (CLFE)*/
13475 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13476 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13477 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13478 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13480 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13482 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13483 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13488 static struct hda_channel_mode alc861_asus_modes[2] = {
13489 { 2, alc861_asus_ch2_init },
13490 { 6, alc861_asus_ch6_init },
13495 static struct snd_kcontrol_new alc861_base_mixer[] = {
13496 /* output mixer control */
13497 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13498 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13499 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13500 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13501 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13503 /*Input mixer control */
13504 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13505 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13506 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13507 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13508 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13509 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13510 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13511 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13512 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13513 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13518 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13519 /* output mixer control */
13520 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13521 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13522 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13523 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13524 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13526 /* Input mixer control */
13527 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13528 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13529 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13530 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13531 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13532 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13533 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13534 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13535 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13536 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13539 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13540 .name = "Channel Mode",
13541 .info = alc_ch_mode_info,
13542 .get = alc_ch_mode_get,
13543 .put = alc_ch_mode_put,
13544 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13549 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13550 /* output mixer control */
13551 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13552 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13553 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13558 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13559 /* output mixer control */
13560 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13561 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13562 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13563 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13564 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13566 /* Input mixer control */
13567 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13568 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13569 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13570 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13571 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13572 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13573 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13574 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13575 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13576 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13579 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13580 .name = "Channel Mode",
13581 .info = alc_ch_mode_info,
13582 .get = alc_ch_mode_get,
13583 .put = alc_ch_mode_put,
13584 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13589 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13590 /* output mixer control */
13591 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13592 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13593 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13594 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13595 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13597 /* Input mixer control */
13598 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13599 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13600 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13601 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13602 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13603 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13604 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13605 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13606 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13607 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13610 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13611 .name = "Channel Mode",
13612 .info = alc_ch_mode_info,
13613 .get = alc_ch_mode_get,
13614 .put = alc_ch_mode_put,
13615 .private_value = ARRAY_SIZE(alc861_asus_modes),
13620 /* additional mixer */
13621 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13622 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13623 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13628 * generic initialization of ADC, input mixers and output mixers
13630 static struct hda_verb alc861_base_init_verbs[] = {
13632 * Unmute ADC0 and set the default input to mic-in
13634 /* port-A for surround (rear panel) */
13635 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13636 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13637 /* port-B for mic-in (rear panel) with vref */
13638 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13639 /* port-C for line-in (rear panel) */
13640 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13641 /* port-D for Front */
13642 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13643 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13644 /* port-E for HP out (front panel) */
13645 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13646 /* route front PCM to HP */
13647 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13648 /* port-F for mic-in (front panel) with vref */
13649 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13650 /* port-G for CLFE (rear panel) */
13651 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13652 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13653 /* port-H for side (rear panel) */
13654 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13655 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13657 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13658 /* route front mic to ADC1*/
13659 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13660 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13662 /* Unmute DAC0~3 & spdif out*/
13663 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13664 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13665 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13666 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13667 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13669 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13670 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13671 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13672 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13673 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13675 /* Unmute Stereo Mixer 15 */
13676 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13677 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13678 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13679 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13681 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13682 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13683 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13684 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13685 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13686 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13687 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13688 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13689 /* hp used DAC 3 (Front) */
13690 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13691 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13696 static struct hda_verb alc861_threestack_init_verbs[] = {
13698 * Unmute ADC0 and set the default input to mic-in
13700 /* port-A for surround (rear panel) */
13701 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13702 /* port-B for mic-in (rear panel) with vref */
13703 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13704 /* port-C for line-in (rear panel) */
13705 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13706 /* port-D for Front */
13707 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13708 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13709 /* port-E for HP out (front panel) */
13710 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13711 /* route front PCM to HP */
13712 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13713 /* port-F for mic-in (front panel) with vref */
13714 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13715 /* port-G for CLFE (rear panel) */
13716 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13717 /* port-H for side (rear panel) */
13718 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13720 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13721 /* route front mic to ADC1*/
13722 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13723 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13724 /* Unmute DAC0~3 & spdif out*/
13725 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13726 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13727 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13728 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13729 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13731 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13732 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13733 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13734 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13735 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13737 /* Unmute Stereo Mixer 15 */
13738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13739 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13740 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13743 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13744 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13745 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13746 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13747 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13748 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13749 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13751 /* hp used DAC 3 (Front) */
13752 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13753 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13757 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13759 * Unmute ADC0 and set the default input to mic-in
13761 /* port-A for surround (rear panel) */
13762 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13763 /* port-B for mic-in (rear panel) with vref */
13764 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13765 /* port-C for line-in (rear panel) */
13766 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13767 /* port-D for Front */
13768 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13769 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13770 /* port-E for HP out (front panel) */
13771 /* this has to be set to VREF80 */
13772 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13773 /* route front PCM to HP */
13774 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13775 /* port-F for mic-in (front panel) with vref */
13776 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13777 /* port-G for CLFE (rear panel) */
13778 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13779 /* port-H for side (rear panel) */
13780 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13782 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13783 /* route front mic to ADC1*/
13784 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13785 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13786 /* Unmute DAC0~3 & spdif out*/
13787 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13788 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13789 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13790 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13791 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13793 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13794 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13795 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13796 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13797 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13799 /* Unmute Stereo Mixer 15 */
13800 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13802 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13803 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13805 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13806 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13807 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13808 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13809 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13810 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13811 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13812 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13813 /* hp used DAC 3 (Front) */
13814 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13815 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13819 static struct hda_verb alc861_asus_init_verbs[] = {
13821 * Unmute ADC0 and set the default input to mic-in
13823 /* port-A for surround (rear panel)
13824 * according to codec#0 this is the HP jack
13826 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13827 /* route front PCM to HP */
13828 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13829 /* port-B for mic-in (rear panel) with vref */
13830 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13831 /* port-C for line-in (rear panel) */
13832 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13833 /* port-D for Front */
13834 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13835 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13836 /* port-E for HP out (front panel) */
13837 /* this has to be set to VREF80 */
13838 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13839 /* route front PCM to HP */
13840 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13841 /* port-F for mic-in (front panel) with vref */
13842 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13843 /* port-G for CLFE (rear panel) */
13844 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13845 /* port-H for side (rear panel) */
13846 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13848 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13849 /* route front mic to ADC1*/
13850 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13851 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13852 /* Unmute DAC0~3 & spdif out*/
13853 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13854 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13855 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13856 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13858 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13859 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13860 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13861 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13862 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13864 /* Unmute Stereo Mixer 15 */
13865 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13866 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13867 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13868 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13870 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13871 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13872 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13873 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13874 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13875 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13876 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13877 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13878 /* hp used DAC 3 (Front) */
13879 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13880 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13884 /* additional init verbs for ASUS laptops */
13885 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13886 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13887 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13892 * generic initialization of ADC, input mixers and output mixers
13894 static struct hda_verb alc861_auto_init_verbs[] = {
13896 * Unmute ADC0 and set the default input to mic-in
13898 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13899 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13901 /* Unmute DAC0~3 & spdif out*/
13902 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13903 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13904 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13905 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13906 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13908 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13909 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13910 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13911 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13912 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13914 /* Unmute Stereo Mixer 15 */
13915 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13916 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13917 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13918 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13920 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13921 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13922 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13923 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13924 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13925 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13926 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13927 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13929 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13930 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13931 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13932 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13933 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13934 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13935 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13936 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13938 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13943 static struct hda_verb alc861_toshiba_init_verbs[] = {
13944 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13949 /* toggle speaker-output according to the hp-jack state */
13950 static void alc861_toshiba_automute(struct hda_codec *codec)
13952 unsigned int present;
13954 present = snd_hda_codec_read(codec, 0x0f, 0,
13955 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13956 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13957 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13958 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13959 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13962 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13965 if ((res >> 26) == ALC880_HP_EVENT)
13966 alc861_toshiba_automute(codec);
13969 /* pcm configuration: identical with ALC880 */
13970 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13971 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13972 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13973 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13976 #define ALC861_DIGOUT_NID 0x07
13978 static struct hda_channel_mode alc861_8ch_modes[1] = {
13982 static hda_nid_t alc861_dac_nids[4] = {
13983 /* front, surround, clfe, side */
13984 0x03, 0x06, 0x05, 0x04
13987 static hda_nid_t alc660_dac_nids[3] = {
13988 /* front, clfe, surround */
13992 static hda_nid_t alc861_adc_nids[1] = {
13997 static struct hda_input_mux alc861_capture_source = {
14001 { "Front Mic", 0x3 },
14008 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14010 struct alc_spec *spec = codec->spec;
14011 hda_nid_t mix, srcs[5];
14014 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14016 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14019 for (i = 0; i < num; i++) {
14021 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14022 if (type != AC_WID_AUD_OUT)
14024 for (j = 0; j < spec->multiout.num_dacs; j++)
14025 if (spec->multiout.dac_nids[j] == srcs[i])
14027 if (j >= spec->multiout.num_dacs)
14033 /* fill in the dac_nids table from the parsed pin configuration */
14034 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14035 const struct auto_pin_cfg *cfg)
14037 struct alc_spec *spec = codec->spec;
14039 hda_nid_t nid, dac;
14041 spec->multiout.dac_nids = spec->private_dac_nids;
14042 for (i = 0; i < cfg->line_outs; i++) {
14043 nid = cfg->line_out_pins[i];
14044 dac = alc861_look_for_dac(codec, nid);
14047 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14052 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14053 hda_nid_t nid, unsigned int chs)
14056 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
14057 return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name,
14058 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14061 /* add playback controls from the parsed DAC table */
14062 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14063 const struct auto_pin_cfg *cfg)
14065 struct alc_spec *spec = codec->spec;
14066 static const char *chname[4] = {
14067 "Front", "Surround", NULL /*CLFE*/, "Side"
14072 if (cfg->line_outs == 1) {
14073 const char *pfx = NULL;
14076 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14079 nid = spec->multiout.dac_nids[0];
14080 return alc861_create_out_sw(codec, pfx, nid, 3);
14084 for (i = 0; i < cfg->line_outs; i++) {
14085 nid = spec->multiout.dac_nids[i];
14090 err = alc861_create_out_sw(codec, "Center", nid, 1);
14093 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14097 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14105 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14107 struct alc_spec *spec = codec->spec;
14114 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14115 nid = alc861_look_for_dac(codec, pin);
14117 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14120 spec->multiout.hp_nid = nid;
14126 /* create playback/capture controls for input pins */
14127 static int alc861_auto_create_analog_input_ctls(struct hda_codec *codec,
14128 const struct auto_pin_cfg *cfg)
14130 struct alc_spec *spec = codec->spec;
14131 struct hda_input_mux *imux = &spec->private_imux[0];
14132 int i, err, idx, idx1;
14134 for (i = 0; i < AUTO_PIN_LAST; i++) {
14135 switch (cfg->input_pins[i]) {
14138 idx = 2; /* Line In */
14142 idx = 2; /* Line In */
14146 idx = 1; /* Mic In */
14150 idx = 1; /* Mic In */
14160 err = new_analog_input(spec, cfg->input_pins[i],
14161 auto_pin_cfg_labels[i], idx, 0x15);
14165 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
14166 imux->items[imux->num_items].index = idx1;
14172 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14174 int pin_type, hda_nid_t dac)
14176 hda_nid_t mix, srcs[5];
14179 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14181 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14183 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14185 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14188 for (i = 0; i < num; i++) {
14190 if (srcs[i] == dac || srcs[i] == 0x15)
14191 mute = AMP_IN_UNMUTE(i);
14193 mute = AMP_IN_MUTE(i);
14194 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14199 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14201 struct alc_spec *spec = codec->spec;
14204 for (i = 0; i < spec->autocfg.line_outs; i++) {
14205 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14206 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14208 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14209 spec->multiout.dac_nids[i]);
14213 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14215 struct alc_spec *spec = codec->spec;
14218 pin = spec->autocfg.hp_pins[0];
14220 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14221 spec->multiout.hp_nid);
14222 pin = spec->autocfg.speaker_pins[0];
14224 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT,
14225 spec->multiout.dac_nids[0]);
14228 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14230 struct alc_spec *spec = codec->spec;
14233 for (i = 0; i < AUTO_PIN_LAST; i++) {
14234 hda_nid_t nid = spec->autocfg.input_pins[i];
14235 if (nid >= 0x0c && nid <= 0x11)
14236 alc_set_input_pin(codec, nid, i);
14240 /* parse the BIOS configuration and set up the alc_spec */
14241 /* return 1 if successful, 0 if the proper config is not found,
14242 * or a negative error code
14244 static int alc861_parse_auto_config(struct hda_codec *codec)
14246 struct alc_spec *spec = codec->spec;
14248 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14250 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14254 if (!spec->autocfg.line_outs)
14255 return 0; /* can't find valid BIOS pin config */
14257 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14260 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14263 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14266 err = alc861_auto_create_analog_input_ctls(codec, &spec->autocfg);
14270 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14272 if (spec->autocfg.dig_outs)
14273 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14275 if (spec->kctls.list)
14276 add_mixer(spec, spec->kctls.list);
14278 add_verb(spec, alc861_auto_init_verbs);
14280 spec->num_mux_defs = 1;
14281 spec->input_mux = &spec->private_imux[0];
14283 spec->adc_nids = alc861_adc_nids;
14284 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14285 set_capture_mixer(spec);
14287 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14292 /* additional initialization for auto-configuration model */
14293 static void alc861_auto_init(struct hda_codec *codec)
14295 struct alc_spec *spec = codec->spec;
14296 alc861_auto_init_multi_out(codec);
14297 alc861_auto_init_hp_out(codec);
14298 alc861_auto_init_analog_input(codec);
14299 if (spec->unsol_event)
14300 alc_inithook(codec);
14303 #ifdef CONFIG_SND_HDA_POWER_SAVE
14304 static struct hda_amp_list alc861_loopbacks[] = {
14305 { 0x15, HDA_INPUT, 0 },
14306 { 0x15, HDA_INPUT, 1 },
14307 { 0x15, HDA_INPUT, 2 },
14308 { 0x15, HDA_INPUT, 3 },
14315 * configuration and preset
14317 static const char *alc861_models[ALC861_MODEL_LAST] = {
14318 [ALC861_3ST] = "3stack",
14319 [ALC660_3ST] = "3stack-660",
14320 [ALC861_3ST_DIG] = "3stack-dig",
14321 [ALC861_6ST_DIG] = "6stack-dig",
14322 [ALC861_UNIWILL_M31] = "uniwill-m31",
14323 [ALC861_TOSHIBA] = "toshiba",
14324 [ALC861_ASUS] = "asus",
14325 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14326 [ALC861_AUTO] = "auto",
14329 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14330 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14331 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14332 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14333 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14334 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14335 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14336 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14337 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14338 * Any other models that need this preset?
14340 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14341 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14342 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14343 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14344 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14345 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14346 /* FIXME: the below seems conflict */
14347 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14348 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14349 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14353 static struct alc_config_preset alc861_presets[] = {
14355 .mixers = { alc861_3ST_mixer },
14356 .init_verbs = { alc861_threestack_init_verbs },
14357 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14358 .dac_nids = alc861_dac_nids,
14359 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14360 .channel_mode = alc861_threestack_modes,
14362 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14363 .adc_nids = alc861_adc_nids,
14364 .input_mux = &alc861_capture_source,
14366 [ALC861_3ST_DIG] = {
14367 .mixers = { alc861_base_mixer },
14368 .init_verbs = { alc861_threestack_init_verbs },
14369 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14370 .dac_nids = alc861_dac_nids,
14371 .dig_out_nid = ALC861_DIGOUT_NID,
14372 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14373 .channel_mode = alc861_threestack_modes,
14375 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14376 .adc_nids = alc861_adc_nids,
14377 .input_mux = &alc861_capture_source,
14379 [ALC861_6ST_DIG] = {
14380 .mixers = { alc861_base_mixer },
14381 .init_verbs = { alc861_base_init_verbs },
14382 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14383 .dac_nids = alc861_dac_nids,
14384 .dig_out_nid = ALC861_DIGOUT_NID,
14385 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14386 .channel_mode = alc861_8ch_modes,
14387 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14388 .adc_nids = alc861_adc_nids,
14389 .input_mux = &alc861_capture_source,
14392 .mixers = { alc861_3ST_mixer },
14393 .init_verbs = { alc861_threestack_init_verbs },
14394 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14395 .dac_nids = alc660_dac_nids,
14396 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14397 .channel_mode = alc861_threestack_modes,
14399 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14400 .adc_nids = alc861_adc_nids,
14401 .input_mux = &alc861_capture_source,
14403 [ALC861_UNIWILL_M31] = {
14404 .mixers = { alc861_uniwill_m31_mixer },
14405 .init_verbs = { alc861_uniwill_m31_init_verbs },
14406 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14407 .dac_nids = alc861_dac_nids,
14408 .dig_out_nid = ALC861_DIGOUT_NID,
14409 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14410 .channel_mode = alc861_uniwill_m31_modes,
14412 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14413 .adc_nids = alc861_adc_nids,
14414 .input_mux = &alc861_capture_source,
14416 [ALC861_TOSHIBA] = {
14417 .mixers = { alc861_toshiba_mixer },
14418 .init_verbs = { alc861_base_init_verbs,
14419 alc861_toshiba_init_verbs },
14420 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14421 .dac_nids = alc861_dac_nids,
14422 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14423 .channel_mode = alc883_3ST_2ch_modes,
14424 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14425 .adc_nids = alc861_adc_nids,
14426 .input_mux = &alc861_capture_source,
14427 .unsol_event = alc861_toshiba_unsol_event,
14428 .init_hook = alc861_toshiba_automute,
14431 .mixers = { alc861_asus_mixer },
14432 .init_verbs = { alc861_asus_init_verbs },
14433 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14434 .dac_nids = alc861_dac_nids,
14435 .dig_out_nid = ALC861_DIGOUT_NID,
14436 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14437 .channel_mode = alc861_asus_modes,
14440 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14441 .adc_nids = alc861_adc_nids,
14442 .input_mux = &alc861_capture_source,
14444 [ALC861_ASUS_LAPTOP] = {
14445 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14446 .init_verbs = { alc861_asus_init_verbs,
14447 alc861_asus_laptop_init_verbs },
14448 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14449 .dac_nids = alc861_dac_nids,
14450 .dig_out_nid = ALC861_DIGOUT_NID,
14451 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14452 .channel_mode = alc883_3ST_2ch_modes,
14454 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14455 .adc_nids = alc861_adc_nids,
14456 .input_mux = &alc861_capture_source,
14461 static int patch_alc861(struct hda_codec *codec)
14463 struct alc_spec *spec;
14467 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14471 codec->spec = spec;
14473 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14477 if (board_config < 0) {
14478 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14480 board_config = ALC861_AUTO;
14483 if (board_config == ALC861_AUTO) {
14484 /* automatic parse from the BIOS config */
14485 err = alc861_parse_auto_config(codec);
14491 "hda_codec: Cannot set up configuration "
14492 "from BIOS. Using base mode...\n");
14493 board_config = ALC861_3ST_DIG;
14497 err = snd_hda_attach_beep_device(codec, 0x23);
14503 if (board_config != ALC861_AUTO)
14504 setup_preset(spec, &alc861_presets[board_config]);
14506 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14507 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14509 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14510 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14512 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14514 spec->vmaster_nid = 0x03;
14516 codec->patch_ops = alc_patch_ops;
14517 if (board_config == ALC861_AUTO)
14518 spec->init_hook = alc861_auto_init;
14519 #ifdef CONFIG_SND_HDA_POWER_SAVE
14520 if (!spec->loopback.amplist)
14521 spec->loopback.amplist = alc861_loopbacks;
14523 codec->proc_widget_hook = print_realtek_coef;
14529 * ALC861-VD support
14533 * In addition, an independent DAC
14535 #define ALC861VD_DIGOUT_NID 0x06
14537 static hda_nid_t alc861vd_dac_nids[4] = {
14538 /* front, surr, clfe, side surr */
14539 0x02, 0x03, 0x04, 0x05
14542 /* dac_nids for ALC660vd are in a different order - according to
14543 * Realtek's driver.
14544 * This should probably result in a different mixer for 6stack models
14545 * of ALC660vd codecs, but for now there is only 3stack mixer
14546 * - and it is the same as in 861vd.
14547 * adc_nids in ALC660vd are (is) the same as in 861vd
14549 static hda_nid_t alc660vd_dac_nids[3] = {
14550 /* front, rear, clfe, rear_surr */
14554 static hda_nid_t alc861vd_adc_nids[1] = {
14559 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14562 /* FIXME: should be a matrix-type input source selection */
14563 static struct hda_input_mux alc861vd_capture_source = {
14567 { "Front Mic", 0x1 },
14573 static struct hda_input_mux alc861vd_dallas_capture_source = {
14576 { "Ext Mic", 0x0 },
14577 { "Int Mic", 0x1 },
14581 static struct hda_input_mux alc861vd_hp_capture_source = {
14584 { "Front Mic", 0x0 },
14585 { "ATAPI Mic", 0x1 },
14592 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14599 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14600 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14601 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14602 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14603 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14610 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14611 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14612 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14613 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14614 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14618 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14619 { 6, alc861vd_6stack_ch6_init },
14620 { 8, alc861vd_6stack_ch8_init },
14623 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14625 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14626 .name = "Channel Mode",
14627 .info = alc_ch_mode_info,
14628 .get = alc_ch_mode_get,
14629 .put = alc_ch_mode_put,
14634 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14635 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14637 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14638 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14639 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14641 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14642 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14644 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14646 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14648 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14649 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14651 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14652 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14654 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14656 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14657 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14658 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14660 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14661 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14662 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14664 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14665 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14667 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14668 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14673 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14674 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14675 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14677 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14679 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14680 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14681 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14683 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14684 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14685 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14687 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14688 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14690 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14691 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14696 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14697 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14698 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14699 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14701 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14703 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14704 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14705 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14707 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14708 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14709 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14711 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14712 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14717 /* Pin assignment: Speaker=0x14, HP = 0x15,
14718 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14720 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14721 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14722 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14723 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14724 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14725 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14726 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14727 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14728 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14729 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14730 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14734 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14735 * Front Mic=0x18, ATAPI Mic = 0x19,
14737 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14738 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14739 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14740 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14741 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14742 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14743 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14744 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14745 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14751 * generic initialization of ADC, input mixers and output mixers
14753 static struct hda_verb alc861vd_volume_init_verbs[] = {
14755 * Unmute ADC0 and set the default input to mic-in
14757 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14758 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14760 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14761 * the analog-loopback mixer widget
14763 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14764 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14765 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14766 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14767 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14768 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14770 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14777 * Set up output mixers (0x02 - 0x05)
14779 /* set vol=0 to output mixers */
14780 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14781 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14782 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14783 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14785 /* set up input amps for analog loopback */
14786 /* Amp Indices: DAC = 0, mixer = 1 */
14787 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14788 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14789 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14790 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14791 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14792 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14793 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14794 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14800 * 3-stack pin configuration:
14801 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14803 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14805 * Set pin mode and muting
14807 /* set front pin widgets 0x14 for output */
14808 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14809 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14810 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14812 /* Mic (rear) pin: input vref at 80% */
14813 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14814 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14815 /* Front Mic pin: input vref at 80% */
14816 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14817 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14818 /* Line In pin: input */
14819 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14820 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14821 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14822 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14823 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14824 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14825 /* CD pin widget for input */
14826 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14832 * 6-stack pin configuration:
14834 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14836 * Set pin mode and muting
14838 /* set front pin widgets 0x14 for output */
14839 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14840 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14841 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14843 /* Rear Pin: output 1 (0x0d) */
14844 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14845 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14846 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14847 /* CLFE Pin: output 2 (0x0e) */
14848 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14849 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14850 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14851 /* Side Pin: output 3 (0x0f) */
14852 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14853 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14854 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14856 /* Mic (rear) pin: input vref at 80% */
14857 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14858 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14859 /* Front Mic pin: input vref at 80% */
14860 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14861 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14862 /* Line In pin: input */
14863 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14864 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14865 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14866 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14867 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14868 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14869 /* CD pin widget for input */
14870 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14875 static struct hda_verb alc861vd_eapd_verbs[] = {
14876 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14880 static struct hda_verb alc660vd_eapd_verbs[] = {
14881 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14882 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14886 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14889 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14890 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14891 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14895 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14897 unsigned int present;
14898 unsigned char bits;
14900 present = snd_hda_codec_read(codec, 0x18, 0,
14901 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14902 bits = present ? HDA_AMP_MUTE : 0;
14903 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14904 HDA_AMP_MUTE, bits);
14907 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14909 struct alc_spec *spec = codec->spec;
14911 spec->autocfg.hp_pins[0] = 0x1b;
14912 spec->autocfg.speaker_pins[0] = 0x14;
14913 alc_automute_amp(codec);
14914 alc861vd_lenovo_mic_automute(codec);
14917 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14920 switch (res >> 26) {
14921 case ALC880_MIC_EVENT:
14922 alc861vd_lenovo_mic_automute(codec);
14925 alc_automute_amp_unsol_event(codec, res);
14930 static struct hda_verb alc861vd_dallas_verbs[] = {
14931 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14932 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14933 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14934 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14936 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14938 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14939 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14940 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14941 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14942 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14943 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14945 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14946 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14947 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14948 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14949 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14950 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14951 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14952 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14954 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14955 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14956 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14957 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14958 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14959 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14960 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14961 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14963 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14964 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14965 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14966 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14968 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14969 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14970 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14975 /* toggle speaker-output according to the hp-jack state */
14976 static void alc861vd_dallas_init_hook(struct hda_codec *codec)
14978 struct alc_spec *spec = codec->spec;
14980 spec->autocfg.hp_pins[0] = 0x15;
14981 spec->autocfg.speaker_pins[0] = 0x14;
14982 alc_automute_amp(codec);
14985 #ifdef CONFIG_SND_HDA_POWER_SAVE
14986 #define alc861vd_loopbacks alc880_loopbacks
14989 /* pcm configuration: identical with ALC880 */
14990 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14991 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14992 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14993 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14996 * configuration and preset
14998 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14999 [ALC660VD_3ST] = "3stack-660",
15000 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15001 [ALC660VD_ASUS_V1S] = "asus-v1s",
15002 [ALC861VD_3ST] = "3stack",
15003 [ALC861VD_3ST_DIG] = "3stack-digout",
15004 [ALC861VD_6ST_DIG] = "6stack-digout",
15005 [ALC861VD_LENOVO] = "lenovo",
15006 [ALC861VD_DALLAS] = "dallas",
15007 [ALC861VD_HP] = "hp",
15008 [ALC861VD_AUTO] = "auto",
15011 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15012 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15013 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15014 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15015 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
15016 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15017 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15018 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15019 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15020 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15021 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15022 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15023 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15024 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15025 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15026 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15030 static struct alc_config_preset alc861vd_presets[] = {
15032 .mixers = { alc861vd_3st_mixer },
15033 .init_verbs = { alc861vd_volume_init_verbs,
15034 alc861vd_3stack_init_verbs },
15035 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15036 .dac_nids = alc660vd_dac_nids,
15037 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15038 .channel_mode = alc861vd_3stack_2ch_modes,
15039 .input_mux = &alc861vd_capture_source,
15041 [ALC660VD_3ST_DIG] = {
15042 .mixers = { alc861vd_3st_mixer },
15043 .init_verbs = { alc861vd_volume_init_verbs,
15044 alc861vd_3stack_init_verbs },
15045 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15046 .dac_nids = alc660vd_dac_nids,
15047 .dig_out_nid = ALC861VD_DIGOUT_NID,
15048 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15049 .channel_mode = alc861vd_3stack_2ch_modes,
15050 .input_mux = &alc861vd_capture_source,
15053 .mixers = { alc861vd_3st_mixer },
15054 .init_verbs = { alc861vd_volume_init_verbs,
15055 alc861vd_3stack_init_verbs },
15056 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15057 .dac_nids = alc861vd_dac_nids,
15058 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15059 .channel_mode = alc861vd_3stack_2ch_modes,
15060 .input_mux = &alc861vd_capture_source,
15062 [ALC861VD_3ST_DIG] = {
15063 .mixers = { alc861vd_3st_mixer },
15064 .init_verbs = { alc861vd_volume_init_verbs,
15065 alc861vd_3stack_init_verbs },
15066 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15067 .dac_nids = alc861vd_dac_nids,
15068 .dig_out_nid = ALC861VD_DIGOUT_NID,
15069 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15070 .channel_mode = alc861vd_3stack_2ch_modes,
15071 .input_mux = &alc861vd_capture_source,
15073 [ALC861VD_6ST_DIG] = {
15074 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15075 .init_verbs = { alc861vd_volume_init_verbs,
15076 alc861vd_6stack_init_verbs },
15077 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15078 .dac_nids = alc861vd_dac_nids,
15079 .dig_out_nid = ALC861VD_DIGOUT_NID,
15080 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15081 .channel_mode = alc861vd_6stack_modes,
15082 .input_mux = &alc861vd_capture_source,
15084 [ALC861VD_LENOVO] = {
15085 .mixers = { alc861vd_lenovo_mixer },
15086 .init_verbs = { alc861vd_volume_init_verbs,
15087 alc861vd_3stack_init_verbs,
15088 alc861vd_eapd_verbs,
15089 alc861vd_lenovo_unsol_verbs },
15090 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15091 .dac_nids = alc660vd_dac_nids,
15092 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15093 .channel_mode = alc861vd_3stack_2ch_modes,
15094 .input_mux = &alc861vd_capture_source,
15095 .unsol_event = alc861vd_lenovo_unsol_event,
15096 .init_hook = alc861vd_lenovo_init_hook,
15098 [ALC861VD_DALLAS] = {
15099 .mixers = { alc861vd_dallas_mixer },
15100 .init_verbs = { alc861vd_dallas_verbs },
15101 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15102 .dac_nids = alc861vd_dac_nids,
15103 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15104 .channel_mode = alc861vd_3stack_2ch_modes,
15105 .input_mux = &alc861vd_dallas_capture_source,
15106 .unsol_event = alc_automute_amp_unsol_event,
15107 .init_hook = alc861vd_dallas_init_hook,
15110 .mixers = { alc861vd_hp_mixer },
15111 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15112 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15113 .dac_nids = alc861vd_dac_nids,
15114 .dig_out_nid = ALC861VD_DIGOUT_NID,
15115 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15116 .channel_mode = alc861vd_3stack_2ch_modes,
15117 .input_mux = &alc861vd_hp_capture_source,
15118 .unsol_event = alc_automute_amp_unsol_event,
15119 .init_hook = alc861vd_dallas_init_hook,
15121 [ALC660VD_ASUS_V1S] = {
15122 .mixers = { alc861vd_lenovo_mixer },
15123 .init_verbs = { alc861vd_volume_init_verbs,
15124 alc861vd_3stack_init_verbs,
15125 alc861vd_eapd_verbs,
15126 alc861vd_lenovo_unsol_verbs },
15127 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15128 .dac_nids = alc660vd_dac_nids,
15129 .dig_out_nid = ALC861VD_DIGOUT_NID,
15130 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15131 .channel_mode = alc861vd_3stack_2ch_modes,
15132 .input_mux = &alc861vd_capture_source,
15133 .unsol_event = alc861vd_lenovo_unsol_event,
15134 .init_hook = alc861vd_lenovo_init_hook,
15139 * BIOS auto configuration
15141 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15142 hda_nid_t nid, int pin_type, int dac_idx)
15144 alc_set_pin_output(codec, nid, pin_type);
15147 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15149 struct alc_spec *spec = codec->spec;
15152 for (i = 0; i <= HDA_SIDE; i++) {
15153 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15154 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15156 alc861vd_auto_set_output_and_unmute(codec, nid,
15162 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15164 struct alc_spec *spec = codec->spec;
15167 pin = spec->autocfg.hp_pins[0];
15168 if (pin) /* connect to front and use dac 0 */
15169 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15170 pin = spec->autocfg.speaker_pins[0];
15172 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15175 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
15176 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15178 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15180 struct alc_spec *spec = codec->spec;
15183 for (i = 0; i < AUTO_PIN_LAST; i++) {
15184 hda_nid_t nid = spec->autocfg.input_pins[i];
15185 if (alc861vd_is_input_pin(nid)) {
15186 alc_set_input_pin(codec, nid, i);
15187 if (nid != ALC861VD_PIN_CD_NID &&
15188 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15189 snd_hda_codec_write(codec, nid, 0,
15190 AC_VERB_SET_AMP_GAIN_MUTE,
15196 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15198 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15199 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15201 /* add playback controls from the parsed DAC table */
15202 /* Based on ALC880 version. But ALC861VD has separate,
15203 * different NIDs for mute/unmute switch and volume control */
15204 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15205 const struct auto_pin_cfg *cfg)
15208 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15209 hda_nid_t nid_v, nid_s;
15212 for (i = 0; i < cfg->line_outs; i++) {
15213 if (!spec->multiout.dac_nids[i])
15215 nid_v = alc861vd_idx_to_mixer_vol(
15217 spec->multiout.dac_nids[i]));
15218 nid_s = alc861vd_idx_to_mixer_switch(
15220 spec->multiout.dac_nids[i]));
15224 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15225 "Center Playback Volume",
15226 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15230 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15231 "LFE Playback Volume",
15232 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15236 err = add_control(spec, ALC_CTL_BIND_MUTE,
15237 "Center Playback Switch",
15238 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15242 err = add_control(spec, ALC_CTL_BIND_MUTE,
15243 "LFE Playback Switch",
15244 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15249 sprintf(name, "%s Playback Volume", chname[i]);
15250 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15251 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15255 sprintf(name, "%s Playback Switch", chname[i]);
15256 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15257 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15266 /* add playback controls for speaker and HP outputs */
15267 /* Based on ALC880 version. But ALC861VD has separate,
15268 * different NIDs for mute/unmute switch and volume control */
15269 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15270 hda_nid_t pin, const char *pfx)
15272 hda_nid_t nid_v, nid_s;
15279 if (alc880_is_fixed_pin(pin)) {
15280 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15281 /* specify the DAC as the extra output */
15282 if (!spec->multiout.hp_nid)
15283 spec->multiout.hp_nid = nid_v;
15285 spec->multiout.extra_out_nid[0] = nid_v;
15286 /* control HP volume/switch on the output mixer amp */
15287 nid_v = alc861vd_idx_to_mixer_vol(
15288 alc880_fixed_pin_idx(pin));
15289 nid_s = alc861vd_idx_to_mixer_switch(
15290 alc880_fixed_pin_idx(pin));
15292 sprintf(name, "%s Playback Volume", pfx);
15293 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15294 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15297 sprintf(name, "%s Playback Switch", pfx);
15298 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15299 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15302 } else if (alc880_is_multi_pin(pin)) {
15303 /* set manual connection */
15304 /* we have only a switch on HP-out PIN */
15305 sprintf(name, "%s Playback Switch", pfx);
15306 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15307 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15314 /* parse the BIOS configuration and set up the alc_spec
15315 * return 1 if successful, 0 if the proper config is not found,
15316 * or a negative error code
15317 * Based on ALC880 version - had to change it to override
15318 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15319 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15321 struct alc_spec *spec = codec->spec;
15323 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15325 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15329 if (!spec->autocfg.line_outs)
15330 return 0; /* can't find valid BIOS pin config */
15332 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15335 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15338 err = alc861vd_auto_create_extra_out(spec,
15339 spec->autocfg.speaker_pins[0],
15343 err = alc861vd_auto_create_extra_out(spec,
15344 spec->autocfg.hp_pins[0],
15348 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15352 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15354 if (spec->autocfg.dig_outs)
15355 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15357 if (spec->kctls.list)
15358 add_mixer(spec, spec->kctls.list);
15360 add_verb(spec, alc861vd_volume_init_verbs);
15362 spec->num_mux_defs = 1;
15363 spec->input_mux = &spec->private_imux[0];
15365 err = alc_auto_add_mic_boost(codec);
15369 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15374 /* additional initialization for auto-configuration model */
15375 static void alc861vd_auto_init(struct hda_codec *codec)
15377 struct alc_spec *spec = codec->spec;
15378 alc861vd_auto_init_multi_out(codec);
15379 alc861vd_auto_init_hp_out(codec);
15380 alc861vd_auto_init_analog_input(codec);
15381 alc861vd_auto_init_input_src(codec);
15382 if (spec->unsol_event)
15383 alc_inithook(codec);
15386 static int patch_alc861vd(struct hda_codec *codec)
15388 struct alc_spec *spec;
15389 int err, board_config;
15391 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15395 codec->spec = spec;
15397 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15401 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15402 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15404 board_config = ALC861VD_AUTO;
15407 if (board_config == ALC861VD_AUTO) {
15408 /* automatic parse from the BIOS config */
15409 err = alc861vd_parse_auto_config(codec);
15415 "hda_codec: Cannot set up configuration "
15416 "from BIOS. Using base mode...\n");
15417 board_config = ALC861VD_3ST;
15421 err = snd_hda_attach_beep_device(codec, 0x23);
15427 if (board_config != ALC861VD_AUTO)
15428 setup_preset(spec, &alc861vd_presets[board_config]);
15430 if (codec->vendor_id == 0x10ec0660) {
15431 /* always turn on EAPD */
15432 add_verb(spec, alc660vd_eapd_verbs);
15435 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15436 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15438 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15439 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15441 spec->adc_nids = alc861vd_adc_nids;
15442 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15443 spec->capsrc_nids = alc861vd_capsrc_nids;
15445 set_capture_mixer(spec);
15446 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15448 spec->vmaster_nid = 0x02;
15450 codec->patch_ops = alc_patch_ops;
15452 if (board_config == ALC861VD_AUTO)
15453 spec->init_hook = alc861vd_auto_init;
15454 #ifdef CONFIG_SND_HDA_POWER_SAVE
15455 if (!spec->loopback.amplist)
15456 spec->loopback.amplist = alc861vd_loopbacks;
15458 codec->proc_widget_hook = print_realtek_coef;
15466 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15467 * configuration. Each pin widget can choose any input DACs and a mixer.
15468 * Each ADC is connected from a mixer of all inputs. This makes possible
15469 * 6-channel independent captures.
15471 * In addition, an independent DAC for the multi-playback (not used in this
15474 #define ALC662_DIGOUT_NID 0x06
15475 #define ALC662_DIGIN_NID 0x0a
15477 static hda_nid_t alc662_dac_nids[4] = {
15478 /* front, rear, clfe, rear_surr */
15482 static hda_nid_t alc272_dac_nids[2] = {
15486 static hda_nid_t alc662_adc_nids[1] = {
15491 static hda_nid_t alc272_adc_nids[1] = {
15496 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15497 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15501 /* FIXME: should be a matrix-type input source selection */
15502 static struct hda_input_mux alc662_capture_source = {
15506 { "Front Mic", 0x1 },
15512 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15520 static struct hda_input_mux alc662_eeepc_capture_source = {
15528 static struct hda_input_mux alc663_capture_source = {
15532 { "Front Mic", 0x1 },
15537 static struct hda_input_mux alc663_m51va_capture_source = {
15540 { "Ext-Mic", 0x0 },
15545 #if 1 /* set to 0 for testing other input sources below */
15546 static struct hda_input_mux alc272_nc10_capture_source = {
15549 { "Autoselect Mic", 0x0 },
15550 { "Internal Mic", 0x1 },
15554 static struct hda_input_mux alc272_nc10_capture_source = {
15557 { "Autoselect Mic", 0x0 },
15558 { "Internal Mic", 0x1 },
15559 { "In-0x02", 0x2 },
15560 { "In-0x03", 0x3 },
15561 { "In-0x04", 0x4 },
15562 { "In-0x05", 0x5 },
15563 { "In-0x06", 0x6 },
15564 { "In-0x07", 0x7 },
15565 { "In-0x08", 0x8 },
15566 { "In-0x09", 0x9 },
15567 { "In-0x0a", 0x0a },
15568 { "In-0x0b", 0x0b },
15569 { "In-0x0c", 0x0c },
15570 { "In-0x0d", 0x0d },
15571 { "In-0x0e", 0x0e },
15572 { "In-0x0f", 0x0f },
15580 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15587 static struct hda_verb alc662_3ST_ch2_init[] = {
15588 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15589 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15590 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15591 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15598 static struct hda_verb alc662_3ST_ch6_init[] = {
15599 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15600 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15601 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15602 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15603 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15604 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15608 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15609 { 2, alc662_3ST_ch2_init },
15610 { 6, alc662_3ST_ch6_init },
15616 static struct hda_verb alc662_sixstack_ch6_init[] = {
15617 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15618 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15619 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15626 static struct hda_verb alc662_sixstack_ch8_init[] = {
15627 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15628 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15629 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15633 static struct hda_channel_mode alc662_5stack_modes[2] = {
15634 { 2, alc662_sixstack_ch6_init },
15635 { 6, alc662_sixstack_ch8_init },
15638 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15639 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15642 static struct snd_kcontrol_new alc662_base_mixer[] = {
15643 /* output mixer control */
15644 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15645 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15646 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15647 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15648 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15649 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15650 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15651 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15652 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15654 /*Input mixer control */
15655 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15656 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15657 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15658 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15659 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15660 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15661 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15662 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15666 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15667 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15668 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15669 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15670 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15671 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15672 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15673 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15674 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15675 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15676 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15677 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15681 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15682 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15683 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15684 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15685 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15686 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15687 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15688 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15689 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15690 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15691 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15692 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15693 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15694 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15697 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15698 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15702 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15703 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15704 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15705 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15706 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15707 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15708 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15709 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15710 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15711 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15715 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15716 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15717 ALC262_HIPPO_MASTER_SWITCH,
15719 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15720 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15721 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15723 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15724 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15725 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15729 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15730 ALC262_HIPPO_MASTER_SWITCH,
15731 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15732 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15733 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15734 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15735 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15736 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15737 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15738 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15739 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15743 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15744 .ops = &snd_hda_bind_vol,
15746 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15747 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15752 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15753 .ops = &snd_hda_bind_sw,
15755 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15756 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15761 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15762 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15763 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15764 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15765 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15769 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15770 .ops = &snd_hda_bind_sw,
15772 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15773 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15774 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15779 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15780 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15781 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15782 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15783 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15784 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15785 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15790 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15791 .ops = &snd_hda_bind_sw,
15793 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15794 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15795 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15800 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15801 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15802 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15805 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15806 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15810 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15811 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15812 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15813 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15814 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15815 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15816 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15817 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15821 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15822 .ops = &snd_hda_bind_vol,
15824 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15825 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15830 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15831 .ops = &snd_hda_bind_sw,
15833 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15834 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15839 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15840 HDA_BIND_VOL("Master Playback Volume",
15841 &alc663_asus_two_bind_master_vol),
15842 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15843 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15844 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15845 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15846 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15850 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15851 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15852 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15853 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15854 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15855 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15856 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15860 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15861 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15862 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15863 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15864 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15865 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15867 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15868 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15869 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15870 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15874 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15875 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15876 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15877 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15879 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15880 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15881 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15882 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15883 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15884 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15888 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15890 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15891 .name = "Channel Mode",
15892 .info = alc_ch_mode_info,
15893 .get = alc_ch_mode_get,
15894 .put = alc_ch_mode_put,
15899 static struct hda_verb alc662_init_verbs[] = {
15900 /* ADC: mute amp left and right */
15901 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15902 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15903 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15905 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15906 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15907 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15908 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15909 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15911 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15912 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15913 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15914 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15915 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15916 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15918 /* Front Pin: output 0 (0x0c) */
15919 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15920 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15922 /* Rear Pin: output 1 (0x0d) */
15923 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15924 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15926 /* CLFE Pin: output 2 (0x0e) */
15927 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15928 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15930 /* Mic (rear) pin: input vref at 80% */
15931 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15932 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15933 /* Front Mic pin: input vref at 80% */
15934 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15935 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15936 /* Line In pin: input */
15937 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15938 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15939 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15940 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15941 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15942 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15943 /* CD pin widget for input */
15944 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15946 /* FIXME: use matrix-type input source selection */
15947 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15949 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15950 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15952 /* always trun on EAPD */
15953 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15954 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15959 static struct hda_verb alc662_sue_init_verbs[] = {
15960 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15961 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15965 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15966 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15967 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15971 /* Set Unsolicited Event*/
15972 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15973 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15974 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15979 * generic initialization of ADC, input mixers and output mixers
15981 static struct hda_verb alc662_auto_init_verbs[] = {
15983 * Unmute ADC and set the default input to mic-in
15985 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15986 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15988 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15990 * Note: PASD motherboards uses the Line In 2 as the input for front
15991 * panel mic (mic 2)
15993 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15994 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15995 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15996 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15997 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15998 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16001 * Set up output mixers (0x0c - 0x0f)
16003 /* set vol=0 to output mixers */
16004 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16005 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16006 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16008 /* set up input amps for analog loopback */
16009 /* Amp Indices: DAC = 0, mixer = 1 */
16010 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16011 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16012 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16013 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16014 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16015 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16018 /* FIXME: use matrix-type input source selection */
16019 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16021 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16022 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16026 /* additional verbs for ALC663 */
16027 static struct hda_verb alc663_auto_init_verbs[] = {
16028 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16029 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16033 static struct hda_verb alc663_m51va_init_verbs[] = {
16034 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16035 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16036 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16037 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16038 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16041 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16042 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16046 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16047 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16048 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16049 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16050 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16051 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16052 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16053 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16057 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16058 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16059 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16060 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16061 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16062 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16064 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16065 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16069 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16070 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16071 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16072 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16073 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16074 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16075 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16076 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16080 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16081 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16082 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16083 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16084 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16085 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16086 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16087 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16088 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16089 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16090 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16091 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16092 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16096 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16097 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16098 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16099 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16100 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16101 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16102 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16103 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16105 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16106 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16107 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16108 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16112 static struct hda_verb alc663_g71v_init_verbs[] = {
16113 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16114 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16115 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16117 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16118 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16119 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16121 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16122 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16123 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16127 static struct hda_verb alc663_g50v_init_verbs[] = {
16128 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16129 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16130 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16132 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16133 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16137 static struct hda_verb alc662_ecs_init_verbs[] = {
16138 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16139 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16140 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16141 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16145 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16146 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16147 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16148 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16149 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16150 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16151 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16152 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16153 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16154 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16155 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16156 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16160 static struct hda_verb alc272_dell_init_verbs[] = {
16161 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16162 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16163 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16164 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16165 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16166 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16167 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16168 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16169 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16170 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16171 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16175 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16176 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16177 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16181 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16182 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16183 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16187 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16189 unsigned int present;
16190 unsigned char bits;
16192 present = snd_hda_codec_read(codec, 0x14, 0,
16193 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16194 bits = present ? HDA_AMP_MUTE : 0;
16195 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16196 HDA_AMP_MUTE, bits);
16199 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16201 unsigned int present;
16202 unsigned char bits;
16204 present = snd_hda_codec_read(codec, 0x1b, 0,
16205 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16206 bits = present ? HDA_AMP_MUTE : 0;
16207 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16208 HDA_AMP_MUTE, bits);
16209 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16210 HDA_AMP_MUTE, bits);
16213 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16216 if ((res >> 26) == ALC880_HP_EVENT)
16217 alc662_lenovo_101e_all_automute(codec);
16218 if ((res >> 26) == ALC880_FRONT_EVENT)
16219 alc662_lenovo_101e_ispeaker_automute(codec);
16222 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
16224 unsigned int present;
16226 present = snd_hda_codec_read(codec, 0x18, 0,
16227 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16228 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16229 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16230 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16231 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16232 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16233 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16234 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16235 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16238 /* unsolicited event for HP jack sensing */
16239 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16242 if ((res >> 26) == ALC880_MIC_EVENT)
16243 alc662_eeepc_mic_automute(codec);
16245 alc262_hippo_unsol_event(codec, res);
16248 static void alc662_eeepc_inithook(struct hda_codec *codec)
16250 alc262_hippo1_init_hook(codec);
16251 alc662_eeepc_mic_automute(codec);
16254 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
16256 struct alc_spec *spec = codec->spec;
16258 spec->autocfg.hp_pins[0] = 0x14;
16259 spec->autocfg.speaker_pins[0] = 0x1b;
16260 alc262_hippo_master_update(codec);
16263 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16265 unsigned int present;
16266 unsigned char bits;
16268 present = snd_hda_codec_read(codec, 0x21, 0,
16269 AC_VERB_GET_PIN_SENSE, 0)
16270 & AC_PINSENSE_PRESENCE;
16271 bits = present ? HDA_AMP_MUTE : 0;
16272 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16273 AMP_IN_MUTE(0), bits);
16274 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16275 AMP_IN_MUTE(0), bits);
16278 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16280 unsigned int present;
16281 unsigned char bits;
16283 present = snd_hda_codec_read(codec, 0x21, 0,
16284 AC_VERB_GET_PIN_SENSE, 0)
16285 & AC_PINSENSE_PRESENCE;
16286 bits = present ? HDA_AMP_MUTE : 0;
16287 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16288 AMP_IN_MUTE(0), bits);
16289 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16290 AMP_IN_MUTE(0), bits);
16291 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16292 AMP_IN_MUTE(0), bits);
16293 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16294 AMP_IN_MUTE(0), bits);
16297 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16299 unsigned int present;
16300 unsigned char bits;
16302 present = snd_hda_codec_read(codec, 0x15, 0,
16303 AC_VERB_GET_PIN_SENSE, 0)
16304 & AC_PINSENSE_PRESENCE;
16305 bits = present ? HDA_AMP_MUTE : 0;
16306 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16307 AMP_IN_MUTE(0), bits);
16308 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16309 AMP_IN_MUTE(0), bits);
16310 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16311 AMP_IN_MUTE(0), bits);
16312 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16313 AMP_IN_MUTE(0), bits);
16316 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16318 unsigned int present;
16319 unsigned char bits;
16321 present = snd_hda_codec_read(codec, 0x1b, 0,
16322 AC_VERB_GET_PIN_SENSE, 0)
16323 & AC_PINSENSE_PRESENCE;
16324 bits = present ? 0 : PIN_OUT;
16325 snd_hda_codec_write(codec, 0x14, 0,
16326 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16329 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16331 unsigned int present1, present2;
16333 present1 = snd_hda_codec_read(codec, 0x21, 0,
16334 AC_VERB_GET_PIN_SENSE, 0)
16335 & AC_PINSENSE_PRESENCE;
16336 present2 = snd_hda_codec_read(codec, 0x15, 0,
16337 AC_VERB_GET_PIN_SENSE, 0)
16338 & AC_PINSENSE_PRESENCE;
16340 if (present1 || present2) {
16341 snd_hda_codec_write_cache(codec, 0x14, 0,
16342 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16344 snd_hda_codec_write_cache(codec, 0x14, 0,
16345 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16349 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16351 unsigned int present1, present2;
16353 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16354 AC_VERB_GET_PIN_SENSE, 0)
16355 & AC_PINSENSE_PRESENCE;
16356 present2 = snd_hda_codec_read(codec, 0x15, 0,
16357 AC_VERB_GET_PIN_SENSE, 0)
16358 & AC_PINSENSE_PRESENCE;
16360 if (present1 || present2) {
16361 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16362 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16363 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16364 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16366 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16367 AMP_IN_MUTE(0), 0);
16368 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16369 AMP_IN_MUTE(0), 0);
16373 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16375 unsigned int present;
16377 present = snd_hda_codec_read(codec, 0x18, 0,
16378 AC_VERB_GET_PIN_SENSE, 0)
16379 & AC_PINSENSE_PRESENCE;
16380 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16381 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16382 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16383 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16384 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16385 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16386 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16387 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16390 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16393 switch (res >> 26) {
16394 case ALC880_HP_EVENT:
16395 alc663_m51va_speaker_automute(codec);
16397 case ALC880_MIC_EVENT:
16398 alc663_m51va_mic_automute(codec);
16403 static void alc663_m51va_inithook(struct hda_codec *codec)
16405 alc663_m51va_speaker_automute(codec);
16406 alc663_m51va_mic_automute(codec);
16409 /* ***************** Mode1 ******************************/
16410 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16413 switch (res >> 26) {
16414 case ALC880_HP_EVENT:
16415 alc663_m51va_speaker_automute(codec);
16417 case ALC880_MIC_EVENT:
16418 alc662_eeepc_mic_automute(codec);
16423 static void alc663_mode1_inithook(struct hda_codec *codec)
16425 alc663_m51va_speaker_automute(codec);
16426 alc662_eeepc_mic_automute(codec);
16428 /* ***************** Mode2 ******************************/
16429 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16432 switch (res >> 26) {
16433 case ALC880_HP_EVENT:
16434 alc662_f5z_speaker_automute(codec);
16436 case ALC880_MIC_EVENT:
16437 alc662_eeepc_mic_automute(codec);
16442 static void alc662_mode2_inithook(struct hda_codec *codec)
16444 alc662_f5z_speaker_automute(codec);
16445 alc662_eeepc_mic_automute(codec);
16447 /* ***************** Mode3 ******************************/
16448 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16451 switch (res >> 26) {
16452 case ALC880_HP_EVENT:
16453 alc663_two_hp_m1_speaker_automute(codec);
16455 case ALC880_MIC_EVENT:
16456 alc662_eeepc_mic_automute(codec);
16461 static void alc663_mode3_inithook(struct hda_codec *codec)
16463 alc663_two_hp_m1_speaker_automute(codec);
16464 alc662_eeepc_mic_automute(codec);
16466 /* ***************** Mode4 ******************************/
16467 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16470 switch (res >> 26) {
16471 case ALC880_HP_EVENT:
16472 alc663_21jd_two_speaker_automute(codec);
16474 case ALC880_MIC_EVENT:
16475 alc662_eeepc_mic_automute(codec);
16480 static void alc663_mode4_inithook(struct hda_codec *codec)
16482 alc663_21jd_two_speaker_automute(codec);
16483 alc662_eeepc_mic_automute(codec);
16485 /* ***************** Mode5 ******************************/
16486 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16489 switch (res >> 26) {
16490 case ALC880_HP_EVENT:
16491 alc663_15jd_two_speaker_automute(codec);
16493 case ALC880_MIC_EVENT:
16494 alc662_eeepc_mic_automute(codec);
16499 static void alc663_mode5_inithook(struct hda_codec *codec)
16501 alc663_15jd_two_speaker_automute(codec);
16502 alc662_eeepc_mic_automute(codec);
16504 /* ***************** Mode6 ******************************/
16505 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16508 switch (res >> 26) {
16509 case ALC880_HP_EVENT:
16510 alc663_two_hp_m2_speaker_automute(codec);
16512 case ALC880_MIC_EVENT:
16513 alc662_eeepc_mic_automute(codec);
16518 static void alc663_mode6_inithook(struct hda_codec *codec)
16520 alc663_two_hp_m2_speaker_automute(codec);
16521 alc662_eeepc_mic_automute(codec);
16524 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16526 unsigned int present;
16527 unsigned char bits;
16529 present = snd_hda_codec_read(codec, 0x21, 0,
16530 AC_VERB_GET_PIN_SENSE, 0)
16531 & AC_PINSENSE_PRESENCE;
16532 bits = present ? HDA_AMP_MUTE : 0;
16533 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16534 HDA_AMP_MUTE, bits);
16535 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16536 HDA_AMP_MUTE, bits);
16539 static void alc663_g71v_front_automute(struct hda_codec *codec)
16541 unsigned int present;
16542 unsigned char bits;
16544 present = snd_hda_codec_read(codec, 0x15, 0,
16545 AC_VERB_GET_PIN_SENSE, 0)
16546 & AC_PINSENSE_PRESENCE;
16547 bits = present ? HDA_AMP_MUTE : 0;
16548 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16549 HDA_AMP_MUTE, bits);
16552 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16555 switch (res >> 26) {
16556 case ALC880_HP_EVENT:
16557 alc663_g71v_hp_automute(codec);
16559 case ALC880_FRONT_EVENT:
16560 alc663_g71v_front_automute(codec);
16562 case ALC880_MIC_EVENT:
16563 alc662_eeepc_mic_automute(codec);
16568 static void alc663_g71v_inithook(struct hda_codec *codec)
16570 alc663_g71v_front_automute(codec);
16571 alc663_g71v_hp_automute(codec);
16572 alc662_eeepc_mic_automute(codec);
16575 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16578 switch (res >> 26) {
16579 case ALC880_HP_EVENT:
16580 alc663_m51va_speaker_automute(codec);
16582 case ALC880_MIC_EVENT:
16583 alc662_eeepc_mic_automute(codec);
16588 static void alc663_g50v_inithook(struct hda_codec *codec)
16590 alc663_m51va_speaker_automute(codec);
16591 alc662_eeepc_mic_automute(codec);
16594 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16595 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16596 ALC262_HIPPO_MASTER_SWITCH,
16598 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16599 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16600 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16602 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16603 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16604 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16608 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16609 /* Master Playback automatically created from Speaker and Headphone */
16610 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16611 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16612 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16613 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16615 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16616 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16617 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16619 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16620 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16621 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16625 #ifdef CONFIG_SND_HDA_POWER_SAVE
16626 #define alc662_loopbacks alc880_loopbacks
16630 /* pcm configuration: identical with ALC880 */
16631 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16632 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16633 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16634 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16637 * configuration and preset
16639 static const char *alc662_models[ALC662_MODEL_LAST] = {
16640 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16641 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16642 [ALC662_3ST_6ch] = "3stack-6ch",
16643 [ALC662_5ST_DIG] = "6stack-dig",
16644 [ALC662_LENOVO_101E] = "lenovo-101e",
16645 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16646 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16647 [ALC662_ECS] = "ecs",
16648 [ALC663_ASUS_M51VA] = "m51va",
16649 [ALC663_ASUS_G71V] = "g71v",
16650 [ALC663_ASUS_H13] = "h13",
16651 [ALC663_ASUS_G50V] = "g50v",
16652 [ALC663_ASUS_MODE1] = "asus-mode1",
16653 [ALC662_ASUS_MODE2] = "asus-mode2",
16654 [ALC663_ASUS_MODE3] = "asus-mode3",
16655 [ALC663_ASUS_MODE4] = "asus-mode4",
16656 [ALC663_ASUS_MODE5] = "asus-mode5",
16657 [ALC663_ASUS_MODE6] = "asus-mode6",
16658 [ALC272_DELL] = "dell",
16659 [ALC272_DELL_ZM1] = "dell-zm1",
16660 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16661 [ALC662_AUTO] = "auto",
16664 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16665 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16666 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16667 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16668 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16669 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16670 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16671 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16672 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16673 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16674 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16675 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16676 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16677 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16678 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16679 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16680 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16681 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16682 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16683 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16684 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16685 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16686 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16687 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16688 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16689 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16690 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16691 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16692 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16693 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16694 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16695 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16696 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16697 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16698 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16699 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16700 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16701 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16702 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16703 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16704 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16705 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16706 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16707 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16708 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16709 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16710 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16711 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16712 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16713 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16714 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16715 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16716 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16717 ALC662_3ST_6ch_DIG),
16718 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16719 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16720 ALC662_3ST_6ch_DIG),
16721 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16722 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16723 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16724 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16725 ALC662_3ST_6ch_DIG),
16726 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16731 static struct alc_config_preset alc662_presets[] = {
16732 [ALC662_3ST_2ch_DIG] = {
16733 .mixers = { alc662_3ST_2ch_mixer },
16734 .init_verbs = { alc662_init_verbs },
16735 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16736 .dac_nids = alc662_dac_nids,
16737 .dig_out_nid = ALC662_DIGOUT_NID,
16738 .dig_in_nid = ALC662_DIGIN_NID,
16739 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16740 .channel_mode = alc662_3ST_2ch_modes,
16741 .input_mux = &alc662_capture_source,
16743 [ALC662_3ST_6ch_DIG] = {
16744 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16745 .init_verbs = { alc662_init_verbs },
16746 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16747 .dac_nids = alc662_dac_nids,
16748 .dig_out_nid = ALC662_DIGOUT_NID,
16749 .dig_in_nid = ALC662_DIGIN_NID,
16750 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16751 .channel_mode = alc662_3ST_6ch_modes,
16753 .input_mux = &alc662_capture_source,
16755 [ALC662_3ST_6ch] = {
16756 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16757 .init_verbs = { alc662_init_verbs },
16758 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16759 .dac_nids = alc662_dac_nids,
16760 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16761 .channel_mode = alc662_3ST_6ch_modes,
16763 .input_mux = &alc662_capture_source,
16765 [ALC662_5ST_DIG] = {
16766 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16767 .init_verbs = { alc662_init_verbs },
16768 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16769 .dac_nids = alc662_dac_nids,
16770 .dig_out_nid = ALC662_DIGOUT_NID,
16771 .dig_in_nid = ALC662_DIGIN_NID,
16772 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16773 .channel_mode = alc662_5stack_modes,
16774 .input_mux = &alc662_capture_source,
16776 [ALC662_LENOVO_101E] = {
16777 .mixers = { alc662_lenovo_101e_mixer },
16778 .init_verbs = { alc662_init_verbs, alc662_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_2ch_modes),
16782 .channel_mode = alc662_3ST_2ch_modes,
16783 .input_mux = &alc662_lenovo_101e_capture_source,
16784 .unsol_event = alc662_lenovo_101e_unsol_event,
16785 .init_hook = alc662_lenovo_101e_all_automute,
16787 [ALC662_ASUS_EEEPC_P701] = {
16788 .mixers = { alc662_eeepc_p701_mixer },
16789 .init_verbs = { alc662_init_verbs,
16790 alc662_eeepc_sue_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 [ALC662_ASUS_EEEPC_EP20] = {
16800 .mixers = { alc662_eeepc_ep20_mixer,
16801 alc662_chmode_mixer },
16802 .init_verbs = { alc662_init_verbs,
16803 alc662_eeepc_ep20_sue_init_verbs },
16804 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16805 .dac_nids = alc662_dac_nids,
16806 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16807 .channel_mode = alc662_3ST_6ch_modes,
16808 .input_mux = &alc662_lenovo_101e_capture_source,
16809 .unsol_event = alc662_eeepc_unsol_event,
16810 .init_hook = alc662_eeepc_ep20_inithook,
16813 .mixers = { alc662_ecs_mixer },
16814 .init_verbs = { alc662_init_verbs,
16815 alc662_ecs_init_verbs },
16816 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16817 .dac_nids = alc662_dac_nids,
16818 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16819 .channel_mode = alc662_3ST_2ch_modes,
16820 .input_mux = &alc662_eeepc_capture_source,
16821 .unsol_event = alc662_eeepc_unsol_event,
16822 .init_hook = alc662_eeepc_inithook,
16824 [ALC663_ASUS_M51VA] = {
16825 .mixers = { alc663_m51va_mixer },
16826 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16827 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16828 .dac_nids = alc662_dac_nids,
16829 .dig_out_nid = ALC662_DIGOUT_NID,
16830 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16831 .channel_mode = alc662_3ST_2ch_modes,
16832 .input_mux = &alc663_m51va_capture_source,
16833 .unsol_event = alc663_m51va_unsol_event,
16834 .init_hook = alc663_m51va_inithook,
16836 [ALC663_ASUS_G71V] = {
16837 .mixers = { alc663_g71v_mixer },
16838 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16839 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16840 .dac_nids = alc662_dac_nids,
16841 .dig_out_nid = ALC662_DIGOUT_NID,
16842 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16843 .channel_mode = alc662_3ST_2ch_modes,
16844 .input_mux = &alc662_eeepc_capture_source,
16845 .unsol_event = alc663_g71v_unsol_event,
16846 .init_hook = alc663_g71v_inithook,
16848 [ALC663_ASUS_H13] = {
16849 .mixers = { alc663_m51va_mixer },
16850 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16851 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16852 .dac_nids = alc662_dac_nids,
16853 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16854 .channel_mode = alc662_3ST_2ch_modes,
16855 .input_mux = &alc663_m51va_capture_source,
16856 .unsol_event = alc663_m51va_unsol_event,
16857 .init_hook = alc663_m51va_inithook,
16859 [ALC663_ASUS_G50V] = {
16860 .mixers = { alc663_g50v_mixer },
16861 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16862 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16863 .dac_nids = alc662_dac_nids,
16864 .dig_out_nid = ALC662_DIGOUT_NID,
16865 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16866 .channel_mode = alc662_3ST_6ch_modes,
16867 .input_mux = &alc663_capture_source,
16868 .unsol_event = alc663_g50v_unsol_event,
16869 .init_hook = alc663_g50v_inithook,
16871 [ALC663_ASUS_MODE1] = {
16872 .mixers = { alc663_m51va_mixer },
16873 .cap_mixer = alc662_auto_capture_mixer,
16874 .init_verbs = { alc662_init_verbs,
16875 alc663_21jd_amic_init_verbs },
16876 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16878 .dac_nids = alc662_dac_nids,
16879 .dig_out_nid = ALC662_DIGOUT_NID,
16880 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16881 .channel_mode = alc662_3ST_2ch_modes,
16882 .input_mux = &alc662_eeepc_capture_source,
16883 .unsol_event = alc663_mode1_unsol_event,
16884 .init_hook = alc663_mode1_inithook,
16886 [ALC662_ASUS_MODE2] = {
16887 .mixers = { alc662_1bjd_mixer },
16888 .cap_mixer = alc662_auto_capture_mixer,
16889 .init_verbs = { alc662_init_verbs,
16890 alc662_1bjd_amic_init_verbs },
16891 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16892 .dac_nids = alc662_dac_nids,
16893 .dig_out_nid = ALC662_DIGOUT_NID,
16894 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16895 .channel_mode = alc662_3ST_2ch_modes,
16896 .input_mux = &alc662_eeepc_capture_source,
16897 .unsol_event = alc662_mode2_unsol_event,
16898 .init_hook = alc662_mode2_inithook,
16900 [ALC663_ASUS_MODE3] = {
16901 .mixers = { alc663_two_hp_m1_mixer },
16902 .cap_mixer = alc662_auto_capture_mixer,
16903 .init_verbs = { alc662_init_verbs,
16904 alc663_two_hp_amic_m1_init_verbs },
16905 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16907 .dac_nids = alc662_dac_nids,
16908 .dig_out_nid = ALC662_DIGOUT_NID,
16909 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16910 .channel_mode = alc662_3ST_2ch_modes,
16911 .input_mux = &alc662_eeepc_capture_source,
16912 .unsol_event = alc663_mode3_unsol_event,
16913 .init_hook = alc663_mode3_inithook,
16915 [ALC663_ASUS_MODE4] = {
16916 .mixers = { alc663_asus_21jd_clfe_mixer },
16917 .cap_mixer = alc662_auto_capture_mixer,
16918 .init_verbs = { alc662_init_verbs,
16919 alc663_21jd_amic_init_verbs},
16920 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16922 .dac_nids = alc662_dac_nids,
16923 .dig_out_nid = ALC662_DIGOUT_NID,
16924 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16925 .channel_mode = alc662_3ST_2ch_modes,
16926 .input_mux = &alc662_eeepc_capture_source,
16927 .unsol_event = alc663_mode4_unsol_event,
16928 .init_hook = alc663_mode4_inithook,
16930 [ALC663_ASUS_MODE5] = {
16931 .mixers = { alc663_asus_15jd_clfe_mixer },
16932 .cap_mixer = alc662_auto_capture_mixer,
16933 .init_verbs = { alc662_init_verbs,
16934 alc663_15jd_amic_init_verbs },
16935 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16937 .dac_nids = alc662_dac_nids,
16938 .dig_out_nid = ALC662_DIGOUT_NID,
16939 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16940 .channel_mode = alc662_3ST_2ch_modes,
16941 .input_mux = &alc662_eeepc_capture_source,
16942 .unsol_event = alc663_mode5_unsol_event,
16943 .init_hook = alc663_mode5_inithook,
16945 [ALC663_ASUS_MODE6] = {
16946 .mixers = { alc663_two_hp_m2_mixer },
16947 .cap_mixer = alc662_auto_capture_mixer,
16948 .init_verbs = { alc662_init_verbs,
16949 alc663_two_hp_amic_m2_init_verbs },
16950 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16952 .dac_nids = alc662_dac_nids,
16953 .dig_out_nid = ALC662_DIGOUT_NID,
16954 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16955 .channel_mode = alc662_3ST_2ch_modes,
16956 .input_mux = &alc662_eeepc_capture_source,
16957 .unsol_event = alc663_mode6_unsol_event,
16958 .init_hook = alc663_mode6_inithook,
16961 .mixers = { alc663_m51va_mixer },
16962 .cap_mixer = alc272_auto_capture_mixer,
16963 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16964 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16965 .dac_nids = alc662_dac_nids,
16966 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16967 .adc_nids = alc272_adc_nids,
16968 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16969 .capsrc_nids = alc272_capsrc_nids,
16970 .channel_mode = alc662_3ST_2ch_modes,
16971 .input_mux = &alc663_m51va_capture_source,
16972 .unsol_event = alc663_m51va_unsol_event,
16973 .init_hook = alc663_m51va_inithook,
16975 [ALC272_DELL_ZM1] = {
16976 .mixers = { alc663_m51va_mixer },
16977 .cap_mixer = alc662_auto_capture_mixer,
16978 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16979 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16980 .dac_nids = alc662_dac_nids,
16981 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16982 .adc_nids = alc662_adc_nids,
16983 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
16984 .capsrc_nids = alc662_capsrc_nids,
16985 .channel_mode = alc662_3ST_2ch_modes,
16986 .input_mux = &alc663_m51va_capture_source,
16987 .unsol_event = alc663_m51va_unsol_event,
16988 .init_hook = alc663_m51va_inithook,
16990 [ALC272_SAMSUNG_NC10] = {
16991 .mixers = { alc272_nc10_mixer },
16992 .init_verbs = { alc662_init_verbs,
16993 alc663_21jd_amic_init_verbs },
16994 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16995 .dac_nids = alc272_dac_nids,
16996 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16997 .channel_mode = alc662_3ST_2ch_modes,
16998 .input_mux = &alc272_nc10_capture_source,
16999 .unsol_event = alc663_mode4_unsol_event,
17000 .init_hook = alc663_mode4_inithook,
17006 * BIOS auto configuration
17009 /* add playback controls from the parsed DAC table */
17010 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
17011 const struct auto_pin_cfg *cfg)
17014 static const char *chname[4] = {
17015 "Front", "Surround", NULL /*CLFE*/, "Side"
17020 for (i = 0; i < cfg->line_outs; i++) {
17021 if (!spec->multiout.dac_nids[i])
17023 nid = alc880_idx_to_dac(i);
17026 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17027 "Center Playback Volume",
17028 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
17032 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17033 "LFE Playback Volume",
17034 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
17038 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17039 "Center Playback Switch",
17040 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17044 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17045 "LFE Playback Switch",
17046 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17051 sprintf(name, "%s Playback Volume", chname[i]);
17052 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17053 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
17057 sprintf(name, "%s Playback Switch", chname[i]);
17058 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17059 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
17068 /* add playback controls for speaker and HP outputs */
17069 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17080 /* ALC663 has a mono output pin on 0x17 */
17081 sprintf(name, "%s Playback Switch", pfx);
17082 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17083 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17087 if (alc880_is_fixed_pin(pin)) {
17088 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17089 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17090 /* specify the DAC as the extra output */
17091 if (!spec->multiout.hp_nid)
17092 spec->multiout.hp_nid = nid;
17094 spec->multiout.extra_out_nid[0] = nid;
17095 /* control HP volume/switch on the output mixer amp */
17096 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17097 sprintf(name, "%s Playback Volume", pfx);
17098 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17099 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17102 sprintf(name, "%s Playback Switch", pfx);
17103 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17104 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17107 } else if (alc880_is_multi_pin(pin)) {
17108 /* set manual connection */
17109 /* we have only a switch on HP-out PIN */
17110 sprintf(name, "%s Playback Switch", pfx);
17111 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17112 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17119 /* return the index of the src widget from the connection list of the nid.
17120 * return -1 if not found
17122 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
17125 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
17128 conns = snd_hda_get_connections(codec, nid, conn_list,
17129 ARRAY_SIZE(conn_list));
17132 for (i = 0; i < conns; i++)
17133 if (conn_list[i] == src)
17138 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
17140 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
17141 return (pincap & AC_PINCAP_IN) != 0;
17144 /* create playback/capture controls for input pins */
17145 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
17146 const struct auto_pin_cfg *cfg)
17148 struct alc_spec *spec = codec->spec;
17149 struct hda_input_mux *imux = &spec->private_imux[0];
17152 for (i = 0; i < AUTO_PIN_LAST; i++) {
17153 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
17154 idx = alc662_input_pin_idx(codec, 0x0b,
17155 cfg->input_pins[i]);
17157 err = new_analog_input(spec, cfg->input_pins[i],
17158 auto_pin_cfg_labels[i],
17163 idx = alc662_input_pin_idx(codec, 0x22,
17164 cfg->input_pins[i]);
17166 imux->items[imux->num_items].label =
17167 auto_pin_cfg_labels[i];
17168 imux->items[imux->num_items].index = idx;
17176 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17177 hda_nid_t nid, int pin_type,
17180 alc_set_pin_output(codec, nid, pin_type);
17181 /* need the manual connection? */
17182 if (alc880_is_multi_pin(nid)) {
17183 struct alc_spec *spec = codec->spec;
17184 int idx = alc880_multi_pin_idx(nid);
17185 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17186 AC_VERB_SET_CONNECT_SEL,
17187 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17191 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17193 struct alc_spec *spec = codec->spec;
17196 for (i = 0; i <= HDA_SIDE; i++) {
17197 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17198 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17200 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17205 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17207 struct alc_spec *spec = codec->spec;
17210 pin = spec->autocfg.hp_pins[0];
17211 if (pin) /* connect to front */
17213 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17214 pin = spec->autocfg.speaker_pins[0];
17216 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17219 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17221 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17223 struct alc_spec *spec = codec->spec;
17226 for (i = 0; i < AUTO_PIN_LAST; i++) {
17227 hda_nid_t nid = spec->autocfg.input_pins[i];
17228 if (alc662_is_input_pin(codec, nid)) {
17229 alc_set_input_pin(codec, nid, i);
17230 if (nid != ALC662_PIN_CD_NID &&
17231 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17232 snd_hda_codec_write(codec, nid, 0,
17233 AC_VERB_SET_AMP_GAIN_MUTE,
17239 #define alc662_auto_init_input_src alc882_auto_init_input_src
17241 static int alc662_parse_auto_config(struct hda_codec *codec)
17243 struct alc_spec *spec = codec->spec;
17245 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17247 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17251 if (!spec->autocfg.line_outs)
17252 return 0; /* can't find valid BIOS pin config */
17254 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17257 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17260 err = alc662_auto_create_extra_out(spec,
17261 spec->autocfg.speaker_pins[0],
17265 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17269 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
17273 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17275 if (spec->autocfg.dig_outs)
17276 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17278 if (spec->kctls.list)
17279 add_mixer(spec, spec->kctls.list);
17281 spec->num_mux_defs = 1;
17282 spec->input_mux = &spec->private_imux[0];
17284 add_verb(spec, alc662_auto_init_verbs);
17285 if (codec->vendor_id == 0x10ec0663)
17286 add_verb(spec, alc663_auto_init_verbs);
17288 err = alc_auto_add_mic_boost(codec);
17292 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17297 /* additional initialization for auto-configuration model */
17298 static void alc662_auto_init(struct hda_codec *codec)
17300 struct alc_spec *spec = codec->spec;
17301 alc662_auto_init_multi_out(codec);
17302 alc662_auto_init_hp_out(codec);
17303 alc662_auto_init_analog_input(codec);
17304 alc662_auto_init_input_src(codec);
17305 if (spec->unsol_event)
17306 alc_inithook(codec);
17309 static int patch_alc662(struct hda_codec *codec)
17311 struct alc_spec *spec;
17312 int err, board_config;
17314 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17318 codec->spec = spec;
17320 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17322 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17325 if (board_config < 0) {
17326 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17328 board_config = ALC662_AUTO;
17331 if (board_config == ALC662_AUTO) {
17332 /* automatic parse from the BIOS config */
17333 err = alc662_parse_auto_config(codec);
17339 "hda_codec: Cannot set up configuration "
17340 "from BIOS. Using base mode...\n");
17341 board_config = ALC662_3ST_2ch_DIG;
17345 err = snd_hda_attach_beep_device(codec, 0x1);
17351 if (board_config != ALC662_AUTO)
17352 setup_preset(spec, &alc662_presets[board_config]);
17354 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17355 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17357 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17358 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17360 spec->adc_nids = alc662_adc_nids;
17361 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17362 spec->capsrc_nids = alc662_capsrc_nids;
17364 if (!spec->cap_mixer)
17365 set_capture_mixer(spec);
17366 if (codec->vendor_id == 0x10ec0662)
17367 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17369 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17371 spec->vmaster_nid = 0x02;
17373 codec->patch_ops = alc_patch_ops;
17374 if (board_config == ALC662_AUTO)
17375 spec->init_hook = alc662_auto_init;
17376 #ifdef CONFIG_SND_HDA_POWER_SAVE
17377 if (!spec->loopback.amplist)
17378 spec->loopback.amplist = alc662_loopbacks;
17380 codec->proc_widget_hook = print_realtek_coef;
17388 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17389 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17390 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17391 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17392 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17393 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17394 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17395 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17396 .patch = patch_alc861 },
17397 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17398 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17399 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17400 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17401 .patch = patch_alc882 },
17402 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17403 .patch = patch_alc662 },
17404 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17405 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17406 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17407 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17408 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17409 .patch = patch_alc882 },
17410 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17411 .patch = patch_alc882 },
17412 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17413 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17414 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17415 .patch = patch_alc882 },
17416 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17417 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17418 {} /* terminator */
17421 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17423 MODULE_LICENSE("GPL");
17424 MODULE_DESCRIPTION("Realtek HD-audio codec");
17426 static struct hda_codec_preset_list realtek_list = {
17427 .preset = snd_hda_preset_realtek,
17428 .owner = THIS_MODULE,
17431 static int __init patch_realtek_init(void)
17433 return snd_hda_add_codec_preset(&realtek_list);
17436 static void __exit patch_realtek_exit(void)
17438 snd_hda_delete_codec_preset(&realtek_list);
17441 module_init(patch_realtek_init)
17442 module_exit(patch_realtek_exit)