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,
222 ALC883_TARGA_2ch_DIG,
225 ALC888_ACER_ASPIRE_4930G,
229 ALC883_LENOVO_101E_2ch,
230 ALC883_LENOVO_NB0763,
231 ALC888_LENOVO_MS7195_DIG,
238 ALC883_FUJITSU_PI2515,
239 ALC888_FUJITSU_XA3530,
240 ALC883_3ST_6ch_INTEL,
248 /* styles of capture selection */
250 CAPT_MUX = 0, /* only mux based */
251 CAPT_MIX, /* only mixer based */
252 CAPT_1MUX_MIX, /* first mux and other mixers */
256 #define GPIO_MASK 0x03
258 /* extra amp-initialization sequence types */
268 /* codec parameterization */
269 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
270 unsigned int num_mixers;
271 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
272 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
274 const struct hda_verb *init_verbs[5]; /* initialization verbs
278 unsigned int num_init_verbs;
280 char stream_name_analog[16]; /* analog PCM stream */
281 struct hda_pcm_stream *stream_analog_playback;
282 struct hda_pcm_stream *stream_analog_capture;
283 struct hda_pcm_stream *stream_analog_alt_playback;
284 struct hda_pcm_stream *stream_analog_alt_capture;
286 char stream_name_digital[16]; /* digital PCM stream */
287 struct hda_pcm_stream *stream_digital_playback;
288 struct hda_pcm_stream *stream_digital_capture;
291 struct hda_multi_out multiout; /* playback set-up
292 * max_channels, dacs must be set
293 * dig_out_nid and hp_nid are optional
295 hda_nid_t alt_dac_nid;
296 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
300 unsigned int num_adc_nids;
302 hda_nid_t *capsrc_nids;
303 hda_nid_t dig_in_nid; /* digital-in NID; optional */
304 int capture_style; /* capture style (CAPT_*) */
307 unsigned int num_mux_defs;
308 const struct hda_input_mux *input_mux;
309 unsigned int cur_mux[3];
312 const struct hda_channel_mode *channel_mode;
313 int num_channel_mode;
316 /* PCM information */
317 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
319 /* dynamic controls, init_verbs and input_mux */
320 struct auto_pin_cfg autocfg;
321 struct snd_array kctls;
322 struct hda_input_mux private_imux[3];
323 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
326 void (*init_hook)(struct hda_codec *codec);
327 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
329 /* for pin sensing */
330 unsigned int sense_updated: 1;
331 unsigned int jack_present: 1;
332 unsigned int master_sw: 1;
335 unsigned int no_analog :1; /* digital I/O only */
338 /* for virtual master */
339 hda_nid_t vmaster_nid;
340 #ifdef CONFIG_SND_HDA_POWER_SAVE
341 struct hda_loopback_check loopback;
346 unsigned int pll_coef_idx, pll_coef_bit;
350 * configuration template - to be copied to the spec instance
352 struct alc_config_preset {
353 struct snd_kcontrol_new *mixers[5]; /* should be identical size
356 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
357 const struct hda_verb *init_verbs[5];
358 unsigned int num_dacs;
360 hda_nid_t dig_out_nid; /* optional */
361 hda_nid_t hp_nid; /* optional */
362 hda_nid_t *slave_dig_outs;
363 unsigned int num_adc_nids;
365 hda_nid_t *capsrc_nids;
366 hda_nid_t dig_in_nid;
367 unsigned int num_channel_mode;
368 const struct hda_channel_mode *channel_mode;
370 unsigned int num_mux_defs;
371 const struct hda_input_mux *input_mux;
372 void (*unsol_event)(struct hda_codec *, unsigned int);
373 void (*init_hook)(struct hda_codec *);
374 #ifdef CONFIG_SND_HDA_POWER_SAVE
375 struct hda_amp_list *loopbacks;
383 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
384 struct snd_ctl_elem_info *uinfo)
386 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
387 struct alc_spec *spec = codec->spec;
388 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
389 if (mux_idx >= spec->num_mux_defs)
391 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
394 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
395 struct snd_ctl_elem_value *ucontrol)
397 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
398 struct alc_spec *spec = codec->spec;
399 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
401 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
405 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
406 struct snd_ctl_elem_value *ucontrol)
408 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
409 struct alc_spec *spec = codec->spec;
410 const struct hda_input_mux *imux;
411 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
412 unsigned int mux_idx;
413 hda_nid_t nid = spec->capsrc_nids ?
414 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
416 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
417 imux = &spec->input_mux[mux_idx];
419 if (spec->capture_style &&
420 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) {
421 /* Matrix-mixer style (e.g. ALC882) */
422 unsigned int *cur_val = &spec->cur_mux[adc_idx];
425 idx = ucontrol->value.enumerated.item[0];
426 if (idx >= imux->num_items)
427 idx = imux->num_items - 1;
430 for (i = 0; i < imux->num_items; i++) {
431 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
432 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
433 imux->items[i].index,
439 /* MUX style (e.g. ALC880) */
440 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
441 &spec->cur_mux[adc_idx]);
446 * channel mode setting
448 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
449 struct snd_ctl_elem_info *uinfo)
451 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
452 struct alc_spec *spec = codec->spec;
453 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
454 spec->num_channel_mode);
457 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
458 struct snd_ctl_elem_value *ucontrol)
460 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
461 struct alc_spec *spec = codec->spec;
462 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
463 spec->num_channel_mode,
464 spec->multiout.max_channels);
467 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
468 struct snd_ctl_elem_value *ucontrol)
470 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
471 struct alc_spec *spec = codec->spec;
472 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
473 spec->num_channel_mode,
474 &spec->multiout.max_channels);
475 if (err >= 0 && spec->need_dac_fix)
476 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
481 * Control the mode of pin widget settings via the mixer. "pc" is used
482 * instead of "%" to avoid consequences of accidently treating the % as
483 * being part of a format specifier. Maximum allowed length of a value is
484 * 63 characters plus NULL terminator.
486 * Note: some retasking pin complexes seem to ignore requests for input
487 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
488 * are requested. Therefore order this list so that this behaviour will not
489 * cause problems when mixer clients move through the enum sequentially.
490 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
493 static char *alc_pin_mode_names[] = {
494 "Mic 50pc bias", "Mic 80pc bias",
495 "Line in", "Line out", "Headphone out",
497 static unsigned char alc_pin_mode_values[] = {
498 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
500 /* The control can present all 5 options, or it can limit the options based
501 * in the pin being assumed to be exclusively an input or an output pin. In
502 * addition, "input" pins may or may not process the mic bias option
503 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
504 * accept requests for bias as of chip versions up to March 2006) and/or
505 * wiring in the computer.
507 #define ALC_PIN_DIR_IN 0x00
508 #define ALC_PIN_DIR_OUT 0x01
509 #define ALC_PIN_DIR_INOUT 0x02
510 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
511 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
513 /* Info about the pin modes supported by the different pin direction modes.
514 * For each direction the minimum and maximum values are given.
516 static signed char alc_pin_mode_dir_info[5][2] = {
517 { 0, 2 }, /* ALC_PIN_DIR_IN */
518 { 3, 4 }, /* ALC_PIN_DIR_OUT */
519 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
520 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
521 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
523 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
524 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
525 #define alc_pin_mode_n_items(_dir) \
526 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
528 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
529 struct snd_ctl_elem_info *uinfo)
531 unsigned int item_num = uinfo->value.enumerated.item;
532 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
534 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
536 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
538 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
539 item_num = alc_pin_mode_min(dir);
540 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
544 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
545 struct snd_ctl_elem_value *ucontrol)
548 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
549 hda_nid_t nid = kcontrol->private_value & 0xffff;
550 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
551 long *valp = ucontrol->value.integer.value;
552 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
553 AC_VERB_GET_PIN_WIDGET_CONTROL,
556 /* Find enumerated value for current pinctl setting */
557 i = alc_pin_mode_min(dir);
558 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
560 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
564 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
565 struct snd_ctl_elem_value *ucontrol)
568 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
569 hda_nid_t nid = kcontrol->private_value & 0xffff;
570 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
571 long val = *ucontrol->value.integer.value;
572 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
573 AC_VERB_GET_PIN_WIDGET_CONTROL,
576 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
577 val = alc_pin_mode_min(dir);
579 change = pinctl != alc_pin_mode_values[val];
581 /* Set pin mode to that requested */
582 snd_hda_codec_write_cache(codec, nid, 0,
583 AC_VERB_SET_PIN_WIDGET_CONTROL,
584 alc_pin_mode_values[val]);
586 /* Also enable the retasking pin's input/output as required
587 * for the requested pin mode. Enum values of 2 or less are
590 * Dynamically switching the input/output buffers probably
591 * reduces noise slightly (particularly on input) so we'll
592 * do it. However, having both input and output buffers
593 * enabled simultaneously doesn't seem to be problematic if
594 * this turns out to be necessary in the future.
597 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
598 HDA_AMP_MUTE, HDA_AMP_MUTE);
599 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
602 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
603 HDA_AMP_MUTE, HDA_AMP_MUTE);
604 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
611 #define ALC_PIN_MODE(xname, nid, dir) \
612 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
613 .info = alc_pin_mode_info, \
614 .get = alc_pin_mode_get, \
615 .put = alc_pin_mode_put, \
616 .private_value = nid | (dir<<16) }
618 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
619 * together using a mask with more than one bit set. This control is
620 * currently used only by the ALC260 test model. At this stage they are not
621 * needed for any "production" models.
623 #ifdef CONFIG_SND_DEBUG
624 #define alc_gpio_data_info snd_ctl_boolean_mono_info
626 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
627 struct snd_ctl_elem_value *ucontrol)
629 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
630 hda_nid_t nid = kcontrol->private_value & 0xffff;
631 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
632 long *valp = ucontrol->value.integer.value;
633 unsigned int val = snd_hda_codec_read(codec, nid, 0,
634 AC_VERB_GET_GPIO_DATA, 0x00);
636 *valp = (val & mask) != 0;
639 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
640 struct snd_ctl_elem_value *ucontrol)
643 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
644 hda_nid_t nid = kcontrol->private_value & 0xffff;
645 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
646 long val = *ucontrol->value.integer.value;
647 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
648 AC_VERB_GET_GPIO_DATA,
651 /* Set/unset the masked GPIO bit(s) as needed */
652 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
657 snd_hda_codec_write_cache(codec, nid, 0,
658 AC_VERB_SET_GPIO_DATA, gpio_data);
662 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
663 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
664 .info = alc_gpio_data_info, \
665 .get = alc_gpio_data_get, \
666 .put = alc_gpio_data_put, \
667 .private_value = nid | (mask<<16) }
668 #endif /* CONFIG_SND_DEBUG */
670 /* A switch control to allow the enabling of the digital IO pins on the
671 * ALC260. This is incredibly simplistic; the intention of this control is
672 * to provide something in the test model allowing digital outputs to be
673 * identified if present. If models are found which can utilise these
674 * outputs a more complete mixer control can be devised for those models if
677 #ifdef CONFIG_SND_DEBUG
678 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
680 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
681 struct snd_ctl_elem_value *ucontrol)
683 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
684 hda_nid_t nid = kcontrol->private_value & 0xffff;
685 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
686 long *valp = ucontrol->value.integer.value;
687 unsigned int val = snd_hda_codec_read(codec, nid, 0,
688 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
690 *valp = (val & mask) != 0;
693 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
694 struct snd_ctl_elem_value *ucontrol)
697 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
698 hda_nid_t nid = kcontrol->private_value & 0xffff;
699 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
700 long val = *ucontrol->value.integer.value;
701 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
702 AC_VERB_GET_DIGI_CONVERT_1,
705 /* Set/unset the masked control bit(s) as needed */
706 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
711 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
716 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
717 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
718 .info = alc_spdif_ctrl_info, \
719 .get = alc_spdif_ctrl_get, \
720 .put = alc_spdif_ctrl_put, \
721 .private_value = nid | (mask<<16) }
722 #endif /* CONFIG_SND_DEBUG */
724 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
725 * Again, this is only used in the ALC26x test models to help identify when
726 * the EAPD line must be asserted for features to work.
728 #ifdef CONFIG_SND_DEBUG
729 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
731 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
732 struct snd_ctl_elem_value *ucontrol)
734 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
735 hda_nid_t nid = kcontrol->private_value & 0xffff;
736 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
737 long *valp = ucontrol->value.integer.value;
738 unsigned int val = snd_hda_codec_read(codec, nid, 0,
739 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
741 *valp = (val & mask) != 0;
745 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
746 struct snd_ctl_elem_value *ucontrol)
749 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
750 hda_nid_t nid = kcontrol->private_value & 0xffff;
751 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
752 long val = *ucontrol->value.integer.value;
753 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
754 AC_VERB_GET_EAPD_BTLENABLE,
757 /* Set/unset the masked control bit(s) as needed */
758 change = (!val ? 0 : mask) != (ctrl_data & mask);
763 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
769 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
770 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
771 .info = alc_eapd_ctrl_info, \
772 .get = alc_eapd_ctrl_get, \
773 .put = alc_eapd_ctrl_put, \
774 .private_value = nid | (mask<<16) }
775 #endif /* CONFIG_SND_DEBUG */
778 * set up the input pin config (depending on the given auto-pin type)
780 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
783 unsigned int val = PIN_IN;
785 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
787 pincap = snd_hda_query_pin_caps(codec, nid);
788 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
789 if (pincap & AC_PINCAP_VREF_80)
792 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
797 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
799 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
801 spec->mixers[spec->num_mixers++] = mix;
804 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
806 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
808 spec->init_verbs[spec->num_init_verbs++] = verb;
811 #ifdef CONFIG_PROC_FS
815 static void print_realtek_coef(struct snd_info_buffer *buffer,
816 struct hda_codec *codec, hda_nid_t nid)
822 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
823 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
824 coeff = snd_hda_codec_read(codec, nid, 0,
825 AC_VERB_GET_COEF_INDEX, 0);
826 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
829 #define print_realtek_coef NULL
833 * set up from the preset table
835 static void setup_preset(struct alc_spec *spec,
836 const struct alc_config_preset *preset)
840 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
841 add_mixer(spec, preset->mixers[i]);
842 spec->cap_mixer = preset->cap_mixer;
843 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
845 add_verb(spec, preset->init_verbs[i]);
847 spec->channel_mode = preset->channel_mode;
848 spec->num_channel_mode = preset->num_channel_mode;
849 spec->need_dac_fix = preset->need_dac_fix;
851 spec->multiout.max_channels = spec->channel_mode[0].channels;
853 spec->multiout.num_dacs = preset->num_dacs;
854 spec->multiout.dac_nids = preset->dac_nids;
855 spec->multiout.dig_out_nid = preset->dig_out_nid;
856 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
857 spec->multiout.hp_nid = preset->hp_nid;
859 spec->num_mux_defs = preset->num_mux_defs;
860 if (!spec->num_mux_defs)
861 spec->num_mux_defs = 1;
862 spec->input_mux = preset->input_mux;
864 spec->num_adc_nids = preset->num_adc_nids;
865 spec->adc_nids = preset->adc_nids;
866 spec->capsrc_nids = preset->capsrc_nids;
867 spec->dig_in_nid = preset->dig_in_nid;
869 spec->unsol_event = preset->unsol_event;
870 spec->init_hook = preset->init_hook;
871 #ifdef CONFIG_SND_HDA_POWER_SAVE
872 spec->loopback.amplist = preset->loopbacks;
876 /* Enable GPIO mask and set output */
877 static struct hda_verb alc_gpio1_init_verbs[] = {
878 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
879 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
880 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
884 static struct hda_verb alc_gpio2_init_verbs[] = {
885 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
886 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
887 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
891 static struct hda_verb alc_gpio3_init_verbs[] = {
892 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
893 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
894 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
899 * Fix hardware PLL issue
900 * On some codecs, the analog PLL gating control must be off while
901 * the default value is 1.
903 static void alc_fix_pll(struct hda_codec *codec)
905 struct alc_spec *spec = codec->spec;
910 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
912 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
913 AC_VERB_GET_PROC_COEF, 0);
914 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
916 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
917 val & ~(1 << spec->pll_coef_bit));
920 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
921 unsigned int coef_idx, unsigned int coef_bit)
923 struct alc_spec *spec = codec->spec;
925 spec->pll_coef_idx = coef_idx;
926 spec->pll_coef_bit = coef_bit;
930 static void alc_automute_pin(struct hda_codec *codec)
932 struct alc_spec *spec = codec->spec;
933 unsigned int present;
934 unsigned int nid = spec->autocfg.hp_pins[0];
937 /* need to execute and sync at first */
938 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
939 present = snd_hda_codec_read(codec, nid, 0,
940 AC_VERB_GET_PIN_SENSE, 0);
941 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
942 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
943 nid = spec->autocfg.speaker_pins[i];
946 snd_hda_codec_write(codec, nid, 0,
947 AC_VERB_SET_PIN_WIDGET_CONTROL,
948 spec->jack_present ? 0 : PIN_OUT);
952 #if 0 /* it's broken in some acses -- temporarily disabled */
953 static void alc_mic_automute(struct hda_codec *codec)
955 struct alc_spec *spec = codec->spec;
956 unsigned int present;
957 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
958 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
959 unsigned int mix_nid = spec->capsrc_nids[0];
960 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
962 capsrc_idx_mic = mic_nid - 0x18;
963 capsrc_idx_fmic = fmic_nid - 0x18;
964 present = snd_hda_codec_read(codec, mic_nid, 0,
965 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
966 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
967 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
968 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
969 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
970 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
971 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
974 #define alc_mic_automute(codec) do {} while(0) /* NOP */
975 #endif /* disabled */
977 /* unsolicited event for HP jack sensing */
978 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
980 if (codec->vendor_id == 0x10ec0880)
985 case ALC880_HP_EVENT:
986 alc_automute_pin(codec);
988 case ALC880_MIC_EVENT:
989 alc_mic_automute(codec);
994 static void alc_inithook(struct hda_codec *codec)
996 alc_automute_pin(codec);
997 alc_mic_automute(codec);
1000 /* additional initialization for ALC888 variants */
1001 static void alc888_coef_init(struct hda_codec *codec)
1005 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1006 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1007 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1008 if ((tmp & 0xf0) == 0x20)
1010 snd_hda_codec_read(codec, 0x20, 0,
1011 AC_VERB_SET_PROC_COEF, 0x830);
1014 snd_hda_codec_read(codec, 0x20, 0,
1015 AC_VERB_SET_PROC_COEF, 0x3030);
1018 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1023 case ALC_INIT_GPIO1:
1024 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1026 case ALC_INIT_GPIO2:
1027 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1029 case ALC_INIT_GPIO3:
1030 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1032 case ALC_INIT_DEFAULT:
1033 switch (codec->vendor_id) {
1035 snd_hda_codec_write(codec, 0x0f, 0,
1036 AC_VERB_SET_EAPD_BTLENABLE, 2);
1037 snd_hda_codec_write(codec, 0x10, 0,
1038 AC_VERB_SET_EAPD_BTLENABLE, 2);
1050 snd_hda_codec_write(codec, 0x14, 0,
1051 AC_VERB_SET_EAPD_BTLENABLE, 2);
1052 snd_hda_codec_write(codec, 0x15, 0,
1053 AC_VERB_SET_EAPD_BTLENABLE, 2);
1056 switch (codec->vendor_id) {
1058 snd_hda_codec_write(codec, 0x1a, 0,
1059 AC_VERB_SET_COEF_INDEX, 7);
1060 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1061 AC_VERB_GET_PROC_COEF, 0);
1062 snd_hda_codec_write(codec, 0x1a, 0,
1063 AC_VERB_SET_COEF_INDEX, 7);
1064 snd_hda_codec_write(codec, 0x1a, 0,
1065 AC_VERB_SET_PROC_COEF,
1075 snd_hda_codec_write(codec, 0x20, 0,
1076 AC_VERB_SET_COEF_INDEX, 7);
1077 tmp = snd_hda_codec_read(codec, 0x20, 0,
1078 AC_VERB_GET_PROC_COEF, 0);
1079 snd_hda_codec_write(codec, 0x20, 0,
1080 AC_VERB_SET_COEF_INDEX, 7);
1081 snd_hda_codec_write(codec, 0x20, 0,
1082 AC_VERB_SET_PROC_COEF,
1086 alc888_coef_init(codec);
1090 snd_hda_codec_write(codec, 0x20, 0,
1091 AC_VERB_SET_COEF_INDEX, 7);
1092 tmp = snd_hda_codec_read(codec, 0x20, 0,
1093 AC_VERB_GET_PROC_COEF, 0);
1094 snd_hda_codec_write(codec, 0x20, 0,
1095 AC_VERB_SET_COEF_INDEX, 7);
1096 snd_hda_codec_write(codec, 0x20, 0,
1097 AC_VERB_SET_PROC_COEF,
1105 static void alc_init_auto_hp(struct hda_codec *codec)
1107 struct alc_spec *spec = codec->spec;
1109 if (!spec->autocfg.hp_pins[0])
1112 if (!spec->autocfg.speaker_pins[0]) {
1113 if (spec->autocfg.line_out_pins[0] &&
1114 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1115 spec->autocfg.speaker_pins[0] =
1116 spec->autocfg.line_out_pins[0];
1121 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1122 spec->autocfg.hp_pins[0]);
1123 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1124 AC_VERB_SET_UNSOLICITED_ENABLE,
1125 AC_USRSP_EN | ALC880_HP_EVENT);
1126 spec->unsol_event = alc_sku_unsol_event;
1129 /* check subsystem ID and set up device-specific initialization;
1130 * return 1 if initialized, 0 if invalid SSID
1132 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1133 * 31 ~ 16 : Manufacture ID
1135 * 7 ~ 0 : Assembly ID
1136 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1138 static int alc_subsystem_id(struct hda_codec *codec,
1139 hda_nid_t porta, hda_nid_t porte,
1142 unsigned int ass, tmp, i;
1144 struct alc_spec *spec = codec->spec;
1146 ass = codec->subsystem_id & 0xffff;
1147 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1150 /* invalid SSID, check the special NID pin defcfg instead */
1152 * 31~30 : port conetcivity
1155 * 19~16 : Check sum (15:1)
1160 if (codec->vendor_id == 0x10ec0260)
1162 ass = snd_hda_codec_get_pincfg(codec, nid);
1163 snd_printd("realtek: No valid SSID, "
1164 "checking pincfg 0x%08x for NID 0x%x\n",
1166 if (!(ass & 1) && !(ass & 0x100000))
1168 if ((ass >> 30) != 1) /* no physical connection */
1173 for (i = 1; i < 16; i++) {
1177 if (((ass >> 16) & 0xf) != tmp)
1180 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1181 ass & 0xffff, codec->vendor_id);
1185 * 2 : 0 --> Desktop, 1 --> Laptop
1186 * 3~5 : External Amplifier control
1189 tmp = (ass & 0x38) >> 3; /* external Amp control */
1192 spec->init_amp = ALC_INIT_GPIO1;
1195 spec->init_amp = ALC_INIT_GPIO2;
1198 spec->init_amp = ALC_INIT_GPIO3;
1201 spec->init_amp = ALC_INIT_DEFAULT;
1205 /* is laptop or Desktop and enable the function "Mute internal speaker
1206 * when the external headphone out jack is plugged"
1208 if (!(ass & 0x8000))
1211 * 10~8 : Jack location
1212 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1214 * 15 : 1 --> enable the function "Mute internal speaker
1215 * when the external headphone out jack is plugged"
1217 if (!spec->autocfg.hp_pins[0]) {
1218 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1220 spec->autocfg.hp_pins[0] = porta;
1222 spec->autocfg.hp_pins[0] = porte;
1224 spec->autocfg.hp_pins[0] = portd;
1229 alc_init_auto_hp(codec);
1233 static void alc_ssid_check(struct hda_codec *codec,
1234 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1236 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1237 struct alc_spec *spec = codec->spec;
1238 snd_printd("realtek: "
1239 "Enable default setup for auto mode as fallback\n");
1240 spec->init_amp = ALC_INIT_DEFAULT;
1241 alc_init_auto_hp(codec);
1246 * Fix-up pin default configurations
1254 static void alc_fix_pincfg(struct hda_codec *codec,
1255 const struct snd_pci_quirk *quirk,
1256 const struct alc_pincfg **pinfix)
1258 const struct alc_pincfg *cfg;
1260 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1264 cfg = pinfix[quirk->value];
1265 for (; cfg->nid; cfg++)
1266 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1276 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1277 /* Mic-in jack as mic in */
1278 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1279 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1280 /* Line-in jack as Line in */
1281 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1282 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1283 /* Line-Out as Front */
1284 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1291 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1292 /* Mic-in jack as mic in */
1293 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1294 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1295 /* Line-in jack as Surround */
1296 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1297 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1298 /* Line-Out as Front */
1299 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1306 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1307 /* Mic-in jack as CLFE */
1308 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1309 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1310 /* Line-in jack as Surround */
1311 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1312 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1313 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1314 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1321 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1322 /* Mic-in jack as CLFE */
1323 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1324 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1325 /* Line-in jack as Surround */
1326 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1327 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1328 /* Line-Out as Side */
1329 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1333 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1334 { 2, alc888_4ST_ch2_intel_init },
1335 { 4, alc888_4ST_ch4_intel_init },
1336 { 6, alc888_4ST_ch6_intel_init },
1337 { 8, alc888_4ST_ch8_intel_init },
1341 * ALC888 Fujitsu Siemens Amillo xa3530
1344 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1345 /* Front Mic: set to PIN_IN (empty by default) */
1346 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1347 /* Connect Internal HP to Front */
1348 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1349 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1350 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1351 /* Connect Bass HP to Front */
1352 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1353 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1354 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1355 /* Connect Line-Out side jack (SPDIF) to Side */
1356 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1357 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1358 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1359 /* Connect Mic jack to CLFE */
1360 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1361 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1362 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1363 /* Connect Line-in jack to Surround */
1364 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1365 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1366 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1367 /* Connect HP out jack to Front */
1368 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1369 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1370 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1371 /* Enable unsolicited event for HP jack and Line-out jack */
1372 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1373 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1377 static void alc_automute_amp(struct hda_codec *codec)
1379 struct alc_spec *spec = codec->spec;
1380 unsigned int val, mute;
1384 spec->jack_present = 0;
1385 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1386 nid = spec->autocfg.hp_pins[i];
1389 val = snd_hda_codec_read(codec, nid, 0,
1390 AC_VERB_GET_PIN_SENSE, 0);
1391 if (val & AC_PINSENSE_PRESENCE) {
1392 spec->jack_present = 1;
1397 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1398 /* Toggle internal speakers muting */
1399 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1400 nid = spec->autocfg.speaker_pins[i];
1403 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1404 HDA_AMP_MUTE, mute);
1408 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1411 if (codec->vendor_id == 0x10ec0880)
1415 if (res == ALC880_HP_EVENT)
1416 alc_automute_amp(codec);
1419 static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec)
1421 struct alc_spec *spec = codec->spec;
1423 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1424 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1425 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1426 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1427 alc_automute_amp(codec);
1431 * ALC888 Acer Aspire 4930G model
1434 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1435 /* Front Mic: set to PIN_IN (empty by default) */
1436 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1437 /* Unselect Front Mic by default in input mixer 3 */
1438 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1439 /* Enable unsolicited event for HP jack */
1440 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1441 /* Connect Internal HP to front */
1442 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1443 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1444 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1445 /* Connect HP out to front */
1446 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1447 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1448 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1452 static struct hda_input_mux alc888_2_capture_sources[2] = {
1453 /* Front mic only available on one ADC */
1460 { "Front Mic", 0xb },
1473 static struct snd_kcontrol_new alc888_base_mixer[] = {
1474 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1475 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1476 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1477 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1478 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1480 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1481 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1482 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1483 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1484 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1485 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1486 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1487 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1488 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1489 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1490 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1491 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1495 static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec)
1497 struct alc_spec *spec = codec->spec;
1499 spec->autocfg.hp_pins[0] = 0x15;
1500 spec->autocfg.speaker_pins[0] = 0x14;
1501 alc_automute_amp(codec);
1505 * ALC880 3-stack model
1507 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1508 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1509 * F-Mic = 0x1b, HP = 0x19
1512 static hda_nid_t alc880_dac_nids[4] = {
1513 /* front, rear, clfe, rear_surr */
1514 0x02, 0x05, 0x04, 0x03
1517 static hda_nid_t alc880_adc_nids[3] = {
1522 /* The datasheet says the node 0x07 is connected from inputs,
1523 * but it shows zero connection in the real implementation on some devices.
1524 * Note: this is a 915GAV bug, fixed on 915GLV
1526 static hda_nid_t alc880_adc_nids_alt[2] = {
1531 #define ALC880_DIGOUT_NID 0x06
1532 #define ALC880_DIGIN_NID 0x0a
1534 static struct hda_input_mux alc880_capture_source = {
1538 { "Front Mic", 0x3 },
1544 /* channel source setting (2/6 channel selection for 3-stack) */
1546 static struct hda_verb alc880_threestack_ch2_init[] = {
1547 /* set line-in to input, mute it */
1548 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1549 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1550 /* set mic-in to input vref 80%, mute it */
1551 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1552 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1557 static struct hda_verb alc880_threestack_ch6_init[] = {
1558 /* set line-in to output, unmute it */
1559 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1560 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1561 /* set mic-in to output, unmute it */
1562 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1563 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1567 static struct hda_channel_mode alc880_threestack_modes[2] = {
1568 { 2, alc880_threestack_ch2_init },
1569 { 6, alc880_threestack_ch6_init },
1572 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1573 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1574 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1575 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1576 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1577 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1578 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1579 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1580 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1581 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1582 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1583 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1584 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1585 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1586 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1587 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1588 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1589 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1591 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1592 .name = "Channel Mode",
1593 .info = alc_ch_mode_info,
1594 .get = alc_ch_mode_get,
1595 .put = alc_ch_mode_put,
1600 /* capture mixer elements */
1601 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1602 struct snd_ctl_elem_info *uinfo)
1604 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1605 struct alc_spec *spec = codec->spec;
1608 mutex_lock(&codec->control_mutex);
1609 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1611 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1612 mutex_unlock(&codec->control_mutex);
1616 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1617 unsigned int size, unsigned int __user *tlv)
1619 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1620 struct alc_spec *spec = codec->spec;
1623 mutex_lock(&codec->control_mutex);
1624 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1626 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1627 mutex_unlock(&codec->control_mutex);
1631 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1632 struct snd_ctl_elem_value *ucontrol);
1634 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1635 struct snd_ctl_elem_value *ucontrol,
1638 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1639 struct alc_spec *spec = codec->spec;
1640 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1643 mutex_lock(&codec->control_mutex);
1644 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1646 err = func(kcontrol, ucontrol);
1647 mutex_unlock(&codec->control_mutex);
1651 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1652 struct snd_ctl_elem_value *ucontrol)
1654 return alc_cap_getput_caller(kcontrol, ucontrol,
1655 snd_hda_mixer_amp_volume_get);
1658 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1659 struct snd_ctl_elem_value *ucontrol)
1661 return alc_cap_getput_caller(kcontrol, ucontrol,
1662 snd_hda_mixer_amp_volume_put);
1665 /* capture mixer elements */
1666 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1668 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1669 struct snd_ctl_elem_value *ucontrol)
1671 return alc_cap_getput_caller(kcontrol, ucontrol,
1672 snd_hda_mixer_amp_switch_get);
1675 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1676 struct snd_ctl_elem_value *ucontrol)
1678 return alc_cap_getput_caller(kcontrol, ucontrol,
1679 snd_hda_mixer_amp_switch_put);
1682 #define _DEFINE_CAPMIX(num) \
1684 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1685 .name = "Capture Switch", \
1686 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1688 .info = alc_cap_sw_info, \
1689 .get = alc_cap_sw_get, \
1690 .put = alc_cap_sw_put, \
1693 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1694 .name = "Capture Volume", \
1695 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1696 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1697 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1699 .info = alc_cap_vol_info, \
1700 .get = alc_cap_vol_get, \
1701 .put = alc_cap_vol_put, \
1702 .tlv = { .c = alc_cap_vol_tlv }, \
1705 #define _DEFINE_CAPSRC(num) \
1707 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1708 /* .name = "Capture Source", */ \
1709 .name = "Input Source", \
1711 .info = alc_mux_enum_info, \
1712 .get = alc_mux_enum_get, \
1713 .put = alc_mux_enum_put, \
1716 #define DEFINE_CAPMIX(num) \
1717 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1718 _DEFINE_CAPMIX(num), \
1719 _DEFINE_CAPSRC(num), \
1723 #define DEFINE_CAPMIX_NOSRC(num) \
1724 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1725 _DEFINE_CAPMIX(num), \
1729 /* up to three ADCs */
1733 DEFINE_CAPMIX_NOSRC(1);
1734 DEFINE_CAPMIX_NOSRC(2);
1735 DEFINE_CAPMIX_NOSRC(3);
1738 * ALC880 5-stack model
1740 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1742 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1743 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1746 /* additional mixers to alc880_three_stack_mixer */
1747 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1748 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1749 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1753 /* channel source setting (6/8 channel selection for 5-stack) */
1755 static struct hda_verb alc880_fivestack_ch6_init[] = {
1756 /* set line-in to input, mute it */
1757 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1758 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1763 static struct hda_verb alc880_fivestack_ch8_init[] = {
1764 /* set line-in to output, unmute it */
1765 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1766 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1770 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1771 { 6, alc880_fivestack_ch6_init },
1772 { 8, alc880_fivestack_ch8_init },
1777 * ALC880 6-stack model
1779 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1780 * Side = 0x05 (0x0f)
1781 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1782 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1785 static hda_nid_t alc880_6st_dac_nids[4] = {
1786 /* front, rear, clfe, rear_surr */
1787 0x02, 0x03, 0x04, 0x05
1790 static struct hda_input_mux alc880_6stack_capture_source = {
1794 { "Front Mic", 0x1 },
1800 /* fixed 8-channels */
1801 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1805 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1806 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1807 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1808 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1809 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1810 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1811 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1812 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1813 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1814 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1815 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1816 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1817 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1818 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1819 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1820 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1821 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1822 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1823 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1825 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1826 .name = "Channel Mode",
1827 .info = alc_ch_mode_info,
1828 .get = alc_ch_mode_get,
1829 .put = alc_ch_mode_put,
1838 * W810 has rear IO for:
1841 * Center/LFE (DAC 04)
1844 * The system also has a pair of internal speakers, and a headphone jack.
1845 * These are both connected to Line2 on the codec, hence to DAC 02.
1847 * There is a variable resistor to control the speaker or headphone
1848 * volume. This is a hardware-only device without a software API.
1850 * Plugging headphones in will disable the internal speakers. This is
1851 * implemented in hardware, not via the driver using jack sense. In
1852 * a similar fashion, plugging into the rear socket marked "front" will
1853 * disable both the speakers and headphones.
1855 * For input, there's a microphone jack, and an "audio in" jack.
1856 * These may not do anything useful with this driver yet, because I
1857 * haven't setup any initialization verbs for these yet...
1860 static hda_nid_t alc880_w810_dac_nids[3] = {
1861 /* front, rear/surround, clfe */
1865 /* fixed 6 channels */
1866 static struct hda_channel_mode alc880_w810_modes[1] = {
1870 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1871 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1872 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1873 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1874 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1875 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1876 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1877 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1878 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1879 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1880 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1888 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1889 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1893 static hda_nid_t alc880_z71v_dac_nids[1] = {
1896 #define ALC880_Z71V_HP_DAC 0x03
1898 /* fixed 2 channels */
1899 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1903 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1904 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1905 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1906 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1907 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1908 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1909 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1910 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1911 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1917 * ALC880 F1734 model
1919 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1920 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1923 static hda_nid_t alc880_f1734_dac_nids[1] = {
1926 #define ALC880_F1734_HP_DAC 0x02
1928 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1929 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1930 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1931 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1932 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1933 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1934 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1936 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1940 static struct hda_input_mux alc880_f1734_capture_source = {
1952 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1953 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1954 * Mic = 0x18, Line = 0x1a
1957 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1958 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1960 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1961 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1962 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1963 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1964 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1965 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1966 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1967 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1968 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1969 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1970 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1971 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1972 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1973 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1974 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1976 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1977 .name = "Channel Mode",
1978 .info = alc_ch_mode_info,
1979 .get = alc_ch_mode_get,
1980 .put = alc_ch_mode_put,
1986 * ALC880 ASUS W1V model
1988 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1989 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1990 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1993 /* additional mixers to alc880_asus_mixer */
1994 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1995 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1996 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2001 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2002 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2003 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2004 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2005 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2006 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2007 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2008 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2009 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2010 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2015 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2016 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2017 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2018 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2019 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2020 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2021 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2022 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2023 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2024 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2025 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2026 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2027 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2028 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2029 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2030 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2031 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2033 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2034 .name = "Channel Mode",
2035 .info = alc_ch_mode_info,
2036 .get = alc_ch_mode_get,
2037 .put = alc_ch_mode_put,
2042 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2043 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2044 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2045 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2046 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2047 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2048 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2049 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2050 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2051 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2052 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2056 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2057 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2058 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2059 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2060 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2061 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2062 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2067 * virtual master controls
2071 * slave controls for virtual master
2073 static const char *alc_slave_vols[] = {
2074 "Front Playback Volume",
2075 "Surround Playback Volume",
2076 "Center Playback Volume",
2077 "LFE Playback Volume",
2078 "Side Playback Volume",
2079 "Headphone Playback Volume",
2080 "Speaker Playback Volume",
2081 "Mono Playback Volume",
2082 "Line-Out Playback Volume",
2083 "PCM Playback Volume",
2087 static const char *alc_slave_sws[] = {
2088 "Front Playback Switch",
2089 "Surround Playback Switch",
2090 "Center Playback Switch",
2091 "LFE Playback Switch",
2092 "Side Playback Switch",
2093 "Headphone Playback Switch",
2094 "Speaker Playback Switch",
2095 "Mono Playback Switch",
2096 "IEC958 Playback Switch",
2101 * build control elements
2104 static void alc_free_kctls(struct hda_codec *codec);
2106 /* additional beep mixers; the actual parameters are overwritten at build */
2107 static struct snd_kcontrol_new alc_beep_mixer[] = {
2108 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2109 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2113 static int alc_build_controls(struct hda_codec *codec)
2115 struct alc_spec *spec = codec->spec;
2119 for (i = 0; i < spec->num_mixers; i++) {
2120 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2124 if (spec->cap_mixer) {
2125 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2129 if (spec->multiout.dig_out_nid) {
2130 err = snd_hda_create_spdif_out_ctls(codec,
2131 spec->multiout.dig_out_nid);
2134 if (!spec->no_analog) {
2135 err = snd_hda_create_spdif_share_sw(codec,
2139 spec->multiout.share_spdif = 1;
2142 if (spec->dig_in_nid) {
2143 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2148 /* create beep controls if needed */
2149 if (spec->beep_amp) {
2150 struct snd_kcontrol_new *knew;
2151 for (knew = alc_beep_mixer; knew->name; knew++) {
2152 struct snd_kcontrol *kctl;
2153 kctl = snd_ctl_new1(knew, codec);
2156 kctl->private_value = spec->beep_amp;
2157 err = snd_hda_ctl_add(codec, kctl);
2163 /* if we have no master control, let's create it */
2164 if (!spec->no_analog &&
2165 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2166 unsigned int vmaster_tlv[4];
2167 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2168 HDA_OUTPUT, vmaster_tlv);
2169 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2170 vmaster_tlv, alc_slave_vols);
2174 if (!spec->no_analog &&
2175 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2176 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2177 NULL, alc_slave_sws);
2182 alc_free_kctls(codec); /* no longer needed */
2188 * initialize the codec volumes, etc
2192 * generic initialization of ADC, input mixers and output mixers
2194 static struct hda_verb alc880_volume_init_verbs[] = {
2196 * Unmute ADC0-2 and set the default input to mic-in
2198 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2199 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2200 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2201 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2202 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2203 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2205 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2207 * Note: PASD motherboards uses the Line In 2 as the input for front
2210 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2211 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2212 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2213 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2214 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2215 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2216 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2217 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2220 * Set up output mixers (0x0c - 0x0f)
2222 /* set vol=0 to output mixers */
2223 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2224 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2225 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2226 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2227 /* set up input amps for analog loopback */
2228 /* Amp Indices: DAC = 0, mixer = 1 */
2229 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2230 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2231 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2232 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2233 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2234 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2235 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2236 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2242 * 3-stack pin configuration:
2243 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2245 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2247 * preset connection lists of input pins
2248 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2250 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2251 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2252 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2255 * Set pin mode and muting
2257 /* set front pin widgets 0x14 for output */
2258 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2259 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2260 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2261 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2262 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2263 /* Mic2 (as headphone out) for HP output */
2264 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2265 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2266 /* Line In pin widget for input */
2267 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2268 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2269 /* Line2 (as front mic) pin widget for input and vref at 80% */
2270 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2271 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2272 /* CD pin widget for input */
2273 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2279 * 5-stack pin configuration:
2280 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2281 * line-in/side = 0x1a, f-mic = 0x1b
2283 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2285 * preset connection lists of input pins
2286 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2288 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2289 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2292 * Set pin mode and muting
2294 /* set pin widgets 0x14-0x17 for output */
2295 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2296 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2297 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2298 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2299 /* unmute pins for output (no gain on this amp) */
2300 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2301 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2302 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2303 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2305 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2306 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2307 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2308 /* Mic2 (as headphone out) for HP output */
2309 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2310 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2311 /* Line In pin widget for input */
2312 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2313 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2314 /* Line2 (as front mic) pin widget for input and vref at 80% */
2315 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2316 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2317 /* CD pin widget for input */
2318 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2324 * W810 pin configuration:
2325 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2327 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2328 /* hphone/speaker input selector: front DAC */
2329 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2331 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2332 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2333 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2334 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2335 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2336 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2338 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2339 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2345 * Z71V pin configuration:
2346 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2348 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2349 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2350 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2351 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2352 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2354 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2355 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2356 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2357 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2363 * 6-stack pin configuration:
2364 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2365 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2367 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2368 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2370 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2371 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2372 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2373 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2374 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2375 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2376 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2377 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2379 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2380 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2381 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2382 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2383 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2384 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2385 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2386 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2387 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2393 * Uniwill pin configuration:
2394 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2397 static struct hda_verb alc880_uniwill_init_verbs[] = {
2398 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2400 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2401 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2402 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2403 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2404 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2405 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2406 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2407 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2408 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2409 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2410 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2411 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2412 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2413 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2415 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2416 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2417 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2418 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2419 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2420 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2421 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2422 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2423 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2425 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2426 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2433 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2435 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2436 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2438 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2439 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2440 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2441 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2442 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2443 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2444 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2445 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2446 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2447 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2448 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2449 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2451 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2452 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2453 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2454 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2455 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2456 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2458 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2459 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2464 static struct hda_verb alc880_beep_init_verbs[] = {
2465 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2469 /* auto-toggle front mic */
2470 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2472 unsigned int present;
2475 present = snd_hda_codec_read(codec, 0x18, 0,
2476 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2477 bits = present ? HDA_AMP_MUTE : 0;
2478 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2481 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2483 struct alc_spec *spec = codec->spec;
2485 spec->autocfg.hp_pins[0] = 0x14;
2486 spec->autocfg.speaker_pins[0] = 0x15;
2487 spec->autocfg.speaker_pins[0] = 0x16;
2488 alc_automute_amp(codec);
2489 alc880_uniwill_mic_automute(codec);
2492 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2495 /* Looks like the unsol event is incompatible with the standard
2496 * definition. 4bit tag is placed at 28 bit!
2498 switch (res >> 28) {
2499 case ALC880_MIC_EVENT:
2500 alc880_uniwill_mic_automute(codec);
2503 alc_automute_amp_unsol_event(codec, res);
2508 static void alc880_uniwill_p53_init_hook(struct hda_codec *codec)
2510 struct alc_spec *spec = codec->spec;
2512 spec->autocfg.hp_pins[0] = 0x14;
2513 spec->autocfg.speaker_pins[0] = 0x15;
2514 alc_automute_amp(codec);
2517 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2519 unsigned int present;
2521 present = snd_hda_codec_read(codec, 0x21, 0,
2522 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2523 present &= HDA_AMP_VOLMASK;
2524 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2525 HDA_AMP_VOLMASK, present);
2526 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2527 HDA_AMP_VOLMASK, present);
2530 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2533 /* Looks like the unsol event is incompatible with the standard
2534 * definition. 4bit tag is placed at 28 bit!
2536 if ((res >> 28) == ALC880_DCVOL_EVENT)
2537 alc880_uniwill_p53_dcvol_automute(codec);
2539 alc_automute_amp_unsol_event(codec, res);
2543 * F1734 pin configuration:
2544 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2546 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2547 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2548 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2549 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2550 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2551 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2553 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2554 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2555 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2556 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2558 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2559 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2560 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2561 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2562 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2563 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2564 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2565 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2566 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2568 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2569 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2575 * ASUS pin configuration:
2576 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2578 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2579 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2580 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2581 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2582 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2584 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2585 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2586 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2587 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2588 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2589 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2590 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2591 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2593 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2594 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2595 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2596 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2597 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2598 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2599 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2600 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2601 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2606 /* Enable GPIO mask and set output */
2607 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2608 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2610 /* Clevo m520g init */
2611 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2612 /* headphone output */
2613 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2615 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2616 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2618 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2619 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2621 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2622 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2623 /* Mic1 (rear panel) */
2624 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2625 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2626 /* Mic2 (front panel) */
2627 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2628 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2630 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2631 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2632 /* change to EAPD mode */
2633 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2634 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2639 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2640 /* change to EAPD mode */
2641 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2642 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2644 /* Headphone output */
2645 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2647 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2648 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2650 /* Line In pin widget for input */
2651 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2652 /* CD pin widget for input */
2653 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2654 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2655 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2657 /* change to EAPD mode */
2658 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2659 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2665 * LG m1 express dual
2668 * Rear Line-In/Out (blue): 0x14
2669 * Build-in Mic-In: 0x15
2671 * HP-Out (green): 0x1b
2672 * Mic-In/Out (red): 0x19
2676 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2677 static hda_nid_t alc880_lg_dac_nids[3] = {
2681 /* seems analog CD is not working */
2682 static struct hda_input_mux alc880_lg_capture_source = {
2687 { "Internal Mic", 0x6 },
2691 /* 2,4,6 channel modes */
2692 static struct hda_verb alc880_lg_ch2_init[] = {
2693 /* set line-in and mic-in to input */
2694 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2695 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2699 static struct hda_verb alc880_lg_ch4_init[] = {
2700 /* set line-in to out and mic-in to input */
2701 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2702 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2706 static struct hda_verb alc880_lg_ch6_init[] = {
2707 /* set line-in and mic-in to output */
2708 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2709 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2713 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2714 { 2, alc880_lg_ch2_init },
2715 { 4, alc880_lg_ch4_init },
2716 { 6, alc880_lg_ch6_init },
2719 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2720 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2721 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2722 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2723 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2724 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2725 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2726 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2727 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2728 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2729 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2730 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2731 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2732 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2733 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2735 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2736 .name = "Channel Mode",
2737 .info = alc_ch_mode_info,
2738 .get = alc_ch_mode_get,
2739 .put = alc_ch_mode_put,
2744 static struct hda_verb alc880_lg_init_verbs[] = {
2745 /* set capture source to mic-in */
2746 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2747 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2748 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2749 /* mute all amp mixer inputs */
2750 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2751 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2752 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2753 /* line-in to input */
2754 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2755 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2757 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2758 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2760 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2761 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2762 /* mic-in to input */
2763 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2765 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2767 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2768 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2769 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2771 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2775 /* toggle speaker-output according to the hp-jack state */
2776 static void alc880_lg_init_hook(struct hda_codec *codec)
2778 struct alc_spec *spec = codec->spec;
2780 spec->autocfg.hp_pins[0] = 0x1b;
2781 spec->autocfg.speaker_pins[0] = 0x17;
2782 alc_automute_amp(codec);
2791 * Built-in Mic-In: 0x19
2797 static struct hda_input_mux alc880_lg_lw_capture_source = {
2801 { "Internal Mic", 0x1 },
2806 #define alc880_lg_lw_modes alc880_threestack_modes
2808 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2809 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2810 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2811 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2812 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2813 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2814 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2815 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2816 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2817 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2818 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2819 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2820 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2821 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2822 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2824 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2825 .name = "Channel Mode",
2826 .info = alc_ch_mode_info,
2827 .get = alc_ch_mode_get,
2828 .put = alc_ch_mode_put,
2833 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2834 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2835 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2836 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2838 /* set capture source to mic-in */
2839 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2840 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2841 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2842 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2844 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2845 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2847 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2848 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2849 /* mic-in to input */
2850 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2851 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2853 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2854 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2856 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2860 /* toggle speaker-output according to the hp-jack state */
2861 static void alc880_lg_lw_init_hook(struct hda_codec *codec)
2863 struct alc_spec *spec = codec->spec;
2865 spec->autocfg.hp_pins[0] = 0x1b;
2866 spec->autocfg.speaker_pins[0] = 0x14;
2867 alc_automute_amp(codec);
2870 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2871 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2872 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2874 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2875 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2876 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2880 static struct hda_input_mux alc880_medion_rim_capture_source = {
2884 { "Internal Mic", 0x1 },
2888 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2889 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2891 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2892 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2894 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2895 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2896 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2897 /* Mic2 (as headphone out) for HP output */
2898 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2899 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2900 /* Internal Speaker */
2901 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2902 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2904 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2905 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2907 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2911 /* toggle speaker-output according to the hp-jack state */
2912 static void alc880_medion_rim_automute(struct hda_codec *codec)
2914 struct alc_spec *spec = codec->spec;
2915 alc_automute_amp(codec);
2917 if (spec->jack_present)
2918 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2920 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2923 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2926 /* Looks like the unsol event is incompatible with the standard
2927 * definition. 4bit tag is placed at 28 bit!
2929 if ((res >> 28) == ALC880_HP_EVENT)
2930 alc880_medion_rim_automute(codec);
2933 static void alc880_medion_rim_init_hook(struct hda_codec *codec)
2935 struct alc_spec *spec = codec->spec;
2937 spec->autocfg.hp_pins[0] = 0x14;
2938 spec->autocfg.speaker_pins[0] = 0x1b;
2939 alc880_medion_rim_automute(codec);
2942 #ifdef CONFIG_SND_HDA_POWER_SAVE
2943 static struct hda_amp_list alc880_loopbacks[] = {
2944 { 0x0b, HDA_INPUT, 0 },
2945 { 0x0b, HDA_INPUT, 1 },
2946 { 0x0b, HDA_INPUT, 2 },
2947 { 0x0b, HDA_INPUT, 3 },
2948 { 0x0b, HDA_INPUT, 4 },
2952 static struct hda_amp_list alc880_lg_loopbacks[] = {
2953 { 0x0b, HDA_INPUT, 1 },
2954 { 0x0b, HDA_INPUT, 6 },
2955 { 0x0b, HDA_INPUT, 7 },
2964 static int alc_init(struct hda_codec *codec)
2966 struct alc_spec *spec = codec->spec;
2970 alc_auto_init_amp(codec, spec->init_amp);
2972 for (i = 0; i < spec->num_init_verbs; i++)
2973 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2975 if (spec->init_hook)
2976 spec->init_hook(codec);
2981 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2983 struct alc_spec *spec = codec->spec;
2985 if (spec->unsol_event)
2986 spec->unsol_event(codec, res);
2989 #ifdef CONFIG_SND_HDA_POWER_SAVE
2990 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2992 struct alc_spec *spec = codec->spec;
2993 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2998 * Analog playback callbacks
3000 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3001 struct hda_codec *codec,
3002 struct snd_pcm_substream *substream)
3004 struct alc_spec *spec = codec->spec;
3005 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3009 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3010 struct hda_codec *codec,
3011 unsigned int stream_tag,
3012 unsigned int format,
3013 struct snd_pcm_substream *substream)
3015 struct alc_spec *spec = codec->spec;
3016 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3017 stream_tag, format, substream);
3020 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3021 struct hda_codec *codec,
3022 struct snd_pcm_substream *substream)
3024 struct alc_spec *spec = codec->spec;
3025 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3031 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3032 struct hda_codec *codec,
3033 struct snd_pcm_substream *substream)
3035 struct alc_spec *spec = codec->spec;
3036 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3039 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3040 struct hda_codec *codec,
3041 unsigned int stream_tag,
3042 unsigned int format,
3043 struct snd_pcm_substream *substream)
3045 struct alc_spec *spec = codec->spec;
3046 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3047 stream_tag, format, substream);
3050 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3051 struct hda_codec *codec,
3052 struct snd_pcm_substream *substream)
3054 struct alc_spec *spec = codec->spec;
3055 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3058 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3059 struct hda_codec *codec,
3060 struct snd_pcm_substream *substream)
3062 struct alc_spec *spec = codec->spec;
3063 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3069 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3070 struct hda_codec *codec,
3071 unsigned int stream_tag,
3072 unsigned int format,
3073 struct snd_pcm_substream *substream)
3075 struct alc_spec *spec = codec->spec;
3077 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3078 stream_tag, 0, format);
3082 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3083 struct hda_codec *codec,
3084 struct snd_pcm_substream *substream)
3086 struct alc_spec *spec = codec->spec;
3088 snd_hda_codec_cleanup_stream(codec,
3089 spec->adc_nids[substream->number + 1]);
3096 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3100 /* NID is set in alc_build_pcms */
3102 .open = alc880_playback_pcm_open,
3103 .prepare = alc880_playback_pcm_prepare,
3104 .cleanup = alc880_playback_pcm_cleanup
3108 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3112 /* NID is set in alc_build_pcms */
3115 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3119 /* NID is set in alc_build_pcms */
3122 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3123 .substreams = 2, /* can be overridden */
3126 /* NID is set in alc_build_pcms */
3128 .prepare = alc880_alt_capture_pcm_prepare,
3129 .cleanup = alc880_alt_capture_pcm_cleanup
3133 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3137 /* NID is set in alc_build_pcms */
3139 .open = alc880_dig_playback_pcm_open,
3140 .close = alc880_dig_playback_pcm_close,
3141 .prepare = alc880_dig_playback_pcm_prepare,
3142 .cleanup = alc880_dig_playback_pcm_cleanup
3146 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3150 /* NID is set in alc_build_pcms */
3153 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3154 static struct hda_pcm_stream alc_pcm_null_stream = {
3160 static int alc_build_pcms(struct hda_codec *codec)
3162 struct alc_spec *spec = codec->spec;
3163 struct hda_pcm *info = spec->pcm_rec;
3166 codec->num_pcms = 1;
3167 codec->pcm_info = info;
3169 if (spec->no_analog)
3172 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3173 "%s Analog", codec->chip_name);
3174 info->name = spec->stream_name_analog;
3176 if (spec->stream_analog_playback) {
3177 if (snd_BUG_ON(!spec->multiout.dac_nids))
3179 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3180 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3182 if (spec->stream_analog_capture) {
3183 if (snd_BUG_ON(!spec->adc_nids))
3185 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3186 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3189 if (spec->channel_mode) {
3190 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3191 for (i = 0; i < spec->num_channel_mode; i++) {
3192 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3193 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3199 /* SPDIF for stream index #1 */
3200 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3201 snprintf(spec->stream_name_digital,
3202 sizeof(spec->stream_name_digital),
3203 "%s Digital", codec->chip_name);
3204 codec->num_pcms = 2;
3205 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3206 info = spec->pcm_rec + 1;
3207 info->name = spec->stream_name_digital;
3208 if (spec->dig_out_type)
3209 info->pcm_type = spec->dig_out_type;
3211 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3212 if (spec->multiout.dig_out_nid &&
3213 spec->stream_digital_playback) {
3214 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3215 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3217 if (spec->dig_in_nid &&
3218 spec->stream_digital_capture) {
3219 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3220 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3222 /* FIXME: do we need this for all Realtek codec models? */
3223 codec->spdif_status_reset = 1;
3226 if (spec->no_analog)
3229 /* If the use of more than one ADC is requested for the current
3230 * model, configure a second analog capture-only PCM.
3232 /* Additional Analaog capture for index #2 */
3233 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3234 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3235 codec->num_pcms = 3;
3236 info = spec->pcm_rec + 2;
3237 info->name = spec->stream_name_analog;
3238 if (spec->alt_dac_nid) {
3239 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3240 *spec->stream_analog_alt_playback;
3241 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3244 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3245 alc_pcm_null_stream;
3246 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3248 if (spec->num_adc_nids > 1) {
3249 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3250 *spec->stream_analog_alt_capture;
3251 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3253 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3254 spec->num_adc_nids - 1;
3256 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3257 alc_pcm_null_stream;
3258 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3265 static void alc_free_kctls(struct hda_codec *codec)
3267 struct alc_spec *spec = codec->spec;
3269 if (spec->kctls.list) {
3270 struct snd_kcontrol_new *kctl = spec->kctls.list;
3272 for (i = 0; i < spec->kctls.used; i++)
3273 kfree(kctl[i].name);
3275 snd_array_free(&spec->kctls);
3278 static void alc_free(struct hda_codec *codec)
3280 struct alc_spec *spec = codec->spec;
3285 alc_free_kctls(codec);
3287 snd_hda_detach_beep_device(codec);
3290 #ifdef SND_HDA_NEEDS_RESUME
3291 static int alc_resume(struct hda_codec *codec)
3293 codec->patch_ops.init(codec);
3294 snd_hda_codec_resume_amp(codec);
3295 snd_hda_codec_resume_cache(codec);
3302 static struct hda_codec_ops alc_patch_ops = {
3303 .build_controls = alc_build_controls,
3304 .build_pcms = alc_build_pcms,
3307 .unsol_event = alc_unsol_event,
3308 #ifdef SND_HDA_NEEDS_RESUME
3309 .resume = alc_resume,
3311 #ifdef CONFIG_SND_HDA_POWER_SAVE
3312 .check_power_status = alc_check_power_status,
3318 * Test configuration for debugging
3320 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3323 #ifdef CONFIG_SND_DEBUG
3324 static hda_nid_t alc880_test_dac_nids[4] = {
3325 0x02, 0x03, 0x04, 0x05
3328 static struct hda_input_mux alc880_test_capture_source = {
3337 { "Surround", 0x6 },
3341 static struct hda_channel_mode alc880_test_modes[4] = {
3348 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3349 struct snd_ctl_elem_info *uinfo)
3351 static char *texts[] = {
3352 "N/A", "Line Out", "HP Out",
3353 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3355 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3357 uinfo->value.enumerated.items = 8;
3358 if (uinfo->value.enumerated.item >= 8)
3359 uinfo->value.enumerated.item = 7;
3360 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3364 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3365 struct snd_ctl_elem_value *ucontrol)
3367 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3368 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3369 unsigned int pin_ctl, item = 0;
3371 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3372 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3373 if (pin_ctl & AC_PINCTL_OUT_EN) {
3374 if (pin_ctl & AC_PINCTL_HP_EN)
3378 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3379 switch (pin_ctl & AC_PINCTL_VREFEN) {
3380 case AC_PINCTL_VREF_HIZ: item = 3; break;
3381 case AC_PINCTL_VREF_50: item = 4; break;
3382 case AC_PINCTL_VREF_GRD: item = 5; break;
3383 case AC_PINCTL_VREF_80: item = 6; break;
3384 case AC_PINCTL_VREF_100: item = 7; break;
3387 ucontrol->value.enumerated.item[0] = item;
3391 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3392 struct snd_ctl_elem_value *ucontrol)
3394 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3395 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3396 static unsigned int ctls[] = {
3397 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3398 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3399 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3400 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3401 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3402 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3404 unsigned int old_ctl, new_ctl;
3406 old_ctl = snd_hda_codec_read(codec, nid, 0,
3407 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3408 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3409 if (old_ctl != new_ctl) {
3411 snd_hda_codec_write_cache(codec, nid, 0,
3412 AC_VERB_SET_PIN_WIDGET_CONTROL,
3414 val = ucontrol->value.enumerated.item[0] >= 3 ?
3416 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3423 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3424 struct snd_ctl_elem_info *uinfo)
3426 static char *texts[] = {
3427 "Front", "Surround", "CLFE", "Side"
3429 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3431 uinfo->value.enumerated.items = 4;
3432 if (uinfo->value.enumerated.item >= 4)
3433 uinfo->value.enumerated.item = 3;
3434 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3438 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3439 struct snd_ctl_elem_value *ucontrol)
3441 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3442 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3445 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3446 ucontrol->value.enumerated.item[0] = sel & 3;
3450 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3451 struct snd_ctl_elem_value *ucontrol)
3453 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3454 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3457 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3458 if (ucontrol->value.enumerated.item[0] != sel) {
3459 sel = ucontrol->value.enumerated.item[0] & 3;
3460 snd_hda_codec_write_cache(codec, nid, 0,
3461 AC_VERB_SET_CONNECT_SEL, sel);
3467 #define PIN_CTL_TEST(xname,nid) { \
3468 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3470 .info = alc_test_pin_ctl_info, \
3471 .get = alc_test_pin_ctl_get, \
3472 .put = alc_test_pin_ctl_put, \
3473 .private_value = nid \
3476 #define PIN_SRC_TEST(xname,nid) { \
3477 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3479 .info = alc_test_pin_src_info, \
3480 .get = alc_test_pin_src_get, \
3481 .put = alc_test_pin_src_put, \
3482 .private_value = nid \
3485 static struct snd_kcontrol_new alc880_test_mixer[] = {
3486 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3487 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3488 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3489 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3490 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3491 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3492 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3493 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3494 PIN_CTL_TEST("Front Pin Mode", 0x14),
3495 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3496 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3497 PIN_CTL_TEST("Side Pin Mode", 0x17),
3498 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3499 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3500 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3501 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3502 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3503 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3504 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3505 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3506 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3507 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3508 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3509 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3510 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3511 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3512 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3513 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3514 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3515 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3517 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3518 .name = "Channel Mode",
3519 .info = alc_ch_mode_info,
3520 .get = alc_ch_mode_get,
3521 .put = alc_ch_mode_put,
3526 static struct hda_verb alc880_test_init_verbs[] = {
3527 /* Unmute inputs of 0x0c - 0x0f */
3528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3529 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3530 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3531 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3532 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3533 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3534 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3535 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3536 /* Vol output for 0x0c-0x0f */
3537 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3538 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3539 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3540 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3541 /* Set output pins 0x14-0x17 */
3542 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3543 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3544 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3545 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3546 /* Unmute output pins 0x14-0x17 */
3547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3548 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3549 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3550 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3551 /* Set input pins 0x18-0x1c */
3552 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3553 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3554 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3555 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3556 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3557 /* Mute input pins 0x18-0x1b */
3558 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3559 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3560 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3561 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3563 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3564 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3565 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3566 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3567 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3568 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3569 /* Analog input/passthru */
3570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3572 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3573 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3574 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3582 static const char *alc880_models[ALC880_MODEL_LAST] = {
3583 [ALC880_3ST] = "3stack",
3584 [ALC880_TCL_S700] = "tcl",
3585 [ALC880_3ST_DIG] = "3stack-digout",
3586 [ALC880_CLEVO] = "clevo",
3587 [ALC880_5ST] = "5stack",
3588 [ALC880_5ST_DIG] = "5stack-digout",
3589 [ALC880_W810] = "w810",
3590 [ALC880_Z71V] = "z71v",
3591 [ALC880_6ST] = "6stack",
3592 [ALC880_6ST_DIG] = "6stack-digout",
3593 [ALC880_ASUS] = "asus",
3594 [ALC880_ASUS_W1V] = "asus-w1v",
3595 [ALC880_ASUS_DIG] = "asus-dig",
3596 [ALC880_ASUS_DIG2] = "asus-dig2",
3597 [ALC880_UNIWILL_DIG] = "uniwill",
3598 [ALC880_UNIWILL_P53] = "uniwill-p53",
3599 [ALC880_FUJITSU] = "fujitsu",
3600 [ALC880_F1734] = "F1734",
3602 [ALC880_LG_LW] = "lg-lw",
3603 [ALC880_MEDION_RIM] = "medion",
3604 #ifdef CONFIG_SND_DEBUG
3605 [ALC880_TEST] = "test",
3607 [ALC880_AUTO] = "auto",
3610 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3611 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3612 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3613 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3614 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3615 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3616 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3617 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3618 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3619 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3620 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3621 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3622 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3623 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3624 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3625 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3626 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3627 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3628 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3629 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3630 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3631 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3632 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3633 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3634 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3635 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3636 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3637 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3638 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3639 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3640 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3641 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3642 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3643 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3644 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3645 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3646 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3647 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3648 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3649 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3650 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3651 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3652 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3653 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3654 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3655 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3656 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3657 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3658 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3659 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3660 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3661 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3662 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3663 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3664 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3665 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3666 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3667 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3668 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3669 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3670 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3671 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3672 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3673 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3674 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3675 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3676 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3677 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3678 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3680 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3681 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3682 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3687 * ALC880 codec presets
3689 static struct alc_config_preset alc880_presets[] = {
3691 .mixers = { alc880_three_stack_mixer },
3692 .init_verbs = { alc880_volume_init_verbs,
3693 alc880_pin_3stack_init_verbs },
3694 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3695 .dac_nids = alc880_dac_nids,
3696 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3697 .channel_mode = alc880_threestack_modes,
3699 .input_mux = &alc880_capture_source,
3701 [ALC880_3ST_DIG] = {
3702 .mixers = { alc880_three_stack_mixer },
3703 .init_verbs = { alc880_volume_init_verbs,
3704 alc880_pin_3stack_init_verbs },
3705 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3706 .dac_nids = alc880_dac_nids,
3707 .dig_out_nid = ALC880_DIGOUT_NID,
3708 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3709 .channel_mode = alc880_threestack_modes,
3711 .input_mux = &alc880_capture_source,
3713 [ALC880_TCL_S700] = {
3714 .mixers = { alc880_tcl_s700_mixer },
3715 .init_verbs = { alc880_volume_init_verbs,
3716 alc880_pin_tcl_S700_init_verbs,
3717 alc880_gpio2_init_verbs },
3718 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3719 .dac_nids = alc880_dac_nids,
3720 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3721 .num_adc_nids = 1, /* single ADC */
3723 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3724 .channel_mode = alc880_2_jack_modes,
3725 .input_mux = &alc880_capture_source,
3728 .mixers = { alc880_three_stack_mixer,
3729 alc880_five_stack_mixer},
3730 .init_verbs = { alc880_volume_init_verbs,
3731 alc880_pin_5stack_init_verbs },
3732 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3733 .dac_nids = alc880_dac_nids,
3734 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3735 .channel_mode = alc880_fivestack_modes,
3736 .input_mux = &alc880_capture_source,
3738 [ALC880_5ST_DIG] = {
3739 .mixers = { alc880_three_stack_mixer,
3740 alc880_five_stack_mixer },
3741 .init_verbs = { alc880_volume_init_verbs,
3742 alc880_pin_5stack_init_verbs },
3743 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3744 .dac_nids = alc880_dac_nids,
3745 .dig_out_nid = ALC880_DIGOUT_NID,
3746 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3747 .channel_mode = alc880_fivestack_modes,
3748 .input_mux = &alc880_capture_source,
3751 .mixers = { alc880_six_stack_mixer },
3752 .init_verbs = { alc880_volume_init_verbs,
3753 alc880_pin_6stack_init_verbs },
3754 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3755 .dac_nids = alc880_6st_dac_nids,
3756 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3757 .channel_mode = alc880_sixstack_modes,
3758 .input_mux = &alc880_6stack_capture_source,
3760 [ALC880_6ST_DIG] = {
3761 .mixers = { alc880_six_stack_mixer },
3762 .init_verbs = { alc880_volume_init_verbs,
3763 alc880_pin_6stack_init_verbs },
3764 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3765 .dac_nids = alc880_6st_dac_nids,
3766 .dig_out_nid = ALC880_DIGOUT_NID,
3767 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3768 .channel_mode = alc880_sixstack_modes,
3769 .input_mux = &alc880_6stack_capture_source,
3772 .mixers = { alc880_w810_base_mixer },
3773 .init_verbs = { alc880_volume_init_verbs,
3774 alc880_pin_w810_init_verbs,
3775 alc880_gpio2_init_verbs },
3776 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3777 .dac_nids = alc880_w810_dac_nids,
3778 .dig_out_nid = ALC880_DIGOUT_NID,
3779 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3780 .channel_mode = alc880_w810_modes,
3781 .input_mux = &alc880_capture_source,
3784 .mixers = { alc880_z71v_mixer },
3785 .init_verbs = { alc880_volume_init_verbs,
3786 alc880_pin_z71v_init_verbs },
3787 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3788 .dac_nids = alc880_z71v_dac_nids,
3789 .dig_out_nid = ALC880_DIGOUT_NID,
3791 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3792 .channel_mode = alc880_2_jack_modes,
3793 .input_mux = &alc880_capture_source,
3796 .mixers = { alc880_f1734_mixer },
3797 .init_verbs = { alc880_volume_init_verbs,
3798 alc880_pin_f1734_init_verbs },
3799 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3800 .dac_nids = alc880_f1734_dac_nids,
3802 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3803 .channel_mode = alc880_2_jack_modes,
3804 .input_mux = &alc880_f1734_capture_source,
3805 .unsol_event = alc880_uniwill_p53_unsol_event,
3806 .init_hook = alc880_uniwill_p53_init_hook,
3809 .mixers = { alc880_asus_mixer },
3810 .init_verbs = { alc880_volume_init_verbs,
3811 alc880_pin_asus_init_verbs,
3812 alc880_gpio1_init_verbs },
3813 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3814 .dac_nids = alc880_asus_dac_nids,
3815 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3816 .channel_mode = alc880_asus_modes,
3818 .input_mux = &alc880_capture_source,
3820 [ALC880_ASUS_DIG] = {
3821 .mixers = { alc880_asus_mixer },
3822 .init_verbs = { alc880_volume_init_verbs,
3823 alc880_pin_asus_init_verbs,
3824 alc880_gpio1_init_verbs },
3825 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3826 .dac_nids = alc880_asus_dac_nids,
3827 .dig_out_nid = ALC880_DIGOUT_NID,
3828 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3829 .channel_mode = alc880_asus_modes,
3831 .input_mux = &alc880_capture_source,
3833 [ALC880_ASUS_DIG2] = {
3834 .mixers = { alc880_asus_mixer },
3835 .init_verbs = { alc880_volume_init_verbs,
3836 alc880_pin_asus_init_verbs,
3837 alc880_gpio2_init_verbs }, /* use GPIO2 */
3838 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3839 .dac_nids = alc880_asus_dac_nids,
3840 .dig_out_nid = ALC880_DIGOUT_NID,
3841 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3842 .channel_mode = alc880_asus_modes,
3844 .input_mux = &alc880_capture_source,
3846 [ALC880_ASUS_W1V] = {
3847 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3848 .init_verbs = { alc880_volume_init_verbs,
3849 alc880_pin_asus_init_verbs,
3850 alc880_gpio1_init_verbs },
3851 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3852 .dac_nids = alc880_asus_dac_nids,
3853 .dig_out_nid = ALC880_DIGOUT_NID,
3854 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3855 .channel_mode = alc880_asus_modes,
3857 .input_mux = &alc880_capture_source,
3859 [ALC880_UNIWILL_DIG] = {
3860 .mixers = { alc880_asus_mixer },
3861 .init_verbs = { alc880_volume_init_verbs,
3862 alc880_pin_asus_init_verbs },
3863 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3864 .dac_nids = alc880_asus_dac_nids,
3865 .dig_out_nid = ALC880_DIGOUT_NID,
3866 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3867 .channel_mode = alc880_asus_modes,
3869 .input_mux = &alc880_capture_source,
3871 [ALC880_UNIWILL] = {
3872 .mixers = { alc880_uniwill_mixer },
3873 .init_verbs = { alc880_volume_init_verbs,
3874 alc880_uniwill_init_verbs },
3875 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3876 .dac_nids = alc880_asus_dac_nids,
3877 .dig_out_nid = ALC880_DIGOUT_NID,
3878 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3879 .channel_mode = alc880_threestack_modes,
3881 .input_mux = &alc880_capture_source,
3882 .unsol_event = alc880_uniwill_unsol_event,
3883 .init_hook = alc880_uniwill_init_hook,
3885 [ALC880_UNIWILL_P53] = {
3886 .mixers = { alc880_uniwill_p53_mixer },
3887 .init_verbs = { alc880_volume_init_verbs,
3888 alc880_uniwill_p53_init_verbs },
3889 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3890 .dac_nids = alc880_asus_dac_nids,
3891 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3892 .channel_mode = alc880_threestack_modes,
3893 .input_mux = &alc880_capture_source,
3894 .unsol_event = alc880_uniwill_p53_unsol_event,
3895 .init_hook = alc880_uniwill_p53_init_hook,
3897 [ALC880_FUJITSU] = {
3898 .mixers = { alc880_fujitsu_mixer },
3899 .init_verbs = { alc880_volume_init_verbs,
3900 alc880_uniwill_p53_init_verbs,
3901 alc880_beep_init_verbs },
3902 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3903 .dac_nids = alc880_dac_nids,
3904 .dig_out_nid = ALC880_DIGOUT_NID,
3905 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3906 .channel_mode = alc880_2_jack_modes,
3907 .input_mux = &alc880_capture_source,
3908 .unsol_event = alc880_uniwill_p53_unsol_event,
3909 .init_hook = alc880_uniwill_p53_init_hook,
3912 .mixers = { alc880_three_stack_mixer },
3913 .init_verbs = { alc880_volume_init_verbs,
3914 alc880_pin_clevo_init_verbs },
3915 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3916 .dac_nids = alc880_dac_nids,
3918 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3919 .channel_mode = alc880_threestack_modes,
3921 .input_mux = &alc880_capture_source,
3924 .mixers = { alc880_lg_mixer },
3925 .init_verbs = { alc880_volume_init_verbs,
3926 alc880_lg_init_verbs },
3927 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3928 .dac_nids = alc880_lg_dac_nids,
3929 .dig_out_nid = ALC880_DIGOUT_NID,
3930 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3931 .channel_mode = alc880_lg_ch_modes,
3933 .input_mux = &alc880_lg_capture_source,
3934 .unsol_event = alc_automute_amp_unsol_event,
3935 .init_hook = alc880_lg_init_hook,
3936 #ifdef CONFIG_SND_HDA_POWER_SAVE
3937 .loopbacks = alc880_lg_loopbacks,
3941 .mixers = { alc880_lg_lw_mixer },
3942 .init_verbs = { alc880_volume_init_verbs,
3943 alc880_lg_lw_init_verbs },
3944 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3945 .dac_nids = alc880_dac_nids,
3946 .dig_out_nid = ALC880_DIGOUT_NID,
3947 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3948 .channel_mode = alc880_lg_lw_modes,
3949 .input_mux = &alc880_lg_lw_capture_source,
3950 .unsol_event = alc_automute_amp_unsol_event,
3951 .init_hook = alc880_lg_lw_init_hook,
3953 [ALC880_MEDION_RIM] = {
3954 .mixers = { alc880_medion_rim_mixer },
3955 .init_verbs = { alc880_volume_init_verbs,
3956 alc880_medion_rim_init_verbs,
3957 alc_gpio2_init_verbs },
3958 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3959 .dac_nids = alc880_dac_nids,
3960 .dig_out_nid = ALC880_DIGOUT_NID,
3961 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3962 .channel_mode = alc880_2_jack_modes,
3963 .input_mux = &alc880_medion_rim_capture_source,
3964 .unsol_event = alc880_medion_rim_unsol_event,
3965 .init_hook = alc880_medion_rim_init_hook,
3967 #ifdef CONFIG_SND_DEBUG
3969 .mixers = { alc880_test_mixer },
3970 .init_verbs = { alc880_test_init_verbs },
3971 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3972 .dac_nids = alc880_test_dac_nids,
3973 .dig_out_nid = ALC880_DIGOUT_NID,
3974 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3975 .channel_mode = alc880_test_modes,
3976 .input_mux = &alc880_test_capture_source,
3982 * Automatic parse of I/O pins from the BIOS configuration
3987 ALC_CTL_WIDGET_MUTE,
3990 static struct snd_kcontrol_new alc880_control_templates[] = {
3991 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3992 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3993 HDA_BIND_MUTE(NULL, 0, 0, 0),
3996 /* add dynamic controls */
3997 static int add_control(struct alc_spec *spec, int type, const char *name,
4000 struct snd_kcontrol_new *knew;
4002 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4003 knew = snd_array_new(&spec->kctls);
4006 *knew = alc880_control_templates[type];
4007 knew->name = kstrdup(name, GFP_KERNEL);
4010 knew->private_value = val;
4014 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4015 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4016 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4017 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4018 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4019 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4020 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4021 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4022 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4023 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4024 #define ALC880_PIN_CD_NID 0x1c
4026 /* fill in the dac_nids table from the parsed pin configuration */
4027 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4028 const struct auto_pin_cfg *cfg)
4034 memset(assigned, 0, sizeof(assigned));
4035 spec->multiout.dac_nids = spec->private_dac_nids;
4037 /* check the pins hardwired to audio widget */
4038 for (i = 0; i < cfg->line_outs; i++) {
4039 nid = cfg->line_out_pins[i];
4040 if (alc880_is_fixed_pin(nid)) {
4041 int idx = alc880_fixed_pin_idx(nid);
4042 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4046 /* left pins can be connect to any audio widget */
4047 for (i = 0; i < cfg->line_outs; i++) {
4048 nid = cfg->line_out_pins[i];
4049 if (alc880_is_fixed_pin(nid))
4051 /* search for an empty channel */
4052 for (j = 0; j < cfg->line_outs; j++) {
4054 spec->multiout.dac_nids[i] =
4055 alc880_idx_to_dac(j);
4061 spec->multiout.num_dacs = cfg->line_outs;
4065 /* add playback controls from the parsed DAC table */
4066 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4067 const struct auto_pin_cfg *cfg)
4070 static const char *chname[4] = {
4071 "Front", "Surround", NULL /*CLFE*/, "Side"
4076 for (i = 0; i < cfg->line_outs; i++) {
4077 if (!spec->multiout.dac_nids[i])
4079 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4082 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4083 "Center Playback Volume",
4084 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4088 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4089 "LFE Playback Volume",
4090 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4094 err = add_control(spec, ALC_CTL_BIND_MUTE,
4095 "Center Playback Switch",
4096 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4100 err = add_control(spec, ALC_CTL_BIND_MUTE,
4101 "LFE Playback Switch",
4102 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4107 sprintf(name, "%s Playback Volume", chname[i]);
4108 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4109 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4113 sprintf(name, "%s Playback Switch", chname[i]);
4114 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4115 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4124 /* add playback controls for speaker and HP outputs */
4125 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4135 if (alc880_is_fixed_pin(pin)) {
4136 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4137 /* specify the DAC as the extra output */
4138 if (!spec->multiout.hp_nid)
4139 spec->multiout.hp_nid = nid;
4141 spec->multiout.extra_out_nid[0] = nid;
4142 /* control HP volume/switch on the output mixer amp */
4143 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4144 sprintf(name, "%s Playback Volume", pfx);
4145 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4146 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4149 sprintf(name, "%s Playback Switch", pfx);
4150 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4151 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4154 } else if (alc880_is_multi_pin(pin)) {
4155 /* set manual connection */
4156 /* we have only a switch on HP-out PIN */
4157 sprintf(name, "%s Playback Switch", pfx);
4158 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4159 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4166 /* create input playback/capture controls for the given pin */
4167 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4168 const char *ctlname,
4169 int idx, hda_nid_t mix_nid)
4174 sprintf(name, "%s Playback Volume", ctlname);
4175 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4176 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4179 sprintf(name, "%s Playback Switch", ctlname);
4180 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4181 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4187 /* create playback/capture controls for input pins */
4188 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4189 const struct auto_pin_cfg *cfg)
4191 struct hda_input_mux *imux = &spec->private_imux[0];
4194 for (i = 0; i < AUTO_PIN_LAST; i++) {
4195 if (alc880_is_input_pin(cfg->input_pins[i])) {
4196 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4197 err = new_analog_input(spec, cfg->input_pins[i],
4198 auto_pin_cfg_labels[i],
4202 imux->items[imux->num_items].label =
4203 auto_pin_cfg_labels[i];
4204 imux->items[imux->num_items].index =
4205 alc880_input_pin_idx(cfg->input_pins[i]);
4212 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4213 unsigned int pin_type)
4215 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4218 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4222 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4223 hda_nid_t nid, int pin_type,
4226 alc_set_pin_output(codec, nid, pin_type);
4227 /* need the manual connection? */
4228 if (alc880_is_multi_pin(nid)) {
4229 struct alc_spec *spec = codec->spec;
4230 int idx = alc880_multi_pin_idx(nid);
4231 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4232 AC_VERB_SET_CONNECT_SEL,
4233 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4237 static int get_pin_type(int line_out_type)
4239 if (line_out_type == AUTO_PIN_HP_OUT)
4245 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4247 struct alc_spec *spec = codec->spec;
4250 for (i = 0; i < spec->autocfg.line_outs; i++) {
4251 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4252 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4253 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4257 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4259 struct alc_spec *spec = codec->spec;
4262 pin = spec->autocfg.speaker_pins[0];
4263 if (pin) /* connect to front */
4264 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4265 pin = spec->autocfg.hp_pins[0];
4266 if (pin) /* connect to front */
4267 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4270 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4272 struct alc_spec *spec = codec->spec;
4275 for (i = 0; i < AUTO_PIN_LAST; i++) {
4276 hda_nid_t nid = spec->autocfg.input_pins[i];
4277 if (alc880_is_input_pin(nid)) {
4278 alc_set_input_pin(codec, nid, i);
4279 if (nid != ALC880_PIN_CD_NID &&
4280 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4281 snd_hda_codec_write(codec, nid, 0,
4282 AC_VERB_SET_AMP_GAIN_MUTE,
4288 /* parse the BIOS configuration and set up the alc_spec */
4289 /* return 1 if successful, 0 if the proper config is not found,
4290 * or a negative error code
4292 static int alc880_parse_auto_config(struct hda_codec *codec)
4294 struct alc_spec *spec = codec->spec;
4296 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4298 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4302 if (!spec->autocfg.line_outs)
4303 return 0; /* can't find valid BIOS pin config */
4305 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4308 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4311 err = alc880_auto_create_extra_out(spec,
4312 spec->autocfg.speaker_pins[0],
4316 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4320 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4324 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4326 /* check multiple SPDIF-out (for recent codecs) */
4327 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4329 err = snd_hda_get_connections(codec,
4330 spec->autocfg.dig_out_pins[i],
4335 spec->multiout.dig_out_nid = dig_nid;
4337 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4338 spec->slave_dig_outs[i - 1] = dig_nid;
4339 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4343 if (spec->autocfg.dig_in_pin)
4344 spec->dig_in_nid = ALC880_DIGIN_NID;
4346 if (spec->kctls.list)
4347 add_mixer(spec, spec->kctls.list);
4349 add_verb(spec, alc880_volume_init_verbs);
4351 spec->num_mux_defs = 1;
4352 spec->input_mux = &spec->private_imux[0];
4354 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4359 /* additional initialization for auto-configuration model */
4360 static void alc880_auto_init(struct hda_codec *codec)
4362 struct alc_spec *spec = codec->spec;
4363 alc880_auto_init_multi_out(codec);
4364 alc880_auto_init_extra_out(codec);
4365 alc880_auto_init_analog_input(codec);
4366 if (spec->unsol_event)
4367 alc_inithook(codec);
4370 static void set_capture_mixer(struct alc_spec *spec)
4372 static struct snd_kcontrol_new *caps[2][3] = {
4373 { alc_capture_mixer_nosrc1,
4374 alc_capture_mixer_nosrc2,
4375 alc_capture_mixer_nosrc3 },
4376 { alc_capture_mixer1,
4378 alc_capture_mixer3 },
4380 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4382 if (spec->input_mux && spec->input_mux->num_items > 1)
4386 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4390 #define set_beep_amp(spec, nid, idx, dir) \
4391 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4394 * OK, here we have finally the patch for ALC880
4397 static int patch_alc880(struct hda_codec *codec)
4399 struct alc_spec *spec;
4403 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4409 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4412 if (board_config < 0) {
4413 printk(KERN_INFO "hda_codec: Unknown model for %s, "
4414 "trying auto-probe from BIOS...\n", codec->chip_name);
4415 board_config = ALC880_AUTO;
4418 if (board_config == ALC880_AUTO) {
4419 /* automatic parse from the BIOS config */
4420 err = alc880_parse_auto_config(codec);
4426 "hda_codec: Cannot set up configuration "
4427 "from BIOS. Using 3-stack mode...\n");
4428 board_config = ALC880_3ST;
4432 err = snd_hda_attach_beep_device(codec, 0x1);
4438 if (board_config != ALC880_AUTO)
4439 setup_preset(spec, &alc880_presets[board_config]);
4441 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4442 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4443 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4445 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4446 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4448 if (!spec->adc_nids && spec->input_mux) {
4449 /* check whether NID 0x07 is valid */
4450 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4452 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4453 if (wcap != AC_WID_AUD_IN) {
4454 spec->adc_nids = alc880_adc_nids_alt;
4455 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4457 spec->adc_nids = alc880_adc_nids;
4458 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4461 set_capture_mixer(spec);
4462 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4464 spec->vmaster_nid = 0x0c;
4466 codec->patch_ops = alc_patch_ops;
4467 if (board_config == ALC880_AUTO)
4468 spec->init_hook = alc880_auto_init;
4469 #ifdef CONFIG_SND_HDA_POWER_SAVE
4470 if (!spec->loopback.amplist)
4471 spec->loopback.amplist = alc880_loopbacks;
4473 codec->proc_widget_hook = print_realtek_coef;
4483 static hda_nid_t alc260_dac_nids[1] = {
4488 static hda_nid_t alc260_adc_nids[1] = {
4493 static hda_nid_t alc260_adc_nids_alt[1] = {
4498 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4499 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4501 static hda_nid_t alc260_dual_adc_nids[2] = {
4506 #define ALC260_DIGOUT_NID 0x03
4507 #define ALC260_DIGIN_NID 0x06
4509 static struct hda_input_mux alc260_capture_source = {
4513 { "Front Mic", 0x1 },
4519 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4520 * headphone jack and the internal CD lines since these are the only pins at
4521 * which audio can appear. For flexibility, also allow the option of
4522 * recording the mixer output on the second ADC (ADC0 doesn't have a
4523 * connection to the mixer output).
4525 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4529 { "Mic/Line", 0x0 },
4531 { "Headphone", 0x2 },
4537 { "Mic/Line", 0x0 },
4539 { "Headphone", 0x2 },
4546 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4547 * the Fujitsu S702x, but jacks are marked differently.
4549 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4556 { "Headphone", 0x5 },
4565 { "Headphone", 0x6 },
4571 /* Maxdata Favorit 100XS */
4572 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4576 { "Line/Mic", 0x0 },
4583 { "Line/Mic", 0x0 },
4591 * This is just place-holder, so there's something for alc_build_pcms to look
4592 * at when it calculates the maximum number of channels. ALC260 has no mixer
4593 * element which allows changing the channel mode, so the verb list is
4596 static struct hda_channel_mode alc260_modes[1] = {
4601 /* Mixer combinations
4603 * basic: base_output + input + pc_beep + capture
4604 * HP: base_output + input + capture_alt
4605 * HP_3013: hp_3013 + input + capture
4606 * fujitsu: fujitsu + capture
4607 * acer: acer + capture
4610 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4611 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4612 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4613 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4614 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4615 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4616 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4620 static struct snd_kcontrol_new alc260_input_mixer[] = {
4621 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4622 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4623 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4624 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4625 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4626 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4627 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4628 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4632 /* update HP, line and mono out pins according to the master switch */
4633 static void alc260_hp_master_update(struct hda_codec *codec,
4634 hda_nid_t hp, hda_nid_t line,
4637 struct alc_spec *spec = codec->spec;
4638 unsigned int val = spec->master_sw ? PIN_HP : 0;
4639 /* change HP and line-out pins */
4640 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4642 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4644 /* mono (speaker) depending on the HP jack sense */
4645 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4646 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4650 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4651 struct snd_ctl_elem_value *ucontrol)
4653 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4654 struct alc_spec *spec = codec->spec;
4655 *ucontrol->value.integer.value = spec->master_sw;
4659 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4660 struct snd_ctl_elem_value *ucontrol)
4662 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4663 struct alc_spec *spec = codec->spec;
4664 int val = !!*ucontrol->value.integer.value;
4665 hda_nid_t hp, line, mono;
4667 if (val == spec->master_sw)
4669 spec->master_sw = val;
4670 hp = (kcontrol->private_value >> 16) & 0xff;
4671 line = (kcontrol->private_value >> 8) & 0xff;
4672 mono = kcontrol->private_value & 0xff;
4673 alc260_hp_master_update(codec, hp, line, mono);
4677 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4679 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4680 .name = "Master Playback Switch",
4681 .info = snd_ctl_boolean_mono_info,
4682 .get = alc260_hp_master_sw_get,
4683 .put = alc260_hp_master_sw_put,
4684 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4686 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4687 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4688 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4689 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4690 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4692 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4696 static struct hda_verb alc260_hp_unsol_verbs[] = {
4697 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4701 static void alc260_hp_automute(struct hda_codec *codec)
4703 struct alc_spec *spec = codec->spec;
4704 unsigned int present;
4706 present = snd_hda_codec_read(codec, 0x10, 0,
4707 AC_VERB_GET_PIN_SENSE, 0);
4708 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4709 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4712 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4714 if ((res >> 26) == ALC880_HP_EVENT)
4715 alc260_hp_automute(codec);
4718 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4720 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4721 .name = "Master Playback Switch",
4722 .info = snd_ctl_boolean_mono_info,
4723 .get = alc260_hp_master_sw_get,
4724 .put = alc260_hp_master_sw_put,
4725 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4727 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4728 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4729 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4730 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4731 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4732 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4733 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4734 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4738 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4739 .ops = &snd_hda_bind_vol,
4741 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4742 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4743 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4748 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4749 .ops = &snd_hda_bind_sw,
4751 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4752 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4757 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4758 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4759 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4760 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4761 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4765 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4766 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4770 static void alc260_hp_3013_automute(struct hda_codec *codec)
4772 struct alc_spec *spec = codec->spec;
4773 unsigned int present;
4775 present = snd_hda_codec_read(codec, 0x15, 0,
4776 AC_VERB_GET_PIN_SENSE, 0);
4777 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4778 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4781 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4784 if ((res >> 26) == ALC880_HP_EVENT)
4785 alc260_hp_3013_automute(codec);
4788 static void alc260_hp_3012_automute(struct hda_codec *codec)
4790 unsigned int present, bits;
4792 present = snd_hda_codec_read(codec, 0x10, 0,
4793 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4795 bits = present ? 0 : PIN_OUT;
4796 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4798 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4800 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4804 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4807 if ((res >> 26) == ALC880_HP_EVENT)
4808 alc260_hp_3012_automute(codec);
4811 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4812 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4814 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4815 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4816 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4817 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4818 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4819 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4820 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4821 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4822 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4823 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4824 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4828 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4829 * versions of the ALC260 don't act on requests to enable mic bias from NID
4830 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4831 * datasheet doesn't mention this restriction. At this stage it's not clear
4832 * whether this behaviour is intentional or is a hardware bug in chip
4833 * revisions available in early 2006. Therefore for now allow the
4834 * "Headphone Jack Mode" control to span all choices, but if it turns out
4835 * that the lack of mic bias for this NID is intentional we could change the
4836 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4838 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4839 * don't appear to make the mic bias available from the "line" jack, even
4840 * though the NID used for this jack (0x14) can supply it. The theory is
4841 * that perhaps Acer have included blocking capacitors between the ALC260
4842 * and the output jack. If this turns out to be the case for all such
4843 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4844 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4846 * The C20x Tablet series have a mono internal speaker which is controlled
4847 * via the chip's Mono sum widget and pin complex, so include the necessary
4848 * controls for such models. On models without a "mono speaker" the control
4849 * won't do anything.
4851 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4852 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4853 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4854 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4855 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4857 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4859 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4860 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4861 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4862 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4863 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4864 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4865 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4866 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4870 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
4872 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
4873 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4874 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4875 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4876 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4877 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4878 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4882 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4883 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4885 static struct snd_kcontrol_new alc260_will_mixer[] = {
4886 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4887 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4888 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4889 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4890 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4891 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4892 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4893 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4894 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4895 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4899 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4900 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4902 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4903 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4904 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4905 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4906 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4907 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4908 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4909 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4910 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4911 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4912 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4917 * initialization verbs
4919 static struct hda_verb alc260_init_verbs[] = {
4920 /* Line In pin widget for input */
4921 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4922 /* CD pin widget for input */
4923 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4924 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4925 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4926 /* Mic2 (front panel) pin widget for input and vref at 80% */
4927 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4928 /* LINE-2 is used for line-out in rear */
4929 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4930 /* select line-out */
4931 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4933 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4935 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4937 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4938 /* mute capture amp left and right */
4939 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4940 /* set connection select to line in (default select for this ADC) */
4941 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4942 /* mute capture amp left and right */
4943 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4944 /* set connection select to line in (default select for this ADC) */
4945 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4946 /* set vol=0 Line-Out mixer amp left and right */
4947 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4948 /* unmute pin widget amp left and right (no gain on this amp) */
4949 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4950 /* set vol=0 HP mixer amp left and right */
4951 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4952 /* unmute pin widget amp left and right (no gain on this amp) */
4953 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4954 /* set vol=0 Mono mixer amp left and right */
4955 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4956 /* unmute pin widget amp left and right (no gain on this amp) */
4957 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4958 /* unmute LINE-2 out pin */
4959 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4960 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4963 /* mute analog inputs */
4964 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4965 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4966 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4967 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4968 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4969 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4970 /* mute Front out path */
4971 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4972 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4973 /* mute Headphone out path */
4974 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4975 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4976 /* mute Mono out path */
4977 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4978 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4982 #if 0 /* should be identical with alc260_init_verbs? */
4983 static struct hda_verb alc260_hp_init_verbs[] = {
4984 /* Headphone and output */
4985 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4987 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4988 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4989 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4990 /* Mic2 (front panel) pin widget for input and vref at 80% */
4991 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4992 /* Line In pin widget for input */
4993 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4994 /* Line-2 pin widget for output */
4995 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4996 /* CD pin widget for input */
4997 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4998 /* unmute amp left and right */
4999 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5000 /* set connection select to line in (default select for this ADC) */
5001 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5002 /* unmute Line-Out mixer amp left and right (volume = 0) */
5003 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5004 /* mute pin widget amp left and right (no gain on this amp) */
5005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5006 /* unmute HP mixer amp left and right (volume = 0) */
5007 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5008 /* mute pin widget amp left and right (no gain on this amp) */
5009 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5010 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5013 /* mute analog inputs */
5014 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5015 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5016 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5017 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5018 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5019 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5020 /* Unmute Front out path */
5021 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5022 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5023 /* Unmute Headphone out path */
5024 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5025 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5026 /* Unmute Mono out path */
5027 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5028 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5033 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5034 /* Line out and output */
5035 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5037 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5038 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5039 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5040 /* Mic2 (front panel) pin widget for input and vref at 80% */
5041 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5042 /* Line In pin widget for input */
5043 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5044 /* Headphone pin widget for output */
5045 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5046 /* CD pin widget for input */
5047 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5048 /* unmute amp left and right */
5049 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5050 /* set connection select to line in (default select for this ADC) */
5051 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5052 /* unmute Line-Out mixer amp left and right (volume = 0) */
5053 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5054 /* mute pin widget amp left and right (no gain on this amp) */
5055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5056 /* unmute HP mixer amp left and right (volume = 0) */
5057 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5058 /* mute pin widget amp left and right (no gain on this amp) */
5059 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5060 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5063 /* mute analog inputs */
5064 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5065 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5066 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5067 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5068 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5069 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5070 /* Unmute Front out path */
5071 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5072 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5073 /* Unmute Headphone out path */
5074 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5075 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5076 /* Unmute Mono out path */
5077 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5078 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5082 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5083 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5084 * audio = 0x16, internal speaker = 0x10.
5086 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5087 /* Disable all GPIOs */
5088 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5089 /* Internal speaker is connected to headphone pin */
5090 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5091 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5092 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5093 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5094 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5095 /* Ensure all other unused pins are disabled and muted. */
5096 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5097 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5098 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5099 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5100 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5101 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5102 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5103 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5105 /* Disable digital (SPDIF) pins */
5106 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5107 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5109 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5110 * when acting as an output.
5112 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5114 /* Start with output sum widgets muted and their output gains at min */
5115 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5116 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5117 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5118 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5119 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5120 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5121 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5122 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5123 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5125 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5126 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5127 /* Unmute Line1 pin widget output buffer since it starts as an output.
5128 * If the pin mode is changed by the user the pin mode control will
5129 * take care of enabling the pin's input/output buffers as needed.
5130 * Therefore there's no need to enable the input buffer at this
5133 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5134 /* Unmute input buffer of pin widget used for Line-in (no equiv
5137 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5139 /* Mute capture amp left and right */
5140 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5141 /* Set ADC connection select to match default mixer setting - line
5144 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5146 /* Do the same for the second ADC: mute capture input amp and
5147 * set ADC connection to line in (on mic1 pin)
5149 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5150 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5152 /* Mute all inputs to mixer widget (even unconnected ones) */
5153 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5154 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5155 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5156 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5158 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5159 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5165 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5166 * similar laptops (adapted from Fujitsu init verbs).
5168 static struct hda_verb alc260_acer_init_verbs[] = {
5169 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5170 * the headphone jack. Turn this on and rely on the standard mute
5171 * methods whenever the user wants to turn these outputs off.
5173 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5174 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5175 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5176 /* Internal speaker/Headphone jack is connected to Line-out pin */
5177 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5178 /* Internal microphone/Mic jack is connected to Mic1 pin */
5179 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5180 /* Line In jack is connected to Line1 pin */
5181 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5182 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5183 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5184 /* Ensure all other unused pins are disabled and muted. */
5185 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5186 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5187 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5188 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5189 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5190 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5191 /* Disable digital (SPDIF) pins */
5192 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5193 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5195 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5196 * bus when acting as outputs.
5198 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5199 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5201 /* Start with output sum widgets muted and their output gains at min */
5202 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5203 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5204 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5205 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5206 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5207 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5208 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5209 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5210 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5212 /* Unmute Line-out pin widget amp left and right
5213 * (no equiv mixer ctrl)
5215 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5216 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5217 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5218 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5219 * inputs. If the pin mode is changed by the user the pin mode control
5220 * will take care of enabling the pin's input/output buffers as needed.
5221 * Therefore there's no need to enable the input buffer at this
5224 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5225 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5227 /* Mute capture amp left and right */
5228 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5229 /* Set ADC connection select to match default mixer setting - mic
5232 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5234 /* Do similar with the second ADC: mute capture input amp and
5235 * set ADC connection to mic to match ALSA's default state.
5237 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5238 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5240 /* Mute all inputs to mixer widget (even unconnected ones) */
5241 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5242 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5243 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5244 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5245 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5246 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5247 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5248 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5253 /* Initialisation sequence for Maxdata Favorit 100XS
5254 * (adapted from Acer init verbs).
5256 static struct hda_verb alc260_favorit100_init_verbs[] = {
5257 /* GPIO 0 enables the output jack.
5258 * Turn this on and rely on the standard mute
5259 * methods whenever the user wants to turn these outputs off.
5261 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5262 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5263 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5264 /* Line/Mic input jack is connected to Mic1 pin */
5265 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5266 /* Ensure all other unused pins are disabled and muted. */
5267 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5268 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5269 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5270 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5271 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5272 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5273 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5274 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5275 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5276 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5277 /* Disable digital (SPDIF) pins */
5278 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5279 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5281 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5282 * bus when acting as outputs.
5284 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5285 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5287 /* Start with output sum widgets muted and their output gains at min */
5288 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5289 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5290 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5291 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5292 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5293 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5294 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5295 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5296 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5298 /* Unmute Line-out pin widget amp left and right
5299 * (no equiv mixer ctrl)
5301 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5302 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5303 * inputs. If the pin mode is changed by the user the pin mode control
5304 * will take care of enabling the pin's input/output buffers as needed.
5305 * Therefore there's no need to enable the input buffer at this
5308 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5310 /* Mute capture amp left and right */
5311 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5312 /* Set ADC connection select to match default mixer setting - mic
5315 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5317 /* Do similar with the second ADC: mute capture input amp and
5318 * set ADC connection to mic to match ALSA's default state.
5320 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5321 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5323 /* Mute all inputs to mixer widget (even unconnected ones) */
5324 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5325 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5326 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5327 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5330 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5336 static struct hda_verb alc260_will_verbs[] = {
5337 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5338 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5339 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5340 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5341 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5342 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5346 static struct hda_verb alc260_replacer_672v_verbs[] = {
5347 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5348 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5349 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5351 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5352 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5353 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5355 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5359 /* toggle speaker-output according to the hp-jack state */
5360 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5362 unsigned int present;
5364 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5365 present = snd_hda_codec_read(codec, 0x0f, 0,
5366 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5368 snd_hda_codec_write_cache(codec, 0x01, 0,
5369 AC_VERB_SET_GPIO_DATA, 1);
5370 snd_hda_codec_write_cache(codec, 0x0f, 0,
5371 AC_VERB_SET_PIN_WIDGET_CONTROL,
5374 snd_hda_codec_write_cache(codec, 0x01, 0,
5375 AC_VERB_SET_GPIO_DATA, 0);
5376 snd_hda_codec_write_cache(codec, 0x0f, 0,
5377 AC_VERB_SET_PIN_WIDGET_CONTROL,
5382 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5385 if ((res >> 26) == ALC880_HP_EVENT)
5386 alc260_replacer_672v_automute(codec);
5389 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5390 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5391 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5392 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5393 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5394 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5395 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5396 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5397 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5398 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5399 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5403 /* Test configuration for debugging, modelled after the ALC880 test
5406 #ifdef CONFIG_SND_DEBUG
5407 static hda_nid_t alc260_test_dac_nids[1] = {
5410 static hda_nid_t alc260_test_adc_nids[2] = {
5413 /* For testing the ALC260, each input MUX needs its own definition since
5414 * the signal assignments are different. This assumes that the first ADC
5417 static struct hda_input_mux alc260_test_capture_sources[2] = {
5421 { "MIC1 pin", 0x0 },
5422 { "MIC2 pin", 0x1 },
5423 { "LINE1 pin", 0x2 },
5424 { "LINE2 pin", 0x3 },
5426 { "LINE-OUT pin", 0x5 },
5427 { "HP-OUT pin", 0x6 },
5433 { "MIC1 pin", 0x0 },
5434 { "MIC2 pin", 0x1 },
5435 { "LINE1 pin", 0x2 },
5436 { "LINE2 pin", 0x3 },
5439 { "LINE-OUT pin", 0x6 },
5440 { "HP-OUT pin", 0x7 },
5444 static struct snd_kcontrol_new alc260_test_mixer[] = {
5445 /* Output driver widgets */
5446 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5447 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5448 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5449 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5450 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5451 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5453 /* Modes for retasking pin widgets
5454 * Note: the ALC260 doesn't seem to act on requests to enable mic
5455 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5456 * mention this restriction. At this stage it's not clear whether
5457 * this behaviour is intentional or is a hardware bug in chip
5458 * revisions available at least up until early 2006. Therefore for
5459 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5460 * choices, but if it turns out that the lack of mic bias for these
5461 * NIDs is intentional we could change their modes from
5462 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5464 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5465 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5466 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5467 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5468 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5469 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5471 /* Loopback mixer controls */
5472 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5473 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5474 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5475 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5476 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5477 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5478 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5479 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5480 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5481 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5482 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5483 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5484 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5485 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5487 /* Controls for GPIO pins, assuming they are configured as outputs */
5488 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5489 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5490 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5491 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5493 /* Switches to allow the digital IO pins to be enabled. The datasheet
5494 * is ambigious as to which NID is which; testing on laptops which
5495 * make this output available should provide clarification.
5497 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5498 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5500 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5501 * this output to turn on an external amplifier.
5503 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5504 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5508 static struct hda_verb alc260_test_init_verbs[] = {
5509 /* Enable all GPIOs as outputs with an initial value of 0 */
5510 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5511 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5512 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5514 /* Enable retasking pins as output, initially without power amp */
5515 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5516 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5517 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5518 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5519 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5520 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5522 /* Disable digital (SPDIF) pins initially, but users can enable
5523 * them via a mixer switch. In the case of SPDIF-out, this initverb
5524 * payload also sets the generation to 0, output to be in "consumer"
5525 * PCM format, copyright asserted, no pre-emphasis and no validity
5528 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5529 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5531 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5532 * OUT1 sum bus when acting as an output.
5534 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5535 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5536 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5537 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5539 /* Start with output sum widgets muted and their output gains at min */
5540 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5541 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5542 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5543 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5544 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5545 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5546 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5547 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5548 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5550 /* Unmute retasking pin widget output buffers since the default
5551 * state appears to be output. As the pin mode is changed by the
5552 * user the pin mode control will take care of enabling the pin's
5553 * input/output buffers as needed.
5555 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5556 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5557 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5558 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5559 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5560 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5561 /* Also unmute the mono-out pin widget */
5562 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5564 /* Mute capture amp left and right */
5565 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5566 /* Set ADC connection select to match default mixer setting (mic1
5569 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5571 /* Do the same for the second ADC: mute capture input amp and
5572 * set ADC connection to mic1 pin
5574 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5575 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5577 /* Mute all inputs to mixer widget (even unconnected ones) */
5578 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5579 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5582 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5583 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5584 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5585 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5591 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5592 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5594 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5595 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5598 * for BIOS auto-configuration
5601 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5602 const char *pfx, int *vol_bits)
5605 unsigned long vol_val, sw_val;
5609 if (nid >= 0x0f && nid < 0x11) {
5610 nid_vol = nid - 0x7;
5611 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5612 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5613 } else if (nid == 0x11) {
5614 nid_vol = nid - 0x7;
5615 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5616 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5617 } else if (nid >= 0x12 && nid <= 0x15) {
5619 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5620 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5624 if (!(*vol_bits & (1 << nid_vol))) {
5625 /* first control for the volume widget */
5626 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5627 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5630 *vol_bits |= (1 << nid_vol);
5632 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5633 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5639 /* add playback controls from the parsed DAC table */
5640 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5641 const struct auto_pin_cfg *cfg)
5647 spec->multiout.num_dacs = 1;
5648 spec->multiout.dac_nids = spec->private_dac_nids;
5649 spec->multiout.dac_nids[0] = 0x02;
5651 nid = cfg->line_out_pins[0];
5653 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5658 nid = cfg->speaker_pins[0];
5660 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5665 nid = cfg->hp_pins[0];
5667 err = alc260_add_playback_controls(spec, nid, "Headphone",
5675 /* create playback/capture controls for input pins */
5676 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5677 const struct auto_pin_cfg *cfg)
5679 struct hda_input_mux *imux = &spec->private_imux[0];
5682 for (i = 0; i < AUTO_PIN_LAST; i++) {
5683 if (cfg->input_pins[i] >= 0x12) {
5684 idx = cfg->input_pins[i] - 0x12;
5685 err = new_analog_input(spec, cfg->input_pins[i],
5686 auto_pin_cfg_labels[i], idx,
5690 imux->items[imux->num_items].label =
5691 auto_pin_cfg_labels[i];
5692 imux->items[imux->num_items].index = idx;
5695 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5696 idx = cfg->input_pins[i] - 0x09;
5697 err = new_analog_input(spec, cfg->input_pins[i],
5698 auto_pin_cfg_labels[i], idx,
5702 imux->items[imux->num_items].label =
5703 auto_pin_cfg_labels[i];
5704 imux->items[imux->num_items].index = idx;
5711 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5712 hda_nid_t nid, int pin_type,
5715 alc_set_pin_output(codec, nid, pin_type);
5716 /* need the manual connection? */
5718 int idx = nid - 0x12;
5719 snd_hda_codec_write(codec, idx + 0x0b, 0,
5720 AC_VERB_SET_CONNECT_SEL, sel_idx);
5724 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5726 struct alc_spec *spec = codec->spec;
5729 nid = spec->autocfg.line_out_pins[0];
5731 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5732 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5735 nid = spec->autocfg.speaker_pins[0];
5737 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5739 nid = spec->autocfg.hp_pins[0];
5741 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5744 #define ALC260_PIN_CD_NID 0x16
5745 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5747 struct alc_spec *spec = codec->spec;
5750 for (i = 0; i < AUTO_PIN_LAST; i++) {
5751 hda_nid_t nid = spec->autocfg.input_pins[i];
5753 alc_set_input_pin(codec, nid, i);
5754 if (nid != ALC260_PIN_CD_NID &&
5755 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5756 snd_hda_codec_write(codec, nid, 0,
5757 AC_VERB_SET_AMP_GAIN_MUTE,
5764 * generic initialization of ADC, input mixers and output mixers
5766 static struct hda_verb alc260_volume_init_verbs[] = {
5768 * Unmute ADC0-1 and set the default input to mic-in
5770 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5771 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5772 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5773 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5775 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5777 * Note: PASD motherboards uses the Line In 2 as the input for
5778 * front panel mic (mic 2)
5780 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5781 /* mute analog inputs */
5782 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5783 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5784 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5785 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5786 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5789 * Set up output mixers (0x08 - 0x0a)
5791 /* set vol=0 to output mixers */
5792 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5793 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5794 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5795 /* set up input amps for analog loopback */
5796 /* Amp Indices: DAC = 0, mixer = 1 */
5797 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5798 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5799 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5800 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5801 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5802 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5807 static int alc260_parse_auto_config(struct hda_codec *codec)
5809 struct alc_spec *spec = codec->spec;
5811 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5813 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5817 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5820 if (!spec->kctls.list)
5821 return 0; /* can't find valid BIOS pin config */
5822 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5826 spec->multiout.max_channels = 2;
5828 if (spec->autocfg.dig_outs)
5829 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5830 if (spec->kctls.list)
5831 add_mixer(spec, spec->kctls.list);
5833 add_verb(spec, alc260_volume_init_verbs);
5835 spec->num_mux_defs = 1;
5836 spec->input_mux = &spec->private_imux[0];
5838 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
5843 /* additional initialization for auto-configuration model */
5844 static void alc260_auto_init(struct hda_codec *codec)
5846 struct alc_spec *spec = codec->spec;
5847 alc260_auto_init_multi_out(codec);
5848 alc260_auto_init_analog_input(codec);
5849 if (spec->unsol_event)
5850 alc_inithook(codec);
5853 #ifdef CONFIG_SND_HDA_POWER_SAVE
5854 static struct hda_amp_list alc260_loopbacks[] = {
5855 { 0x07, HDA_INPUT, 0 },
5856 { 0x07, HDA_INPUT, 1 },
5857 { 0x07, HDA_INPUT, 2 },
5858 { 0x07, HDA_INPUT, 3 },
5859 { 0x07, HDA_INPUT, 4 },
5865 * ALC260 configurations
5867 static const char *alc260_models[ALC260_MODEL_LAST] = {
5868 [ALC260_BASIC] = "basic",
5870 [ALC260_HP_3013] = "hp-3013",
5871 [ALC260_HP_DC7600] = "hp-dc7600",
5872 [ALC260_FUJITSU_S702X] = "fujitsu",
5873 [ALC260_ACER] = "acer",
5874 [ALC260_WILL] = "will",
5875 [ALC260_REPLACER_672V] = "replacer",
5876 [ALC260_FAVORIT100] = "favorit100",
5877 #ifdef CONFIG_SND_DEBUG
5878 [ALC260_TEST] = "test",
5880 [ALC260_AUTO] = "auto",
5883 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5884 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5885 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5886 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
5887 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5888 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5889 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5890 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5891 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5892 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5893 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5894 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5895 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5896 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5897 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5898 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5899 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5900 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5901 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5902 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5906 static struct alc_config_preset alc260_presets[] = {
5908 .mixers = { alc260_base_output_mixer,
5909 alc260_input_mixer },
5910 .init_verbs = { alc260_init_verbs },
5911 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5912 .dac_nids = alc260_dac_nids,
5913 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5914 .adc_nids = alc260_adc_nids,
5915 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5916 .channel_mode = alc260_modes,
5917 .input_mux = &alc260_capture_source,
5920 .mixers = { alc260_hp_output_mixer,
5921 alc260_input_mixer },
5922 .init_verbs = { alc260_init_verbs,
5923 alc260_hp_unsol_verbs },
5924 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5925 .dac_nids = alc260_dac_nids,
5926 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5927 .adc_nids = alc260_adc_nids_alt,
5928 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5929 .channel_mode = alc260_modes,
5930 .input_mux = &alc260_capture_source,
5931 .unsol_event = alc260_hp_unsol_event,
5932 .init_hook = alc260_hp_automute,
5934 [ALC260_HP_DC7600] = {
5935 .mixers = { alc260_hp_dc7600_mixer,
5936 alc260_input_mixer },
5937 .init_verbs = { alc260_init_verbs,
5938 alc260_hp_dc7600_verbs },
5939 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5940 .dac_nids = alc260_dac_nids,
5941 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5942 .adc_nids = alc260_adc_nids_alt,
5943 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5944 .channel_mode = alc260_modes,
5945 .input_mux = &alc260_capture_source,
5946 .unsol_event = alc260_hp_3012_unsol_event,
5947 .init_hook = alc260_hp_3012_automute,
5949 [ALC260_HP_3013] = {
5950 .mixers = { alc260_hp_3013_mixer,
5951 alc260_input_mixer },
5952 .init_verbs = { alc260_hp_3013_init_verbs,
5953 alc260_hp_3013_unsol_verbs },
5954 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5955 .dac_nids = alc260_dac_nids,
5956 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5957 .adc_nids = alc260_adc_nids_alt,
5958 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5959 .channel_mode = alc260_modes,
5960 .input_mux = &alc260_capture_source,
5961 .unsol_event = alc260_hp_3013_unsol_event,
5962 .init_hook = alc260_hp_3013_automute,
5964 [ALC260_FUJITSU_S702X] = {
5965 .mixers = { alc260_fujitsu_mixer },
5966 .init_verbs = { alc260_fujitsu_init_verbs },
5967 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5968 .dac_nids = alc260_dac_nids,
5969 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5970 .adc_nids = alc260_dual_adc_nids,
5971 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5972 .channel_mode = alc260_modes,
5973 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5974 .input_mux = alc260_fujitsu_capture_sources,
5977 .mixers = { alc260_acer_mixer },
5978 .init_verbs = { alc260_acer_init_verbs },
5979 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5980 .dac_nids = alc260_dac_nids,
5981 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5982 .adc_nids = alc260_dual_adc_nids,
5983 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5984 .channel_mode = alc260_modes,
5985 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5986 .input_mux = alc260_acer_capture_sources,
5988 [ALC260_FAVORIT100] = {
5989 .mixers = { alc260_favorit100_mixer },
5990 .init_verbs = { alc260_favorit100_init_verbs },
5991 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5992 .dac_nids = alc260_dac_nids,
5993 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5994 .adc_nids = alc260_dual_adc_nids,
5995 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5996 .channel_mode = alc260_modes,
5997 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
5998 .input_mux = alc260_favorit100_capture_sources,
6001 .mixers = { alc260_will_mixer },
6002 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6003 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6004 .dac_nids = alc260_dac_nids,
6005 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6006 .adc_nids = alc260_adc_nids,
6007 .dig_out_nid = ALC260_DIGOUT_NID,
6008 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6009 .channel_mode = alc260_modes,
6010 .input_mux = &alc260_capture_source,
6012 [ALC260_REPLACER_672V] = {
6013 .mixers = { alc260_replacer_672v_mixer },
6014 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6015 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6016 .dac_nids = alc260_dac_nids,
6017 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6018 .adc_nids = alc260_adc_nids,
6019 .dig_out_nid = ALC260_DIGOUT_NID,
6020 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6021 .channel_mode = alc260_modes,
6022 .input_mux = &alc260_capture_source,
6023 .unsol_event = alc260_replacer_672v_unsol_event,
6024 .init_hook = alc260_replacer_672v_automute,
6026 #ifdef CONFIG_SND_DEBUG
6028 .mixers = { alc260_test_mixer },
6029 .init_verbs = { alc260_test_init_verbs },
6030 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6031 .dac_nids = alc260_test_dac_nids,
6032 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6033 .adc_nids = alc260_test_adc_nids,
6034 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6035 .channel_mode = alc260_modes,
6036 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6037 .input_mux = alc260_test_capture_sources,
6042 static int patch_alc260(struct hda_codec *codec)
6044 struct alc_spec *spec;
6045 int err, board_config;
6047 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6053 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6056 if (board_config < 0) {
6057 snd_printd(KERN_INFO "hda_codec: Unknown model for %s, "
6058 "trying auto-probe from BIOS...\n",
6060 board_config = ALC260_AUTO;
6063 if (board_config == ALC260_AUTO) {
6064 /* automatic parse from the BIOS config */
6065 err = alc260_parse_auto_config(codec);
6071 "hda_codec: Cannot set up configuration "
6072 "from BIOS. Using base mode...\n");
6073 board_config = ALC260_BASIC;
6077 err = snd_hda_attach_beep_device(codec, 0x1);
6083 if (board_config != ALC260_AUTO)
6084 setup_preset(spec, &alc260_presets[board_config]);
6086 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6087 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6089 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6090 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6092 if (!spec->adc_nids && spec->input_mux) {
6093 /* check whether NID 0x04 is valid */
6094 unsigned int wcap = get_wcaps(codec, 0x04);
6095 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6097 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6098 spec->adc_nids = alc260_adc_nids_alt;
6099 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6101 spec->adc_nids = alc260_adc_nids;
6102 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6105 set_capture_mixer(spec);
6106 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6108 spec->vmaster_nid = 0x08;
6110 codec->patch_ops = alc_patch_ops;
6111 if (board_config == ALC260_AUTO)
6112 spec->init_hook = alc260_auto_init;
6113 #ifdef CONFIG_SND_HDA_POWER_SAVE
6114 if (!spec->loopback.amplist)
6115 spec->loopback.amplist = alc260_loopbacks;
6117 codec->proc_widget_hook = print_realtek_coef;
6126 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6127 * configuration. Each pin widget can choose any input DACs and a mixer.
6128 * Each ADC is connected from a mixer of all inputs. This makes possible
6129 * 6-channel independent captures.
6131 * In addition, an independent DAC for the multi-playback (not used in this
6134 #define ALC882_DIGOUT_NID 0x06
6135 #define ALC882_DIGIN_NID 0x0a
6137 static struct hda_channel_mode alc882_ch_modes[1] = {
6141 static hda_nid_t alc882_dac_nids[4] = {
6142 /* front, rear, clfe, rear_surr */
6143 0x02, 0x03, 0x04, 0x05
6146 /* identical with ALC880 */
6147 #define alc882_adc_nids alc880_adc_nids
6148 #define alc882_adc_nids_alt alc880_adc_nids_alt
6150 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6151 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6154 /* FIXME: should be a matrix-type input source selection */
6156 static struct hda_input_mux alc882_capture_source = {
6160 { "Front Mic", 0x1 },
6166 static struct hda_input_mux mb5_capture_source = {
6178 static struct hda_verb alc882_3ST_ch2_init[] = {
6179 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6180 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6181 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6182 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6189 static struct hda_verb alc882_3ST_ch6_init[] = {
6190 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6191 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6192 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6193 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6194 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6195 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6199 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6200 { 2, alc882_3ST_ch2_init },
6201 { 6, alc882_3ST_ch6_init },
6207 static struct hda_verb alc882_sixstack_ch6_init[] = {
6208 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6209 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6210 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6211 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6218 static struct hda_verb alc882_sixstack_ch8_init[] = {
6219 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6220 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6221 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6222 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6226 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6227 { 6, alc882_sixstack_ch6_init },
6228 { 8, alc882_sixstack_ch8_init },
6232 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6238 static struct hda_verb alc885_mbp_ch2_init[] = {
6239 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6240 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6241 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6248 static struct hda_verb alc885_mbp_ch6_init[] = {
6249 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6250 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6251 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6252 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6253 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6257 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6258 { 2, alc885_mbp_ch2_init },
6259 { 6, alc885_mbp_ch6_init },
6263 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6264 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6266 static struct snd_kcontrol_new alc882_base_mixer[] = {
6267 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6268 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6269 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6270 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6271 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6272 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6273 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6274 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6275 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6276 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6277 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6278 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6279 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6280 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6281 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6282 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6283 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6284 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6285 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6286 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6287 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6291 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6292 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6293 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6294 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6295 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6296 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6297 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6298 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6299 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6300 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6301 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6305 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6306 HDA_CODEC_VOLUME("Front Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6307 HDA_BIND_MUTE ("Front Playback Switch", 0x0d, 0x02, HDA_INPUT),
6308 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6309 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
6310 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6311 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6312 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6313 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6314 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6315 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6318 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6319 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6320 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6321 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6322 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6323 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6324 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6325 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6326 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6327 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6331 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6332 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6333 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6334 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6335 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6336 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6337 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6338 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6339 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6340 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6341 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6342 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6343 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6344 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6348 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6349 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6351 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6352 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6353 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6354 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6355 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6356 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6357 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6358 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6359 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6360 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6361 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6362 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6363 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6364 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6368 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6369 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6370 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6371 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6372 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6373 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6374 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6375 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6377 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6378 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6382 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6384 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6385 .name = "Channel Mode",
6386 .info = alc_ch_mode_info,
6387 .get = alc_ch_mode_get,
6388 .put = alc_ch_mode_put,
6393 static struct hda_verb alc882_init_verbs[] = {
6394 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6395 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6396 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6397 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6399 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6400 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6401 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6403 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6404 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6405 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6407 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6408 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6409 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6411 /* Front Pin: output 0 (0x0c) */
6412 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6413 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6414 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6415 /* Rear Pin: output 1 (0x0d) */
6416 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6417 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6418 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6419 /* CLFE Pin: output 2 (0x0e) */
6420 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6421 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6422 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6423 /* Side Pin: output 3 (0x0f) */
6424 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6425 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6426 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6427 /* Mic (rear) pin: input vref at 80% */
6428 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6429 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6430 /* Front Mic pin: input vref at 80% */
6431 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6432 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6433 /* Line In pin: input */
6434 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6435 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6436 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6437 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6438 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6439 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6440 /* CD pin widget for input */
6441 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6443 /* FIXME: use matrix-type input source selection */
6444 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6445 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6446 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6447 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6448 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6451 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6452 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6453 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6454 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6457 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6459 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6460 /* ADC1: mute amp left and right */
6461 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6462 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6463 /* ADC2: mute amp left and right */
6464 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6465 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6466 /* ADC3: mute amp left and right */
6467 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6468 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6473 static struct hda_verb alc882_eapd_verbs[] = {
6474 /* change to EAPD mode */
6475 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6476 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6481 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6482 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6483 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6484 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6485 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6486 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6487 /* FIXME: this looks suspicious...
6488 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6489 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6494 static struct hda_verb alc882_macpro_init_verbs[] = {
6495 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6496 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6497 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6498 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6499 /* Front Pin: output 0 (0x0c) */
6500 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6501 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6502 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6503 /* Front Mic pin: input vref at 80% */
6504 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6505 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6506 /* Speaker: output */
6507 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6508 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6509 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6510 /* Headphone output (output 0 - 0x0c) */
6511 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6512 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6513 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6515 /* FIXME: use matrix-type input source selection */
6516 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6517 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6518 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6520 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6521 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6524 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6525 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6526 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6529 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6530 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6531 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6532 /* ADC1: mute amp left and right */
6533 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6534 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6535 /* ADC2: mute amp left and right */
6536 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6537 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6538 /* ADC3: mute amp left and right */
6539 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6540 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6546 static struct hda_verb alc885_mb5_init_verbs[] = {
6548 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6549 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6550 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6552 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6555 /* Front Pin: output 0 (0x0d) */
6556 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
6557 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6558 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01},
6559 /* HP Pin: output 0 (0x0c) */
6560 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6561 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6562 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6563 /* Front Mic pin: input vref at 80% */
6564 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6565 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6567 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6568 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6570 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6571 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6572 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6573 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6577 /* Macbook Pro rev3 */
6578 static struct hda_verb alc885_mbp3_init_verbs[] = {
6579 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6580 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6586 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6587 /* Front Pin: output 0 (0x0c) */
6588 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6589 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6590 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6591 /* HP Pin: output 0 (0x0d) */
6592 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6593 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6594 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6595 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6596 /* Mic (rear) pin: input vref at 80% */
6597 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6598 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6599 /* Front Mic pin: input vref at 80% */
6600 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6601 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6602 /* Line In pin: use output 1 when in LineOut mode */
6603 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6604 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6605 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6607 /* FIXME: use matrix-type input source selection */
6608 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6609 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6610 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6611 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6612 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6615 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6616 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6617 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6618 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6624 /* ADC1: mute amp left and right */
6625 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6626 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6627 /* ADC2: mute amp left and right */
6628 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6629 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6630 /* ADC3: mute amp left and right */
6631 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6632 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6637 /* iMac 24 mixer. */
6638 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6639 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6640 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6644 /* iMac 24 init verbs. */
6645 static struct hda_verb alc885_imac24_init_verbs[] = {
6646 /* Internal speakers: output 0 (0x0c) */
6647 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6648 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6649 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6650 /* Internal speakers: output 0 (0x0c) */
6651 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6652 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6653 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6654 /* Headphone: output 0 (0x0c) */
6655 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6656 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6657 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6658 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6659 /* Front Mic: input vref at 80% */
6660 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6661 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6665 /* Toggle speaker-output according to the hp-jack state */
6666 static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
6668 struct alc_spec *spec = codec->spec;
6670 spec->autocfg.hp_pins[0] = 0x14;
6671 spec->autocfg.speaker_pins[0] = 0x18;
6672 spec->autocfg.speaker_pins[1] = 0x1a;
6673 alc_automute_amp(codec);
6676 static void alc885_mbp3_init_hook(struct hda_codec *codec)
6678 struct alc_spec *spec = codec->spec;
6680 spec->autocfg.hp_pins[0] = 0x15;
6681 spec->autocfg.speaker_pins[0] = 0x14;
6682 alc_automute_amp(codec);
6686 static struct hda_verb alc882_targa_verbs[] = {
6687 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6688 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6690 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6691 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6693 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6694 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6695 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6697 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6698 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6699 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6700 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6704 /* toggle speaker-output according to the hp-jack state */
6705 static void alc882_targa_automute(struct hda_codec *codec)
6707 struct alc_spec *spec = codec->spec;
6708 alc_automute_amp(codec);
6709 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6710 spec->jack_present ? 1 : 3);
6713 static void alc882_targa_init_hook(struct hda_codec *codec)
6715 struct alc_spec *spec = codec->spec;
6717 spec->autocfg.hp_pins[0] = 0x14;
6718 spec->autocfg.speaker_pins[0] = 0x1b;
6719 alc882_targa_automute(codec);
6722 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6724 if ((res >> 26) == ALC880_HP_EVENT)
6725 alc882_targa_automute(codec);
6728 static struct hda_verb alc882_asus_a7j_verbs[] = {
6729 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6730 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6732 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6733 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6734 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6736 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6737 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6738 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6740 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6741 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6742 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6746 static struct hda_verb alc882_asus_a7m_verbs[] = {
6747 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6748 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6750 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6751 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6752 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6754 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6755 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6756 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6758 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6759 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6760 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6764 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6766 unsigned int gpiostate, gpiomask, gpiodir;
6768 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6769 AC_VERB_GET_GPIO_DATA, 0);
6772 gpiostate |= (1 << pin);
6774 gpiostate &= ~(1 << pin);
6776 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6777 AC_VERB_GET_GPIO_MASK, 0);
6778 gpiomask |= (1 << pin);
6780 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6781 AC_VERB_GET_GPIO_DIRECTION, 0);
6782 gpiodir |= (1 << pin);
6785 snd_hda_codec_write(codec, codec->afg, 0,
6786 AC_VERB_SET_GPIO_MASK, gpiomask);
6787 snd_hda_codec_write(codec, codec->afg, 0,
6788 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6792 snd_hda_codec_write(codec, codec->afg, 0,
6793 AC_VERB_SET_GPIO_DATA, gpiostate);
6796 /* set up GPIO at initialization */
6797 static void alc885_macpro_init_hook(struct hda_codec *codec)
6799 alc882_gpio_mute(codec, 0, 0);
6800 alc882_gpio_mute(codec, 1, 0);
6803 /* set up GPIO and update auto-muting at initialization */
6804 static void alc885_imac24_init_hook(struct hda_codec *codec)
6806 alc885_macpro_init_hook(codec);
6807 alc885_imac24_automute_init_hook(codec);
6811 * generic initialization of ADC, input mixers and output mixers
6813 static struct hda_verb alc882_auto_init_verbs[] = {
6815 * Unmute ADC0-2 and set the default input to mic-in
6817 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6818 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6819 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6820 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6821 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6822 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6824 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6826 * Note: PASD motherboards uses the Line In 2 as the input for
6827 * front panel mic (mic 2)
6829 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6830 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6831 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6832 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6834 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6837 * Set up output mixers (0x0c - 0x0f)
6839 /* set vol=0 to output mixers */
6840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6841 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6842 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6843 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6844 /* set up input amps for analog loopback */
6845 /* Amp Indices: DAC = 0, mixer = 1 */
6846 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6847 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6848 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6849 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6850 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6851 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6852 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6853 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6854 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6855 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6857 /* FIXME: use matrix-type input source selection */
6858 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6859 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6860 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6861 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6862 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6863 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6865 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6866 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6867 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6868 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6870 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6871 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6872 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6873 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6878 #ifdef CONFIG_SND_HDA_POWER_SAVE
6879 #define alc882_loopbacks alc880_loopbacks
6882 /* pcm configuration: identiacal with ALC880 */
6883 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6884 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6885 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6886 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6889 * configuration and preset
6891 static const char *alc882_models[ALC882_MODEL_LAST] = {
6892 [ALC882_3ST_DIG] = "3stack-dig",
6893 [ALC882_6ST_DIG] = "6stack-dig",
6894 [ALC882_ARIMA] = "arima",
6895 [ALC882_W2JC] = "w2jc",
6896 [ALC882_TARGA] = "targa",
6897 [ALC882_ASUS_A7J] = "asus-a7j",
6898 [ALC882_ASUS_A7M] = "asus-a7m",
6899 [ALC885_MACPRO] = "macpro",
6900 [ALC885_MB5] = "mb5",
6901 [ALC885_MBP3] = "mbp3",
6902 [ALC885_IMAC24] = "imac24",
6903 [ALC882_AUTO] = "auto",
6906 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6907 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6908 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6909 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6910 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6911 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6912 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6913 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6914 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6915 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6916 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6917 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6918 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6922 static struct alc_config_preset alc882_presets[] = {
6923 [ALC882_3ST_DIG] = {
6924 .mixers = { alc882_base_mixer },
6925 .init_verbs = { alc882_init_verbs },
6926 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6927 .dac_nids = alc882_dac_nids,
6928 .dig_out_nid = ALC882_DIGOUT_NID,
6929 .dig_in_nid = ALC882_DIGIN_NID,
6930 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6931 .channel_mode = alc882_ch_modes,
6933 .input_mux = &alc882_capture_source,
6935 [ALC882_6ST_DIG] = {
6936 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6937 .init_verbs = { alc882_init_verbs },
6938 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6939 .dac_nids = alc882_dac_nids,
6940 .dig_out_nid = ALC882_DIGOUT_NID,
6941 .dig_in_nid = ALC882_DIGIN_NID,
6942 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6943 .channel_mode = alc882_sixstack_modes,
6944 .input_mux = &alc882_capture_source,
6947 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6948 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6949 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6950 .dac_nids = alc882_dac_nids,
6951 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6952 .channel_mode = alc882_sixstack_modes,
6953 .input_mux = &alc882_capture_source,
6956 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6957 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6958 alc880_gpio1_init_verbs },
6959 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6960 .dac_nids = alc882_dac_nids,
6961 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6962 .channel_mode = alc880_threestack_modes,
6964 .input_mux = &alc882_capture_source,
6965 .dig_out_nid = ALC882_DIGOUT_NID,
6968 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6969 .init_verbs = { alc885_mbp3_init_verbs,
6970 alc880_gpio1_init_verbs },
6971 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6972 .dac_nids = alc882_dac_nids,
6973 .channel_mode = alc885_mbp_6ch_modes,
6974 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6975 .input_mux = &alc882_capture_source,
6976 .dig_out_nid = ALC882_DIGOUT_NID,
6977 .dig_in_nid = ALC882_DIGIN_NID,
6978 .unsol_event = alc_automute_amp_unsol_event,
6979 .init_hook = alc885_mbp3_init_hook,
6982 .mixers = { alc885_mb5_mixer },
6983 .init_verbs = { alc885_mb5_init_verbs,
6984 alc880_gpio1_init_verbs },
6985 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6986 .dac_nids = alc882_dac_nids,
6987 .channel_mode = alc885_mbp_6ch_modes,
6988 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6989 .input_mux = &mb5_capture_source,
6990 .dig_out_nid = ALC882_DIGOUT_NID,
6991 .dig_in_nid = ALC882_DIGIN_NID,
6994 .mixers = { alc882_macpro_mixer },
6995 .init_verbs = { alc882_macpro_init_verbs },
6996 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6997 .dac_nids = alc882_dac_nids,
6998 .dig_out_nid = ALC882_DIGOUT_NID,
6999 .dig_in_nid = ALC882_DIGIN_NID,
7000 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7001 .channel_mode = alc882_ch_modes,
7002 .input_mux = &alc882_capture_source,
7003 .init_hook = alc885_macpro_init_hook,
7006 .mixers = { alc885_imac24_mixer },
7007 .init_verbs = { alc885_imac24_init_verbs },
7008 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7009 .dac_nids = alc882_dac_nids,
7010 .dig_out_nid = ALC882_DIGOUT_NID,
7011 .dig_in_nid = ALC882_DIGIN_NID,
7012 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7013 .channel_mode = alc882_ch_modes,
7014 .input_mux = &alc882_capture_source,
7015 .unsol_event = alc_automute_amp_unsol_event,
7016 .init_hook = alc885_imac24_init_hook,
7019 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
7020 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
7021 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7022 .dac_nids = alc882_dac_nids,
7023 .dig_out_nid = ALC882_DIGOUT_NID,
7024 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7025 .adc_nids = alc882_adc_nids,
7026 .capsrc_nids = alc882_capsrc_nids,
7027 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7028 .channel_mode = alc882_3ST_6ch_modes,
7030 .input_mux = &alc882_capture_source,
7031 .unsol_event = alc882_targa_unsol_event,
7032 .init_hook = alc882_targa_init_hook,
7034 [ALC882_ASUS_A7J] = {
7035 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
7036 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
7037 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7038 .dac_nids = alc882_dac_nids,
7039 .dig_out_nid = ALC882_DIGOUT_NID,
7040 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7041 .adc_nids = alc882_adc_nids,
7042 .capsrc_nids = alc882_capsrc_nids,
7043 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7044 .channel_mode = alc882_3ST_6ch_modes,
7046 .input_mux = &alc882_capture_source,
7048 [ALC882_ASUS_A7M] = {
7049 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
7050 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
7051 alc880_gpio1_init_verbs,
7052 alc882_asus_a7m_verbs },
7053 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7054 .dac_nids = alc882_dac_nids,
7055 .dig_out_nid = ALC882_DIGOUT_NID,
7056 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
7057 .channel_mode = alc880_threestack_modes,
7059 .input_mux = &alc882_capture_source,
7068 PINFIX_ABIT_AW9D_MAX
7071 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
7072 { 0x15, 0x01080104 }, /* side */
7073 { 0x16, 0x01011012 }, /* rear */
7074 { 0x17, 0x01016011 }, /* clfe */
7078 static const struct alc_pincfg *alc882_pin_fixes[] = {
7079 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
7082 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
7083 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
7088 * BIOS auto configuration
7090 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
7091 hda_nid_t nid, int pin_type,
7095 struct alc_spec *spec = codec->spec;
7098 alc_set_pin_output(codec, nid, pin_type);
7099 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7102 idx = spec->multiout.dac_nids[dac_idx] - 2;
7103 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7107 static void alc882_auto_init_multi_out(struct hda_codec *codec)
7109 struct alc_spec *spec = codec->spec;
7112 for (i = 0; i <= HDA_SIDE; i++) {
7113 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7114 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7116 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
7121 static void alc882_auto_init_hp_out(struct hda_codec *codec)
7123 struct alc_spec *spec = codec->spec;
7126 pin = spec->autocfg.hp_pins[0];
7127 if (pin) /* connect to front */
7129 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7130 pin = spec->autocfg.speaker_pins[0];
7132 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7135 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7136 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7138 static void alc882_auto_init_analog_input(struct hda_codec *codec)
7140 struct alc_spec *spec = codec->spec;
7143 for (i = 0; i < AUTO_PIN_LAST; i++) {
7144 hda_nid_t nid = spec->autocfg.input_pins[i];
7147 alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/);
7148 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
7149 snd_hda_codec_write(codec, nid, 0,
7150 AC_VERB_SET_AMP_GAIN_MUTE,
7155 static void alc882_auto_init_input_src(struct hda_codec *codec)
7157 struct alc_spec *spec = codec->spec;
7160 for (c = 0; c < spec->num_adc_nids; c++) {
7161 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
7162 hda_nid_t nid = spec->capsrc_nids[c];
7163 unsigned int mux_idx;
7164 const struct hda_input_mux *imux;
7165 int conns, mute, idx, item;
7167 conns = snd_hda_get_connections(codec, nid, conn_list,
7168 ARRAY_SIZE(conn_list));
7171 mux_idx = c >= spec->num_mux_defs ? 0 : c;
7172 imux = &spec->input_mux[mux_idx];
7173 for (idx = 0; idx < conns; idx++) {
7174 /* if the current connection is the selected one,
7175 * unmute it as default - otherwise mute it
7177 mute = AMP_IN_MUTE(idx);
7178 for (item = 0; item < imux->num_items; item++) {
7179 if (imux->items[item].index == idx) {
7180 if (spec->cur_mux[c] == item)
7181 mute = AMP_IN_UNMUTE(idx);
7185 /* check if we have a selector or mixer
7186 * we could check for the widget type instead, but
7187 * just check for Amp-In presence (in case of mixer
7188 * without amp-in there is something wrong, this
7189 * function shouldn't be used or capsrc nid is wrong)
7191 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
7192 snd_hda_codec_write(codec, nid, 0,
7193 AC_VERB_SET_AMP_GAIN_MUTE,
7195 else if (mute != AMP_IN_MUTE(idx))
7196 snd_hda_codec_write(codec, nid, 0,
7197 AC_VERB_SET_CONNECT_SEL,
7203 /* add mic boosts if needed */
7204 static int alc_auto_add_mic_boost(struct hda_codec *codec)
7206 struct alc_spec *spec = codec->spec;
7210 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7211 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7212 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7214 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7218 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7219 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7220 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7222 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7229 /* almost identical with ALC880 parser... */
7230 static int alc882_parse_auto_config(struct hda_codec *codec)
7232 struct alc_spec *spec = codec->spec;
7233 int err = alc880_parse_auto_config(codec);
7238 return 0; /* no config found */
7240 err = alc_auto_add_mic_boost(codec);
7244 /* hack - override the init verbs */
7245 spec->init_verbs[0] = alc882_auto_init_verbs;
7247 return 1; /* config found */
7250 /* additional initialization for auto-configuration model */
7251 static void alc882_auto_init(struct hda_codec *codec)
7253 struct alc_spec *spec = codec->spec;
7254 alc882_auto_init_multi_out(codec);
7255 alc882_auto_init_hp_out(codec);
7256 alc882_auto_init_analog_input(codec);
7257 alc882_auto_init_input_src(codec);
7258 if (spec->unsol_event)
7259 alc_inithook(codec);
7262 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7264 static int patch_alc882(struct hda_codec *codec)
7266 struct alc_spec *spec;
7267 int err, board_config;
7269 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7275 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7279 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7280 /* Pick up systems that don't supply PCI SSID */
7281 switch (codec->subsystem_id) {
7282 case 0x106b0c00: /* Mac Pro */
7283 board_config = ALC885_MACPRO;
7285 case 0x106b1000: /* iMac 24 */
7286 case 0x106b2800: /* AppleTV */
7287 case 0x106b3e00: /* iMac 24 Aluminium */
7288 board_config = ALC885_IMAC24;
7290 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7291 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7292 case 0x106b00a4: /* MacbookPro4,1 */
7293 case 0x106b2c00: /* Macbook Pro rev3 */
7294 case 0x106b3600: /* Macbook 3.1 */
7295 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7296 board_config = ALC885_MBP3;
7298 case 0x106b3f00: /* Macbook 5,1 */
7299 case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense
7300 * seems not working, so apparently
7301 * no perfect solution yet
7303 board_config = ALC885_MB5;
7306 /* ALC889A is handled better as ALC888-compatible */
7307 if (codec->revision_id == 0x100101 ||
7308 codec->revision_id == 0x100103) {
7310 return patch_alc883(codec);
7312 printk(KERN_INFO "hda_codec: Unknown model for %s, "
7313 "trying auto-probe from BIOS...\n",
7315 board_config = ALC882_AUTO;
7319 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7321 if (board_config == ALC882_AUTO) {
7322 /* automatic parse from the BIOS config */
7323 err = alc882_parse_auto_config(codec);
7329 "hda_codec: Cannot set up configuration "
7330 "from BIOS. Using base mode...\n");
7331 board_config = ALC882_3ST_DIG;
7335 err = snd_hda_attach_beep_device(codec, 0x1);
7341 if (board_config != ALC882_AUTO)
7342 setup_preset(spec, &alc882_presets[board_config]);
7344 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7345 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7346 /* FIXME: setup DAC5 */
7347 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7348 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7350 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7351 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7353 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7354 if (!spec->adc_nids && spec->input_mux) {
7355 /* check whether NID 0x07 is valid */
7356 unsigned int wcap = get_wcaps(codec, 0x07);
7358 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7359 if (wcap != AC_WID_AUD_IN) {
7360 spec->adc_nids = alc882_adc_nids_alt;
7361 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7362 spec->capsrc_nids = alc882_capsrc_nids_alt;
7364 spec->adc_nids = alc882_adc_nids;
7365 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7366 spec->capsrc_nids = alc882_capsrc_nids;
7369 set_capture_mixer(spec);
7370 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7372 spec->vmaster_nid = 0x0c;
7374 codec->patch_ops = alc_patch_ops;
7375 if (board_config == ALC882_AUTO)
7376 spec->init_hook = alc882_auto_init;
7377 #ifdef CONFIG_SND_HDA_POWER_SAVE
7378 if (!spec->loopback.amplist)
7379 spec->loopback.amplist = alc882_loopbacks;
7381 codec->proc_widget_hook = print_realtek_coef;
7389 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7390 * configuration. Each pin widget can choose any input DACs and a mixer.
7391 * Each ADC is connected from a mixer of all inputs. This makes possible
7392 * 6-channel independent captures.
7394 * In addition, an independent DAC for the multi-playback (not used in this
7397 #define ALC883_DIGOUT_NID 0x06
7398 #define ALC883_DIGIN_NID 0x0a
7400 #define ALC1200_DIGOUT_NID 0x10
7402 static hda_nid_t alc883_dac_nids[4] = {
7403 /* front, rear, clfe, rear_surr */
7404 0x02, 0x03, 0x04, 0x05
7407 static hda_nid_t alc883_adc_nids[2] = {
7412 static hda_nid_t alc883_adc_nids_alt[1] = {
7417 static hda_nid_t alc883_adc_nids_rev[2] = {
7422 #define alc889_adc_nids alc880_adc_nids
7424 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7426 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7428 #define alc889_capsrc_nids alc882_capsrc_nids
7431 /* FIXME: should be a matrix-type input source selection */
7433 static struct hda_input_mux alc883_capture_source = {
7437 { "Front Mic", 0x1 },
7443 static struct hda_input_mux alc883_3stack_6ch_intel = {
7447 { "Front Mic", 0x0 },
7453 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7461 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7471 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7479 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7483 { "Front Mic", 0x1 },
7488 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7499 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7506 static struct hda_verb alc883_3ST_ch2_init[] = {
7507 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7508 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7509 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7510 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7517 static struct hda_verb alc883_3ST_ch4_init[] = {
7518 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7519 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7520 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7521 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7522 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7529 static struct hda_verb alc883_3ST_ch6_init[] = {
7530 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7531 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7532 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7533 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7534 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7535 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7539 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7540 { 2, alc883_3ST_ch2_init },
7541 { 4, alc883_3ST_ch4_init },
7542 { 6, alc883_3ST_ch6_init },
7548 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7549 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7550 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7551 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7552 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7559 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7560 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7561 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7562 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7563 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7564 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7571 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7572 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7573 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7574 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7575 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7576 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7577 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7581 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7582 { 2, alc883_3ST_ch2_intel_init },
7583 { 4, alc883_3ST_ch4_intel_init },
7584 { 6, alc883_3ST_ch6_intel_init },
7590 static struct hda_verb alc883_sixstack_ch6_init[] = {
7591 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7592 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7593 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7594 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7601 static struct hda_verb alc883_sixstack_ch8_init[] = {
7602 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7603 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7604 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7605 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7609 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7610 { 6, alc883_sixstack_ch6_init },
7611 { 8, alc883_sixstack_ch8_init },
7614 static struct hda_verb alc883_medion_eapd_verbs[] = {
7615 /* eanable EAPD on medion laptop */
7616 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7617 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7621 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7622 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7625 static struct snd_kcontrol_new alc883_base_mixer[] = {
7626 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7627 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7628 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7629 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7630 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7631 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7632 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7633 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7634 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7635 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7636 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7637 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7638 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7639 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7640 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7641 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7642 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7643 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7644 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7645 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7646 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7650 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7651 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7652 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7653 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7654 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7655 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7656 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7657 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7658 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7659 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7660 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7661 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7662 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7663 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7667 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7668 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7669 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7670 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7671 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7672 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7673 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7674 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7675 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7676 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7677 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7681 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7682 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7683 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7684 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7685 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7686 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7687 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7688 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7689 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7690 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7691 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7695 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7696 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7697 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7698 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7699 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7700 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7701 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7702 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7703 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7704 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7705 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7706 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7707 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7708 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7712 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7713 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7714 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7715 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7716 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7717 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7718 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7719 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7720 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7721 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7722 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7723 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7724 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7725 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7726 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7727 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7728 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7729 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7730 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7731 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7735 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7736 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7737 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7738 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7739 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7740 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7742 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7743 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7744 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7745 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7746 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7747 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7748 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7749 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7750 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7751 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7752 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7753 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7754 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7755 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7759 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7760 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7761 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7762 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7763 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7764 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7765 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7766 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7767 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7768 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7769 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7770 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7771 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7772 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7774 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7775 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7776 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7777 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7778 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7782 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7783 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7784 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7785 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7786 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7787 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7788 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7789 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7790 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7791 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7792 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7793 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7794 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7795 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7796 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7797 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7798 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7802 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7803 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7804 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7805 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7806 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7807 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7808 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7809 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7810 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7811 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7812 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7813 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7817 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7818 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7819 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7820 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7821 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7822 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7823 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7824 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7829 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7830 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7831 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7832 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7833 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7834 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7835 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7836 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7837 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7838 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7842 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7843 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7844 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7845 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7846 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7847 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7848 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7849 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7850 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7851 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7855 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7856 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7857 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7858 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7859 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7860 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7861 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7862 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7863 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7867 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7868 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7869 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7870 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7871 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7872 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7873 0x0d, 1, 0x0, HDA_OUTPUT),
7874 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7875 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7876 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7877 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7878 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7879 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7880 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7881 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7882 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7883 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7884 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7885 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7886 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7887 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7888 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7892 static struct hda_bind_ctls alc883_bind_cap_vol = {
7893 .ops = &snd_hda_bind_vol,
7895 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7896 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7901 static struct hda_bind_ctls alc883_bind_cap_switch = {
7902 .ops = &snd_hda_bind_sw,
7904 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7905 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7910 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7911 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7912 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7913 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7914 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7915 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7916 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7917 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7918 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7922 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7923 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7924 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7926 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7927 /* .name = "Capture Source", */
7928 .name = "Input Source",
7930 .info = alc_mux_enum_info,
7931 .get = alc_mux_enum_get,
7932 .put = alc_mux_enum_put,
7937 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7939 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7940 .name = "Channel Mode",
7941 .info = alc_ch_mode_info,
7942 .get = alc_ch_mode_get,
7943 .put = alc_ch_mode_put,
7948 static struct hda_verb alc883_init_verbs[] = {
7949 /* ADC1: mute amp left and right */
7950 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7951 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7952 /* ADC2: mute amp left and right */
7953 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7954 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7955 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7956 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7957 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7958 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7960 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7961 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7962 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7964 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7965 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7966 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7968 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7969 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7970 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7972 /* mute analog input loopbacks */
7973 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7974 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7975 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7976 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7977 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7979 /* Front Pin: output 0 (0x0c) */
7980 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7981 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7982 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7983 /* Rear Pin: output 1 (0x0d) */
7984 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7985 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7986 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7987 /* CLFE Pin: output 2 (0x0e) */
7988 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7989 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7990 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7991 /* Side Pin: output 3 (0x0f) */
7992 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7993 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7994 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7995 /* Mic (rear) pin: input vref at 80% */
7996 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7997 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7998 /* Front Mic pin: input vref at 80% */
7999 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8000 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8001 /* Line In pin: input */
8002 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8003 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8004 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8005 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8006 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8007 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8008 /* CD pin widget for input */
8009 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8011 /* FIXME: use matrix-type input source selection */
8012 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8014 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8015 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8016 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8017 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8019 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8020 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8021 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8022 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8026 /* toggle speaker-output according to the hp-jack state */
8027 static void alc883_mitac_init_hook(struct hda_codec *codec)
8029 struct alc_spec *spec = codec->spec;
8031 spec->autocfg.hp_pins[0] = 0x15;
8032 spec->autocfg.speaker_pins[0] = 0x14;
8033 spec->autocfg.speaker_pins[1] = 0x17;
8034 alc_automute_amp(codec);
8037 /* auto-toggle front mic */
8039 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8041 unsigned int present;
8044 present = snd_hda_codec_read(codec, 0x18, 0,
8045 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8046 bits = present ? HDA_AMP_MUTE : 0;
8047 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8051 static struct hda_verb alc883_mitac_verbs[] = {
8053 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8054 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8056 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8057 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8059 /* enable unsolicited event */
8060 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8061 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8066 static struct hda_verb alc883_clevo_m720_verbs[] = {
8068 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8069 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8071 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8072 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8074 /* enable unsolicited event */
8075 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8076 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8081 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8083 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8084 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8086 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8087 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8089 /* enable unsolicited event */
8090 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8095 static struct hda_verb alc883_tagra_verbs[] = {
8096 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8097 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8099 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8100 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8102 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8103 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8104 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8106 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8107 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
8108 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
8109 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
8114 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8115 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8116 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8117 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8121 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8122 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8123 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8124 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8125 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8129 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8130 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8131 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8132 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8133 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8134 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8138 static struct hda_verb alc883_haier_w66_verbs[] = {
8139 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8140 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8142 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8144 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8145 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8146 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8147 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8151 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8152 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8153 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8154 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8155 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8156 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8157 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8158 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8159 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8163 static struct hda_verb alc888_6st_dell_verbs[] = {
8164 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8168 static void alc888_3st_hp_init_hook(struct hda_codec *codec)
8170 struct alc_spec *spec = codec->spec;
8172 spec->autocfg.hp_pins[0] = 0x1b;
8173 spec->autocfg.speaker_pins[0] = 0x14;
8174 spec->autocfg.speaker_pins[1] = 0x16;
8175 spec->autocfg.speaker_pins[2] = 0x18;
8176 alc_automute_amp(codec);
8179 static struct hda_verb alc888_3st_hp_verbs[] = {
8180 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8181 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8182 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8183 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8190 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8191 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8192 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8193 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8194 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8201 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8202 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8203 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8204 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8205 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8206 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8213 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8214 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8215 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8216 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8217 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8218 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8219 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8223 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8224 { 2, alc888_3st_hp_2ch_init },
8225 { 4, alc888_3st_hp_4ch_init },
8226 { 6, alc888_3st_hp_6ch_init },
8229 /* toggle front-jack and RCA according to the hp-jack state */
8230 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8232 unsigned int present;
8234 present = snd_hda_codec_read(codec, 0x1b, 0,
8235 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8236 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8237 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8238 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8239 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8242 /* toggle RCA according to the front-jack state */
8243 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8245 unsigned int present;
8247 present = snd_hda_codec_read(codec, 0x14, 0,
8248 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8249 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8250 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8253 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8256 if ((res >> 26) == ALC880_HP_EVENT)
8257 alc888_lenovo_ms7195_front_automute(codec);
8258 if ((res >> 26) == ALC880_FRONT_EVENT)
8259 alc888_lenovo_ms7195_rca_automute(codec);
8262 static struct hda_verb alc883_medion_md2_verbs[] = {
8263 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8264 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8266 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8268 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8272 /* toggle speaker-output according to the hp-jack state */
8273 static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8275 struct alc_spec *spec = codec->spec;
8277 spec->autocfg.hp_pins[0] = 0x14;
8278 spec->autocfg.speaker_pins[0] = 0x15;
8279 alc_automute_amp(codec);
8282 /* toggle speaker-output according to the hp-jack state */
8283 #define alc883_tagra_init_hook alc882_targa_init_hook
8284 #define alc883_tagra_unsol_event alc882_targa_unsol_event
8286 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8288 unsigned int present;
8290 present = snd_hda_codec_read(codec, 0x18, 0,
8291 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8292 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8293 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8296 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8298 struct alc_spec *spec = codec->spec;
8300 spec->autocfg.hp_pins[0] = 0x15;
8301 spec->autocfg.speaker_pins[0] = 0x14;
8302 alc_automute_amp(codec);
8303 alc883_clevo_m720_mic_automute(codec);
8306 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8309 switch (res >> 26) {
8310 case ALC880_MIC_EVENT:
8311 alc883_clevo_m720_mic_automute(codec);
8314 alc_automute_amp_unsol_event(codec, res);
8319 /* toggle speaker-output according to the hp-jack state */
8320 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec)
8322 struct alc_spec *spec = codec->spec;
8324 spec->autocfg.hp_pins[0] = 0x14;
8325 spec->autocfg.speaker_pins[0] = 0x15;
8326 alc_automute_amp(codec);
8329 static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8331 struct alc_spec *spec = codec->spec;
8333 spec->autocfg.hp_pins[0] = 0x1b;
8334 spec->autocfg.speaker_pins[0] = 0x14;
8335 alc_automute_amp(codec);
8338 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8340 unsigned int present;
8343 present = snd_hda_codec_read(codec, 0x14, 0,
8344 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8345 bits = present ? HDA_AMP_MUTE : 0;
8346 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8347 HDA_AMP_MUTE, bits);
8350 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8352 unsigned int present;
8355 present = snd_hda_codec_read(codec, 0x1b, 0,
8356 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8357 bits = present ? HDA_AMP_MUTE : 0;
8358 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8359 HDA_AMP_MUTE, bits);
8360 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8361 HDA_AMP_MUTE, bits);
8364 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8367 if ((res >> 26) == ALC880_HP_EVENT)
8368 alc883_lenovo_101e_all_automute(codec);
8369 if ((res >> 26) == ALC880_FRONT_EVENT)
8370 alc883_lenovo_101e_ispeaker_automute(codec);
8373 /* toggle speaker-output according to the hp-jack state */
8374 static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8376 struct alc_spec *spec = codec->spec;
8378 spec->autocfg.hp_pins[0] = 0x14;
8379 spec->autocfg.speaker_pins[0] = 0x15;
8380 spec->autocfg.speaker_pins[1] = 0x16;
8381 alc_automute_amp(codec);
8384 static struct hda_verb alc883_acer_eapd_verbs[] = {
8385 /* HP Pin: output 0 (0x0c) */
8386 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8387 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8388 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8389 /* Front Pin: output 0 (0x0c) */
8390 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8391 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8392 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8393 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8394 /* eanable EAPD on medion laptop */
8395 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8396 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8397 /* enable unsolicited event */
8398 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8402 static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8404 struct alc_spec *spec = codec->spec;
8406 spec->autocfg.hp_pins[0] = 0x1b;
8407 spec->autocfg.speaker_pins[0] = 0x14;
8408 spec->autocfg.speaker_pins[1] = 0x15;
8409 spec->autocfg.speaker_pins[2] = 0x16;
8410 spec->autocfg.speaker_pins[3] = 0x17;
8411 alc_automute_amp(codec);
8414 static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8416 struct alc_spec *spec = codec->spec;
8418 spec->autocfg.hp_pins[0] = 0x1b;
8419 spec->autocfg.speaker_pins[0] = 0x14;
8420 spec->autocfg.speaker_pins[1] = 0x15;
8421 spec->autocfg.speaker_pins[2] = 0x16;
8422 spec->autocfg.speaker_pins[3] = 0x17;
8423 spec->autocfg.speaker_pins[4] = 0x1a;
8424 alc_automute_amp(codec);
8428 * generic initialization of ADC, input mixers and output mixers
8430 static struct hda_verb alc883_auto_init_verbs[] = {
8432 * Unmute ADC0-2 and set the default input to mic-in
8434 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8435 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8436 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8437 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8439 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8441 * Note: PASD motherboards uses the Line In 2 as the input for
8442 * front panel mic (mic 2)
8444 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8445 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8446 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8447 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8448 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8449 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8452 * Set up output mixers (0x0c - 0x0f)
8454 /* set vol=0 to output mixers */
8455 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8456 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8457 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8458 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8459 /* set up input amps for analog loopback */
8460 /* Amp Indices: DAC = 0, mixer = 1 */
8461 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8463 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8464 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8465 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8466 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8467 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8468 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8469 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8470 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8472 /* FIXME: use matrix-type input source selection */
8473 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8475 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8476 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8477 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8478 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8479 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8484 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8485 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8490 static struct hda_verb alc888_asus_m90v_verbs[] = {
8491 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8492 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8493 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8494 /* enable unsolicited event */
8495 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8496 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8500 static void alc883_nb_mic_automute(struct hda_codec *codec)
8502 unsigned int present;
8504 present = snd_hda_codec_read(codec, 0x18, 0,
8505 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8506 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8507 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8508 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8509 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8512 static void alc883_M90V_init_hook(struct hda_codec *codec)
8514 struct alc_spec *spec = codec->spec;
8516 spec->autocfg.hp_pins[0] = 0x1b;
8517 spec->autocfg.speaker_pins[0] = 0x14;
8518 spec->autocfg.speaker_pins[1] = 0x15;
8519 spec->autocfg.speaker_pins[2] = 0x16;
8520 alc_automute_pin(codec);
8523 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8526 switch (res >> 26) {
8527 case ALC880_MIC_EVENT:
8528 alc883_nb_mic_automute(codec);
8531 alc_sku_unsol_event(codec, res);
8536 static void alc883_mode2_inithook(struct hda_codec *codec)
8538 alc883_M90V_init_hook(codec);
8539 alc883_nb_mic_automute(codec);
8542 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8543 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8544 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8545 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8546 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8547 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8548 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8549 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8550 /* enable unsolicited event */
8551 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8555 static void alc883_eee1601_inithook(struct hda_codec *codec)
8557 struct alc_spec *spec = codec->spec;
8559 spec->autocfg.hp_pins[0] = 0x14;
8560 spec->autocfg.speaker_pins[0] = 0x1b;
8561 alc_automute_pin(codec);
8564 #ifdef CONFIG_SND_HDA_POWER_SAVE
8565 #define alc883_loopbacks alc880_loopbacks
8568 /* pcm configuration: identiacal with ALC880 */
8569 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8570 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8571 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8572 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8573 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8576 * configuration and preset
8578 static const char *alc883_models[ALC883_MODEL_LAST] = {
8579 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8580 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8581 [ALC883_3ST_6ch] = "3stack-6ch",
8582 [ALC883_6ST_DIG] = "6stack-dig",
8583 [ALC883_TARGA_DIG] = "targa-dig",
8584 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8585 [ALC883_ACER] = "acer",
8586 [ALC883_ACER_ASPIRE] = "acer-aspire",
8587 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8588 [ALC883_MEDION] = "medion",
8589 [ALC883_MEDION_MD2] = "medion-md2",
8590 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8591 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8592 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8593 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8594 [ALC888_LENOVO_SKY] = "lenovo-sky",
8595 [ALC883_HAIER_W66] = "haier-w66",
8596 [ALC888_3ST_HP] = "3stack-hp",
8597 [ALC888_6ST_DELL] = "6stack-dell",
8598 [ALC883_MITAC] = "mitac",
8599 [ALC883_CLEVO_M720] = "clevo-m720",
8600 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8601 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8602 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8603 [ALC1200_ASUS_P5Q] = "asus-p5q",
8604 [ALC883_AUTO] = "auto",
8607 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8608 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8609 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8610 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8611 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8612 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8613 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8614 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8615 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8616 ALC888_ACER_ASPIRE_4930G),
8617 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8618 ALC888_ACER_ASPIRE_4930G),
8619 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
8620 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
8621 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8622 ALC888_ACER_ASPIRE_4930G),
8623 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8624 ALC888_ACER_ASPIRE_4930G),
8625 /* default Acer -- disabled as it causes more problems.
8626 * model=auto should work fine now
8628 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8629 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8630 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8631 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8632 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8633 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8634 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8635 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8636 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8637 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8638 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8639 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8640 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8641 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8642 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8643 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8644 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8645 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8646 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8647 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8648 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8649 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8650 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8651 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8652 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8653 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8654 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8655 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8656 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8657 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8658 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8659 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8660 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8661 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8662 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8663 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8664 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8665 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8666 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8667 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8668 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8669 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8670 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8671 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8672 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8673 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8674 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8675 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8676 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8677 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8678 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8679 ALC883_FUJITSU_PI2515),
8680 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8681 ALC888_FUJITSU_XA3530),
8682 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8683 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8684 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8685 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8686 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8687 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8688 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8689 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8690 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8691 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8692 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8693 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8694 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8695 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8699 static hda_nid_t alc883_slave_dig_outs[] = {
8700 ALC1200_DIGOUT_NID, 0,
8703 static hda_nid_t alc1200_slave_dig_outs[] = {
8704 ALC883_DIGOUT_NID, 0,
8707 static struct alc_config_preset alc883_presets[] = {
8708 [ALC883_3ST_2ch_DIG] = {
8709 .mixers = { alc883_3ST_2ch_mixer },
8710 .init_verbs = { alc883_init_verbs },
8711 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8712 .dac_nids = alc883_dac_nids,
8713 .dig_out_nid = ALC883_DIGOUT_NID,
8714 .dig_in_nid = ALC883_DIGIN_NID,
8715 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8716 .channel_mode = alc883_3ST_2ch_modes,
8717 .input_mux = &alc883_capture_source,
8719 [ALC883_3ST_6ch_DIG] = {
8720 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8721 .init_verbs = { alc883_init_verbs },
8722 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8723 .dac_nids = alc883_dac_nids,
8724 .dig_out_nid = ALC883_DIGOUT_NID,
8725 .dig_in_nid = ALC883_DIGIN_NID,
8726 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8727 .channel_mode = alc883_3ST_6ch_modes,
8729 .input_mux = &alc883_capture_source,
8731 [ALC883_3ST_6ch] = {
8732 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8733 .init_verbs = { alc883_init_verbs },
8734 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8735 .dac_nids = alc883_dac_nids,
8736 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8737 .channel_mode = alc883_3ST_6ch_modes,
8739 .input_mux = &alc883_capture_source,
8741 [ALC883_3ST_6ch_INTEL] = {
8742 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8743 .init_verbs = { alc883_init_verbs },
8744 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8745 .dac_nids = alc883_dac_nids,
8746 .dig_out_nid = ALC883_DIGOUT_NID,
8747 .dig_in_nid = ALC883_DIGIN_NID,
8748 .slave_dig_outs = alc883_slave_dig_outs,
8749 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8750 .channel_mode = alc883_3ST_6ch_intel_modes,
8752 .input_mux = &alc883_3stack_6ch_intel,
8754 [ALC883_6ST_DIG] = {
8755 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8756 .init_verbs = { alc883_init_verbs },
8757 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8758 .dac_nids = alc883_dac_nids,
8759 .dig_out_nid = ALC883_DIGOUT_NID,
8760 .dig_in_nid = ALC883_DIGIN_NID,
8761 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8762 .channel_mode = alc883_sixstack_modes,
8763 .input_mux = &alc883_capture_source,
8765 [ALC883_TARGA_DIG] = {
8766 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8767 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8768 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8769 .dac_nids = alc883_dac_nids,
8770 .dig_out_nid = ALC883_DIGOUT_NID,
8771 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8772 .channel_mode = alc883_3ST_6ch_modes,
8774 .input_mux = &alc883_capture_source,
8775 .unsol_event = alc883_tagra_unsol_event,
8776 .init_hook = alc883_tagra_init_hook,
8778 [ALC883_TARGA_2ch_DIG] = {
8779 .mixers = { alc883_tagra_2ch_mixer},
8780 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8781 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8782 .dac_nids = alc883_dac_nids,
8783 .adc_nids = alc883_adc_nids_alt,
8784 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8785 .dig_out_nid = ALC883_DIGOUT_NID,
8786 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8787 .channel_mode = alc883_3ST_2ch_modes,
8788 .input_mux = &alc883_capture_source,
8789 .unsol_event = alc883_tagra_unsol_event,
8790 .init_hook = alc883_tagra_init_hook,
8793 .mixers = { alc883_base_mixer },
8794 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8795 * and the headphone jack. Turn this on and rely on the
8796 * standard mute methods whenever the user wants to turn
8797 * these outputs off.
8799 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8800 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8801 .dac_nids = alc883_dac_nids,
8802 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8803 .channel_mode = alc883_3ST_2ch_modes,
8804 .input_mux = &alc883_capture_source,
8806 [ALC883_ACER_ASPIRE] = {
8807 .mixers = { alc883_acer_aspire_mixer },
8808 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8809 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8810 .dac_nids = alc883_dac_nids,
8811 .dig_out_nid = ALC883_DIGOUT_NID,
8812 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8813 .channel_mode = alc883_3ST_2ch_modes,
8814 .input_mux = &alc883_capture_source,
8815 .unsol_event = alc_automute_amp_unsol_event,
8816 .init_hook = alc883_acer_aspire_init_hook,
8818 [ALC888_ACER_ASPIRE_4930G] = {
8819 .mixers = { alc888_base_mixer,
8820 alc883_chmode_mixer },
8821 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8822 alc888_acer_aspire_4930g_verbs },
8823 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8824 .dac_nids = alc883_dac_nids,
8825 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8826 .adc_nids = alc883_adc_nids_rev,
8827 .capsrc_nids = alc883_capsrc_nids_rev,
8828 .dig_out_nid = ALC883_DIGOUT_NID,
8829 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8830 .channel_mode = alc883_3ST_6ch_modes,
8833 ARRAY_SIZE(alc888_2_capture_sources),
8834 .input_mux = alc888_2_capture_sources,
8835 .unsol_event = alc_automute_amp_unsol_event,
8836 .init_hook = alc888_acer_aspire_4930g_init_hook,
8839 .mixers = { alc883_fivestack_mixer,
8840 alc883_chmode_mixer },
8841 .init_verbs = { alc883_init_verbs,
8842 alc883_medion_eapd_verbs },
8843 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8844 .dac_nids = alc883_dac_nids,
8845 .adc_nids = alc883_adc_nids_alt,
8846 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8847 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8848 .channel_mode = alc883_sixstack_modes,
8849 .input_mux = &alc883_capture_source,
8851 [ALC883_MEDION_MD2] = {
8852 .mixers = { alc883_medion_md2_mixer},
8853 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8854 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8855 .dac_nids = alc883_dac_nids,
8856 .dig_out_nid = ALC883_DIGOUT_NID,
8857 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8858 .channel_mode = alc883_3ST_2ch_modes,
8859 .input_mux = &alc883_capture_source,
8860 .unsol_event = alc_automute_amp_unsol_event,
8861 .init_hook = alc883_medion_md2_init_hook,
8863 [ALC883_LAPTOP_EAPD] = {
8864 .mixers = { alc883_base_mixer },
8865 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8866 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8867 .dac_nids = alc883_dac_nids,
8868 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8869 .channel_mode = alc883_3ST_2ch_modes,
8870 .input_mux = &alc883_capture_source,
8872 [ALC883_CLEVO_M720] = {
8873 .mixers = { alc883_clevo_m720_mixer },
8874 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8875 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8876 .dac_nids = alc883_dac_nids,
8877 .dig_out_nid = ALC883_DIGOUT_NID,
8878 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8879 .channel_mode = alc883_3ST_2ch_modes,
8880 .input_mux = &alc883_capture_source,
8881 .unsol_event = alc883_clevo_m720_unsol_event,
8882 .init_hook = alc883_clevo_m720_init_hook,
8884 [ALC883_LENOVO_101E_2ch] = {
8885 .mixers = { alc883_lenovo_101e_2ch_mixer},
8886 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8887 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8888 .dac_nids = alc883_dac_nids,
8889 .adc_nids = alc883_adc_nids_alt,
8890 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8891 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8892 .channel_mode = alc883_3ST_2ch_modes,
8893 .input_mux = &alc883_lenovo_101e_capture_source,
8894 .unsol_event = alc883_lenovo_101e_unsol_event,
8895 .init_hook = alc883_lenovo_101e_all_automute,
8897 [ALC883_LENOVO_NB0763] = {
8898 .mixers = { alc883_lenovo_nb0763_mixer },
8899 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8900 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8901 .dac_nids = alc883_dac_nids,
8902 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8903 .channel_mode = alc883_3ST_2ch_modes,
8905 .input_mux = &alc883_lenovo_nb0763_capture_source,
8906 .unsol_event = alc_automute_amp_unsol_event,
8907 .init_hook = alc883_medion_md2_init_hook,
8909 [ALC888_LENOVO_MS7195_DIG] = {
8910 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8911 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8912 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8913 .dac_nids = alc883_dac_nids,
8914 .dig_out_nid = ALC883_DIGOUT_NID,
8915 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8916 .channel_mode = alc883_3ST_6ch_modes,
8918 .input_mux = &alc883_capture_source,
8919 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8920 .init_hook = alc888_lenovo_ms7195_front_automute,
8922 [ALC883_HAIER_W66] = {
8923 .mixers = { alc883_tagra_2ch_mixer},
8924 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8925 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8926 .dac_nids = alc883_dac_nids,
8927 .dig_out_nid = ALC883_DIGOUT_NID,
8928 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8929 .channel_mode = alc883_3ST_2ch_modes,
8930 .input_mux = &alc883_capture_source,
8931 .unsol_event = alc_automute_amp_unsol_event,
8932 .init_hook = alc883_haier_w66_init_hook,
8935 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8936 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8937 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8938 .dac_nids = alc883_dac_nids,
8939 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8940 .channel_mode = alc888_3st_hp_modes,
8942 .input_mux = &alc883_capture_source,
8943 .unsol_event = alc_automute_amp_unsol_event,
8944 .init_hook = alc888_3st_hp_init_hook,
8946 [ALC888_6ST_DELL] = {
8947 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8948 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8949 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8950 .dac_nids = alc883_dac_nids,
8951 .dig_out_nid = ALC883_DIGOUT_NID,
8952 .dig_in_nid = ALC883_DIGIN_NID,
8953 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8954 .channel_mode = alc883_sixstack_modes,
8955 .input_mux = &alc883_capture_source,
8956 .unsol_event = alc_automute_amp_unsol_event,
8957 .init_hook = alc888_6st_dell_init_hook,
8960 .mixers = { alc883_mitac_mixer },
8961 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8962 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8963 .dac_nids = alc883_dac_nids,
8964 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8965 .channel_mode = alc883_3ST_2ch_modes,
8966 .input_mux = &alc883_capture_source,
8967 .unsol_event = alc_automute_amp_unsol_event,
8968 .init_hook = alc883_mitac_init_hook,
8970 [ALC883_FUJITSU_PI2515] = {
8971 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8972 .init_verbs = { alc883_init_verbs,
8973 alc883_2ch_fujitsu_pi2515_verbs},
8974 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8975 .dac_nids = alc883_dac_nids,
8976 .dig_out_nid = ALC883_DIGOUT_NID,
8977 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8978 .channel_mode = alc883_3ST_2ch_modes,
8979 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8980 .unsol_event = alc_automute_amp_unsol_event,
8981 .init_hook = alc883_2ch_fujitsu_pi2515_init_hook,
8983 [ALC888_FUJITSU_XA3530] = {
8984 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8985 .init_verbs = { alc883_init_verbs,
8986 alc888_fujitsu_xa3530_verbs },
8987 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8988 .dac_nids = alc883_dac_nids,
8989 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8990 .adc_nids = alc883_adc_nids_rev,
8991 .capsrc_nids = alc883_capsrc_nids_rev,
8992 .dig_out_nid = ALC883_DIGOUT_NID,
8993 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8994 .channel_mode = alc888_4ST_8ch_intel_modes,
8996 ARRAY_SIZE(alc888_2_capture_sources),
8997 .input_mux = alc888_2_capture_sources,
8998 .unsol_event = alc_automute_amp_unsol_event,
8999 .init_hook = alc888_fujitsu_xa3530_init_hook,
9001 [ALC888_LENOVO_SKY] = {
9002 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9003 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9004 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9005 .dac_nids = alc883_dac_nids,
9006 .dig_out_nid = ALC883_DIGOUT_NID,
9007 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9008 .channel_mode = alc883_sixstack_modes,
9010 .input_mux = &alc883_lenovo_sky_capture_source,
9011 .unsol_event = alc_automute_amp_unsol_event,
9012 .init_hook = alc888_lenovo_sky_init_hook,
9014 [ALC888_ASUS_M90V] = {
9015 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9016 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9017 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9018 .dac_nids = alc883_dac_nids,
9019 .dig_out_nid = ALC883_DIGOUT_NID,
9020 .dig_in_nid = ALC883_DIGIN_NID,
9021 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9022 .channel_mode = alc883_3ST_6ch_modes,
9024 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9025 .unsol_event = alc883_mode2_unsol_event,
9026 .init_hook = alc883_mode2_inithook,
9028 [ALC888_ASUS_EEE1601] = {
9029 .mixers = { alc883_asus_eee1601_mixer },
9030 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9031 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9032 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9033 .dac_nids = alc883_dac_nids,
9034 .dig_out_nid = ALC883_DIGOUT_NID,
9035 .dig_in_nid = ALC883_DIGIN_NID,
9036 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9037 .channel_mode = alc883_3ST_2ch_modes,
9039 .input_mux = &alc883_asus_eee1601_capture_source,
9040 .unsol_event = alc_sku_unsol_event,
9041 .init_hook = alc883_eee1601_inithook,
9043 [ALC1200_ASUS_P5Q] = {
9044 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9045 .init_verbs = { alc883_init_verbs },
9046 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9047 .dac_nids = alc883_dac_nids,
9048 .dig_out_nid = ALC1200_DIGOUT_NID,
9049 .dig_in_nid = ALC883_DIGIN_NID,
9050 .slave_dig_outs = alc1200_slave_dig_outs,
9051 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9052 .channel_mode = alc883_sixstack_modes,
9053 .input_mux = &alc883_capture_source,
9059 * BIOS auto configuration
9061 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
9062 hda_nid_t nid, int pin_type,
9066 struct alc_spec *spec = codec->spec;
9069 alc_set_pin_output(codec, nid, pin_type);
9070 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9073 idx = spec->multiout.dac_nids[dac_idx] - 2;
9074 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9078 static void alc883_auto_init_multi_out(struct hda_codec *codec)
9080 struct alc_spec *spec = codec->spec;
9083 for (i = 0; i <= HDA_SIDE; i++) {
9084 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9085 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9087 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
9092 static void alc883_auto_init_hp_out(struct hda_codec *codec)
9094 struct alc_spec *spec = codec->spec;
9097 pin = spec->autocfg.hp_pins[0];
9098 if (pin) /* connect to front */
9100 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9101 pin = spec->autocfg.speaker_pins[0];
9103 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9106 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9107 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9109 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9111 struct alc_spec *spec = codec->spec;
9114 for (i = 0; i < AUTO_PIN_LAST; i++) {
9115 hda_nid_t nid = spec->autocfg.input_pins[i];
9116 if (alc883_is_input_pin(nid)) {
9117 alc_set_input_pin(codec, nid, i);
9118 if (nid != ALC883_PIN_CD_NID &&
9119 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
9120 snd_hda_codec_write(codec, nid, 0,
9121 AC_VERB_SET_AMP_GAIN_MUTE,
9127 #define alc883_auto_init_input_src alc882_auto_init_input_src
9129 /* almost identical with ALC880 parser... */
9130 static int alc883_parse_auto_config(struct hda_codec *codec)
9132 struct alc_spec *spec = codec->spec;
9133 int err = alc880_parse_auto_config(codec);
9134 struct auto_pin_cfg *cfg = &spec->autocfg;
9140 return 0; /* no config found */
9142 err = alc_auto_add_mic_boost(codec);
9146 /* hack - override the init verbs */
9147 spec->init_verbs[0] = alc883_auto_init_verbs;
9149 /* setup input_mux for ALC889 */
9150 if (codec->vendor_id == 0x10ec0889) {
9151 /* digital-mic input pin is excluded in alc880_auto_create..()
9152 * because it's under 0x18
9154 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9155 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9156 struct hda_input_mux *imux = &spec->private_imux[0];
9157 for (i = 1; i < 3; i++)
9158 memcpy(&spec->private_imux[i],
9159 &spec->private_imux[0],
9160 sizeof(spec->private_imux[0]));
9161 imux->items[imux->num_items].label = "Int DMic";
9162 imux->items[imux->num_items].index = 0x0b;
9164 spec->num_mux_defs = 3;
9165 spec->input_mux = spec->private_imux;
9169 return 1; /* config found */
9172 /* additional initialization for auto-configuration model */
9173 static void alc883_auto_init(struct hda_codec *codec)
9175 struct alc_spec *spec = codec->spec;
9176 alc883_auto_init_multi_out(codec);
9177 alc883_auto_init_hp_out(codec);
9178 alc883_auto_init_analog_input(codec);
9179 alc883_auto_init_input_src(codec);
9180 if (spec->unsol_event)
9181 alc_inithook(codec);
9184 static int patch_alc883(struct hda_codec *codec)
9186 struct alc_spec *spec;
9187 int err, board_config;
9189 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9195 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9197 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9200 if (board_config < 0) {
9201 printk(KERN_INFO "hda_codec: Unknown model for %s, "
9202 "trying auto-probe from BIOS...\n", codec->chip_name);
9203 board_config = ALC883_AUTO;
9206 if (board_config == ALC883_AUTO) {
9207 /* automatic parse from the BIOS config */
9208 err = alc883_parse_auto_config(codec);
9214 "hda_codec: Cannot set up configuration "
9215 "from BIOS. Using base mode...\n");
9216 board_config = ALC883_3ST_2ch_DIG;
9220 err = snd_hda_attach_beep_device(codec, 0x1);
9226 if (board_config != ALC883_AUTO)
9227 setup_preset(spec, &alc883_presets[board_config]);
9229 switch (codec->vendor_id) {
9231 if (!spec->num_adc_nids) {
9232 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9233 spec->adc_nids = alc883_adc_nids;
9235 if (!spec->capsrc_nids)
9236 spec->capsrc_nids = alc883_capsrc_nids;
9237 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9238 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9241 if (!spec->num_adc_nids) {
9242 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9243 spec->adc_nids = alc889_adc_nids;
9245 if (!spec->capsrc_nids)
9246 spec->capsrc_nids = alc889_capsrc_nids;
9247 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9251 if (!spec->num_adc_nids) {
9252 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9253 spec->adc_nids = alc883_adc_nids;
9255 if (!spec->capsrc_nids)
9256 spec->capsrc_nids = alc883_capsrc_nids;
9257 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9261 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9262 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9263 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9265 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9266 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9268 if (!spec->cap_mixer)
9269 set_capture_mixer(spec);
9270 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9272 spec->vmaster_nid = 0x0c;
9274 codec->patch_ops = alc_patch_ops;
9275 if (board_config == ALC883_AUTO)
9276 spec->init_hook = alc883_auto_init;
9278 #ifdef CONFIG_SND_HDA_POWER_SAVE
9279 if (!spec->loopback.amplist)
9280 spec->loopback.amplist = alc883_loopbacks;
9282 codec->proc_widget_hook = print_realtek_coef;
9291 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9292 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9294 #define alc262_dac_nids alc260_dac_nids
9295 #define alc262_adc_nids alc882_adc_nids
9296 #define alc262_adc_nids_alt alc882_adc_nids_alt
9297 #define alc262_capsrc_nids alc882_capsrc_nids
9298 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9300 #define alc262_modes alc260_modes
9301 #define alc262_capture_source alc882_capture_source
9303 static hda_nid_t alc262_dmic_adc_nids[1] = {
9308 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9310 static struct snd_kcontrol_new alc262_base_mixer[] = {
9311 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9312 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9313 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9314 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9315 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9316 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9317 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9318 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9319 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9320 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9321 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9322 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9323 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9324 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9325 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9326 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9330 /* update HP, line and mono-out pins according to the master switch */
9331 static void alc262_hp_master_update(struct hda_codec *codec)
9333 struct alc_spec *spec = codec->spec;
9334 int val = spec->master_sw;
9337 snd_hda_codec_write_cache(codec, 0x1b, 0,
9338 AC_VERB_SET_PIN_WIDGET_CONTROL,
9340 snd_hda_codec_write_cache(codec, 0x15, 0,
9341 AC_VERB_SET_PIN_WIDGET_CONTROL,
9343 /* mono (speaker) depending on the HP jack sense */
9344 val = val && !spec->jack_present;
9345 snd_hda_codec_write_cache(codec, 0x16, 0,
9346 AC_VERB_SET_PIN_WIDGET_CONTROL,
9350 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9352 struct alc_spec *spec = codec->spec;
9353 unsigned int presence;
9354 presence = snd_hda_codec_read(codec, 0x1b, 0,
9355 AC_VERB_GET_PIN_SENSE, 0);
9356 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9357 alc262_hp_master_update(codec);
9360 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9362 if ((res >> 26) != ALC880_HP_EVENT)
9364 alc262_hp_bpc_automute(codec);
9367 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9369 struct alc_spec *spec = codec->spec;
9370 unsigned int presence;
9371 presence = snd_hda_codec_read(codec, 0x15, 0,
9372 AC_VERB_GET_PIN_SENSE, 0);
9373 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9374 alc262_hp_master_update(codec);
9377 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9380 if ((res >> 26) != ALC880_HP_EVENT)
9382 alc262_hp_wildwest_automute(codec);
9385 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9387 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9388 struct snd_ctl_elem_value *ucontrol)
9390 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9391 struct alc_spec *spec = codec->spec;
9392 int val = !!*ucontrol->value.integer.value;
9394 if (val == spec->master_sw)
9396 spec->master_sw = val;
9397 alc262_hp_master_update(codec);
9401 #define ALC262_HP_MASTER_SWITCH \
9403 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9404 .name = "Master Playback Switch", \
9405 .info = snd_ctl_boolean_mono_info, \
9406 .get = alc262_hp_master_sw_get, \
9407 .put = alc262_hp_master_sw_put, \
9410 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9411 ALC262_HP_MASTER_SWITCH,
9412 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9413 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9414 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9415 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9417 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9419 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9420 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9421 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9422 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9423 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9424 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9425 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9426 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9427 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9428 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9429 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9430 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9434 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9435 ALC262_HP_MASTER_SWITCH,
9436 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9437 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9438 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9439 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9440 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9442 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9444 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9445 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9446 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9447 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9448 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9449 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9450 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9454 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9455 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9456 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9457 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9461 /* mute/unmute internal speaker according to the hp jack and mute state */
9462 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9464 struct alc_spec *spec = codec->spec;
9466 spec->autocfg.hp_pins[0] = 0x15;
9467 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9468 alc_automute_amp(codec);
9471 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9472 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9473 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9474 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9475 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9476 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9477 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9478 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9482 static struct hda_verb alc262_hp_t5735_verbs[] = {
9483 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9484 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9486 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9490 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9491 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9492 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9493 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9494 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9495 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9496 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9500 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9501 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9502 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9503 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9504 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9505 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9506 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9507 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9508 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9509 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9510 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9514 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9521 /* bind hp and internal speaker mute (with plug check) as master switch */
9522 static void alc262_hippo_master_update(struct hda_codec *codec)
9524 struct alc_spec *spec = codec->spec;
9525 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9526 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9527 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9531 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
9532 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
9533 HDA_AMP_MUTE, mute);
9534 /* mute internal speaker per jack sense */
9535 if (spec->jack_present)
9536 mute = HDA_AMP_MUTE;
9538 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
9539 HDA_AMP_MUTE, mute);
9540 if (speaker_nid && speaker_nid != line_nid)
9541 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
9542 HDA_AMP_MUTE, mute);
9545 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
9547 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
9548 struct snd_ctl_elem_value *ucontrol)
9550 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9551 struct alc_spec *spec = codec->spec;
9552 int val = !!*ucontrol->value.integer.value;
9554 if (val == spec->master_sw)
9556 spec->master_sw = val;
9557 alc262_hippo_master_update(codec);
9561 #define ALC262_HIPPO_MASTER_SWITCH \
9563 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9564 .name = "Master Playback Switch", \
9565 .info = snd_ctl_boolean_mono_info, \
9566 .get = alc262_hippo_master_sw_get, \
9567 .put = alc262_hippo_master_sw_put, \
9570 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
9571 ALC262_HIPPO_MASTER_SWITCH,
9572 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9573 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9574 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9575 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9576 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9577 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9578 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9579 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9580 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9581 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9582 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9583 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9587 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9588 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9589 ALC262_HIPPO_MASTER_SWITCH,
9590 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9591 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9592 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9593 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9594 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9595 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9596 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9597 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9598 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9599 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9603 /* mute/unmute internal speaker according to the hp jack and mute state */
9604 static void alc262_hippo_automute(struct hda_codec *codec)
9606 struct alc_spec *spec = codec->spec;
9607 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9608 unsigned int present;
9610 /* need to execute and sync at first */
9611 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
9612 present = snd_hda_codec_read(codec, hp_nid, 0,
9613 AC_VERB_GET_PIN_SENSE, 0);
9614 spec->jack_present = (present & 0x80000000) != 0;
9615 alc262_hippo_master_update(codec);
9618 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
9620 if ((res >> 26) != ALC880_HP_EVENT)
9622 alc262_hippo_automute(codec);
9625 static void alc262_hippo_init_hook(struct hda_codec *codec)
9627 struct alc_spec *spec = codec->spec;
9629 spec->autocfg.hp_pins[0] = 0x15;
9630 spec->autocfg.speaker_pins[0] = 0x14;
9631 alc262_hippo_automute(codec);
9634 static void alc262_hippo1_init_hook(struct hda_codec *codec)
9636 struct alc_spec *spec = codec->spec;
9638 spec->autocfg.hp_pins[0] = 0x1b;
9639 spec->autocfg.speaker_pins[0] = 0x14;
9640 alc262_hippo_automute(codec);
9644 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9645 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9646 ALC262_HIPPO_MASTER_SWITCH,
9647 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9648 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9649 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9650 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9654 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9655 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9656 ALC262_HIPPO_MASTER_SWITCH,
9657 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9658 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9659 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9660 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9661 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9665 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9666 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9667 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9668 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9669 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9670 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9671 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9672 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9673 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9674 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9675 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9676 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9677 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9681 static struct hda_verb alc262_tyan_verbs[] = {
9682 /* Headphone automute */
9683 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9684 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9685 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9687 /* P11 AUX_IN, white 4-pin connector */
9688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9689 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9690 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9691 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9696 /* unsolicited event for HP jack sensing */
9697 static void alc262_tyan_init_hook(struct hda_codec *codec)
9699 struct alc_spec *spec = codec->spec;
9701 spec->autocfg.hp_pins[0] = 0x1b;
9702 spec->autocfg.speaker_pins[0] = 0x15;
9703 alc_automute_amp(codec);
9707 #define alc262_capture_mixer alc882_capture_mixer
9708 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9711 * generic initialization of ADC, input mixers and output mixers
9713 static struct hda_verb alc262_init_verbs[] = {
9715 * Unmute ADC0-2 and set the default input to mic-in
9717 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9718 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9719 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9720 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9721 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9722 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9724 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9726 * Note: PASD motherboards uses the Line In 2 as the input for
9727 * front panel mic (mic 2)
9729 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9733 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9734 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9737 * Set up output mixers (0x0c - 0x0e)
9739 /* set vol=0 to output mixers */
9740 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9741 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9742 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9743 /* set up input amps for analog loopback */
9744 /* Amp Indices: DAC = 0, mixer = 1 */
9745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9747 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9748 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9749 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9750 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9752 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9753 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9754 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9755 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9756 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9757 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9759 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9760 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9761 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9762 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9763 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9765 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9766 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9768 /* FIXME: use matrix-type input source selection */
9769 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9770 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9771 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9772 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9773 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9774 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9776 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9777 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9778 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9779 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9781 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9782 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9783 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9784 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9789 static struct hda_verb alc262_eapd_verbs[] = {
9790 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9791 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9795 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9796 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9797 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9801 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9802 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9803 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9804 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9806 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9807 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9811 static struct hda_verb alc262_sony_unsol_verbs[] = {
9812 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9813 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9814 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9816 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9817 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9821 static struct hda_input_mux alc262_dmic_capture_source = {
9824 { "Int DMic", 0x9 },
9829 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9830 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9831 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 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),
9838 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9839 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9841 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9842 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9843 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9844 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9845 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9846 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9850 static void alc262_dmic_automute(struct hda_codec *codec)
9852 unsigned int present;
9854 present = snd_hda_codec_read(codec, 0x18, 0,
9855 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9856 snd_hda_codec_write(codec, 0x22, 0,
9857 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9861 /* unsolicited event for HP jack sensing */
9862 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9865 if ((res >> 26) == ALC880_MIC_EVENT)
9866 alc262_dmic_automute(codec);
9868 alc_sku_unsol_event(codec, res);
9871 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9873 struct alc_spec *spec = codec->spec;
9875 spec->autocfg.hp_pins[0] = 0x15;
9876 spec->autocfg.speaker_pins[0] = 0x14;
9877 alc_automute_pin(codec);
9878 alc262_dmic_automute(codec);
9884 * 0x16 = internal speaker
9885 * 0x18 = external mic
9888 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9889 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9890 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9894 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9896 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9897 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9901 static struct hda_verb alc262_nec_verbs[] = {
9902 /* Unmute Speaker */
9903 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9906 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9907 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9909 /* External mic to headphone */
9910 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9911 /* External mic to speaker */
9912 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9918 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9919 * 0x1b = port replicator headphone out
9922 #define ALC_HP_EVENT 0x37
9924 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9925 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9926 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9927 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9928 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9932 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9933 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9934 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9938 static struct hda_input_mux alc262_fujitsu_capture_source = {
9947 static struct hda_input_mux alc262_HP_capture_source = {
9951 { "Front Mic", 0x1 },
9958 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9962 { "Front Mic", 0x2 },
9968 /* mute/unmute internal speaker according to the hp jacks and mute state */
9969 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9971 struct alc_spec *spec = codec->spec;
9974 if (force || !spec->sense_updated) {
9975 unsigned int present;
9976 /* need to execute and sync at first */
9977 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9978 /* check laptop HP jack */
9979 present = snd_hda_codec_read(codec, 0x14, 0,
9980 AC_VERB_GET_PIN_SENSE, 0);
9981 /* need to execute and sync at first */
9982 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9983 /* check docking HP jack */
9984 present |= snd_hda_codec_read(codec, 0x1b, 0,
9985 AC_VERB_GET_PIN_SENSE, 0);
9986 if (present & AC_PINSENSE_PRESENCE)
9987 spec->jack_present = 1;
9989 spec->jack_present = 0;
9990 spec->sense_updated = 1;
9992 /* unmute internal speaker only if both HPs are unplugged and
9993 * master switch is on
9995 if (spec->jack_present)
9996 mute = HDA_AMP_MUTE;
9998 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9999 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10000 HDA_AMP_MUTE, mute);
10003 /* unsolicited event for HP jack sensing */
10004 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10007 if ((res >> 26) != ALC_HP_EVENT)
10009 alc262_fujitsu_automute(codec, 1);
10012 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10014 alc262_fujitsu_automute(codec, 1);
10017 /* bind volumes of both NID 0x0c and 0x0d */
10018 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10019 .ops = &snd_hda_bind_vol,
10021 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10022 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10027 /* mute/unmute internal speaker according to the hp jack and mute state */
10028 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10030 struct alc_spec *spec = codec->spec;
10033 if (force || !spec->sense_updated) {
10034 unsigned int present_int_hp;
10035 /* need to execute and sync at first */
10036 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10037 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10038 AC_VERB_GET_PIN_SENSE, 0);
10039 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10040 spec->sense_updated = 1;
10042 if (spec->jack_present) {
10043 /* mute internal speaker */
10044 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10045 HDA_AMP_MUTE, HDA_AMP_MUTE);
10046 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10047 HDA_AMP_MUTE, HDA_AMP_MUTE);
10049 /* unmute internal speaker if necessary */
10050 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10051 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10052 HDA_AMP_MUTE, mute);
10053 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10054 HDA_AMP_MUTE, mute);
10058 /* unsolicited event for HP jack sensing */
10059 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10062 if ((res >> 26) != ALC_HP_EVENT)
10064 alc262_lenovo_3000_automute(codec, 1);
10067 /* bind hp and internal speaker mute (with plug check) */
10068 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10069 struct snd_ctl_elem_value *ucontrol)
10071 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10072 long *valp = ucontrol->value.integer.value;
10075 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10077 valp ? 0 : HDA_AMP_MUTE);
10078 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10080 valp ? 0 : HDA_AMP_MUTE);
10083 alc262_fujitsu_automute(codec, 0);
10087 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10088 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10090 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10091 .name = "Master Playback Switch",
10092 .info = snd_hda_mixer_amp_switch_info,
10093 .get = snd_hda_mixer_amp_switch_get,
10094 .put = alc262_fujitsu_master_sw_put,
10095 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10097 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10098 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10099 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10100 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10101 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10102 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10103 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10104 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10108 /* bind hp and internal speaker mute (with plug check) */
10109 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10110 struct snd_ctl_elem_value *ucontrol)
10112 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10113 long *valp = ucontrol->value.integer.value;
10116 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10118 valp ? 0 : HDA_AMP_MUTE);
10121 alc262_lenovo_3000_automute(codec, 0);
10125 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10126 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10128 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10129 .name = "Master Playback Switch",
10130 .info = snd_hda_mixer_amp_switch_info,
10131 .get = snd_hda_mixer_amp_switch_get,
10132 .put = alc262_lenovo_3000_master_sw_put,
10133 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10135 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10136 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10137 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10138 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10139 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10140 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10141 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10142 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10146 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10147 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10148 ALC262_HIPPO_MASTER_SWITCH,
10149 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10150 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10151 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10152 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10153 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10154 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10158 /* additional init verbs for Benq laptops */
10159 static struct hda_verb alc262_EAPD_verbs[] = {
10160 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10161 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10165 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10166 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10167 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10169 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10170 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10174 /* Samsung Q1 Ultra Vista model setup */
10175 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10176 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10177 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10178 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10179 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10180 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10181 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10185 static struct hda_verb alc262_ultra_verbs[] = {
10187 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10191 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10192 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10193 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10194 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10196 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10197 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10198 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10199 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10200 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10202 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10203 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10204 /* ADC, choose mic */
10205 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10206 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10207 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10208 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10209 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10210 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10211 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10212 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10213 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10214 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10218 /* mute/unmute internal speaker according to the hp jack and mute state */
10219 static void alc262_ultra_automute(struct hda_codec *codec)
10221 struct alc_spec *spec = codec->spec;
10225 /* auto-mute only when HP is used as HP */
10226 if (!spec->cur_mux[0]) {
10227 unsigned int present;
10228 /* need to execute and sync at first */
10229 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10230 present = snd_hda_codec_read(codec, 0x15, 0,
10231 AC_VERB_GET_PIN_SENSE, 0);
10232 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10233 if (spec->jack_present)
10234 mute = HDA_AMP_MUTE;
10236 /* mute/unmute internal speaker */
10237 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10238 HDA_AMP_MUTE, mute);
10239 /* mute/unmute HP */
10240 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10241 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10244 /* unsolicited event for HP jack sensing */
10245 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10248 if ((res >> 26) != ALC880_HP_EVENT)
10250 alc262_ultra_automute(codec);
10253 static struct hda_input_mux alc262_ultra_capture_source = {
10257 { "Headphone", 0x7 },
10261 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10262 struct snd_ctl_elem_value *ucontrol)
10264 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10265 struct alc_spec *spec = codec->spec;
10268 ret = alc_mux_enum_put(kcontrol, ucontrol);
10271 /* reprogram the HP pin as mic or HP according to the input source */
10272 snd_hda_codec_write_cache(codec, 0x15, 0,
10273 AC_VERB_SET_PIN_WIDGET_CONTROL,
10274 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10275 alc262_ultra_automute(codec); /* mute/unmute HP */
10279 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10280 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10281 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10283 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10284 .name = "Capture Source",
10285 .info = alc_mux_enum_info,
10286 .get = alc_mux_enum_get,
10287 .put = alc262_ultra_mux_enum_put,
10292 /* add playback controls from the parsed DAC table */
10293 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10294 const struct auto_pin_cfg *cfg)
10299 spec->multiout.num_dacs = 1; /* only use one dac */
10300 spec->multiout.dac_nids = spec->private_dac_nids;
10301 spec->multiout.dac_nids[0] = 2;
10303 nid = cfg->line_out_pins[0];
10305 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10306 "Front Playback Volume",
10307 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10310 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10311 "Front Playback Switch",
10312 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10317 nid = cfg->speaker_pins[0];
10320 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10321 "Speaker Playback Volume",
10322 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10326 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10327 "Speaker Playback Switch",
10328 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10333 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10334 "Speaker Playback Switch",
10335 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10341 nid = cfg->hp_pins[0];
10343 /* spec->multiout.hp_nid = 2; */
10345 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10346 "Headphone Playback Volume",
10347 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10351 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10352 "Headphone Playback Switch",
10353 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10358 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10359 "Headphone Playback Switch",
10360 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10369 /* identical with ALC880 */
10370 #define alc262_auto_create_analog_input_ctls \
10371 alc880_auto_create_analog_input_ctls
10374 * generic initialization of ADC, input mixers and output mixers
10376 static struct hda_verb alc262_volume_init_verbs[] = {
10378 * Unmute ADC0-2 and set the default input to mic-in
10380 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10381 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10382 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10383 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10384 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10385 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10387 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10389 * Note: PASD motherboards uses the Line In 2 as the input for
10390 * front panel mic (mic 2)
10392 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10393 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10394 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10395 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10396 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10397 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10400 * Set up output mixers (0x0c - 0x0f)
10402 /* set vol=0 to output mixers */
10403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10404 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10405 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10407 /* set up input amps for analog loopback */
10408 /* Amp Indices: DAC = 0, mixer = 1 */
10409 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10410 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10411 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10412 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10413 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10414 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10416 /* FIXME: use matrix-type input source selection */
10417 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10418 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10420 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10421 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10422 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10424 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10425 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10426 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10427 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10429 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10430 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10431 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10432 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10437 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10439 * Unmute ADC0-2 and set the default input to mic-in
10441 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10442 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10443 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10444 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10445 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10446 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10448 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10450 * Note: PASD motherboards uses the Line In 2 as the input for
10451 * front panel mic (mic 2)
10453 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10454 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10455 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10456 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10457 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10463 * Set up output mixers (0x0c - 0x0e)
10465 /* set vol=0 to output mixers */
10466 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10467 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10468 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10470 /* set up input amps for analog loopback */
10471 /* Amp Indices: DAC = 0, mixer = 1 */
10472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10474 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10475 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10476 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10477 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10479 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10480 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10481 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10483 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10484 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10486 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10487 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10489 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10490 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10491 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10492 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10493 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10495 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10496 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10497 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10498 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10499 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10500 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10503 /* FIXME: use matrix-type input source selection */
10504 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10505 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10506 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10507 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10508 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10509 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10511 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10512 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10513 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10514 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10516 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10517 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10518 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10519 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10521 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10526 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10528 * Unmute ADC0-2 and set the default input to mic-in
10530 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10532 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10533 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10534 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10535 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10537 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10539 * Note: PASD motherboards uses the Line In 2 as the input for front
10540 * panel mic (mic 2)
10542 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10543 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10544 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10550 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10552 * Set up output mixers (0x0c - 0x0e)
10554 /* set vol=0 to output mixers */
10555 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10556 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10557 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10559 /* set up input amps for analog loopback */
10560 /* Amp Indices: DAC = 0, mixer = 1 */
10561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10563 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10564 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10565 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10569 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10570 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10571 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10572 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10573 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10574 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10575 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10577 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10578 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10580 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10581 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10583 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10584 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10585 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10586 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10587 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10588 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10590 /* FIXME: use matrix-type input source selection */
10591 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10592 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10593 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10594 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10595 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10596 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10597 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10598 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10599 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10601 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10602 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10603 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10604 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10605 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10606 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10607 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10609 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10610 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10611 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10612 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10613 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10614 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10615 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10617 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10622 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10624 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10625 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10626 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10628 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10629 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10630 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10631 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10633 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10634 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10635 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10640 #ifdef CONFIG_SND_HDA_POWER_SAVE
10641 #define alc262_loopbacks alc880_loopbacks
10644 /* pcm configuration: identiacal with ALC880 */
10645 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10646 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10647 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10648 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10651 * BIOS auto configuration
10653 static int alc262_parse_auto_config(struct hda_codec *codec)
10655 struct alc_spec *spec = codec->spec;
10657 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10659 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10663 if (!spec->autocfg.line_outs) {
10664 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10665 spec->multiout.max_channels = 2;
10666 spec->no_analog = 1;
10669 return 0; /* can't find valid BIOS pin config */
10671 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10674 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10678 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10681 if (spec->autocfg.dig_outs) {
10682 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10683 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10685 if (spec->autocfg.dig_in_pin)
10686 spec->dig_in_nid = ALC262_DIGIN_NID;
10688 if (spec->kctls.list)
10689 add_mixer(spec, spec->kctls.list);
10691 add_verb(spec, alc262_volume_init_verbs);
10692 spec->num_mux_defs = 1;
10693 spec->input_mux = &spec->private_imux[0];
10695 err = alc_auto_add_mic_boost(codec);
10699 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
10704 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10705 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10706 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10707 #define alc262_auto_init_input_src alc882_auto_init_input_src
10710 /* init callback for auto-configuration model -- overriding the default init */
10711 static void alc262_auto_init(struct hda_codec *codec)
10713 struct alc_spec *spec = codec->spec;
10714 alc262_auto_init_multi_out(codec);
10715 alc262_auto_init_hp_out(codec);
10716 alc262_auto_init_analog_input(codec);
10717 alc262_auto_init_input_src(codec);
10718 if (spec->unsol_event)
10719 alc_inithook(codec);
10723 * configuration and preset
10725 static const char *alc262_models[ALC262_MODEL_LAST] = {
10726 [ALC262_BASIC] = "basic",
10727 [ALC262_HIPPO] = "hippo",
10728 [ALC262_HIPPO_1] = "hippo_1",
10729 [ALC262_FUJITSU] = "fujitsu",
10730 [ALC262_HP_BPC] = "hp-bpc",
10731 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10732 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10733 [ALC262_HP_RP5700] = "hp-rp5700",
10734 [ALC262_BENQ_ED8] = "benq",
10735 [ALC262_BENQ_T31] = "benq-t31",
10736 [ALC262_SONY_ASSAMD] = "sony-assamd",
10737 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10738 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10739 [ALC262_ULTRA] = "ultra",
10740 [ALC262_LENOVO_3000] = "lenovo-3000",
10741 [ALC262_NEC] = "nec",
10742 [ALC262_TYAN] = "tyan",
10743 [ALC262_AUTO] = "auto",
10746 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10747 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10748 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10749 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
10751 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
10753 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
10755 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10756 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10757 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10758 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10759 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10760 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10761 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10762 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10763 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10764 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10765 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10766 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10767 ALC262_HP_TC_T5735),
10768 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10769 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10770 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10771 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10772 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
10773 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
10774 ALC262_SONY_ASSAMD),
10775 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10776 ALC262_TOSHIBA_RX1),
10777 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10778 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10779 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10780 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10781 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
10783 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10784 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10785 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10786 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10787 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10791 static struct alc_config_preset alc262_presets[] = {
10793 .mixers = { alc262_base_mixer },
10794 .init_verbs = { alc262_init_verbs },
10795 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10796 .dac_nids = alc262_dac_nids,
10798 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10799 .channel_mode = alc262_modes,
10800 .input_mux = &alc262_capture_source,
10803 .mixers = { alc262_hippo_mixer },
10804 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10805 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10806 .dac_nids = alc262_dac_nids,
10808 .dig_out_nid = ALC262_DIGOUT_NID,
10809 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10810 .channel_mode = alc262_modes,
10811 .input_mux = &alc262_capture_source,
10812 .unsol_event = alc262_hippo_unsol_event,
10813 .init_hook = alc262_hippo_init_hook,
10815 [ALC262_HIPPO_1] = {
10816 .mixers = { alc262_hippo1_mixer },
10817 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10818 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10819 .dac_nids = alc262_dac_nids,
10821 .dig_out_nid = ALC262_DIGOUT_NID,
10822 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10823 .channel_mode = alc262_modes,
10824 .input_mux = &alc262_capture_source,
10825 .unsol_event = alc262_hippo_unsol_event,
10826 .init_hook = alc262_hippo1_init_hook,
10828 [ALC262_FUJITSU] = {
10829 .mixers = { alc262_fujitsu_mixer },
10830 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10831 alc262_fujitsu_unsol_verbs },
10832 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10833 .dac_nids = alc262_dac_nids,
10835 .dig_out_nid = ALC262_DIGOUT_NID,
10836 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10837 .channel_mode = alc262_modes,
10838 .input_mux = &alc262_fujitsu_capture_source,
10839 .unsol_event = alc262_fujitsu_unsol_event,
10840 .init_hook = alc262_fujitsu_init_hook,
10842 [ALC262_HP_BPC] = {
10843 .mixers = { alc262_HP_BPC_mixer },
10844 .init_verbs = { alc262_HP_BPC_init_verbs },
10845 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10846 .dac_nids = alc262_dac_nids,
10848 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10849 .channel_mode = alc262_modes,
10850 .input_mux = &alc262_HP_capture_source,
10851 .unsol_event = alc262_hp_bpc_unsol_event,
10852 .init_hook = alc262_hp_bpc_automute,
10854 [ALC262_HP_BPC_D7000_WF] = {
10855 .mixers = { alc262_HP_BPC_WildWest_mixer },
10856 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10857 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10858 .dac_nids = alc262_dac_nids,
10860 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10861 .channel_mode = alc262_modes,
10862 .input_mux = &alc262_HP_D7000_capture_source,
10863 .unsol_event = alc262_hp_wildwest_unsol_event,
10864 .init_hook = alc262_hp_wildwest_automute,
10866 [ALC262_HP_BPC_D7000_WL] = {
10867 .mixers = { alc262_HP_BPC_WildWest_mixer,
10868 alc262_HP_BPC_WildWest_option_mixer },
10869 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10870 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10871 .dac_nids = alc262_dac_nids,
10873 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10874 .channel_mode = alc262_modes,
10875 .input_mux = &alc262_HP_D7000_capture_source,
10876 .unsol_event = alc262_hp_wildwest_unsol_event,
10877 .init_hook = alc262_hp_wildwest_automute,
10879 [ALC262_HP_TC_T5735] = {
10880 .mixers = { alc262_hp_t5735_mixer },
10881 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10882 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10883 .dac_nids = alc262_dac_nids,
10885 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10886 .channel_mode = alc262_modes,
10887 .input_mux = &alc262_capture_source,
10888 .unsol_event = alc_automute_amp_unsol_event,
10889 .init_hook = alc262_hp_t5735_init_hook,
10891 [ALC262_HP_RP5700] = {
10892 .mixers = { alc262_hp_rp5700_mixer },
10893 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10894 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10895 .dac_nids = alc262_dac_nids,
10896 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10897 .channel_mode = alc262_modes,
10898 .input_mux = &alc262_hp_rp5700_capture_source,
10900 [ALC262_BENQ_ED8] = {
10901 .mixers = { alc262_base_mixer },
10902 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10903 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10904 .dac_nids = alc262_dac_nids,
10906 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10907 .channel_mode = alc262_modes,
10908 .input_mux = &alc262_capture_source,
10910 [ALC262_SONY_ASSAMD] = {
10911 .mixers = { alc262_sony_mixer },
10912 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10913 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10914 .dac_nids = alc262_dac_nids,
10916 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10917 .channel_mode = alc262_modes,
10918 .input_mux = &alc262_capture_source,
10919 .unsol_event = alc262_hippo_unsol_event,
10920 .init_hook = alc262_hippo_init_hook,
10922 [ALC262_BENQ_T31] = {
10923 .mixers = { alc262_benq_t31_mixer },
10924 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10925 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10926 .dac_nids = alc262_dac_nids,
10928 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10929 .channel_mode = alc262_modes,
10930 .input_mux = &alc262_capture_source,
10931 .unsol_event = alc262_hippo_unsol_event,
10932 .init_hook = alc262_hippo_init_hook,
10935 .mixers = { alc262_ultra_mixer },
10936 .cap_mixer = alc262_ultra_capture_mixer,
10937 .init_verbs = { alc262_ultra_verbs },
10938 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10939 .dac_nids = alc262_dac_nids,
10940 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10941 .channel_mode = alc262_modes,
10942 .input_mux = &alc262_ultra_capture_source,
10943 .adc_nids = alc262_adc_nids, /* ADC0 */
10944 .capsrc_nids = alc262_capsrc_nids,
10945 .num_adc_nids = 1, /* single ADC */
10946 .unsol_event = alc262_ultra_unsol_event,
10947 .init_hook = alc262_ultra_automute,
10949 [ALC262_LENOVO_3000] = {
10950 .mixers = { alc262_lenovo_3000_mixer },
10951 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10952 alc262_lenovo_3000_unsol_verbs },
10953 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10954 .dac_nids = alc262_dac_nids,
10956 .dig_out_nid = ALC262_DIGOUT_NID,
10957 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10958 .channel_mode = alc262_modes,
10959 .input_mux = &alc262_fujitsu_capture_source,
10960 .unsol_event = alc262_lenovo_3000_unsol_event,
10963 .mixers = { alc262_nec_mixer },
10964 .init_verbs = { alc262_nec_verbs },
10965 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10966 .dac_nids = alc262_dac_nids,
10968 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10969 .channel_mode = alc262_modes,
10970 .input_mux = &alc262_capture_source,
10972 [ALC262_TOSHIBA_S06] = {
10973 .mixers = { alc262_toshiba_s06_mixer },
10974 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10975 alc262_eapd_verbs },
10976 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10977 .capsrc_nids = alc262_dmic_capsrc_nids,
10978 .dac_nids = alc262_dac_nids,
10979 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10980 .dig_out_nid = ALC262_DIGOUT_NID,
10981 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10982 .channel_mode = alc262_modes,
10983 .input_mux = &alc262_dmic_capture_source,
10984 .unsol_event = alc262_toshiba_s06_unsol_event,
10985 .init_hook = alc262_toshiba_s06_init_hook,
10987 [ALC262_TOSHIBA_RX1] = {
10988 .mixers = { alc262_toshiba_rx1_mixer },
10989 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10990 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10991 .dac_nids = alc262_dac_nids,
10993 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10994 .channel_mode = alc262_modes,
10995 .input_mux = &alc262_capture_source,
10996 .unsol_event = alc262_hippo_unsol_event,
10997 .init_hook = alc262_hippo_init_hook,
11000 .mixers = { alc262_tyan_mixer },
11001 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11002 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11003 .dac_nids = alc262_dac_nids,
11005 .dig_out_nid = ALC262_DIGOUT_NID,
11006 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11007 .channel_mode = alc262_modes,
11008 .input_mux = &alc262_capture_source,
11009 .unsol_event = alc_automute_amp_unsol_event,
11010 .init_hook = alc262_tyan_init_hook,
11014 static int patch_alc262(struct hda_codec *codec)
11016 struct alc_spec *spec;
11020 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11024 codec->spec = spec;
11026 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11031 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11032 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11033 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11034 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11038 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11040 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11044 if (board_config < 0) {
11045 printk(KERN_INFO "hda_codec: Unknown model for %s, "
11046 "trying auto-probe from BIOS...\n", codec->chip_name);
11047 board_config = ALC262_AUTO;
11050 if (board_config == ALC262_AUTO) {
11051 /* automatic parse from the BIOS config */
11052 err = alc262_parse_auto_config(codec);
11058 "hda_codec: Cannot set up configuration "
11059 "from BIOS. Using base mode...\n");
11060 board_config = ALC262_BASIC;
11064 if (!spec->no_analog) {
11065 err = snd_hda_attach_beep_device(codec, 0x1);
11072 if (board_config != ALC262_AUTO)
11073 setup_preset(spec, &alc262_presets[board_config]);
11075 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11076 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11078 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11079 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11081 spec->capture_style = CAPT_MIX;
11082 if (!spec->adc_nids && spec->input_mux) {
11083 /* check whether NID 0x07 is valid */
11084 unsigned int wcap = get_wcaps(codec, 0x07);
11087 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11088 if (wcap != AC_WID_AUD_IN) {
11089 spec->adc_nids = alc262_adc_nids_alt;
11090 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11091 spec->capsrc_nids = alc262_capsrc_nids_alt;
11093 spec->adc_nids = alc262_adc_nids;
11094 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11095 spec->capsrc_nids = alc262_capsrc_nids;
11098 if (!spec->cap_mixer && !spec->no_analog)
11099 set_capture_mixer(spec);
11100 if (!spec->no_analog)
11101 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11103 spec->vmaster_nid = 0x0c;
11105 codec->patch_ops = alc_patch_ops;
11106 if (board_config == ALC262_AUTO)
11107 spec->init_hook = alc262_auto_init;
11108 #ifdef CONFIG_SND_HDA_POWER_SAVE
11109 if (!spec->loopback.amplist)
11110 spec->loopback.amplist = alc262_loopbacks;
11112 codec->proc_widget_hook = print_realtek_coef;
11118 * ALC268 channel source setting (2 channel)
11120 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11121 #define alc268_modes alc260_modes
11123 static hda_nid_t alc268_dac_nids[2] = {
11128 static hda_nid_t alc268_adc_nids[2] = {
11133 static hda_nid_t alc268_adc_nids_alt[1] = {
11138 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11140 static struct snd_kcontrol_new alc268_base_mixer[] = {
11141 /* output mixer control */
11142 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11143 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11144 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11145 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11146 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11147 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11148 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11152 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11153 /* output mixer control */
11154 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11155 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11156 ALC262_HIPPO_MASTER_SWITCH,
11157 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11158 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11159 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11163 /* bind Beep switches of both NID 0x0f and 0x10 */
11164 static struct hda_bind_ctls alc268_bind_beep_sw = {
11165 .ops = &snd_hda_bind_sw,
11167 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11168 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11173 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11174 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11175 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11179 static struct hda_verb alc268_eapd_verbs[] = {
11180 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11181 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11185 /* Toshiba specific */
11186 static struct hda_verb alc268_toshiba_verbs[] = {
11187 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11191 static struct hda_input_mux alc268_acer_lc_capture_source = {
11199 /* Acer specific */
11200 /* bind volumes of both NID 0x02 and 0x03 */
11201 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11202 .ops = &snd_hda_bind_vol,
11204 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11205 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11210 /* mute/unmute internal speaker according to the hp jack and mute state */
11211 static void alc268_acer_automute(struct hda_codec *codec, int force)
11213 struct alc_spec *spec = codec->spec;
11216 if (force || !spec->sense_updated) {
11217 unsigned int present;
11218 present = snd_hda_codec_read(codec, 0x14, 0,
11219 AC_VERB_GET_PIN_SENSE, 0);
11220 spec->jack_present = (present & 0x80000000) != 0;
11221 spec->sense_updated = 1;
11223 if (spec->jack_present)
11224 mute = HDA_AMP_MUTE; /* mute internal speaker */
11225 else /* unmute internal speaker if necessary */
11226 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11227 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11228 HDA_AMP_MUTE, mute);
11232 /* bind hp and internal speaker mute (with plug check) */
11233 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11234 struct snd_ctl_elem_value *ucontrol)
11236 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11237 long *valp = ucontrol->value.integer.value;
11240 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11242 valp[0] ? 0 : HDA_AMP_MUTE);
11243 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11245 valp[1] ? 0 : HDA_AMP_MUTE);
11247 alc268_acer_automute(codec, 0);
11251 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11252 /* output mixer control */
11253 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11255 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11256 .name = "Master Playback Switch",
11257 .info = snd_hda_mixer_amp_switch_info,
11258 .get = snd_hda_mixer_amp_switch_get,
11259 .put = alc268_acer_master_sw_put,
11260 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11262 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11266 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11267 /* output mixer control */
11268 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11270 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11271 .name = "Master Playback Switch",
11272 .info = snd_hda_mixer_amp_switch_info,
11273 .get = snd_hda_mixer_amp_switch_get,
11274 .put = alc268_acer_master_sw_put,
11275 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11277 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11278 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11279 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11283 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11284 /* output mixer control */
11285 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11287 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11288 .name = "Master Playback Switch",
11289 .info = snd_hda_mixer_amp_switch_info,
11290 .get = snd_hda_mixer_amp_switch_get,
11291 .put = alc268_acer_master_sw_put,
11292 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11294 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11295 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11299 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11300 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11301 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11302 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11303 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11304 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11309 static struct hda_verb alc268_acer_verbs[] = {
11310 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11311 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11312 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11313 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11314 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11315 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11316 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11320 /* unsolicited event for HP jack sensing */
11321 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11322 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11324 static void alc268_acer_unsol_event(struct hda_codec *codec,
11327 if ((res >> 26) != ALC880_HP_EVENT)
11329 alc268_acer_automute(codec, 1);
11332 static void alc268_acer_init_hook(struct hda_codec *codec)
11334 alc268_acer_automute(codec, 1);
11337 /* toggle speaker-output according to the hp-jack state */
11338 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11340 unsigned int present;
11341 unsigned char bits;
11343 present = snd_hda_codec_read(codec, 0x15, 0,
11344 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11345 bits = present ? AMP_IN_MUTE(0) : 0;
11346 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11347 AMP_IN_MUTE(0), bits);
11348 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11349 AMP_IN_MUTE(0), bits);
11353 static void alc268_acer_mic_automute(struct hda_codec *codec)
11355 unsigned int present;
11357 present = snd_hda_codec_read(codec, 0x18, 0,
11358 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11359 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11360 present ? 0x0 : 0x6);
11363 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11366 if ((res >> 26) == ALC880_HP_EVENT)
11367 alc268_aspire_one_speaker_automute(codec);
11368 if ((res >> 26) == ALC880_MIC_EVENT)
11369 alc268_acer_mic_automute(codec);
11372 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11374 alc268_aspire_one_speaker_automute(codec);
11375 alc268_acer_mic_automute(codec);
11378 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11379 /* output mixer control */
11380 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11381 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11382 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11383 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11384 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11385 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11389 static struct hda_verb alc268_dell_verbs[] = {
11390 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11391 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11392 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11396 /* mute/unmute internal speaker according to the hp jack and mute state */
11397 static void alc268_dell_init_hook(struct hda_codec *codec)
11399 struct alc_spec *spec = codec->spec;
11401 spec->autocfg.hp_pins[0] = 0x15;
11402 spec->autocfg.speaker_pins[0] = 0x14;
11403 alc_automute_pin(codec);
11406 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11407 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11408 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11409 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11410 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11411 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11412 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11413 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11414 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11418 static struct hda_verb alc267_quanta_il1_verbs[] = {
11419 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11420 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11424 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11426 unsigned int present;
11428 present = snd_hda_codec_read(codec, 0x18, 0,
11429 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11430 snd_hda_codec_write(codec, 0x23, 0,
11431 AC_VERB_SET_CONNECT_SEL,
11432 present ? 0x00 : 0x01);
11435 static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
11437 struct alc_spec *spec = codec->spec;
11439 spec->autocfg.hp_pins[0] = 0x15;
11440 spec->autocfg.speaker_pins[0] = 0x14;
11441 alc_automute_pin(codec);
11442 alc267_quanta_il1_mic_automute(codec);
11445 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11448 switch (res >> 26) {
11449 case ALC880_MIC_EVENT:
11450 alc267_quanta_il1_mic_automute(codec);
11453 alc_sku_unsol_event(codec, res);
11459 * generic initialization of ADC, input mixers and output mixers
11461 static struct hda_verb alc268_base_init_verbs[] = {
11462 /* Unmute DAC0-1 and set vol = 0 */
11463 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11464 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11467 * Set up output mixers (0x0c - 0x0e)
11469 /* set vol=0 to output mixers */
11470 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11471 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11473 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11474 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11476 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11477 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11478 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11479 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11480 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11481 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11482 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11483 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11485 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11486 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11487 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11488 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11489 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11491 /* set PCBEEP vol = 0, mute connections */
11492 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11493 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11494 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11496 /* Unmute Selector 23h,24h and set the default input to mic-in */
11498 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11499 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11500 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11501 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11507 * generic initialization of ADC, input mixers and output mixers
11509 static struct hda_verb alc268_volume_init_verbs[] = {
11510 /* set output DAC */
11511 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11512 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11514 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11515 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11516 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11517 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11518 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11520 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11521 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11522 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11524 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11525 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11527 /* set PCBEEP vol = 0, mute connections */
11528 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11529 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11530 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11535 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11536 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11537 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11539 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11540 /* The multiple "Capture Source" controls confuse alsamixer
11541 * So call somewhat different..
11543 /* .name = "Capture Source", */
11544 .name = "Input Source",
11546 .info = alc_mux_enum_info,
11547 .get = alc_mux_enum_get,
11548 .put = alc_mux_enum_put,
11553 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11554 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11555 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11556 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11557 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11559 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11560 /* The multiple "Capture Source" controls confuse alsamixer
11561 * So call somewhat different..
11563 /* .name = "Capture Source", */
11564 .name = "Input Source",
11566 .info = alc_mux_enum_info,
11567 .get = alc_mux_enum_get,
11568 .put = alc_mux_enum_put,
11573 static struct hda_input_mux alc268_capture_source = {
11577 { "Front Mic", 0x1 },
11583 static struct hda_input_mux alc268_acer_capture_source = {
11587 { "Internal Mic", 0x1 },
11592 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11596 { "Internal Mic", 0x6 },
11601 #ifdef CONFIG_SND_DEBUG
11602 static struct snd_kcontrol_new alc268_test_mixer[] = {
11603 /* Volume widgets */
11604 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11605 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11606 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11607 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11608 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11609 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11610 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11611 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11612 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11613 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11614 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11615 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11616 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11617 /* The below appears problematic on some hardwares */
11618 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11619 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11620 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11621 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11622 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11624 /* Modes for retasking pin widgets */
11625 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11626 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11627 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11628 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11630 /* Controls for GPIO pins, assuming they are configured as outputs */
11631 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11632 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11633 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11634 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11636 /* Switches to allow the digital SPDIF output pin to be enabled.
11637 * The ALC268 does not have an SPDIF input.
11639 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11641 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11642 * this output to turn on an external amplifier.
11644 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11645 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11651 /* create input playback/capture controls for the given pin */
11652 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11653 const char *ctlname, int idx)
11658 sprintf(name, "%s Playback Volume", ctlname);
11660 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11661 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11665 } else if (nid == 0x15) {
11666 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11667 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11673 sprintf(name, "%s Playback Switch", ctlname);
11674 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11675 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11681 /* add playback controls from the parsed DAC table */
11682 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11683 const struct auto_pin_cfg *cfg)
11688 spec->multiout.num_dacs = 2; /* only use one dac */
11689 spec->multiout.dac_nids = spec->private_dac_nids;
11690 spec->multiout.dac_nids[0] = 2;
11691 spec->multiout.dac_nids[1] = 3;
11693 nid = cfg->line_out_pins[0];
11695 alc268_new_analog_output(spec, nid, "Front", 0);
11697 nid = cfg->speaker_pins[0];
11699 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11700 "Speaker Playback Volume",
11701 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11705 nid = cfg->hp_pins[0];
11707 alc268_new_analog_output(spec, nid, "Headphone", 0);
11709 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11711 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11712 "Mono Playback Switch",
11713 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11720 /* create playback/capture controls for input pins */
11721 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11722 const struct auto_pin_cfg *cfg)
11724 struct hda_input_mux *imux = &spec->private_imux[0];
11727 for (i = 0; i < AUTO_PIN_LAST; i++) {
11728 switch(cfg->input_pins[i]) {
11730 idx1 = 0; /* Mic 1 */
11733 idx1 = 1; /* Mic 2 */
11736 idx1 = 2; /* Line In */
11743 idx1 = 6; /* digital mics */
11748 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11749 imux->items[imux->num_items].index = idx1;
11755 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11757 struct alc_spec *spec = codec->spec;
11758 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11759 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11760 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11761 unsigned int dac_vol1, dac_vol2;
11764 snd_hda_codec_write(codec, speaker_nid, 0,
11765 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11766 snd_hda_codec_write(codec, 0x0f, 0,
11767 AC_VERB_SET_AMP_GAIN_MUTE,
11769 snd_hda_codec_write(codec, 0x10, 0,
11770 AC_VERB_SET_AMP_GAIN_MUTE,
11773 snd_hda_codec_write(codec, 0x0f, 0,
11774 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11775 snd_hda_codec_write(codec, 0x10, 0,
11776 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11779 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11780 if (line_nid == 0x14)
11781 dac_vol2 = AMP_OUT_ZERO;
11782 else if (line_nid == 0x15)
11783 dac_vol1 = AMP_OUT_ZERO;
11784 if (hp_nid == 0x14)
11785 dac_vol2 = AMP_OUT_ZERO;
11786 else if (hp_nid == 0x15)
11787 dac_vol1 = AMP_OUT_ZERO;
11788 if (line_nid != 0x16 || hp_nid != 0x16 ||
11789 spec->autocfg.line_out_pins[1] != 0x16 ||
11790 spec->autocfg.line_out_pins[2] != 0x16)
11791 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11793 snd_hda_codec_write(codec, 0x02, 0,
11794 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11795 snd_hda_codec_write(codec, 0x03, 0,
11796 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11799 /* pcm configuration: identiacal with ALC880 */
11800 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11801 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11802 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11803 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11806 * BIOS auto configuration
11808 static int alc268_parse_auto_config(struct hda_codec *codec)
11810 struct alc_spec *spec = codec->spec;
11812 static hda_nid_t alc268_ignore[] = { 0 };
11814 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11818 if (!spec->autocfg.line_outs) {
11819 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11820 spec->multiout.max_channels = 2;
11821 spec->no_analog = 1;
11824 return 0; /* can't find valid BIOS pin config */
11826 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11829 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11833 spec->multiout.max_channels = 2;
11836 /* digital only support output */
11837 if (spec->autocfg.dig_outs) {
11838 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11839 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11841 if (spec->kctls.list)
11842 add_mixer(spec, spec->kctls.list);
11844 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
11845 add_mixer(spec, alc268_beep_mixer);
11847 add_verb(spec, alc268_volume_init_verbs);
11848 spec->num_mux_defs = 1;
11849 spec->input_mux = &spec->private_imux[0];
11851 err = alc_auto_add_mic_boost(codec);
11858 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11859 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11860 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11862 /* init callback for auto-configuration model -- overriding the default init */
11863 static void alc268_auto_init(struct hda_codec *codec)
11865 struct alc_spec *spec = codec->spec;
11866 alc268_auto_init_multi_out(codec);
11867 alc268_auto_init_hp_out(codec);
11868 alc268_auto_init_mono_speaker_out(codec);
11869 alc268_auto_init_analog_input(codec);
11870 if (spec->unsol_event)
11871 alc_inithook(codec);
11875 * configuration and preset
11877 static const char *alc268_models[ALC268_MODEL_LAST] = {
11878 [ALC267_QUANTA_IL1] = "quanta-il1",
11879 [ALC268_3ST] = "3stack",
11880 [ALC268_TOSHIBA] = "toshiba",
11881 [ALC268_ACER] = "acer",
11882 [ALC268_ACER_DMIC] = "acer-dmic",
11883 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11884 [ALC268_DELL] = "dell",
11885 [ALC268_ZEPTO] = "zepto",
11886 #ifdef CONFIG_SND_DEBUG
11887 [ALC268_TEST] = "test",
11889 [ALC268_AUTO] = "auto",
11892 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11893 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11894 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11895 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11896 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11897 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11898 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11899 ALC268_ACER_ASPIRE_ONE),
11900 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11901 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
11902 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11903 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11904 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11905 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11906 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11907 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11908 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11909 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11910 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11914 static struct alc_config_preset alc268_presets[] = {
11915 [ALC267_QUANTA_IL1] = {
11916 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
11917 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11918 alc267_quanta_il1_verbs },
11919 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11920 .dac_nids = alc268_dac_nids,
11921 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11922 .adc_nids = alc268_adc_nids_alt,
11924 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11925 .channel_mode = alc268_modes,
11926 .input_mux = &alc268_capture_source,
11927 .unsol_event = alc267_quanta_il1_unsol_event,
11928 .init_hook = alc267_quanta_il1_init_hook,
11931 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11932 alc268_beep_mixer },
11933 .init_verbs = { alc268_base_init_verbs },
11934 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11935 .dac_nids = alc268_dac_nids,
11936 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11937 .adc_nids = alc268_adc_nids_alt,
11938 .capsrc_nids = alc268_capsrc_nids,
11940 .dig_out_nid = ALC268_DIGOUT_NID,
11941 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11942 .channel_mode = alc268_modes,
11943 .input_mux = &alc268_capture_source,
11945 [ALC268_TOSHIBA] = {
11946 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
11947 alc268_beep_mixer },
11948 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11949 alc268_toshiba_verbs },
11950 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11951 .dac_nids = alc268_dac_nids,
11952 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11953 .adc_nids = alc268_adc_nids_alt,
11954 .capsrc_nids = alc268_capsrc_nids,
11956 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11957 .channel_mode = alc268_modes,
11958 .input_mux = &alc268_capture_source,
11959 .unsol_event = alc268_toshiba_unsol_event,
11960 .init_hook = alc268_toshiba_init_hook,
11963 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11964 alc268_beep_mixer },
11965 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11966 alc268_acer_verbs },
11967 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11968 .dac_nids = alc268_dac_nids,
11969 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11970 .adc_nids = alc268_adc_nids_alt,
11971 .capsrc_nids = alc268_capsrc_nids,
11973 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11974 .channel_mode = alc268_modes,
11975 .input_mux = &alc268_acer_capture_source,
11976 .unsol_event = alc268_acer_unsol_event,
11977 .init_hook = alc268_acer_init_hook,
11979 [ALC268_ACER_DMIC] = {
11980 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11981 alc268_beep_mixer },
11982 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11983 alc268_acer_verbs },
11984 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11985 .dac_nids = alc268_dac_nids,
11986 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11987 .adc_nids = alc268_adc_nids_alt,
11988 .capsrc_nids = alc268_capsrc_nids,
11990 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11991 .channel_mode = alc268_modes,
11992 .input_mux = &alc268_acer_dmic_capture_source,
11993 .unsol_event = alc268_acer_unsol_event,
11994 .init_hook = alc268_acer_init_hook,
11996 [ALC268_ACER_ASPIRE_ONE] = {
11997 .mixers = { alc268_acer_aspire_one_mixer,
11999 alc268_capture_alt_mixer },
12000 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12001 alc268_acer_aspire_one_verbs },
12002 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12003 .dac_nids = alc268_dac_nids,
12004 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12005 .adc_nids = alc268_adc_nids_alt,
12006 .capsrc_nids = alc268_capsrc_nids,
12008 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12009 .channel_mode = alc268_modes,
12010 .input_mux = &alc268_acer_lc_capture_source,
12011 .unsol_event = alc268_acer_lc_unsol_event,
12012 .init_hook = alc268_acer_lc_init_hook,
12015 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12016 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12017 alc268_dell_verbs },
12018 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12019 .dac_nids = alc268_dac_nids,
12021 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12022 .channel_mode = alc268_modes,
12023 .unsol_event = alc_sku_unsol_event,
12024 .init_hook = alc268_dell_init_hook,
12025 .input_mux = &alc268_capture_source,
12028 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12029 alc268_beep_mixer },
12030 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12031 alc268_toshiba_verbs },
12032 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12033 .dac_nids = alc268_dac_nids,
12034 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12035 .adc_nids = alc268_adc_nids_alt,
12036 .capsrc_nids = alc268_capsrc_nids,
12038 .dig_out_nid = ALC268_DIGOUT_NID,
12039 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12040 .channel_mode = alc268_modes,
12041 .input_mux = &alc268_capture_source,
12042 .unsol_event = alc268_toshiba_unsol_event,
12043 .init_hook = alc268_toshiba_init_hook
12045 #ifdef CONFIG_SND_DEBUG
12047 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12048 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12049 alc268_volume_init_verbs },
12050 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12051 .dac_nids = alc268_dac_nids,
12052 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12053 .adc_nids = alc268_adc_nids_alt,
12054 .capsrc_nids = alc268_capsrc_nids,
12056 .dig_out_nid = ALC268_DIGOUT_NID,
12057 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12058 .channel_mode = alc268_modes,
12059 .input_mux = &alc268_capture_source,
12064 static int patch_alc268(struct hda_codec *codec)
12066 struct alc_spec *spec;
12068 int i, has_beep, err;
12070 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12074 codec->spec = spec;
12076 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12080 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12081 printk(KERN_INFO "hda_codec: Unknown model for %s, "
12082 "trying auto-probe from BIOS...\n", codec->chip_name);
12083 board_config = ALC268_AUTO;
12086 if (board_config == ALC268_AUTO) {
12087 /* automatic parse from the BIOS config */
12088 err = alc268_parse_auto_config(codec);
12094 "hda_codec: Cannot set up configuration "
12095 "from BIOS. Using base mode...\n");
12096 board_config = ALC268_3ST;
12100 if (board_config != ALC268_AUTO)
12101 setup_preset(spec, &alc268_presets[board_config]);
12103 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12104 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12105 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12107 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12110 for (i = 0; i < spec->num_mixers; i++) {
12111 if (spec->mixers[i] == alc268_beep_mixer) {
12118 err = snd_hda_attach_beep_device(codec, 0x1);
12123 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12124 /* override the amp caps for beep generator */
12125 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12126 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12127 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12128 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12129 (0 << AC_AMPCAP_MUTE_SHIFT));
12132 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12133 /* check whether NID 0x07 is valid */
12134 unsigned int wcap = get_wcaps(codec, 0x07);
12138 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12139 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12140 spec->adc_nids = alc268_adc_nids_alt;
12141 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12142 add_mixer(spec, alc268_capture_alt_mixer);
12144 spec->adc_nids = alc268_adc_nids;
12145 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12146 add_mixer(spec, alc268_capture_mixer);
12148 spec->capsrc_nids = alc268_capsrc_nids;
12149 /* set default input source */
12150 for (i = 0; i < spec->num_adc_nids; i++)
12151 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12152 0, AC_VERB_SET_CONNECT_SEL,
12153 spec->input_mux->items[0].index);
12156 spec->vmaster_nid = 0x02;
12158 codec->patch_ops = alc_patch_ops;
12159 if (board_config == ALC268_AUTO)
12160 spec->init_hook = alc268_auto_init;
12162 codec->proc_widget_hook = print_realtek_coef;
12168 * ALC269 channel source setting (2 channel)
12170 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12172 #define alc269_dac_nids alc260_dac_nids
12174 static hda_nid_t alc269_adc_nids[1] = {
12179 static hda_nid_t alc269_capsrc_nids[1] = {
12183 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12187 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12195 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12203 #define alc269_modes alc260_modes
12204 #define alc269_capture_source alc880_lg_lw_capture_source
12206 static struct snd_kcontrol_new alc269_base_mixer[] = {
12207 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12208 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12209 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12210 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12211 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12212 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12213 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12214 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12215 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12216 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12217 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12218 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12222 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12223 /* output mixer control */
12224 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12226 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12227 .name = "Master Playback Switch",
12228 .info = snd_hda_mixer_amp_switch_info,
12229 .get = snd_hda_mixer_amp_switch_get,
12230 .put = alc268_acer_master_sw_put,
12231 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12234 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12235 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12236 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12237 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12238 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12242 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12243 /* output mixer control */
12244 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12246 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12247 .name = "Master Playback Switch",
12248 .info = snd_hda_mixer_amp_switch_info,
12249 .get = snd_hda_mixer_amp_switch_get,
12250 .put = alc268_acer_master_sw_put,
12251 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12255 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12256 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12257 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12258 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12259 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12260 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12261 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12265 /* bind volumes of both NID 0x0c and 0x0d */
12266 static struct hda_bind_ctls alc269_epc_bind_vol = {
12267 .ops = &snd_hda_bind_vol,
12269 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12270 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12275 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12276 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12277 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12278 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12282 /* capture mixer elements */
12283 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12284 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12285 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12286 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12291 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12292 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12293 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12294 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12298 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12299 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12300 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12301 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12302 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12303 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12304 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12308 static struct hda_verb alc269_lifebook_verbs[] = {
12309 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12310 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12311 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12312 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12313 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12314 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12315 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12316 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12317 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12318 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12322 /* toggle speaker-output according to the hp-jack state */
12323 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12325 unsigned int present;
12326 unsigned char bits;
12328 present = snd_hda_codec_read(codec, 0x15, 0,
12329 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12330 bits = present ? AMP_IN_MUTE(0) : 0;
12331 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12332 AMP_IN_MUTE(0), bits);
12333 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12334 AMP_IN_MUTE(0), bits);
12336 snd_hda_codec_write(codec, 0x20, 0,
12337 AC_VERB_SET_COEF_INDEX, 0x0c);
12338 snd_hda_codec_write(codec, 0x20, 0,
12339 AC_VERB_SET_PROC_COEF, 0x680);
12341 snd_hda_codec_write(codec, 0x20, 0,
12342 AC_VERB_SET_COEF_INDEX, 0x0c);
12343 snd_hda_codec_write(codec, 0x20, 0,
12344 AC_VERB_SET_PROC_COEF, 0x480);
12347 /* toggle speaker-output according to the hp-jacks state */
12348 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12350 unsigned int present;
12351 unsigned char bits;
12353 /* Check laptop headphone socket */
12354 present = snd_hda_codec_read(codec, 0x15, 0,
12355 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12357 /* Check port replicator headphone socket */
12358 present |= snd_hda_codec_read(codec, 0x1a, 0,
12359 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12361 bits = present ? AMP_IN_MUTE(0) : 0;
12362 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12363 AMP_IN_MUTE(0), bits);
12364 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12365 AMP_IN_MUTE(0), bits);
12367 snd_hda_codec_write(codec, 0x20, 0,
12368 AC_VERB_SET_COEF_INDEX, 0x0c);
12369 snd_hda_codec_write(codec, 0x20, 0,
12370 AC_VERB_SET_PROC_COEF, 0x680);
12372 snd_hda_codec_write(codec, 0x20, 0,
12373 AC_VERB_SET_COEF_INDEX, 0x0c);
12374 snd_hda_codec_write(codec, 0x20, 0,
12375 AC_VERB_SET_PROC_COEF, 0x480);
12378 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12380 unsigned int present;
12382 present = snd_hda_codec_read(codec, 0x18, 0,
12383 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12384 snd_hda_codec_write(codec, 0x23, 0,
12385 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12388 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12390 unsigned int present_laptop;
12391 unsigned int present_dock;
12393 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12394 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12396 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12397 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12399 /* Laptop mic port overrides dock mic port, design decision */
12401 snd_hda_codec_write(codec, 0x23, 0,
12402 AC_VERB_SET_CONNECT_SEL, 0x3);
12403 if (present_laptop)
12404 snd_hda_codec_write(codec, 0x23, 0,
12405 AC_VERB_SET_CONNECT_SEL, 0x0);
12406 if (!present_dock && !present_laptop)
12407 snd_hda_codec_write(codec, 0x23, 0,
12408 AC_VERB_SET_CONNECT_SEL, 0x1);
12411 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12414 if ((res >> 26) == ALC880_HP_EVENT)
12415 alc269_quanta_fl1_speaker_automute(codec);
12416 if ((res >> 26) == ALC880_MIC_EVENT)
12417 alc269_quanta_fl1_mic_automute(codec);
12420 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12423 if ((res >> 26) == ALC880_HP_EVENT)
12424 alc269_lifebook_speaker_automute(codec);
12425 if ((res >> 26) == ALC880_MIC_EVENT)
12426 alc269_lifebook_mic_autoswitch(codec);
12429 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12431 alc269_quanta_fl1_speaker_automute(codec);
12432 alc269_quanta_fl1_mic_automute(codec);
12435 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12437 alc269_lifebook_speaker_automute(codec);
12438 alc269_lifebook_mic_autoswitch(codec);
12441 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12442 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12443 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12444 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12445 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12446 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12447 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12448 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12452 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12453 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12454 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12455 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12456 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12457 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12458 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12462 /* toggle speaker-output according to the hp-jack state */
12463 static void alc269_speaker_automute(struct hda_codec *codec)
12465 unsigned int present;
12466 unsigned char bits;
12468 present = snd_hda_codec_read(codec, 0x15, 0,
12469 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12470 bits = present ? AMP_IN_MUTE(0) : 0;
12471 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12472 AMP_IN_MUTE(0), bits);
12473 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12474 AMP_IN_MUTE(0), bits);
12477 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12479 unsigned int present;
12481 present = snd_hda_codec_read(codec, 0x18, 0,
12482 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12483 snd_hda_codec_write(codec, 0x23, 0,
12484 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12487 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12489 unsigned int present;
12491 present = snd_hda_codec_read(codec, 0x18, 0,
12492 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12493 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12494 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12495 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12496 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12499 /* unsolicited event for HP jack sensing */
12500 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12503 if ((res >> 26) == ALC880_HP_EVENT)
12504 alc269_speaker_automute(codec);
12506 if ((res >> 26) == ALC880_MIC_EVENT)
12507 alc269_eeepc_dmic_automute(codec);
12510 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12512 alc269_speaker_automute(codec);
12513 alc269_eeepc_dmic_automute(codec);
12516 /* unsolicited event for HP jack sensing */
12517 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12520 if ((res >> 26) == ALC880_HP_EVENT)
12521 alc269_speaker_automute(codec);
12523 if ((res >> 26) == ALC880_MIC_EVENT)
12524 alc269_eeepc_amic_automute(codec);
12527 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12529 alc269_speaker_automute(codec);
12530 alc269_eeepc_amic_automute(codec);
12534 * generic initialization of ADC, input mixers and output mixers
12536 static struct hda_verb alc269_init_verbs[] = {
12538 * Unmute ADC0 and set the default input to mic-in
12540 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12542 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12543 * analog-loopback mixer widget
12544 * Note: PASD motherboards uses the Line In 2 as the input for
12545 * front panel mic (mic 2)
12547 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12550 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12551 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12552 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12555 * Set up output mixers (0x0c - 0x0e)
12557 /* set vol=0 to output mixers */
12558 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12559 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12561 /* set up input amps for analog loopback */
12562 /* Amp Indices: DAC = 0, mixer = 1 */
12563 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12564 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12565 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12566 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12567 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12568 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12570 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12571 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12572 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12573 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12574 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12575 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12576 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12578 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12579 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12580 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12581 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12582 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12583 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12584 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12586 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12587 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12589 /* FIXME: use matrix-type input source selection */
12590 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12591 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12592 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12593 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12594 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12595 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12598 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12599 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12603 /* add playback controls from the parsed DAC table */
12604 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12605 const struct auto_pin_cfg *cfg)
12610 spec->multiout.num_dacs = 1; /* only use one dac */
12611 spec->multiout.dac_nids = spec->private_dac_nids;
12612 spec->multiout.dac_nids[0] = 2;
12614 nid = cfg->line_out_pins[0];
12616 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12617 "Front Playback Volume",
12618 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12621 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12622 "Front Playback Switch",
12623 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12628 nid = cfg->speaker_pins[0];
12630 if (!cfg->line_out_pins[0]) {
12631 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12632 "Speaker Playback Volume",
12633 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12639 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12640 "Speaker Playback Switch",
12641 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12646 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12647 "Speaker Playback Switch",
12648 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12654 nid = cfg->hp_pins[0];
12656 /* spec->multiout.hp_nid = 2; */
12657 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12658 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12659 "Headphone Playback Volume",
12660 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12666 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12667 "Headphone Playback Switch",
12668 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12673 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12674 "Headphone Playback Switch",
12675 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12684 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12685 const struct auto_pin_cfg *cfg)
12689 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12692 /* digital-mic input pin is excluded in alc880_auto_create..()
12693 * because it's under 0x18
12695 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12696 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12697 struct hda_input_mux *imux = &spec->private_imux[0];
12698 imux->items[imux->num_items].label = "Int Mic";
12699 imux->items[imux->num_items].index = 0x05;
12705 #ifdef CONFIG_SND_HDA_POWER_SAVE
12706 #define alc269_loopbacks alc880_loopbacks
12709 /* pcm configuration: identiacal with ALC880 */
12710 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12711 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12712 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12713 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12715 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
12719 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12720 /* NID is set in alc_build_pcms */
12722 .open = alc880_playback_pcm_open,
12723 .prepare = alc880_playback_pcm_prepare,
12724 .cleanup = alc880_playback_pcm_cleanup
12728 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
12732 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12733 /* NID is set in alc_build_pcms */
12737 * BIOS auto configuration
12739 static int alc269_parse_auto_config(struct hda_codec *codec)
12741 struct alc_spec *spec = codec->spec;
12743 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12745 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12750 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12753 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12757 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12759 if (spec->autocfg.dig_outs)
12760 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12762 if (spec->kctls.list)
12763 add_mixer(spec, spec->kctls.list);
12765 add_verb(spec, alc269_init_verbs);
12766 spec->num_mux_defs = 1;
12767 spec->input_mux = &spec->private_imux[0];
12768 /* set default input source */
12769 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12770 0, AC_VERB_SET_CONNECT_SEL,
12771 spec->input_mux->items[0].index);
12773 err = alc_auto_add_mic_boost(codec);
12777 if (!spec->cap_mixer && !spec->no_analog)
12778 set_capture_mixer(spec);
12783 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12784 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12785 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12788 /* init callback for auto-configuration model -- overriding the default init */
12789 static void alc269_auto_init(struct hda_codec *codec)
12791 struct alc_spec *spec = codec->spec;
12792 alc269_auto_init_multi_out(codec);
12793 alc269_auto_init_hp_out(codec);
12794 alc269_auto_init_analog_input(codec);
12795 if (spec->unsol_event)
12796 alc_inithook(codec);
12800 * configuration and preset
12802 static const char *alc269_models[ALC269_MODEL_LAST] = {
12803 [ALC269_BASIC] = "basic",
12804 [ALC269_QUANTA_FL1] = "quanta",
12805 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12806 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12807 [ALC269_FUJITSU] = "fujitsu",
12808 [ALC269_LIFEBOOK] = "lifebook"
12811 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12812 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12813 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12814 ALC269_ASUS_EEEPC_P703),
12815 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
12816 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
12817 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
12818 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
12819 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
12820 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
12821 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12822 ALC269_ASUS_EEEPC_P901),
12823 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12824 ALC269_ASUS_EEEPC_P901),
12825 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
12826 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12827 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12831 static struct alc_config_preset alc269_presets[] = {
12833 .mixers = { alc269_base_mixer },
12834 .init_verbs = { alc269_init_verbs },
12835 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12836 .dac_nids = alc269_dac_nids,
12838 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12839 .channel_mode = alc269_modes,
12840 .input_mux = &alc269_capture_source,
12842 [ALC269_QUANTA_FL1] = {
12843 .mixers = { alc269_quanta_fl1_mixer },
12844 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12845 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12846 .dac_nids = alc269_dac_nids,
12848 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12849 .channel_mode = alc269_modes,
12850 .input_mux = &alc269_capture_source,
12851 .unsol_event = alc269_quanta_fl1_unsol_event,
12852 .init_hook = alc269_quanta_fl1_init_hook,
12854 [ALC269_ASUS_EEEPC_P703] = {
12855 .mixers = { alc269_eeepc_mixer },
12856 .cap_mixer = alc269_epc_capture_mixer,
12857 .init_verbs = { alc269_init_verbs,
12858 alc269_eeepc_amic_init_verbs },
12859 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12860 .dac_nids = alc269_dac_nids,
12862 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12863 .channel_mode = alc269_modes,
12864 .input_mux = &alc269_eeepc_amic_capture_source,
12865 .unsol_event = alc269_eeepc_amic_unsol_event,
12866 .init_hook = alc269_eeepc_amic_inithook,
12868 [ALC269_ASUS_EEEPC_P901] = {
12869 .mixers = { alc269_eeepc_mixer },
12870 .cap_mixer = alc269_epc_capture_mixer,
12871 .init_verbs = { alc269_init_verbs,
12872 alc269_eeepc_dmic_init_verbs },
12873 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12874 .dac_nids = alc269_dac_nids,
12876 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12877 .channel_mode = alc269_modes,
12878 .input_mux = &alc269_eeepc_dmic_capture_source,
12879 .unsol_event = alc269_eeepc_dmic_unsol_event,
12880 .init_hook = alc269_eeepc_dmic_inithook,
12882 [ALC269_FUJITSU] = {
12883 .mixers = { alc269_fujitsu_mixer },
12884 .cap_mixer = alc269_epc_capture_mixer,
12885 .init_verbs = { alc269_init_verbs,
12886 alc269_eeepc_dmic_init_verbs },
12887 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12888 .dac_nids = alc269_dac_nids,
12890 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12891 .channel_mode = alc269_modes,
12892 .input_mux = &alc269_eeepc_dmic_capture_source,
12893 .unsol_event = alc269_eeepc_dmic_unsol_event,
12894 .init_hook = alc269_eeepc_dmic_inithook,
12896 [ALC269_LIFEBOOK] = {
12897 .mixers = { alc269_lifebook_mixer },
12898 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12899 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12900 .dac_nids = alc269_dac_nids,
12902 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12903 .channel_mode = alc269_modes,
12904 .input_mux = &alc269_capture_source,
12905 .unsol_event = alc269_lifebook_unsol_event,
12906 .init_hook = alc269_lifebook_init_hook,
12910 static int patch_alc269(struct hda_codec *codec)
12912 struct alc_spec *spec;
12916 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12920 codec->spec = spec;
12922 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12924 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12928 if (board_config < 0) {
12929 printk(KERN_INFO "hda_codec: Unknown model for %s, "
12930 "trying auto-probe from BIOS...\n", codec->chip_name);
12931 board_config = ALC269_AUTO;
12934 if (board_config == ALC269_AUTO) {
12935 /* automatic parse from the BIOS config */
12936 err = alc269_parse_auto_config(codec);
12942 "hda_codec: Cannot set up configuration "
12943 "from BIOS. Using base mode...\n");
12944 board_config = ALC269_BASIC;
12948 err = snd_hda_attach_beep_device(codec, 0x1);
12954 if (board_config != ALC269_AUTO)
12955 setup_preset(spec, &alc269_presets[board_config]);
12957 if (codec->subsystem_id == 0x17aa3bf8) {
12958 /* Due to a hardware problem on Lenovo Ideadpad, we need to
12959 * fix the sample rate of analog I/O to 44.1kHz
12961 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
12962 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
12964 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12965 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12967 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12968 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12970 spec->adc_nids = alc269_adc_nids;
12971 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12972 spec->capsrc_nids = alc269_capsrc_nids;
12973 if (!spec->cap_mixer)
12974 set_capture_mixer(spec);
12975 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12977 codec->patch_ops = alc_patch_ops;
12978 if (board_config == ALC269_AUTO)
12979 spec->init_hook = alc269_auto_init;
12980 #ifdef CONFIG_SND_HDA_POWER_SAVE
12981 if (!spec->loopback.amplist)
12982 spec->loopback.amplist = alc269_loopbacks;
12984 codec->proc_widget_hook = print_realtek_coef;
12990 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12994 * set the path ways for 2 channel output
12995 * need to set the codec line out and mic 1 pin widgets to inputs
12997 static struct hda_verb alc861_threestack_ch2_init[] = {
12998 /* set pin widget 1Ah (line in) for input */
12999 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13000 /* set pin widget 18h (mic1/2) for input, for mic also enable
13003 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13005 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13007 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13008 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13014 * need to set the codec line out and mic 1 pin widgets to outputs
13016 static struct hda_verb alc861_threestack_ch6_init[] = {
13017 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13018 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13019 /* set pin widget 18h (mic1) for output (CLFE)*/
13020 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13022 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13023 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13025 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13027 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13028 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13033 static struct hda_channel_mode alc861_threestack_modes[2] = {
13034 { 2, alc861_threestack_ch2_init },
13035 { 6, alc861_threestack_ch6_init },
13037 /* Set mic1 as input and unmute the mixer */
13038 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13039 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13040 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13043 /* Set mic1 as output and mute mixer */
13044 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13045 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13046 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13050 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13051 { 2, alc861_uniwill_m31_ch2_init },
13052 { 4, alc861_uniwill_m31_ch4_init },
13055 /* Set mic1 and line-in as input and unmute the mixer */
13056 static struct hda_verb alc861_asus_ch2_init[] = {
13057 /* set pin widget 1Ah (line in) for input */
13058 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13059 /* set pin widget 18h (mic1/2) for input, for mic also enable
13062 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13064 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13066 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13067 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13071 /* Set mic1 nad line-in as output and mute mixer */
13072 static struct hda_verb alc861_asus_ch6_init[] = {
13073 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13074 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13075 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13076 /* set pin widget 18h (mic1) for output (CLFE)*/
13077 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13078 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13079 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13080 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13082 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13084 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13085 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13090 static struct hda_channel_mode alc861_asus_modes[2] = {
13091 { 2, alc861_asus_ch2_init },
13092 { 6, alc861_asus_ch6_init },
13097 static struct snd_kcontrol_new alc861_base_mixer[] = {
13098 /* output mixer control */
13099 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13100 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13101 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13102 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13103 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13105 /*Input mixer control */
13106 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13107 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13108 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13109 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13110 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13111 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13112 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13113 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13114 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13115 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13120 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13121 /* output mixer control */
13122 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13123 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13124 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13125 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13126 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13128 /* Input mixer control */
13129 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13130 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13131 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13132 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13133 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13134 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13135 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13136 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13137 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13138 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13141 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13142 .name = "Channel Mode",
13143 .info = alc_ch_mode_info,
13144 .get = alc_ch_mode_get,
13145 .put = alc_ch_mode_put,
13146 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13151 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13152 /* output mixer control */
13153 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13154 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13155 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13160 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13161 /* output mixer control */
13162 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13163 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13164 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13165 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13166 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13168 /* Input mixer control */
13169 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13170 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13171 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13172 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13173 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13174 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13175 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13176 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13177 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13178 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13181 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13182 .name = "Channel Mode",
13183 .info = alc_ch_mode_info,
13184 .get = alc_ch_mode_get,
13185 .put = alc_ch_mode_put,
13186 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13191 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13192 /* output mixer control */
13193 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13194 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13195 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13196 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13197 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13199 /* Input mixer control */
13200 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13201 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13202 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13203 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13204 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13205 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13206 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13207 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13208 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13209 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13212 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13213 .name = "Channel Mode",
13214 .info = alc_ch_mode_info,
13215 .get = alc_ch_mode_get,
13216 .put = alc_ch_mode_put,
13217 .private_value = ARRAY_SIZE(alc861_asus_modes),
13222 /* additional mixer */
13223 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13224 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13225 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13230 * generic initialization of ADC, input mixers and output mixers
13232 static struct hda_verb alc861_base_init_verbs[] = {
13234 * Unmute ADC0 and set the default input to mic-in
13236 /* port-A for surround (rear panel) */
13237 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13238 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13239 /* port-B for mic-in (rear panel) with vref */
13240 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13241 /* port-C for line-in (rear panel) */
13242 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13243 /* port-D for Front */
13244 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13245 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13246 /* port-E for HP out (front panel) */
13247 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13248 /* route front PCM to HP */
13249 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13250 /* port-F for mic-in (front panel) with vref */
13251 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13252 /* port-G for CLFE (rear panel) */
13253 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13254 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13255 /* port-H for side (rear panel) */
13256 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13257 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13259 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13260 /* route front mic to ADC1*/
13261 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13262 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13264 /* Unmute DAC0~3 & spdif out*/
13265 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13266 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13267 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13268 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13269 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13271 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13272 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13273 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13274 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13275 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13277 /* Unmute Stereo Mixer 15 */
13278 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13279 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13280 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13281 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13283 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13284 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13285 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13286 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13287 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13288 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13289 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13290 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13291 /* hp used DAC 3 (Front) */
13292 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13293 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13298 static struct hda_verb alc861_threestack_init_verbs[] = {
13300 * Unmute ADC0 and set the default input to mic-in
13302 /* port-A for surround (rear panel) */
13303 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13304 /* port-B for mic-in (rear panel) with vref */
13305 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13306 /* port-C for line-in (rear panel) */
13307 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13308 /* port-D for Front */
13309 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13310 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13311 /* port-E for HP out (front panel) */
13312 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13313 /* route front PCM to HP */
13314 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13315 /* port-F for mic-in (front panel) with vref */
13316 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13317 /* port-G for CLFE (rear panel) */
13318 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13319 /* port-H for side (rear panel) */
13320 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13322 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13323 /* route front mic to ADC1*/
13324 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13325 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13326 /* Unmute DAC0~3 & spdif out*/
13327 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13328 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13329 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13330 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13333 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13334 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13335 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13336 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13337 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13339 /* Unmute Stereo Mixer 15 */
13340 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13341 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13342 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13343 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13345 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13346 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13347 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13348 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13349 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13350 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13351 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13352 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13353 /* hp used DAC 3 (Front) */
13354 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13355 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13359 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13361 * Unmute ADC0 and set the default input to mic-in
13363 /* port-A for surround (rear panel) */
13364 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13365 /* port-B for mic-in (rear panel) with vref */
13366 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13367 /* port-C for line-in (rear panel) */
13368 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13369 /* port-D for Front */
13370 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13371 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13372 /* port-E for HP out (front panel) */
13373 /* this has to be set to VREF80 */
13374 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13375 /* route front PCM to HP */
13376 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13377 /* port-F for mic-in (front panel) with vref */
13378 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13379 /* port-G for CLFE (rear panel) */
13380 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13381 /* port-H for side (rear panel) */
13382 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13384 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13385 /* route front mic to ADC1*/
13386 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13387 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13388 /* Unmute DAC0~3 & spdif out*/
13389 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13390 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13391 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13392 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13393 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13395 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13396 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13397 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13398 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13399 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13401 /* Unmute Stereo Mixer 15 */
13402 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13403 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13404 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13405 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13407 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13408 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13409 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13410 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13411 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13412 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13413 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13414 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13415 /* hp used DAC 3 (Front) */
13416 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13417 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13421 static struct hda_verb alc861_asus_init_verbs[] = {
13423 * Unmute ADC0 and set the default input to mic-in
13425 /* port-A for surround (rear panel)
13426 * according to codec#0 this is the HP jack
13428 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13429 /* route front PCM to HP */
13430 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13431 /* port-B for mic-in (rear panel) with vref */
13432 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13433 /* port-C for line-in (rear panel) */
13434 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13435 /* port-D for Front */
13436 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13437 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13438 /* port-E for HP out (front panel) */
13439 /* this has to be set to VREF80 */
13440 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13441 /* route front PCM to HP */
13442 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13443 /* port-F for mic-in (front panel) with vref */
13444 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13445 /* port-G for CLFE (rear panel) */
13446 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13447 /* port-H for side (rear panel) */
13448 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13450 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13451 /* route front mic to ADC1*/
13452 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13453 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13454 /* Unmute DAC0~3 & spdif out*/
13455 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13456 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13457 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13458 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13460 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13461 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13462 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13463 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13464 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13466 /* Unmute Stereo Mixer 15 */
13467 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13468 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13469 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13470 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13472 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13473 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13474 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13475 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13476 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13477 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13478 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13479 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13480 /* hp used DAC 3 (Front) */
13481 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13482 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13486 /* additional init verbs for ASUS laptops */
13487 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13488 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13489 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13494 * generic initialization of ADC, input mixers and output mixers
13496 static struct hda_verb alc861_auto_init_verbs[] = {
13498 * Unmute ADC0 and set the default input to mic-in
13500 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13501 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13503 /* Unmute DAC0~3 & spdif out*/
13504 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13505 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13506 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13507 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13508 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13510 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13511 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13512 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13513 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13514 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13516 /* Unmute Stereo Mixer 15 */
13517 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13518 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13519 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13520 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13522 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13523 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13524 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13525 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13526 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13527 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13528 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13529 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13531 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13532 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13533 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13534 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13535 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13536 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13537 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13538 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13540 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13545 static struct hda_verb alc861_toshiba_init_verbs[] = {
13546 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13551 /* toggle speaker-output according to the hp-jack state */
13552 static void alc861_toshiba_automute(struct hda_codec *codec)
13554 unsigned int present;
13556 present = snd_hda_codec_read(codec, 0x0f, 0,
13557 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13558 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13559 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13560 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13561 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13564 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13567 if ((res >> 26) == ALC880_HP_EVENT)
13568 alc861_toshiba_automute(codec);
13571 /* pcm configuration: identiacal with ALC880 */
13572 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13573 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13574 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13575 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13578 #define ALC861_DIGOUT_NID 0x07
13580 static struct hda_channel_mode alc861_8ch_modes[1] = {
13584 static hda_nid_t alc861_dac_nids[4] = {
13585 /* front, surround, clfe, side */
13586 0x03, 0x06, 0x05, 0x04
13589 static hda_nid_t alc660_dac_nids[3] = {
13590 /* front, clfe, surround */
13594 static hda_nid_t alc861_adc_nids[1] = {
13599 static struct hda_input_mux alc861_capture_source = {
13603 { "Front Mic", 0x3 },
13610 /* fill in the dac_nids table from the parsed pin configuration */
13611 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13612 const struct auto_pin_cfg *cfg)
13617 spec->multiout.dac_nids = spec->private_dac_nids;
13618 for (i = 0; i < cfg->line_outs; i++) {
13619 nid = cfg->line_out_pins[i];
13621 if (i >= ARRAY_SIZE(alc861_dac_nids))
13623 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13626 spec->multiout.num_dacs = cfg->line_outs;
13630 /* add playback controls from the parsed DAC table */
13631 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13632 const struct auto_pin_cfg *cfg)
13635 static const char *chname[4] = {
13636 "Front", "Surround", NULL /*CLFE*/, "Side"
13641 for (i = 0; i < cfg->line_outs; i++) {
13642 nid = spec->multiout.dac_nids[i];
13647 err = add_control(spec, ALC_CTL_BIND_MUTE,
13648 "Center Playback Switch",
13649 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13653 err = add_control(spec, ALC_CTL_BIND_MUTE,
13654 "LFE Playback Switch",
13655 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13660 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13662 if (nid == alc861_dac_nids[idx])
13664 sprintf(name, "%s Playback Switch", chname[idx]);
13665 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13666 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13675 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13683 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13685 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13686 "Headphone Playback Switch",
13687 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13690 spec->multiout.hp_nid = nid;
13695 /* create playback/capture controls for input pins */
13696 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13697 const struct auto_pin_cfg *cfg)
13699 struct hda_input_mux *imux = &spec->private_imux[0];
13700 int i, err, idx, idx1;
13702 for (i = 0; i < AUTO_PIN_LAST; i++) {
13703 switch (cfg->input_pins[i]) {
13706 idx = 2; /* Line In */
13710 idx = 2; /* Line In */
13714 idx = 1; /* Mic In */
13718 idx = 1; /* Mic In */
13728 err = new_analog_input(spec, cfg->input_pins[i],
13729 auto_pin_cfg_labels[i], idx, 0x15);
13733 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13734 imux->items[imux->num_items].index = idx1;
13740 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13742 int pin_type, int dac_idx)
13744 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13746 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13750 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13752 struct alc_spec *spec = codec->spec;
13755 for (i = 0; i < spec->autocfg.line_outs; i++) {
13756 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13757 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13759 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13760 spec->multiout.dac_nids[i]);
13764 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13766 struct alc_spec *spec = codec->spec;
13769 pin = spec->autocfg.hp_pins[0];
13770 if (pin) /* connect to front */
13771 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13772 spec->multiout.dac_nids[0]);
13773 pin = spec->autocfg.speaker_pins[0];
13775 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13778 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13780 struct alc_spec *spec = codec->spec;
13783 for (i = 0; i < AUTO_PIN_LAST; i++) {
13784 hda_nid_t nid = spec->autocfg.input_pins[i];
13785 if (nid >= 0x0c && nid <= 0x11)
13786 alc_set_input_pin(codec, nid, i);
13790 /* parse the BIOS configuration and set up the alc_spec */
13791 /* return 1 if successful, 0 if the proper config is not found,
13792 * or a negative error code
13794 static int alc861_parse_auto_config(struct hda_codec *codec)
13796 struct alc_spec *spec = codec->spec;
13798 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13800 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13804 if (!spec->autocfg.line_outs)
13805 return 0; /* can't find valid BIOS pin config */
13807 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13810 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13813 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13816 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13820 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13822 if (spec->autocfg.dig_outs)
13823 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13825 if (spec->kctls.list)
13826 add_mixer(spec, spec->kctls.list);
13828 add_verb(spec, alc861_auto_init_verbs);
13830 spec->num_mux_defs = 1;
13831 spec->input_mux = &spec->private_imux[0];
13833 spec->adc_nids = alc861_adc_nids;
13834 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13835 set_capture_mixer(spec);
13837 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
13842 /* additional initialization for auto-configuration model */
13843 static void alc861_auto_init(struct hda_codec *codec)
13845 struct alc_spec *spec = codec->spec;
13846 alc861_auto_init_multi_out(codec);
13847 alc861_auto_init_hp_out(codec);
13848 alc861_auto_init_analog_input(codec);
13849 if (spec->unsol_event)
13850 alc_inithook(codec);
13853 #ifdef CONFIG_SND_HDA_POWER_SAVE
13854 static struct hda_amp_list alc861_loopbacks[] = {
13855 { 0x15, HDA_INPUT, 0 },
13856 { 0x15, HDA_INPUT, 1 },
13857 { 0x15, HDA_INPUT, 2 },
13858 { 0x15, HDA_INPUT, 3 },
13865 * configuration and preset
13867 static const char *alc861_models[ALC861_MODEL_LAST] = {
13868 [ALC861_3ST] = "3stack",
13869 [ALC660_3ST] = "3stack-660",
13870 [ALC861_3ST_DIG] = "3stack-dig",
13871 [ALC861_6ST_DIG] = "6stack-dig",
13872 [ALC861_UNIWILL_M31] = "uniwill-m31",
13873 [ALC861_TOSHIBA] = "toshiba",
13874 [ALC861_ASUS] = "asus",
13875 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13876 [ALC861_AUTO] = "auto",
13879 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13880 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13881 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13882 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13883 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13884 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13885 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13886 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13887 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13888 * Any other models that need this preset?
13890 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13891 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13892 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13893 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13894 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13895 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13896 /* FIXME: the below seems conflict */
13897 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13898 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13899 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13903 static struct alc_config_preset alc861_presets[] = {
13905 .mixers = { alc861_3ST_mixer },
13906 .init_verbs = { alc861_threestack_init_verbs },
13907 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13908 .dac_nids = alc861_dac_nids,
13909 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13910 .channel_mode = alc861_threestack_modes,
13912 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13913 .adc_nids = alc861_adc_nids,
13914 .input_mux = &alc861_capture_source,
13916 [ALC861_3ST_DIG] = {
13917 .mixers = { alc861_base_mixer },
13918 .init_verbs = { alc861_threestack_init_verbs },
13919 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13920 .dac_nids = alc861_dac_nids,
13921 .dig_out_nid = ALC861_DIGOUT_NID,
13922 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13923 .channel_mode = alc861_threestack_modes,
13925 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13926 .adc_nids = alc861_adc_nids,
13927 .input_mux = &alc861_capture_source,
13929 [ALC861_6ST_DIG] = {
13930 .mixers = { alc861_base_mixer },
13931 .init_verbs = { alc861_base_init_verbs },
13932 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13933 .dac_nids = alc861_dac_nids,
13934 .dig_out_nid = ALC861_DIGOUT_NID,
13935 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13936 .channel_mode = alc861_8ch_modes,
13937 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13938 .adc_nids = alc861_adc_nids,
13939 .input_mux = &alc861_capture_source,
13942 .mixers = { alc861_3ST_mixer },
13943 .init_verbs = { alc861_threestack_init_verbs },
13944 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13945 .dac_nids = alc660_dac_nids,
13946 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13947 .channel_mode = alc861_threestack_modes,
13949 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13950 .adc_nids = alc861_adc_nids,
13951 .input_mux = &alc861_capture_source,
13953 [ALC861_UNIWILL_M31] = {
13954 .mixers = { alc861_uniwill_m31_mixer },
13955 .init_verbs = { alc861_uniwill_m31_init_verbs },
13956 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13957 .dac_nids = alc861_dac_nids,
13958 .dig_out_nid = ALC861_DIGOUT_NID,
13959 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13960 .channel_mode = alc861_uniwill_m31_modes,
13962 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13963 .adc_nids = alc861_adc_nids,
13964 .input_mux = &alc861_capture_source,
13966 [ALC861_TOSHIBA] = {
13967 .mixers = { alc861_toshiba_mixer },
13968 .init_verbs = { alc861_base_init_verbs,
13969 alc861_toshiba_init_verbs },
13970 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13971 .dac_nids = alc861_dac_nids,
13972 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13973 .channel_mode = alc883_3ST_2ch_modes,
13974 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13975 .adc_nids = alc861_adc_nids,
13976 .input_mux = &alc861_capture_source,
13977 .unsol_event = alc861_toshiba_unsol_event,
13978 .init_hook = alc861_toshiba_automute,
13981 .mixers = { alc861_asus_mixer },
13982 .init_verbs = { alc861_asus_init_verbs },
13983 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13984 .dac_nids = alc861_dac_nids,
13985 .dig_out_nid = ALC861_DIGOUT_NID,
13986 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13987 .channel_mode = alc861_asus_modes,
13990 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13991 .adc_nids = alc861_adc_nids,
13992 .input_mux = &alc861_capture_source,
13994 [ALC861_ASUS_LAPTOP] = {
13995 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13996 .init_verbs = { alc861_asus_init_verbs,
13997 alc861_asus_laptop_init_verbs },
13998 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13999 .dac_nids = alc861_dac_nids,
14000 .dig_out_nid = ALC861_DIGOUT_NID,
14001 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14002 .channel_mode = alc883_3ST_2ch_modes,
14004 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14005 .adc_nids = alc861_adc_nids,
14006 .input_mux = &alc861_capture_source,
14011 static int patch_alc861(struct hda_codec *codec)
14013 struct alc_spec *spec;
14017 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14021 codec->spec = spec;
14023 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14027 if (board_config < 0) {
14028 printk(KERN_INFO "hda_codec: Unknown model for %s, "
14029 "trying auto-probe from BIOS...\n", codec->chip_name);
14030 board_config = ALC861_AUTO;
14033 if (board_config == ALC861_AUTO) {
14034 /* automatic parse from the BIOS config */
14035 err = alc861_parse_auto_config(codec);
14041 "hda_codec: Cannot set up configuration "
14042 "from BIOS. Using base mode...\n");
14043 board_config = ALC861_3ST_DIG;
14047 err = snd_hda_attach_beep_device(codec, 0x23);
14053 if (board_config != ALC861_AUTO)
14054 setup_preset(spec, &alc861_presets[board_config]);
14056 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14057 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14059 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14060 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14062 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14064 spec->vmaster_nid = 0x03;
14066 codec->patch_ops = alc_patch_ops;
14067 if (board_config == ALC861_AUTO)
14068 spec->init_hook = alc861_auto_init;
14069 #ifdef CONFIG_SND_HDA_POWER_SAVE
14070 if (!spec->loopback.amplist)
14071 spec->loopback.amplist = alc861_loopbacks;
14073 codec->proc_widget_hook = print_realtek_coef;
14079 * ALC861-VD support
14083 * In addition, an independent DAC
14085 #define ALC861VD_DIGOUT_NID 0x06
14087 static hda_nid_t alc861vd_dac_nids[4] = {
14088 /* front, surr, clfe, side surr */
14089 0x02, 0x03, 0x04, 0x05
14092 /* dac_nids for ALC660vd are in a different order - according to
14093 * Realtek's driver.
14094 * This should probably tesult in a different mixer for 6stack models
14095 * of ALC660vd codecs, but for now there is only 3stack mixer
14096 * - and it is the same as in 861vd.
14097 * adc_nids in ALC660vd are (is) the same as in 861vd
14099 static hda_nid_t alc660vd_dac_nids[3] = {
14100 /* front, rear, clfe, rear_surr */
14104 static hda_nid_t alc861vd_adc_nids[1] = {
14109 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14112 /* FIXME: should be a matrix-type input source selection */
14113 static struct hda_input_mux alc861vd_capture_source = {
14117 { "Front Mic", 0x1 },
14123 static struct hda_input_mux alc861vd_dallas_capture_source = {
14126 { "Ext Mic", 0x0 },
14127 { "Int Mic", 0x1 },
14131 static struct hda_input_mux alc861vd_hp_capture_source = {
14134 { "Front Mic", 0x0 },
14135 { "ATAPI Mic", 0x1 },
14142 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14149 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14150 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14151 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14152 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14153 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14160 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14161 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14162 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14163 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14164 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14168 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14169 { 6, alc861vd_6stack_ch6_init },
14170 { 8, alc861vd_6stack_ch8_init },
14173 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14175 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14176 .name = "Channel Mode",
14177 .info = alc_ch_mode_info,
14178 .get = alc_ch_mode_get,
14179 .put = alc_ch_mode_put,
14184 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14185 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14187 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14188 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14189 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14191 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14192 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14194 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14196 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14198 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14199 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14201 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14202 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14204 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14206 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14207 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14208 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14210 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14211 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14212 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14214 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14215 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14217 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14218 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14223 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14224 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14225 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14229 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14230 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14231 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14233 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14234 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14235 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14237 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14238 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14240 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14241 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14246 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14247 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14248 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14249 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14251 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14253 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14254 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14255 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14257 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14258 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14259 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14261 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14262 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14267 /* Pin assignment: Speaker=0x14, HP = 0x15,
14268 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14270 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14271 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14272 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14273 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14274 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14275 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14276 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14277 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14278 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14279 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14280 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14284 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14285 * Front Mic=0x18, ATAPI Mic = 0x19,
14287 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14288 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14289 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14290 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14291 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14292 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14293 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14294 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14295 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14301 * generic initialization of ADC, input mixers and output mixers
14303 static struct hda_verb alc861vd_volume_init_verbs[] = {
14305 * Unmute ADC0 and set the default input to mic-in
14307 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14308 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14310 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14311 * the analog-loopback mixer widget
14313 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14314 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14315 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14316 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14320 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14321 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14324 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14327 * Set up output mixers (0x02 - 0x05)
14329 /* set vol=0 to output mixers */
14330 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14331 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14332 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14333 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14335 /* set up input amps for analog loopback */
14336 /* Amp Indices: DAC = 0, mixer = 1 */
14337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14338 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14339 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14340 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14341 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14342 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14343 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14344 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14350 * 3-stack pin configuration:
14351 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14353 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14355 * Set pin mode and muting
14357 /* set front pin widgets 0x14 for output */
14358 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14359 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14360 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14362 /* Mic (rear) pin: input vref at 80% */
14363 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14364 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14365 /* Front Mic pin: input vref at 80% */
14366 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14367 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14368 /* Line In pin: input */
14369 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14370 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14371 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14372 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14373 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14374 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14375 /* CD pin widget for input */
14376 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14382 * 6-stack pin configuration:
14384 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14386 * Set pin mode and muting
14388 /* set front pin widgets 0x14 for output */
14389 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14390 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14391 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14393 /* Rear Pin: output 1 (0x0d) */
14394 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14395 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14396 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14397 /* CLFE Pin: output 2 (0x0e) */
14398 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14399 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14400 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14401 /* Side Pin: output 3 (0x0f) */
14402 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14403 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14404 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14406 /* Mic (rear) pin: input vref at 80% */
14407 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14408 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14409 /* Front Mic pin: input vref at 80% */
14410 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14411 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14412 /* Line In pin: input */
14413 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14414 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14415 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14416 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14417 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14418 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14419 /* CD pin widget for input */
14420 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14425 static struct hda_verb alc861vd_eapd_verbs[] = {
14426 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14430 static struct hda_verb alc660vd_eapd_verbs[] = {
14431 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14432 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14436 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14437 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14438 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14439 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14440 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14441 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14445 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14447 unsigned int present;
14448 unsigned char bits;
14450 present = snd_hda_codec_read(codec, 0x18, 0,
14451 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14452 bits = present ? HDA_AMP_MUTE : 0;
14453 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14454 HDA_AMP_MUTE, bits);
14457 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14459 struct alc_spec *spec = codec->spec;
14461 spec->autocfg.hp_pins[0] = 0x1b;
14462 spec->autocfg.speaker_pins[0] = 0x14;
14463 alc_automute_amp(codec);
14464 alc861vd_lenovo_mic_automute(codec);
14467 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14470 switch (res >> 26) {
14471 case ALC880_MIC_EVENT:
14472 alc861vd_lenovo_mic_automute(codec);
14475 alc_automute_amp_unsol_event(codec, res);
14480 static struct hda_verb alc861vd_dallas_verbs[] = {
14481 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14482 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14483 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14484 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14486 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14487 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14488 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14489 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14490 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14491 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14492 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14493 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14497 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14498 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14499 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14500 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14501 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14502 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14504 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14505 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14506 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14507 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14508 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14509 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14510 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14511 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14515 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14516 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14518 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14519 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14520 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14525 /* toggle speaker-output according to the hp-jack state */
14526 static void alc861vd_dallas_init_hook(struct hda_codec *codec)
14528 struct alc_spec *spec = codec->spec;
14530 spec->autocfg.hp_pins[0] = 0x15;
14531 spec->autocfg.speaker_pins[0] = 0x14;
14532 alc_automute_amp(codec);
14535 #ifdef CONFIG_SND_HDA_POWER_SAVE
14536 #define alc861vd_loopbacks alc880_loopbacks
14539 /* pcm configuration: identiacal with ALC880 */
14540 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14541 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14542 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14543 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14546 * configuration and preset
14548 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14549 [ALC660VD_3ST] = "3stack-660",
14550 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14551 [ALC660VD_ASUS_V1S] = "asus-v1s",
14552 [ALC861VD_3ST] = "3stack",
14553 [ALC861VD_3ST_DIG] = "3stack-digout",
14554 [ALC861VD_6ST_DIG] = "6stack-digout",
14555 [ALC861VD_LENOVO] = "lenovo",
14556 [ALC861VD_DALLAS] = "dallas",
14557 [ALC861VD_HP] = "hp",
14558 [ALC861VD_AUTO] = "auto",
14561 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14562 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14563 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14564 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14565 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14566 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14567 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14568 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14569 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14570 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14571 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14572 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14573 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14574 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14575 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14576 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14580 static struct alc_config_preset alc861vd_presets[] = {
14582 .mixers = { alc861vd_3st_mixer },
14583 .init_verbs = { alc861vd_volume_init_verbs,
14584 alc861vd_3stack_init_verbs },
14585 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14586 .dac_nids = alc660vd_dac_nids,
14587 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14588 .channel_mode = alc861vd_3stack_2ch_modes,
14589 .input_mux = &alc861vd_capture_source,
14591 [ALC660VD_3ST_DIG] = {
14592 .mixers = { alc861vd_3st_mixer },
14593 .init_verbs = { alc861vd_volume_init_verbs,
14594 alc861vd_3stack_init_verbs },
14595 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14596 .dac_nids = alc660vd_dac_nids,
14597 .dig_out_nid = ALC861VD_DIGOUT_NID,
14598 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14599 .channel_mode = alc861vd_3stack_2ch_modes,
14600 .input_mux = &alc861vd_capture_source,
14603 .mixers = { alc861vd_3st_mixer },
14604 .init_verbs = { alc861vd_volume_init_verbs,
14605 alc861vd_3stack_init_verbs },
14606 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14607 .dac_nids = alc861vd_dac_nids,
14608 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14609 .channel_mode = alc861vd_3stack_2ch_modes,
14610 .input_mux = &alc861vd_capture_source,
14612 [ALC861VD_3ST_DIG] = {
14613 .mixers = { alc861vd_3st_mixer },
14614 .init_verbs = { alc861vd_volume_init_verbs,
14615 alc861vd_3stack_init_verbs },
14616 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14617 .dac_nids = alc861vd_dac_nids,
14618 .dig_out_nid = ALC861VD_DIGOUT_NID,
14619 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14620 .channel_mode = alc861vd_3stack_2ch_modes,
14621 .input_mux = &alc861vd_capture_source,
14623 [ALC861VD_6ST_DIG] = {
14624 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14625 .init_verbs = { alc861vd_volume_init_verbs,
14626 alc861vd_6stack_init_verbs },
14627 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14628 .dac_nids = alc861vd_dac_nids,
14629 .dig_out_nid = ALC861VD_DIGOUT_NID,
14630 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14631 .channel_mode = alc861vd_6stack_modes,
14632 .input_mux = &alc861vd_capture_source,
14634 [ALC861VD_LENOVO] = {
14635 .mixers = { alc861vd_lenovo_mixer },
14636 .init_verbs = { alc861vd_volume_init_verbs,
14637 alc861vd_3stack_init_verbs,
14638 alc861vd_eapd_verbs,
14639 alc861vd_lenovo_unsol_verbs },
14640 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14641 .dac_nids = alc660vd_dac_nids,
14642 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14643 .channel_mode = alc861vd_3stack_2ch_modes,
14644 .input_mux = &alc861vd_capture_source,
14645 .unsol_event = alc861vd_lenovo_unsol_event,
14646 .init_hook = alc861vd_lenovo_init_hook,
14648 [ALC861VD_DALLAS] = {
14649 .mixers = { alc861vd_dallas_mixer },
14650 .init_verbs = { alc861vd_dallas_verbs },
14651 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14652 .dac_nids = alc861vd_dac_nids,
14653 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14654 .channel_mode = alc861vd_3stack_2ch_modes,
14655 .input_mux = &alc861vd_dallas_capture_source,
14656 .unsol_event = alc_automute_amp_unsol_event,
14657 .init_hook = alc861vd_dallas_init_hook,
14660 .mixers = { alc861vd_hp_mixer },
14661 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14662 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14663 .dac_nids = alc861vd_dac_nids,
14664 .dig_out_nid = ALC861VD_DIGOUT_NID,
14665 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14666 .channel_mode = alc861vd_3stack_2ch_modes,
14667 .input_mux = &alc861vd_hp_capture_source,
14668 .unsol_event = alc_automute_amp_unsol_event,
14669 .init_hook = alc861vd_dallas_init_hook,
14671 [ALC660VD_ASUS_V1S] = {
14672 .mixers = { alc861vd_lenovo_mixer },
14673 .init_verbs = { alc861vd_volume_init_verbs,
14674 alc861vd_3stack_init_verbs,
14675 alc861vd_eapd_verbs,
14676 alc861vd_lenovo_unsol_verbs },
14677 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14678 .dac_nids = alc660vd_dac_nids,
14679 .dig_out_nid = ALC861VD_DIGOUT_NID,
14680 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14681 .channel_mode = alc861vd_3stack_2ch_modes,
14682 .input_mux = &alc861vd_capture_source,
14683 .unsol_event = alc861vd_lenovo_unsol_event,
14684 .init_hook = alc861vd_lenovo_init_hook,
14689 * BIOS auto configuration
14691 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14692 hda_nid_t nid, int pin_type, int dac_idx)
14694 alc_set_pin_output(codec, nid, pin_type);
14697 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14699 struct alc_spec *spec = codec->spec;
14702 for (i = 0; i <= HDA_SIDE; i++) {
14703 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14704 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14706 alc861vd_auto_set_output_and_unmute(codec, nid,
14712 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14714 struct alc_spec *spec = codec->spec;
14717 pin = spec->autocfg.hp_pins[0];
14718 if (pin) /* connect to front and use dac 0 */
14719 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14720 pin = spec->autocfg.speaker_pins[0];
14722 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14725 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14726 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14728 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14730 struct alc_spec *spec = codec->spec;
14733 for (i = 0; i < AUTO_PIN_LAST; i++) {
14734 hda_nid_t nid = spec->autocfg.input_pins[i];
14735 if (alc861vd_is_input_pin(nid)) {
14736 alc_set_input_pin(codec, nid, i);
14737 if (nid != ALC861VD_PIN_CD_NID &&
14738 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
14739 snd_hda_codec_write(codec, nid, 0,
14740 AC_VERB_SET_AMP_GAIN_MUTE,
14746 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14748 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14749 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14751 /* add playback controls from the parsed DAC table */
14752 /* Based on ALC880 version. But ALC861VD has separate,
14753 * different NIDs for mute/unmute switch and volume control */
14754 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14755 const struct auto_pin_cfg *cfg)
14758 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14759 hda_nid_t nid_v, nid_s;
14762 for (i = 0; i < cfg->line_outs; i++) {
14763 if (!spec->multiout.dac_nids[i])
14765 nid_v = alc861vd_idx_to_mixer_vol(
14767 spec->multiout.dac_nids[i]));
14768 nid_s = alc861vd_idx_to_mixer_switch(
14770 spec->multiout.dac_nids[i]));
14774 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14775 "Center Playback Volume",
14776 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14780 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14781 "LFE Playback Volume",
14782 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14786 err = add_control(spec, ALC_CTL_BIND_MUTE,
14787 "Center Playback Switch",
14788 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14792 err = add_control(spec, ALC_CTL_BIND_MUTE,
14793 "LFE Playback Switch",
14794 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14799 sprintf(name, "%s Playback Volume", chname[i]);
14800 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14801 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14805 sprintf(name, "%s Playback Switch", chname[i]);
14806 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14807 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14816 /* add playback controls for speaker and HP outputs */
14817 /* Based on ALC880 version. But ALC861VD has separate,
14818 * different NIDs for mute/unmute switch and volume control */
14819 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14820 hda_nid_t pin, const char *pfx)
14822 hda_nid_t nid_v, nid_s;
14829 if (alc880_is_fixed_pin(pin)) {
14830 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14831 /* specify the DAC as the extra output */
14832 if (!spec->multiout.hp_nid)
14833 spec->multiout.hp_nid = nid_v;
14835 spec->multiout.extra_out_nid[0] = nid_v;
14836 /* control HP volume/switch on the output mixer amp */
14837 nid_v = alc861vd_idx_to_mixer_vol(
14838 alc880_fixed_pin_idx(pin));
14839 nid_s = alc861vd_idx_to_mixer_switch(
14840 alc880_fixed_pin_idx(pin));
14842 sprintf(name, "%s Playback Volume", pfx);
14843 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14844 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14847 sprintf(name, "%s Playback Switch", pfx);
14848 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14849 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14852 } else if (alc880_is_multi_pin(pin)) {
14853 /* set manual connection */
14854 /* we have only a switch on HP-out PIN */
14855 sprintf(name, "%s Playback Switch", pfx);
14856 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14857 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14864 /* parse the BIOS configuration and set up the alc_spec
14865 * return 1 if successful, 0 if the proper config is not found,
14866 * or a negative error code
14867 * Based on ALC880 version - had to change it to override
14868 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14869 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14871 struct alc_spec *spec = codec->spec;
14873 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14875 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14879 if (!spec->autocfg.line_outs)
14880 return 0; /* can't find valid BIOS pin config */
14882 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14885 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14888 err = alc861vd_auto_create_extra_out(spec,
14889 spec->autocfg.speaker_pins[0],
14893 err = alc861vd_auto_create_extra_out(spec,
14894 spec->autocfg.hp_pins[0],
14898 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14902 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14904 if (spec->autocfg.dig_outs)
14905 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14907 if (spec->kctls.list)
14908 add_mixer(spec, spec->kctls.list);
14910 add_verb(spec, alc861vd_volume_init_verbs);
14912 spec->num_mux_defs = 1;
14913 spec->input_mux = &spec->private_imux[0];
14915 err = alc_auto_add_mic_boost(codec);
14919 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
14924 /* additional initialization for auto-configuration model */
14925 static void alc861vd_auto_init(struct hda_codec *codec)
14927 struct alc_spec *spec = codec->spec;
14928 alc861vd_auto_init_multi_out(codec);
14929 alc861vd_auto_init_hp_out(codec);
14930 alc861vd_auto_init_analog_input(codec);
14931 alc861vd_auto_init_input_src(codec);
14932 if (spec->unsol_event)
14933 alc_inithook(codec);
14936 static int patch_alc861vd(struct hda_codec *codec)
14938 struct alc_spec *spec;
14939 int err, board_config;
14941 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14945 codec->spec = spec;
14947 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14951 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14952 printk(KERN_INFO "hda_codec: Unknown model for %s, "
14953 "trying auto-probe from BIOS...\n", codec->chip_name);
14954 board_config = ALC861VD_AUTO;
14957 if (board_config == ALC861VD_AUTO) {
14958 /* automatic parse from the BIOS config */
14959 err = alc861vd_parse_auto_config(codec);
14965 "hda_codec: Cannot set up configuration "
14966 "from BIOS. Using base mode...\n");
14967 board_config = ALC861VD_3ST;
14971 err = snd_hda_attach_beep_device(codec, 0x23);
14977 if (board_config != ALC861VD_AUTO)
14978 setup_preset(spec, &alc861vd_presets[board_config]);
14980 if (codec->vendor_id == 0x10ec0660) {
14981 /* always turn on EAPD */
14982 add_verb(spec, alc660vd_eapd_verbs);
14985 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14986 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14988 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14989 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14991 spec->adc_nids = alc861vd_adc_nids;
14992 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14993 spec->capsrc_nids = alc861vd_capsrc_nids;
14994 spec->capture_style = CAPT_MIX;
14996 set_capture_mixer(spec);
14997 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
14999 spec->vmaster_nid = 0x02;
15001 codec->patch_ops = alc_patch_ops;
15003 if (board_config == ALC861VD_AUTO)
15004 spec->init_hook = alc861vd_auto_init;
15005 #ifdef CONFIG_SND_HDA_POWER_SAVE
15006 if (!spec->loopback.amplist)
15007 spec->loopback.amplist = alc861vd_loopbacks;
15009 codec->proc_widget_hook = print_realtek_coef;
15017 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15018 * configuration. Each pin widget can choose any input DACs and a mixer.
15019 * Each ADC is connected from a mixer of all inputs. This makes possible
15020 * 6-channel independent captures.
15022 * In addition, an independent DAC for the multi-playback (not used in this
15025 #define ALC662_DIGOUT_NID 0x06
15026 #define ALC662_DIGIN_NID 0x0a
15028 static hda_nid_t alc662_dac_nids[4] = {
15029 /* front, rear, clfe, rear_surr */
15033 static hda_nid_t alc272_dac_nids[2] = {
15037 static hda_nid_t alc662_adc_nids[1] = {
15042 static hda_nid_t alc272_adc_nids[1] = {
15047 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15048 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15052 /* FIXME: should be a matrix-type input source selection */
15053 static struct hda_input_mux alc662_capture_source = {
15057 { "Front Mic", 0x1 },
15063 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15071 static struct hda_input_mux alc662_eeepc_capture_source = {
15079 static struct hda_input_mux alc663_capture_source = {
15083 { "Front Mic", 0x1 },
15088 static struct hda_input_mux alc663_m51va_capture_source = {
15091 { "Ext-Mic", 0x0 },
15096 #if 1 /* set to 0 for testing other input sources below */
15097 static struct hda_input_mux alc272_nc10_capture_source = {
15100 { "Autoselect Mic", 0x0 },
15101 { "Internal Mic", 0x1 },
15105 static struct hda_input_mux alc272_nc10_capture_source = {
15108 { "Autoselect Mic", 0x0 },
15109 { "Internal Mic", 0x1 },
15110 { "In-0x02", 0x2 },
15111 { "In-0x03", 0x3 },
15112 { "In-0x04", 0x4 },
15113 { "In-0x05", 0x5 },
15114 { "In-0x06", 0x6 },
15115 { "In-0x07", 0x7 },
15116 { "In-0x08", 0x8 },
15117 { "In-0x09", 0x9 },
15118 { "In-0x0a", 0x0a },
15119 { "In-0x0b", 0x0b },
15120 { "In-0x0c", 0x0c },
15121 { "In-0x0d", 0x0d },
15122 { "In-0x0e", 0x0e },
15123 { "In-0x0f", 0x0f },
15131 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15138 static struct hda_verb alc662_3ST_ch2_init[] = {
15139 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15140 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15141 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15142 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15149 static struct hda_verb alc662_3ST_ch6_init[] = {
15150 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15151 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15152 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15153 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15154 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15155 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15159 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15160 { 2, alc662_3ST_ch2_init },
15161 { 6, alc662_3ST_ch6_init },
15167 static struct hda_verb alc662_sixstack_ch6_init[] = {
15168 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15169 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15170 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15177 static struct hda_verb alc662_sixstack_ch8_init[] = {
15178 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15179 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15180 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15184 static struct hda_channel_mode alc662_5stack_modes[2] = {
15185 { 2, alc662_sixstack_ch6_init },
15186 { 6, alc662_sixstack_ch8_init },
15189 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15190 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15193 static struct snd_kcontrol_new alc662_base_mixer[] = {
15194 /* output mixer control */
15195 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15196 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15197 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15198 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15199 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15200 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15201 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15202 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15203 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15205 /*Input mixer control */
15206 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15207 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15208 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15209 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15210 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15211 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15212 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15213 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15217 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15218 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15219 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15220 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15221 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15222 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15223 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15224 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15225 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15226 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15227 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15228 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15232 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15233 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15234 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15235 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15236 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15237 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15238 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15239 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15240 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15241 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15242 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15243 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15244 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15245 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15248 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15249 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15253 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15254 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15255 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15256 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15257 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15258 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15259 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15260 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15261 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15262 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15266 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15267 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15268 ALC262_HIPPO_MASTER_SWITCH,
15270 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15271 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15272 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15274 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15275 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15276 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15280 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15281 ALC262_HIPPO_MASTER_SWITCH,
15282 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15283 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15284 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15285 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15286 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15287 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15288 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15289 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15290 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15294 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15295 .ops = &snd_hda_bind_vol,
15297 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15298 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15303 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15304 .ops = &snd_hda_bind_sw,
15306 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15307 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15312 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15313 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15314 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15315 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15316 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15320 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15321 .ops = &snd_hda_bind_sw,
15323 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15324 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15325 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15330 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15331 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15332 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15333 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15334 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15335 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15336 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15341 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15342 .ops = &snd_hda_bind_sw,
15344 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15345 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15346 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15351 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15352 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15353 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15354 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15355 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15356 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15357 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15361 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15362 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15363 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15364 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15365 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15366 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15367 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15368 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15372 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15373 .ops = &snd_hda_bind_vol,
15375 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15376 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15381 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15382 .ops = &snd_hda_bind_sw,
15384 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15385 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15390 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15391 HDA_BIND_VOL("Master Playback Volume",
15392 &alc663_asus_two_bind_master_vol),
15393 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15394 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15395 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15396 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15397 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15401 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15402 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15403 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15404 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15405 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15406 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15407 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15411 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15412 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15413 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15414 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15415 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15416 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15418 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15419 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15420 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15421 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15425 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15426 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15427 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15428 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15430 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15431 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15432 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15433 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15434 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15435 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15439 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15441 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15442 .name = "Channel Mode",
15443 .info = alc_ch_mode_info,
15444 .get = alc_ch_mode_get,
15445 .put = alc_ch_mode_put,
15450 static struct hda_verb alc662_init_verbs[] = {
15451 /* ADC: mute amp left and right */
15452 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15453 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15454 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15456 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15457 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15464 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15465 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15466 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15467 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15469 /* Front Pin: output 0 (0x0c) */
15470 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15471 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15473 /* Rear Pin: output 1 (0x0d) */
15474 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15475 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15477 /* CLFE Pin: output 2 (0x0e) */
15478 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15479 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15481 /* Mic (rear) pin: input vref at 80% */
15482 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15483 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15484 /* Front Mic pin: input vref at 80% */
15485 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15486 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15487 /* Line In pin: input */
15488 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15489 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15490 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15491 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15492 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15493 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15494 /* CD pin widget for input */
15495 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15497 /* FIXME: use matrix-type input source selection */
15498 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15500 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15501 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15503 /* always trun on EAPD */
15504 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15505 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15510 static struct hda_verb alc662_sue_init_verbs[] = {
15511 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15512 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15516 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15517 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15518 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15522 /* Set Unsolicited Event*/
15523 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15524 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15525 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15530 * generic initialization of ADC, input mixers and output mixers
15532 static struct hda_verb alc662_auto_init_verbs[] = {
15534 * Unmute ADC and set the default input to mic-in
15536 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15537 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15539 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15541 * Note: PASD motherboards uses the Line In 2 as the input for front
15542 * panel mic (mic 2)
15544 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15552 * Set up output mixers (0x0c - 0x0f)
15554 /* set vol=0 to output mixers */
15555 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15556 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15557 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15559 /* set up input amps for analog loopback */
15560 /* Amp Indices: DAC = 0, mixer = 1 */
15561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15563 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15564 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15565 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15569 /* FIXME: use matrix-type input source selection */
15570 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15573 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15577 /* additional verbs for ALC663 */
15578 static struct hda_verb alc663_auto_init_verbs[] = {
15579 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15580 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15584 static struct hda_verb alc663_m51va_init_verbs[] = {
15585 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15586 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15587 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15588 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15589 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15590 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15591 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15592 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15593 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15597 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15598 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15599 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15600 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15601 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15602 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15603 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15604 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15608 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15609 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15610 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15611 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15612 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15613 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15614 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15615 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15616 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15620 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15621 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15622 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15623 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15626 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15627 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15631 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15632 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15633 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15634 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15635 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15636 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15637 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15638 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15639 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15640 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15641 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15642 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15643 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15647 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15648 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15649 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15650 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15651 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15652 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15653 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15654 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15657 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15658 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15659 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15663 static struct hda_verb alc663_g71v_init_verbs[] = {
15664 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15665 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15666 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15668 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15669 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15670 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15672 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15673 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15674 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15678 static struct hda_verb alc663_g50v_init_verbs[] = {
15679 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15680 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15681 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15683 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15684 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15688 static struct hda_verb alc662_ecs_init_verbs[] = {
15689 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15690 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15691 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15692 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15696 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
15697 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15698 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15699 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15700 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15701 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15702 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15703 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15704 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15705 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15706 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15707 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15711 static struct hda_verb alc272_dell_init_verbs[] = {
15712 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15713 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15714 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15715 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15716 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15717 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15718 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15719 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15720 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15721 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15722 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15726 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15727 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15728 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15732 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
15733 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
15734 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
15738 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15740 unsigned int present;
15741 unsigned char bits;
15743 present = snd_hda_codec_read(codec, 0x14, 0,
15744 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15745 bits = present ? HDA_AMP_MUTE : 0;
15746 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15747 HDA_AMP_MUTE, bits);
15750 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15752 unsigned int present;
15753 unsigned char bits;
15755 present = snd_hda_codec_read(codec, 0x1b, 0,
15756 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15757 bits = present ? HDA_AMP_MUTE : 0;
15758 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15759 HDA_AMP_MUTE, bits);
15760 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15761 HDA_AMP_MUTE, bits);
15764 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15767 if ((res >> 26) == ALC880_HP_EVENT)
15768 alc662_lenovo_101e_all_automute(codec);
15769 if ((res >> 26) == ALC880_FRONT_EVENT)
15770 alc662_lenovo_101e_ispeaker_automute(codec);
15773 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15775 unsigned int present;
15777 present = snd_hda_codec_read(codec, 0x18, 0,
15778 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15779 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15780 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15781 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15782 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15783 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15784 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15785 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15786 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15789 /* unsolicited event for HP jack sensing */
15790 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15793 if ((res >> 26) == ALC880_MIC_EVENT)
15794 alc662_eeepc_mic_automute(codec);
15796 alc262_hippo_unsol_event(codec, res);
15799 static void alc662_eeepc_inithook(struct hda_codec *codec)
15801 alc262_hippo1_init_hook(codec);
15802 alc662_eeepc_mic_automute(codec);
15805 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15807 struct alc_spec *spec = codec->spec;
15809 spec->autocfg.hp_pins[0] = 0x14;
15810 spec->autocfg.speaker_pins[0] = 0x1b;
15811 alc262_hippo_master_update(codec);
15814 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15816 unsigned int present;
15817 unsigned char bits;
15819 present = snd_hda_codec_read(codec, 0x21, 0,
15820 AC_VERB_GET_PIN_SENSE, 0)
15821 & AC_PINSENSE_PRESENCE;
15822 bits = present ? HDA_AMP_MUTE : 0;
15823 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15824 AMP_IN_MUTE(0), bits);
15825 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15826 AMP_IN_MUTE(0), bits);
15829 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15831 unsigned int present;
15832 unsigned char bits;
15834 present = snd_hda_codec_read(codec, 0x21, 0,
15835 AC_VERB_GET_PIN_SENSE, 0)
15836 & AC_PINSENSE_PRESENCE;
15837 bits = present ? HDA_AMP_MUTE : 0;
15838 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15839 AMP_IN_MUTE(0), bits);
15840 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15841 AMP_IN_MUTE(0), bits);
15842 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15843 AMP_IN_MUTE(0), bits);
15844 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15845 AMP_IN_MUTE(0), bits);
15848 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15850 unsigned int present;
15851 unsigned char bits;
15853 present = snd_hda_codec_read(codec, 0x15, 0,
15854 AC_VERB_GET_PIN_SENSE, 0)
15855 & AC_PINSENSE_PRESENCE;
15856 bits = present ? HDA_AMP_MUTE : 0;
15857 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15858 AMP_IN_MUTE(0), bits);
15859 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15860 AMP_IN_MUTE(0), bits);
15861 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15862 AMP_IN_MUTE(0), bits);
15863 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15864 AMP_IN_MUTE(0), bits);
15867 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15869 unsigned int present;
15870 unsigned char bits;
15872 present = snd_hda_codec_read(codec, 0x1b, 0,
15873 AC_VERB_GET_PIN_SENSE, 0)
15874 & AC_PINSENSE_PRESENCE;
15875 bits = present ? 0 : PIN_OUT;
15876 snd_hda_codec_write(codec, 0x14, 0,
15877 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15880 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15882 unsigned int present1, present2;
15884 present1 = snd_hda_codec_read(codec, 0x21, 0,
15885 AC_VERB_GET_PIN_SENSE, 0)
15886 & AC_PINSENSE_PRESENCE;
15887 present2 = snd_hda_codec_read(codec, 0x15, 0,
15888 AC_VERB_GET_PIN_SENSE, 0)
15889 & AC_PINSENSE_PRESENCE;
15891 if (present1 || present2) {
15892 snd_hda_codec_write_cache(codec, 0x14, 0,
15893 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15895 snd_hda_codec_write_cache(codec, 0x14, 0,
15896 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15900 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15902 unsigned int present1, present2;
15904 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15905 AC_VERB_GET_PIN_SENSE, 0)
15906 & AC_PINSENSE_PRESENCE;
15907 present2 = snd_hda_codec_read(codec, 0x15, 0,
15908 AC_VERB_GET_PIN_SENSE, 0)
15909 & AC_PINSENSE_PRESENCE;
15911 if (present1 || present2) {
15912 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15913 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15914 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15915 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15917 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15918 AMP_IN_MUTE(0), 0);
15919 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15920 AMP_IN_MUTE(0), 0);
15924 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15926 unsigned int present;
15928 present = snd_hda_codec_read(codec, 0x18, 0,
15929 AC_VERB_GET_PIN_SENSE, 0)
15930 & AC_PINSENSE_PRESENCE;
15931 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15932 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15933 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15934 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15935 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15936 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15937 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15938 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15941 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15944 switch (res >> 26) {
15945 case ALC880_HP_EVENT:
15946 alc663_m51va_speaker_automute(codec);
15948 case ALC880_MIC_EVENT:
15949 alc663_m51va_mic_automute(codec);
15954 static void alc663_m51va_inithook(struct hda_codec *codec)
15956 alc663_m51va_speaker_automute(codec);
15957 alc663_m51va_mic_automute(codec);
15960 /* ***************** Mode1 ******************************/
15961 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15964 switch (res >> 26) {
15965 case ALC880_HP_EVENT:
15966 alc663_m51va_speaker_automute(codec);
15968 case ALC880_MIC_EVENT:
15969 alc662_eeepc_mic_automute(codec);
15974 static void alc663_mode1_inithook(struct hda_codec *codec)
15976 alc663_m51va_speaker_automute(codec);
15977 alc662_eeepc_mic_automute(codec);
15979 /* ***************** Mode2 ******************************/
15980 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15983 switch (res >> 26) {
15984 case ALC880_HP_EVENT:
15985 alc662_f5z_speaker_automute(codec);
15987 case ALC880_MIC_EVENT:
15988 alc662_eeepc_mic_automute(codec);
15993 static void alc662_mode2_inithook(struct hda_codec *codec)
15995 alc662_f5z_speaker_automute(codec);
15996 alc662_eeepc_mic_automute(codec);
15998 /* ***************** Mode3 ******************************/
15999 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16002 switch (res >> 26) {
16003 case ALC880_HP_EVENT:
16004 alc663_two_hp_m1_speaker_automute(codec);
16006 case ALC880_MIC_EVENT:
16007 alc662_eeepc_mic_automute(codec);
16012 static void alc663_mode3_inithook(struct hda_codec *codec)
16014 alc663_two_hp_m1_speaker_automute(codec);
16015 alc662_eeepc_mic_automute(codec);
16017 /* ***************** Mode4 ******************************/
16018 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16021 switch (res >> 26) {
16022 case ALC880_HP_EVENT:
16023 alc663_21jd_two_speaker_automute(codec);
16025 case ALC880_MIC_EVENT:
16026 alc662_eeepc_mic_automute(codec);
16031 static void alc663_mode4_inithook(struct hda_codec *codec)
16033 alc663_21jd_two_speaker_automute(codec);
16034 alc662_eeepc_mic_automute(codec);
16036 /* ***************** Mode5 ******************************/
16037 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16040 switch (res >> 26) {
16041 case ALC880_HP_EVENT:
16042 alc663_15jd_two_speaker_automute(codec);
16044 case ALC880_MIC_EVENT:
16045 alc662_eeepc_mic_automute(codec);
16050 static void alc663_mode5_inithook(struct hda_codec *codec)
16052 alc663_15jd_two_speaker_automute(codec);
16053 alc662_eeepc_mic_automute(codec);
16055 /* ***************** Mode6 ******************************/
16056 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16059 switch (res >> 26) {
16060 case ALC880_HP_EVENT:
16061 alc663_two_hp_m2_speaker_automute(codec);
16063 case ALC880_MIC_EVENT:
16064 alc662_eeepc_mic_automute(codec);
16069 static void alc663_mode6_inithook(struct hda_codec *codec)
16071 alc663_two_hp_m2_speaker_automute(codec);
16072 alc662_eeepc_mic_automute(codec);
16075 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16077 unsigned int present;
16078 unsigned char bits;
16080 present = snd_hda_codec_read(codec, 0x21, 0,
16081 AC_VERB_GET_PIN_SENSE, 0)
16082 & AC_PINSENSE_PRESENCE;
16083 bits = present ? HDA_AMP_MUTE : 0;
16084 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16085 HDA_AMP_MUTE, bits);
16086 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16087 HDA_AMP_MUTE, bits);
16090 static void alc663_g71v_front_automute(struct hda_codec *codec)
16092 unsigned int present;
16093 unsigned char bits;
16095 present = snd_hda_codec_read(codec, 0x15, 0,
16096 AC_VERB_GET_PIN_SENSE, 0)
16097 & AC_PINSENSE_PRESENCE;
16098 bits = present ? HDA_AMP_MUTE : 0;
16099 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16100 HDA_AMP_MUTE, bits);
16103 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16106 switch (res >> 26) {
16107 case ALC880_HP_EVENT:
16108 alc663_g71v_hp_automute(codec);
16110 case ALC880_FRONT_EVENT:
16111 alc663_g71v_front_automute(codec);
16113 case ALC880_MIC_EVENT:
16114 alc662_eeepc_mic_automute(codec);
16119 static void alc663_g71v_inithook(struct hda_codec *codec)
16121 alc663_g71v_front_automute(codec);
16122 alc663_g71v_hp_automute(codec);
16123 alc662_eeepc_mic_automute(codec);
16126 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16129 switch (res >> 26) {
16130 case ALC880_HP_EVENT:
16131 alc663_m51va_speaker_automute(codec);
16133 case ALC880_MIC_EVENT:
16134 alc662_eeepc_mic_automute(codec);
16139 static void alc663_g50v_inithook(struct hda_codec *codec)
16141 alc663_m51va_speaker_automute(codec);
16142 alc662_eeepc_mic_automute(codec);
16145 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16146 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16147 ALC262_HIPPO_MASTER_SWITCH,
16149 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16150 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16151 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16153 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16154 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16155 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16159 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16160 /* Master Playback automatically created from Speaker and Headphone */
16161 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16162 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16163 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16164 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16166 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16167 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16168 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16170 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16171 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16172 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16176 #ifdef CONFIG_SND_HDA_POWER_SAVE
16177 #define alc662_loopbacks alc880_loopbacks
16181 /* pcm configuration: identiacal with ALC880 */
16182 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16183 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16184 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16185 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16188 * configuration and preset
16190 static const char *alc662_models[ALC662_MODEL_LAST] = {
16191 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16192 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16193 [ALC662_3ST_6ch] = "3stack-6ch",
16194 [ALC662_5ST_DIG] = "6stack-dig",
16195 [ALC662_LENOVO_101E] = "lenovo-101e",
16196 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16197 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16198 [ALC662_ECS] = "ecs",
16199 [ALC663_ASUS_M51VA] = "m51va",
16200 [ALC663_ASUS_G71V] = "g71v",
16201 [ALC663_ASUS_H13] = "h13",
16202 [ALC663_ASUS_G50V] = "g50v",
16203 [ALC663_ASUS_MODE1] = "asus-mode1",
16204 [ALC662_ASUS_MODE2] = "asus-mode2",
16205 [ALC663_ASUS_MODE3] = "asus-mode3",
16206 [ALC663_ASUS_MODE4] = "asus-mode4",
16207 [ALC663_ASUS_MODE5] = "asus-mode5",
16208 [ALC663_ASUS_MODE6] = "asus-mode6",
16209 [ALC272_DELL] = "dell",
16210 [ALC272_DELL_ZM1] = "dell-zm1",
16211 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16212 [ALC662_AUTO] = "auto",
16215 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16216 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16217 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16218 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16219 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16220 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16221 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16222 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16223 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16224 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16225 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16226 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16227 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16228 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16229 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16230 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16231 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16232 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16233 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16234 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16235 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16236 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16237 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16238 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16239 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16240 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16241 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16242 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16243 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16244 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16245 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16246 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16247 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16248 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16249 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16250 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16251 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16252 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16253 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16254 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16255 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16256 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16257 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16258 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16259 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16260 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16261 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16262 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16263 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16264 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16265 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16266 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16267 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16268 ALC662_3ST_6ch_DIG),
16269 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16270 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16271 ALC662_3ST_6ch_DIG),
16272 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16273 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16274 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16275 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16276 ALC662_3ST_6ch_DIG),
16277 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16282 static struct alc_config_preset alc662_presets[] = {
16283 [ALC662_3ST_2ch_DIG] = {
16284 .mixers = { alc662_3ST_2ch_mixer },
16285 .init_verbs = { alc662_init_verbs },
16286 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16287 .dac_nids = alc662_dac_nids,
16288 .dig_out_nid = ALC662_DIGOUT_NID,
16289 .dig_in_nid = ALC662_DIGIN_NID,
16290 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16291 .channel_mode = alc662_3ST_2ch_modes,
16292 .input_mux = &alc662_capture_source,
16294 [ALC662_3ST_6ch_DIG] = {
16295 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16296 .init_verbs = { alc662_init_verbs },
16297 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16298 .dac_nids = alc662_dac_nids,
16299 .dig_out_nid = ALC662_DIGOUT_NID,
16300 .dig_in_nid = ALC662_DIGIN_NID,
16301 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16302 .channel_mode = alc662_3ST_6ch_modes,
16304 .input_mux = &alc662_capture_source,
16306 [ALC662_3ST_6ch] = {
16307 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16308 .init_verbs = { alc662_init_verbs },
16309 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16310 .dac_nids = alc662_dac_nids,
16311 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16312 .channel_mode = alc662_3ST_6ch_modes,
16314 .input_mux = &alc662_capture_source,
16316 [ALC662_5ST_DIG] = {
16317 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16318 .init_verbs = { alc662_init_verbs },
16319 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16320 .dac_nids = alc662_dac_nids,
16321 .dig_out_nid = ALC662_DIGOUT_NID,
16322 .dig_in_nid = ALC662_DIGIN_NID,
16323 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16324 .channel_mode = alc662_5stack_modes,
16325 .input_mux = &alc662_capture_source,
16327 [ALC662_LENOVO_101E] = {
16328 .mixers = { alc662_lenovo_101e_mixer },
16329 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16330 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16331 .dac_nids = alc662_dac_nids,
16332 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16333 .channel_mode = alc662_3ST_2ch_modes,
16334 .input_mux = &alc662_lenovo_101e_capture_source,
16335 .unsol_event = alc662_lenovo_101e_unsol_event,
16336 .init_hook = alc662_lenovo_101e_all_automute,
16338 [ALC662_ASUS_EEEPC_P701] = {
16339 .mixers = { alc662_eeepc_p701_mixer },
16340 .init_verbs = { alc662_init_verbs,
16341 alc662_eeepc_sue_init_verbs },
16342 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16343 .dac_nids = alc662_dac_nids,
16344 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16345 .channel_mode = alc662_3ST_2ch_modes,
16346 .input_mux = &alc662_eeepc_capture_source,
16347 .unsol_event = alc662_eeepc_unsol_event,
16348 .init_hook = alc662_eeepc_inithook,
16350 [ALC662_ASUS_EEEPC_EP20] = {
16351 .mixers = { alc662_eeepc_ep20_mixer,
16352 alc662_chmode_mixer },
16353 .init_verbs = { alc662_init_verbs,
16354 alc662_eeepc_ep20_sue_init_verbs },
16355 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16356 .dac_nids = alc662_dac_nids,
16357 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16358 .channel_mode = alc662_3ST_6ch_modes,
16359 .input_mux = &alc662_lenovo_101e_capture_source,
16360 .unsol_event = alc662_eeepc_unsol_event,
16361 .init_hook = alc662_eeepc_ep20_inithook,
16364 .mixers = { alc662_ecs_mixer },
16365 .init_verbs = { alc662_init_verbs,
16366 alc662_ecs_init_verbs },
16367 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16368 .dac_nids = alc662_dac_nids,
16369 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16370 .channel_mode = alc662_3ST_2ch_modes,
16371 .input_mux = &alc662_eeepc_capture_source,
16372 .unsol_event = alc662_eeepc_unsol_event,
16373 .init_hook = alc662_eeepc_inithook,
16375 [ALC663_ASUS_M51VA] = {
16376 .mixers = { alc663_m51va_mixer },
16377 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16378 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16379 .dac_nids = alc662_dac_nids,
16380 .dig_out_nid = ALC662_DIGOUT_NID,
16381 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16382 .channel_mode = alc662_3ST_2ch_modes,
16383 .input_mux = &alc663_m51va_capture_source,
16384 .unsol_event = alc663_m51va_unsol_event,
16385 .init_hook = alc663_m51va_inithook,
16387 [ALC663_ASUS_G71V] = {
16388 .mixers = { alc663_g71v_mixer },
16389 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16390 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16391 .dac_nids = alc662_dac_nids,
16392 .dig_out_nid = ALC662_DIGOUT_NID,
16393 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16394 .channel_mode = alc662_3ST_2ch_modes,
16395 .input_mux = &alc662_eeepc_capture_source,
16396 .unsol_event = alc663_g71v_unsol_event,
16397 .init_hook = alc663_g71v_inithook,
16399 [ALC663_ASUS_H13] = {
16400 .mixers = { alc663_m51va_mixer },
16401 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16402 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16403 .dac_nids = alc662_dac_nids,
16404 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16405 .channel_mode = alc662_3ST_2ch_modes,
16406 .input_mux = &alc663_m51va_capture_source,
16407 .unsol_event = alc663_m51va_unsol_event,
16408 .init_hook = alc663_m51va_inithook,
16410 [ALC663_ASUS_G50V] = {
16411 .mixers = { alc663_g50v_mixer },
16412 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16413 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16414 .dac_nids = alc662_dac_nids,
16415 .dig_out_nid = ALC662_DIGOUT_NID,
16416 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16417 .channel_mode = alc662_3ST_6ch_modes,
16418 .input_mux = &alc663_capture_source,
16419 .unsol_event = alc663_g50v_unsol_event,
16420 .init_hook = alc663_g50v_inithook,
16422 [ALC663_ASUS_MODE1] = {
16423 .mixers = { alc663_m51va_mixer },
16424 .cap_mixer = alc662_auto_capture_mixer,
16425 .init_verbs = { alc662_init_verbs,
16426 alc663_21jd_amic_init_verbs },
16427 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16429 .dac_nids = alc662_dac_nids,
16430 .dig_out_nid = ALC662_DIGOUT_NID,
16431 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16432 .channel_mode = alc662_3ST_2ch_modes,
16433 .input_mux = &alc662_eeepc_capture_source,
16434 .unsol_event = alc663_mode1_unsol_event,
16435 .init_hook = alc663_mode1_inithook,
16437 [ALC662_ASUS_MODE2] = {
16438 .mixers = { alc662_1bjd_mixer },
16439 .cap_mixer = alc662_auto_capture_mixer,
16440 .init_verbs = { alc662_init_verbs,
16441 alc662_1bjd_amic_init_verbs },
16442 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16443 .dac_nids = alc662_dac_nids,
16444 .dig_out_nid = ALC662_DIGOUT_NID,
16445 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16446 .channel_mode = alc662_3ST_2ch_modes,
16447 .input_mux = &alc662_eeepc_capture_source,
16448 .unsol_event = alc662_mode2_unsol_event,
16449 .init_hook = alc662_mode2_inithook,
16451 [ALC663_ASUS_MODE3] = {
16452 .mixers = { alc663_two_hp_m1_mixer },
16453 .cap_mixer = alc662_auto_capture_mixer,
16454 .init_verbs = { alc662_init_verbs,
16455 alc663_two_hp_amic_m1_init_verbs },
16456 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16458 .dac_nids = alc662_dac_nids,
16459 .dig_out_nid = ALC662_DIGOUT_NID,
16460 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16461 .channel_mode = alc662_3ST_2ch_modes,
16462 .input_mux = &alc662_eeepc_capture_source,
16463 .unsol_event = alc663_mode3_unsol_event,
16464 .init_hook = alc663_mode3_inithook,
16466 [ALC663_ASUS_MODE4] = {
16467 .mixers = { alc663_asus_21jd_clfe_mixer },
16468 .cap_mixer = alc662_auto_capture_mixer,
16469 .init_verbs = { alc662_init_verbs,
16470 alc663_21jd_amic_init_verbs},
16471 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16473 .dac_nids = alc662_dac_nids,
16474 .dig_out_nid = ALC662_DIGOUT_NID,
16475 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16476 .channel_mode = alc662_3ST_2ch_modes,
16477 .input_mux = &alc662_eeepc_capture_source,
16478 .unsol_event = alc663_mode4_unsol_event,
16479 .init_hook = alc663_mode4_inithook,
16481 [ALC663_ASUS_MODE5] = {
16482 .mixers = { alc663_asus_15jd_clfe_mixer },
16483 .cap_mixer = alc662_auto_capture_mixer,
16484 .init_verbs = { alc662_init_verbs,
16485 alc663_15jd_amic_init_verbs },
16486 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16488 .dac_nids = alc662_dac_nids,
16489 .dig_out_nid = ALC662_DIGOUT_NID,
16490 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16491 .channel_mode = alc662_3ST_2ch_modes,
16492 .input_mux = &alc662_eeepc_capture_source,
16493 .unsol_event = alc663_mode5_unsol_event,
16494 .init_hook = alc663_mode5_inithook,
16496 [ALC663_ASUS_MODE6] = {
16497 .mixers = { alc663_two_hp_m2_mixer },
16498 .cap_mixer = alc662_auto_capture_mixer,
16499 .init_verbs = { alc662_init_verbs,
16500 alc663_two_hp_amic_m2_init_verbs },
16501 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16503 .dac_nids = alc662_dac_nids,
16504 .dig_out_nid = ALC662_DIGOUT_NID,
16505 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16506 .channel_mode = alc662_3ST_2ch_modes,
16507 .input_mux = &alc662_eeepc_capture_source,
16508 .unsol_event = alc663_mode6_unsol_event,
16509 .init_hook = alc663_mode6_inithook,
16512 .mixers = { alc663_m51va_mixer },
16513 .cap_mixer = alc272_auto_capture_mixer,
16514 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16515 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16516 .dac_nids = alc662_dac_nids,
16517 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16518 .adc_nids = alc272_adc_nids,
16519 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16520 .capsrc_nids = alc272_capsrc_nids,
16521 .channel_mode = alc662_3ST_2ch_modes,
16522 .input_mux = &alc663_m51va_capture_source,
16523 .unsol_event = alc663_m51va_unsol_event,
16524 .init_hook = alc663_m51va_inithook,
16526 [ALC272_DELL_ZM1] = {
16527 .mixers = { alc663_m51va_mixer },
16528 .cap_mixer = alc662_auto_capture_mixer,
16529 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16530 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16531 .dac_nids = alc662_dac_nids,
16532 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16533 .adc_nids = alc662_adc_nids,
16534 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
16535 .capsrc_nids = alc662_capsrc_nids,
16536 .channel_mode = alc662_3ST_2ch_modes,
16537 .input_mux = &alc663_m51va_capture_source,
16538 .unsol_event = alc663_m51va_unsol_event,
16539 .init_hook = alc663_m51va_inithook,
16541 [ALC272_SAMSUNG_NC10] = {
16542 .mixers = { alc272_nc10_mixer },
16543 .init_verbs = { alc662_init_verbs,
16544 alc663_21jd_amic_init_verbs },
16545 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16546 .dac_nids = alc272_dac_nids,
16547 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16548 .channel_mode = alc662_3ST_2ch_modes,
16549 .input_mux = &alc272_nc10_capture_source,
16550 .unsol_event = alc663_mode4_unsol_event,
16551 .init_hook = alc663_mode4_inithook,
16557 * BIOS auto configuration
16560 /* add playback controls from the parsed DAC table */
16561 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16562 const struct auto_pin_cfg *cfg)
16565 static const char *chname[4] = {
16566 "Front", "Surround", NULL /*CLFE*/, "Side"
16571 for (i = 0; i < cfg->line_outs; i++) {
16572 if (!spec->multiout.dac_nids[i])
16574 nid = alc880_idx_to_dac(i);
16577 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16578 "Center Playback Volume",
16579 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16583 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16584 "LFE Playback Volume",
16585 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16589 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16590 "Center Playback Switch",
16591 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16595 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16596 "LFE Playback Switch",
16597 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16602 sprintf(name, "%s Playback Volume", chname[i]);
16603 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16604 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16608 sprintf(name, "%s Playback Switch", chname[i]);
16609 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16610 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16619 /* add playback controls for speaker and HP outputs */
16620 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16631 /* ALC663 has a mono output pin on 0x17 */
16632 sprintf(name, "%s Playback Switch", pfx);
16633 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16634 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16638 if (alc880_is_fixed_pin(pin)) {
16639 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16640 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16641 /* specify the DAC as the extra output */
16642 if (!spec->multiout.hp_nid)
16643 spec->multiout.hp_nid = nid;
16645 spec->multiout.extra_out_nid[0] = nid;
16646 /* control HP volume/switch on the output mixer amp */
16647 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16648 sprintf(name, "%s Playback Volume", pfx);
16649 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16650 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16653 sprintf(name, "%s Playback Switch", pfx);
16654 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16655 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16658 } else if (alc880_is_multi_pin(pin)) {
16659 /* set manual connection */
16660 /* we have only a switch on HP-out PIN */
16661 sprintf(name, "%s Playback Switch", pfx);
16662 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16663 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16670 /* return the index of the src widget from the connection list of the nid.
16671 * return -1 if not found
16673 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
16676 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
16679 conns = snd_hda_get_connections(codec, nid, conn_list,
16680 ARRAY_SIZE(conn_list));
16683 for (i = 0; i < conns; i++)
16684 if (conn_list[i] == src)
16689 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
16691 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
16692 return (pincap & AC_PINCAP_IN) != 0;
16695 /* create playback/capture controls for input pins */
16696 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
16697 const struct auto_pin_cfg *cfg)
16699 struct alc_spec *spec = codec->spec;
16700 struct hda_input_mux *imux = &spec->private_imux[0];
16703 for (i = 0; i < AUTO_PIN_LAST; i++) {
16704 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
16705 idx = alc662_input_pin_idx(codec, 0x0b,
16706 cfg->input_pins[i]);
16708 err = new_analog_input(spec, cfg->input_pins[i],
16709 auto_pin_cfg_labels[i],
16714 idx = alc662_input_pin_idx(codec, 0x22,
16715 cfg->input_pins[i]);
16717 imux->items[imux->num_items].label =
16718 auto_pin_cfg_labels[i];
16719 imux->items[imux->num_items].index = idx;
16727 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16728 hda_nid_t nid, int pin_type,
16731 alc_set_pin_output(codec, nid, pin_type);
16732 /* need the manual connection? */
16733 if (alc880_is_multi_pin(nid)) {
16734 struct alc_spec *spec = codec->spec;
16735 int idx = alc880_multi_pin_idx(nid);
16736 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16737 AC_VERB_SET_CONNECT_SEL,
16738 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16742 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16744 struct alc_spec *spec = codec->spec;
16747 for (i = 0; i <= HDA_SIDE; i++) {
16748 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16749 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16751 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16756 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16758 struct alc_spec *spec = codec->spec;
16761 pin = spec->autocfg.hp_pins[0];
16762 if (pin) /* connect to front */
16764 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16765 pin = spec->autocfg.speaker_pins[0];
16767 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16770 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16772 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16774 struct alc_spec *spec = codec->spec;
16777 for (i = 0; i < AUTO_PIN_LAST; i++) {
16778 hda_nid_t nid = spec->autocfg.input_pins[i];
16779 if (alc662_is_input_pin(codec, nid)) {
16780 alc_set_input_pin(codec, nid, i);
16781 if (nid != ALC662_PIN_CD_NID &&
16782 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16783 snd_hda_codec_write(codec, nid, 0,
16784 AC_VERB_SET_AMP_GAIN_MUTE,
16790 #define alc662_auto_init_input_src alc882_auto_init_input_src
16792 static int alc662_parse_auto_config(struct hda_codec *codec)
16794 struct alc_spec *spec = codec->spec;
16796 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16798 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16802 if (!spec->autocfg.line_outs)
16803 return 0; /* can't find valid BIOS pin config */
16805 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16808 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16811 err = alc662_auto_create_extra_out(spec,
16812 spec->autocfg.speaker_pins[0],
16816 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16820 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
16824 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16826 if (spec->autocfg.dig_outs)
16827 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16829 if (spec->kctls.list)
16830 add_mixer(spec, spec->kctls.list);
16832 spec->num_mux_defs = 1;
16833 spec->input_mux = &spec->private_imux[0];
16835 add_verb(spec, alc662_auto_init_verbs);
16836 if (codec->vendor_id == 0x10ec0663)
16837 add_verb(spec, alc663_auto_init_verbs);
16839 err = alc_auto_add_mic_boost(codec);
16843 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
16848 /* additional initialization for auto-configuration model */
16849 static void alc662_auto_init(struct hda_codec *codec)
16851 struct alc_spec *spec = codec->spec;
16852 alc662_auto_init_multi_out(codec);
16853 alc662_auto_init_hp_out(codec);
16854 alc662_auto_init_analog_input(codec);
16855 alc662_auto_init_input_src(codec);
16856 if (spec->unsol_event)
16857 alc_inithook(codec);
16860 static int patch_alc662(struct hda_codec *codec)
16862 struct alc_spec *spec;
16863 int err, board_config;
16865 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16869 codec->spec = spec;
16871 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16873 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16876 if (board_config < 0) {
16877 printk(KERN_INFO "hda_codec: Unknown model for %s, "
16878 "trying auto-probe from BIOS...\n", codec->chip_name);
16879 board_config = ALC662_AUTO;
16882 if (board_config == ALC662_AUTO) {
16883 /* automatic parse from the BIOS config */
16884 err = alc662_parse_auto_config(codec);
16890 "hda_codec: Cannot set up configuration "
16891 "from BIOS. Using base mode...\n");
16892 board_config = ALC662_3ST_2ch_DIG;
16896 err = snd_hda_attach_beep_device(codec, 0x1);
16902 if (board_config != ALC662_AUTO)
16903 setup_preset(spec, &alc662_presets[board_config]);
16905 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16906 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16908 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16909 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16911 spec->adc_nids = alc662_adc_nids;
16912 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16913 spec->capsrc_nids = alc662_capsrc_nids;
16914 spec->capture_style = CAPT_MIX;
16916 if (!spec->cap_mixer)
16917 set_capture_mixer(spec);
16918 if (codec->vendor_id == 0x10ec0662)
16919 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16921 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
16923 spec->vmaster_nid = 0x02;
16925 codec->patch_ops = alc_patch_ops;
16926 if (board_config == ALC662_AUTO)
16927 spec->init_hook = alc662_auto_init;
16928 #ifdef CONFIG_SND_HDA_POWER_SAVE
16929 if (!spec->loopback.amplist)
16930 spec->loopback.amplist = alc662_loopbacks;
16932 codec->proc_widget_hook = print_realtek_coef;
16940 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16941 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16942 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16943 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16944 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16945 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16946 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16947 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16948 .patch = patch_alc861 },
16949 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16950 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16951 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16952 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16953 .patch = patch_alc883 },
16954 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16955 .patch = patch_alc662 },
16956 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16957 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16958 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16959 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16960 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16961 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16962 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16963 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16964 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16965 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16966 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16967 .patch = patch_alc883 },
16968 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16969 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16970 {} /* terminator */
16973 MODULE_ALIAS("snd-hda-codec-id:10ec*");
16975 MODULE_LICENSE("GPL");
16976 MODULE_DESCRIPTION("Realtek HD-audio codec");
16978 static struct hda_codec_preset_list realtek_list = {
16979 .preset = snd_hda_preset_realtek,
16980 .owner = THIS_MODULE,
16983 static int __init patch_realtek_init(void)
16985 return snd_hda_add_codec_preset(&realtek_list);
16988 static void __exit patch_realtek_exit(void)
16990 snd_hda_delete_codec_preset(&realtek_list);
16993 module_init(patch_realtek_init)
16994 module_exit(patch_realtek_exit)