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 ALC880, "
4414 "trying auto-probe from BIOS...\n");
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 ALC260, "
6058 "trying auto-probe from BIOS...\n");
6059 board_config = ALC260_AUTO;
6062 if (board_config == ALC260_AUTO) {
6063 /* automatic parse from the BIOS config */
6064 err = alc260_parse_auto_config(codec);
6070 "hda_codec: Cannot set up configuration "
6071 "from BIOS. Using base mode...\n");
6072 board_config = ALC260_BASIC;
6076 err = snd_hda_attach_beep_device(codec, 0x1);
6082 if (board_config != ALC260_AUTO)
6083 setup_preset(spec, &alc260_presets[board_config]);
6085 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6086 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6088 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6089 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6091 if (!spec->adc_nids && spec->input_mux) {
6092 /* check whether NID 0x04 is valid */
6093 unsigned int wcap = get_wcaps(codec, 0x04);
6094 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6096 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6097 spec->adc_nids = alc260_adc_nids_alt;
6098 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6100 spec->adc_nids = alc260_adc_nids;
6101 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6104 set_capture_mixer(spec);
6105 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6107 spec->vmaster_nid = 0x08;
6109 codec->patch_ops = alc_patch_ops;
6110 if (board_config == ALC260_AUTO)
6111 spec->init_hook = alc260_auto_init;
6112 #ifdef CONFIG_SND_HDA_POWER_SAVE
6113 if (!spec->loopback.amplist)
6114 spec->loopback.amplist = alc260_loopbacks;
6116 codec->proc_widget_hook = print_realtek_coef;
6125 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6126 * configuration. Each pin widget can choose any input DACs and a mixer.
6127 * Each ADC is connected from a mixer of all inputs. This makes possible
6128 * 6-channel independent captures.
6130 * In addition, an independent DAC for the multi-playback (not used in this
6133 #define ALC882_DIGOUT_NID 0x06
6134 #define ALC882_DIGIN_NID 0x0a
6136 static struct hda_channel_mode alc882_ch_modes[1] = {
6140 static hda_nid_t alc882_dac_nids[4] = {
6141 /* front, rear, clfe, rear_surr */
6142 0x02, 0x03, 0x04, 0x05
6145 /* identical with ALC880 */
6146 #define alc882_adc_nids alc880_adc_nids
6147 #define alc882_adc_nids_alt alc880_adc_nids_alt
6149 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6150 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6153 /* FIXME: should be a matrix-type input source selection */
6155 static struct hda_input_mux alc882_capture_source = {
6159 { "Front Mic", 0x1 },
6165 static struct hda_input_mux mb5_capture_source = {
6177 static struct hda_verb alc882_3ST_ch2_init[] = {
6178 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6179 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6180 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6181 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6188 static struct hda_verb alc882_3ST_ch6_init[] = {
6189 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6190 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6191 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6192 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6193 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6194 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6198 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6199 { 2, alc882_3ST_ch2_init },
6200 { 6, alc882_3ST_ch6_init },
6206 static struct hda_verb alc882_sixstack_ch6_init[] = {
6207 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6208 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6209 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6210 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6217 static struct hda_verb alc882_sixstack_ch8_init[] = {
6218 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6219 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6220 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6221 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6225 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6226 { 6, alc882_sixstack_ch6_init },
6227 { 8, alc882_sixstack_ch8_init },
6231 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6237 static struct hda_verb alc885_mbp_ch2_init[] = {
6238 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6239 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6240 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6247 static struct hda_verb alc885_mbp_ch6_init[] = {
6248 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6249 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6250 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6251 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6252 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6256 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6257 { 2, alc885_mbp_ch2_init },
6258 { 6, alc885_mbp_ch6_init },
6262 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6263 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6265 static struct snd_kcontrol_new alc882_base_mixer[] = {
6266 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6267 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6268 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6269 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6270 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6271 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6272 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6273 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6274 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6275 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6276 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6277 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6278 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6279 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6280 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6281 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6282 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6283 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6284 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6285 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6286 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6290 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6291 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6292 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6293 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6294 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6295 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6296 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6297 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6298 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6299 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6300 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6304 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6305 HDA_CODEC_VOLUME("Front Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6306 HDA_BIND_MUTE ("Front Playback Switch", 0x0d, 0x02, HDA_INPUT),
6307 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6308 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
6309 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6310 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6311 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6312 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6313 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6314 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6317 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6318 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6319 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6320 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6321 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6322 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6323 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6324 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6325 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6326 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6330 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6331 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6332 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6333 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6334 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6335 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6336 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6337 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6338 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6339 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6340 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6341 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6342 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6343 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6347 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6348 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6350 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6351 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6352 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6353 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6354 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6355 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6356 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6357 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6358 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6359 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6360 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6361 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6362 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6363 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6367 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6368 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6369 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6370 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6371 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6372 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6373 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6374 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6375 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6376 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6381 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6383 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6384 .name = "Channel Mode",
6385 .info = alc_ch_mode_info,
6386 .get = alc_ch_mode_get,
6387 .put = alc_ch_mode_put,
6392 static struct hda_verb alc882_init_verbs[] = {
6393 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6394 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6395 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6396 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6398 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6399 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6400 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6402 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6403 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6404 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6406 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6407 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6408 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6410 /* Front Pin: output 0 (0x0c) */
6411 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6412 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6413 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6414 /* Rear Pin: output 1 (0x0d) */
6415 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6416 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6417 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6418 /* CLFE Pin: output 2 (0x0e) */
6419 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6420 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6421 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6422 /* Side Pin: output 3 (0x0f) */
6423 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6424 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6425 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6426 /* Mic (rear) pin: input vref at 80% */
6427 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6428 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6429 /* Front Mic pin: input vref at 80% */
6430 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6431 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6432 /* Line In pin: input */
6433 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6434 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6435 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6436 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6437 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6438 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6439 /* CD pin widget for input */
6440 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6442 /* FIXME: use matrix-type input source selection */
6443 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6444 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6445 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6446 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6447 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6448 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6450 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6451 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6452 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6453 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6455 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6457 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6459 /* ADC1: mute amp left and right */
6460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6461 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6462 /* ADC2: mute amp left and right */
6463 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6464 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6465 /* ADC3: mute amp left and right */
6466 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6467 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6472 static struct hda_verb alc882_eapd_verbs[] = {
6473 /* change to EAPD mode */
6474 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6475 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6480 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6481 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6482 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6483 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6484 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6485 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6486 /* FIXME: this looks suspicious...
6487 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6488 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6493 static struct hda_verb alc882_macpro_init_verbs[] = {
6494 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6495 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6496 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6497 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6498 /* Front Pin: output 0 (0x0c) */
6499 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6500 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6501 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6502 /* Front Mic pin: input vref at 80% */
6503 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6504 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6505 /* Speaker: output */
6506 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6507 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6508 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6509 /* Headphone output (output 0 - 0x0c) */
6510 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6511 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6512 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6514 /* FIXME: use matrix-type input source selection */
6515 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6516 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6518 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6520 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6522 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6524 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6525 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6529 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6530 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6531 /* ADC1: mute amp left and right */
6532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6533 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6534 /* ADC2: mute amp left and right */
6535 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6536 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6537 /* ADC3: mute amp left and right */
6538 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6539 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6545 static struct hda_verb alc885_mb5_init_verbs[] = {
6547 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6548 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6549 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6551 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6552 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6554 /* Front Pin: output 0 (0x0d) */
6555 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
6556 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6557 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01},
6558 /* HP Pin: output 0 (0x0c) */
6559 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6560 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6561 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6562 /* Front Mic pin: input vref at 80% */
6563 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6564 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6566 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6567 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6569 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6570 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6571 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6572 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6576 /* Macbook Pro rev3 */
6577 static struct hda_verb alc885_mbp3_init_verbs[] = {
6578 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6579 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6580 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6583 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6586 /* Front Pin: output 0 (0x0c) */
6587 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6588 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6589 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6590 /* HP Pin: output 0 (0x0d) */
6591 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6592 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6593 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6594 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6595 /* Mic (rear) pin: input vref at 80% */
6596 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6597 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6598 /* Front Mic pin: input vref at 80% */
6599 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6600 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6601 /* Line In pin: use output 1 when in LineOut mode */
6602 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6603 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6604 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6606 /* FIXME: use matrix-type input source selection */
6607 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6608 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6609 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6610 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6611 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6612 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6614 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6615 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6616 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6617 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6623 /* ADC1: mute amp left and right */
6624 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6625 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6626 /* ADC2: mute amp left and right */
6627 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6628 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6629 /* ADC3: mute amp left and right */
6630 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6631 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6636 /* iMac 24 mixer. */
6637 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6638 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6639 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6643 /* iMac 24 init verbs. */
6644 static struct hda_verb alc885_imac24_init_verbs[] = {
6645 /* Internal speakers: output 0 (0x0c) */
6646 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6647 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6648 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6649 /* Internal speakers: output 0 (0x0c) */
6650 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6651 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6652 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6653 /* Headphone: output 0 (0x0c) */
6654 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6655 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6656 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6657 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6658 /* Front Mic: input vref at 80% */
6659 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6660 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6664 /* Toggle speaker-output according to the hp-jack state */
6665 static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
6667 struct alc_spec *spec = codec->spec;
6669 spec->autocfg.hp_pins[0] = 0x14;
6670 spec->autocfg.speaker_pins[0] = 0x18;
6671 spec->autocfg.speaker_pins[1] = 0x1a;
6672 alc_automute_amp(codec);
6675 static void alc885_mbp3_init_hook(struct hda_codec *codec)
6677 struct alc_spec *spec = codec->spec;
6679 spec->autocfg.hp_pins[0] = 0x15;
6680 spec->autocfg.speaker_pins[0] = 0x14;
6681 alc_automute_amp(codec);
6685 static struct hda_verb alc882_targa_verbs[] = {
6686 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6687 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6689 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6690 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6692 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6693 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6694 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6696 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6697 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6698 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6699 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6703 /* toggle speaker-output according to the hp-jack state */
6704 static void alc882_targa_automute(struct hda_codec *codec)
6706 struct alc_spec *spec = codec->spec;
6707 alc_automute_amp(codec);
6708 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6709 spec->jack_present ? 1 : 3);
6712 static void alc882_targa_init_hook(struct hda_codec *codec)
6714 struct alc_spec *spec = codec->spec;
6716 spec->autocfg.hp_pins[0] = 0x14;
6717 spec->autocfg.speaker_pins[0] = 0x1b;
6718 alc882_targa_automute(codec);
6721 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6723 if ((res >> 26) == ALC880_HP_EVENT)
6724 alc882_targa_automute(codec);
6727 static struct hda_verb alc882_asus_a7j_verbs[] = {
6728 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6729 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6731 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6732 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6733 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6735 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6736 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6737 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6739 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6740 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6741 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6745 static struct hda_verb alc882_asus_a7m_verbs[] = {
6746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6747 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6749 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6750 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6751 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6753 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6754 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6755 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6757 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6758 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6759 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6763 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6765 unsigned int gpiostate, gpiomask, gpiodir;
6767 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6768 AC_VERB_GET_GPIO_DATA, 0);
6771 gpiostate |= (1 << pin);
6773 gpiostate &= ~(1 << pin);
6775 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6776 AC_VERB_GET_GPIO_MASK, 0);
6777 gpiomask |= (1 << pin);
6779 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6780 AC_VERB_GET_GPIO_DIRECTION, 0);
6781 gpiodir |= (1 << pin);
6784 snd_hda_codec_write(codec, codec->afg, 0,
6785 AC_VERB_SET_GPIO_MASK, gpiomask);
6786 snd_hda_codec_write(codec, codec->afg, 0,
6787 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6791 snd_hda_codec_write(codec, codec->afg, 0,
6792 AC_VERB_SET_GPIO_DATA, gpiostate);
6795 /* set up GPIO at initialization */
6796 static void alc885_macpro_init_hook(struct hda_codec *codec)
6798 alc882_gpio_mute(codec, 0, 0);
6799 alc882_gpio_mute(codec, 1, 0);
6802 /* set up GPIO and update auto-muting at initialization */
6803 static void alc885_imac24_init_hook(struct hda_codec *codec)
6805 alc885_macpro_init_hook(codec);
6806 alc885_imac24_automute_init_hook(codec);
6810 * generic initialization of ADC, input mixers and output mixers
6812 static struct hda_verb alc882_auto_init_verbs[] = {
6814 * Unmute ADC0-2 and set the default input to mic-in
6816 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6817 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6818 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6819 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6820 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6821 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6823 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6825 * Note: PASD motherboards uses the Line In 2 as the input for
6826 * front panel mic (mic 2)
6828 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6829 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6830 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6831 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6832 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6836 * Set up output mixers (0x0c - 0x0f)
6838 /* set vol=0 to output mixers */
6839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6840 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6841 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6842 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6843 /* set up input amps for analog loopback */
6844 /* Amp Indices: DAC = 0, mixer = 1 */
6845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6846 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6847 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6848 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6849 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6850 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6851 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6852 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6853 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6854 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6856 /* FIXME: use matrix-type input source selection */
6857 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6858 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6859 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6860 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6861 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6862 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6864 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6865 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6866 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6867 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6869 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6870 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6871 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6872 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6877 #ifdef CONFIG_SND_HDA_POWER_SAVE
6878 #define alc882_loopbacks alc880_loopbacks
6881 /* pcm configuration: identiacal with ALC880 */
6882 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6883 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6884 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6885 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6888 * configuration and preset
6890 static const char *alc882_models[ALC882_MODEL_LAST] = {
6891 [ALC882_3ST_DIG] = "3stack-dig",
6892 [ALC882_6ST_DIG] = "6stack-dig",
6893 [ALC882_ARIMA] = "arima",
6894 [ALC882_W2JC] = "w2jc",
6895 [ALC882_TARGA] = "targa",
6896 [ALC882_ASUS_A7J] = "asus-a7j",
6897 [ALC882_ASUS_A7M] = "asus-a7m",
6898 [ALC885_MACPRO] = "macpro",
6899 [ALC885_MB5] = "mb5",
6900 [ALC885_MBP3] = "mbp3",
6901 [ALC885_IMAC24] = "imac24",
6902 [ALC882_AUTO] = "auto",
6905 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6906 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6907 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6908 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6909 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6910 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6911 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6912 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6913 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6914 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6915 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6916 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6917 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6921 static struct alc_config_preset alc882_presets[] = {
6922 [ALC882_3ST_DIG] = {
6923 .mixers = { alc882_base_mixer },
6924 .init_verbs = { alc882_init_verbs },
6925 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6926 .dac_nids = alc882_dac_nids,
6927 .dig_out_nid = ALC882_DIGOUT_NID,
6928 .dig_in_nid = ALC882_DIGIN_NID,
6929 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6930 .channel_mode = alc882_ch_modes,
6932 .input_mux = &alc882_capture_source,
6934 [ALC882_6ST_DIG] = {
6935 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6936 .init_verbs = { alc882_init_verbs },
6937 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6938 .dac_nids = alc882_dac_nids,
6939 .dig_out_nid = ALC882_DIGOUT_NID,
6940 .dig_in_nid = ALC882_DIGIN_NID,
6941 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6942 .channel_mode = alc882_sixstack_modes,
6943 .input_mux = &alc882_capture_source,
6946 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6947 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6948 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6949 .dac_nids = alc882_dac_nids,
6950 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6951 .channel_mode = alc882_sixstack_modes,
6952 .input_mux = &alc882_capture_source,
6955 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6956 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6957 alc880_gpio1_init_verbs },
6958 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6959 .dac_nids = alc882_dac_nids,
6960 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6961 .channel_mode = alc880_threestack_modes,
6963 .input_mux = &alc882_capture_source,
6964 .dig_out_nid = ALC882_DIGOUT_NID,
6967 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6968 .init_verbs = { alc885_mbp3_init_verbs,
6969 alc880_gpio1_init_verbs },
6970 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6971 .dac_nids = alc882_dac_nids,
6972 .channel_mode = alc885_mbp_6ch_modes,
6973 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6974 .input_mux = &alc882_capture_source,
6975 .dig_out_nid = ALC882_DIGOUT_NID,
6976 .dig_in_nid = ALC882_DIGIN_NID,
6977 .unsol_event = alc_automute_amp_unsol_event,
6978 .init_hook = alc885_mbp3_init_hook,
6981 .mixers = { alc885_mb5_mixer },
6982 .init_verbs = { alc885_mb5_init_verbs,
6983 alc880_gpio1_init_verbs },
6984 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6985 .dac_nids = alc882_dac_nids,
6986 .channel_mode = alc885_mbp_6ch_modes,
6987 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6988 .input_mux = &mb5_capture_source,
6989 .dig_out_nid = ALC882_DIGOUT_NID,
6990 .dig_in_nid = ALC882_DIGIN_NID,
6993 .mixers = { alc882_macpro_mixer },
6994 .init_verbs = { alc882_macpro_init_verbs },
6995 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6996 .dac_nids = alc882_dac_nids,
6997 .dig_out_nid = ALC882_DIGOUT_NID,
6998 .dig_in_nid = ALC882_DIGIN_NID,
6999 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7000 .channel_mode = alc882_ch_modes,
7001 .input_mux = &alc882_capture_source,
7002 .init_hook = alc885_macpro_init_hook,
7005 .mixers = { alc885_imac24_mixer },
7006 .init_verbs = { alc885_imac24_init_verbs },
7007 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7008 .dac_nids = alc882_dac_nids,
7009 .dig_out_nid = ALC882_DIGOUT_NID,
7010 .dig_in_nid = ALC882_DIGIN_NID,
7011 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7012 .channel_mode = alc882_ch_modes,
7013 .input_mux = &alc882_capture_source,
7014 .unsol_event = alc_automute_amp_unsol_event,
7015 .init_hook = alc885_imac24_init_hook,
7018 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
7019 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
7020 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7021 .dac_nids = alc882_dac_nids,
7022 .dig_out_nid = ALC882_DIGOUT_NID,
7023 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7024 .adc_nids = alc882_adc_nids,
7025 .capsrc_nids = alc882_capsrc_nids,
7026 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7027 .channel_mode = alc882_3ST_6ch_modes,
7029 .input_mux = &alc882_capture_source,
7030 .unsol_event = alc882_targa_unsol_event,
7031 .init_hook = alc882_targa_init_hook,
7033 [ALC882_ASUS_A7J] = {
7034 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
7035 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
7036 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7037 .dac_nids = alc882_dac_nids,
7038 .dig_out_nid = ALC882_DIGOUT_NID,
7039 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7040 .adc_nids = alc882_adc_nids,
7041 .capsrc_nids = alc882_capsrc_nids,
7042 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7043 .channel_mode = alc882_3ST_6ch_modes,
7045 .input_mux = &alc882_capture_source,
7047 [ALC882_ASUS_A7M] = {
7048 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
7049 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
7050 alc880_gpio1_init_verbs,
7051 alc882_asus_a7m_verbs },
7052 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7053 .dac_nids = alc882_dac_nids,
7054 .dig_out_nid = ALC882_DIGOUT_NID,
7055 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
7056 .channel_mode = alc880_threestack_modes,
7058 .input_mux = &alc882_capture_source,
7067 PINFIX_ABIT_AW9D_MAX
7070 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
7071 { 0x15, 0x01080104 }, /* side */
7072 { 0x16, 0x01011012 }, /* rear */
7073 { 0x17, 0x01016011 }, /* clfe */
7077 static const struct alc_pincfg *alc882_pin_fixes[] = {
7078 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
7081 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
7082 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
7087 * BIOS auto configuration
7089 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
7090 hda_nid_t nid, int pin_type,
7094 struct alc_spec *spec = codec->spec;
7097 alc_set_pin_output(codec, nid, pin_type);
7098 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7101 idx = spec->multiout.dac_nids[dac_idx] - 2;
7102 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7106 static void alc882_auto_init_multi_out(struct hda_codec *codec)
7108 struct alc_spec *spec = codec->spec;
7111 for (i = 0; i <= HDA_SIDE; i++) {
7112 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7113 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7115 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
7120 static void alc882_auto_init_hp_out(struct hda_codec *codec)
7122 struct alc_spec *spec = codec->spec;
7125 pin = spec->autocfg.hp_pins[0];
7126 if (pin) /* connect to front */
7128 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7129 pin = spec->autocfg.speaker_pins[0];
7131 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7134 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7135 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7137 static void alc882_auto_init_analog_input(struct hda_codec *codec)
7139 struct alc_spec *spec = codec->spec;
7142 for (i = 0; i < AUTO_PIN_LAST; i++) {
7143 hda_nid_t nid = spec->autocfg.input_pins[i];
7146 alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/);
7147 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
7148 snd_hda_codec_write(codec, nid, 0,
7149 AC_VERB_SET_AMP_GAIN_MUTE,
7154 static void alc882_auto_init_input_src(struct hda_codec *codec)
7156 struct alc_spec *spec = codec->spec;
7159 for (c = 0; c < spec->num_adc_nids; c++) {
7160 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
7161 hda_nid_t nid = spec->capsrc_nids[c];
7162 unsigned int mux_idx;
7163 const struct hda_input_mux *imux;
7164 int conns, mute, idx, item;
7166 conns = snd_hda_get_connections(codec, nid, conn_list,
7167 ARRAY_SIZE(conn_list));
7170 mux_idx = c >= spec->num_mux_defs ? 0 : c;
7171 imux = &spec->input_mux[mux_idx];
7172 for (idx = 0; idx < conns; idx++) {
7173 /* if the current connection is the selected one,
7174 * unmute it as default - otherwise mute it
7176 mute = AMP_IN_MUTE(idx);
7177 for (item = 0; item < imux->num_items; item++) {
7178 if (imux->items[item].index == idx) {
7179 if (spec->cur_mux[c] == item)
7180 mute = AMP_IN_UNMUTE(idx);
7184 /* check if we have a selector or mixer
7185 * we could check for the widget type instead, but
7186 * just check for Amp-In presence (in case of mixer
7187 * without amp-in there is something wrong, this
7188 * function shouldn't be used or capsrc nid is wrong)
7190 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
7191 snd_hda_codec_write(codec, nid, 0,
7192 AC_VERB_SET_AMP_GAIN_MUTE,
7194 else if (mute != AMP_IN_MUTE(idx))
7195 snd_hda_codec_write(codec, nid, 0,
7196 AC_VERB_SET_CONNECT_SEL,
7202 /* add mic boosts if needed */
7203 static int alc_auto_add_mic_boost(struct hda_codec *codec)
7205 struct alc_spec *spec = codec->spec;
7209 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7210 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7211 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7213 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7217 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7218 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7219 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7221 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7228 /* almost identical with ALC880 parser... */
7229 static int alc882_parse_auto_config(struct hda_codec *codec)
7231 struct alc_spec *spec = codec->spec;
7232 int err = alc880_parse_auto_config(codec);
7237 return 0; /* no config found */
7239 err = alc_auto_add_mic_boost(codec);
7243 /* hack - override the init verbs */
7244 spec->init_verbs[0] = alc882_auto_init_verbs;
7246 return 1; /* config found */
7249 /* additional initialization for auto-configuration model */
7250 static void alc882_auto_init(struct hda_codec *codec)
7252 struct alc_spec *spec = codec->spec;
7253 alc882_auto_init_multi_out(codec);
7254 alc882_auto_init_hp_out(codec);
7255 alc882_auto_init_analog_input(codec);
7256 alc882_auto_init_input_src(codec);
7257 if (spec->unsol_event)
7258 alc_inithook(codec);
7261 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7263 static int patch_alc882(struct hda_codec *codec)
7265 struct alc_spec *spec;
7266 int err, board_config;
7268 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7274 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7278 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7279 /* Pick up systems that don't supply PCI SSID */
7280 switch (codec->subsystem_id) {
7281 case 0x106b0c00: /* Mac Pro */
7282 board_config = ALC885_MACPRO;
7284 case 0x106b1000: /* iMac 24 */
7285 case 0x106b2800: /* AppleTV */
7286 case 0x106b3e00: /* iMac 24 Aluminium */
7287 board_config = ALC885_IMAC24;
7289 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7290 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7291 case 0x106b00a4: /* MacbookPro4,1 */
7292 case 0x106b2c00: /* Macbook Pro rev3 */
7293 case 0x106b3600: /* Macbook 3.1 */
7294 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7295 board_config = ALC885_MBP3;
7297 case 0x106b3f00: /* Macbook 5,1 */
7298 case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense
7299 * seems not working, so apparently
7300 * no perfect solution yet
7302 board_config = ALC885_MB5;
7305 /* ALC889A is handled better as ALC888-compatible */
7306 if (codec->revision_id == 0x100101 ||
7307 codec->revision_id == 0x100103) {
7309 return patch_alc883(codec);
7311 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7312 "trying auto-probe from BIOS...\n");
7313 board_config = ALC882_AUTO;
7317 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7319 if (board_config == ALC882_AUTO) {
7320 /* automatic parse from the BIOS config */
7321 err = alc882_parse_auto_config(codec);
7327 "hda_codec: Cannot set up configuration "
7328 "from BIOS. Using base mode...\n");
7329 board_config = ALC882_3ST_DIG;
7333 err = snd_hda_attach_beep_device(codec, 0x1);
7339 if (board_config != ALC882_AUTO)
7340 setup_preset(spec, &alc882_presets[board_config]);
7342 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7343 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7344 /* FIXME: setup DAC5 */
7345 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7346 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7348 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7349 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7351 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7352 if (!spec->adc_nids && spec->input_mux) {
7353 /* check whether NID 0x07 is valid */
7354 unsigned int wcap = get_wcaps(codec, 0x07);
7356 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7357 if (wcap != AC_WID_AUD_IN) {
7358 spec->adc_nids = alc882_adc_nids_alt;
7359 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7360 spec->capsrc_nids = alc882_capsrc_nids_alt;
7362 spec->adc_nids = alc882_adc_nids;
7363 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7364 spec->capsrc_nids = alc882_capsrc_nids;
7367 set_capture_mixer(spec);
7368 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7370 spec->vmaster_nid = 0x0c;
7372 codec->patch_ops = alc_patch_ops;
7373 if (board_config == ALC882_AUTO)
7374 spec->init_hook = alc882_auto_init;
7375 #ifdef CONFIG_SND_HDA_POWER_SAVE
7376 if (!spec->loopback.amplist)
7377 spec->loopback.amplist = alc882_loopbacks;
7379 codec->proc_widget_hook = print_realtek_coef;
7387 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7388 * configuration. Each pin widget can choose any input DACs and a mixer.
7389 * Each ADC is connected from a mixer of all inputs. This makes possible
7390 * 6-channel independent captures.
7392 * In addition, an independent DAC for the multi-playback (not used in this
7395 #define ALC883_DIGOUT_NID 0x06
7396 #define ALC883_DIGIN_NID 0x0a
7398 #define ALC1200_DIGOUT_NID 0x10
7400 static hda_nid_t alc883_dac_nids[4] = {
7401 /* front, rear, clfe, rear_surr */
7402 0x02, 0x03, 0x04, 0x05
7405 static hda_nid_t alc883_adc_nids[2] = {
7410 static hda_nid_t alc883_adc_nids_alt[1] = {
7415 static hda_nid_t alc883_adc_nids_rev[2] = {
7420 #define alc889_adc_nids alc880_adc_nids
7422 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7424 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7426 #define alc889_capsrc_nids alc882_capsrc_nids
7429 /* FIXME: should be a matrix-type input source selection */
7431 static struct hda_input_mux alc883_capture_source = {
7435 { "Front Mic", 0x1 },
7441 static struct hda_input_mux alc883_3stack_6ch_intel = {
7445 { "Front Mic", 0x0 },
7451 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7459 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7469 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7477 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7481 { "Front Mic", 0x1 },
7486 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7497 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7504 static struct hda_verb alc883_3ST_ch2_init[] = {
7505 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7506 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7507 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7508 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7515 static struct hda_verb alc883_3ST_ch4_init[] = {
7516 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7517 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7518 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7519 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7520 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7527 static struct hda_verb alc883_3ST_ch6_init[] = {
7528 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7529 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7530 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7531 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7532 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7533 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7537 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7538 { 2, alc883_3ST_ch2_init },
7539 { 4, alc883_3ST_ch4_init },
7540 { 6, alc883_3ST_ch6_init },
7546 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7547 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7548 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7549 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7550 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7557 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7558 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7559 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7560 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7561 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7562 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7569 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7570 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7571 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7572 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7573 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7574 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7575 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7579 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7580 { 2, alc883_3ST_ch2_intel_init },
7581 { 4, alc883_3ST_ch4_intel_init },
7582 { 6, alc883_3ST_ch6_intel_init },
7588 static struct hda_verb alc883_sixstack_ch6_init[] = {
7589 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7590 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7591 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7592 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7599 static struct hda_verb alc883_sixstack_ch8_init[] = {
7600 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7601 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7602 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7603 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7607 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7608 { 6, alc883_sixstack_ch6_init },
7609 { 8, alc883_sixstack_ch8_init },
7612 static struct hda_verb alc883_medion_eapd_verbs[] = {
7613 /* eanable EAPD on medion laptop */
7614 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7615 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7619 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7620 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7623 static struct snd_kcontrol_new alc883_base_mixer[] = {
7624 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7625 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7626 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7627 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7628 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7629 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7630 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7631 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7632 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7633 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7634 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7635 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7636 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7637 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7638 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7639 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7640 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7641 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7642 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7643 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7644 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7648 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7649 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7650 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7651 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7652 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7653 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7654 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7655 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7656 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7657 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7658 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7659 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7660 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7661 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7665 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7666 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7667 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7668 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7669 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7670 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7671 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7673 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7674 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7675 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7679 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7680 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7681 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7682 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7683 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7684 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7685 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7686 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7687 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7688 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7689 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7693 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7694 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7695 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7696 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7697 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7698 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7699 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7700 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7701 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7702 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7703 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7704 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7705 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7706 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7710 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7711 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7712 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7713 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7714 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7715 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7716 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7717 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7718 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7719 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7720 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7721 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7722 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7723 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7724 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7725 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7726 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7727 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7728 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7729 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7733 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7734 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7735 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7736 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7737 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7738 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7740 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7741 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7742 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7743 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7744 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7745 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7746 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7747 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7748 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7749 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7750 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7751 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7752 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7753 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7757 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7758 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7759 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7760 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7761 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7762 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7763 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7764 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7765 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7766 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7767 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7768 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7769 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7770 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7771 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7772 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7773 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7774 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7775 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7776 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7780 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7781 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7782 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7783 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7784 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7785 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7786 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7787 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7788 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7789 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7790 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7791 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7792 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7793 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7794 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7795 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7796 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7800 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7801 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7802 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7803 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7804 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7805 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7806 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7807 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7808 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7809 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7810 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7811 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7815 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7816 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7817 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7818 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7819 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7820 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7821 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7822 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7823 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7827 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7828 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7829 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7830 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7831 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7832 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7833 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7835 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7836 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7840 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7841 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7842 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7843 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7844 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7845 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7846 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7847 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7848 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7849 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7853 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7854 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7855 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7856 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7857 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7858 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7860 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7861 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7865 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7866 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7867 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7868 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7869 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7870 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7871 0x0d, 1, 0x0, HDA_OUTPUT),
7872 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7873 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7874 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7875 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7876 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7877 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7878 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7879 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7880 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7881 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7882 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7883 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7884 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7885 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7886 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7890 static struct hda_bind_ctls alc883_bind_cap_vol = {
7891 .ops = &snd_hda_bind_vol,
7893 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7894 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7899 static struct hda_bind_ctls alc883_bind_cap_switch = {
7900 .ops = &snd_hda_bind_sw,
7902 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7903 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7908 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7909 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7910 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7911 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7912 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7913 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7914 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7915 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7916 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7920 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7921 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7922 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7924 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7925 /* .name = "Capture Source", */
7926 .name = "Input Source",
7928 .info = alc_mux_enum_info,
7929 .get = alc_mux_enum_get,
7930 .put = alc_mux_enum_put,
7935 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7937 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7938 .name = "Channel Mode",
7939 .info = alc_ch_mode_info,
7940 .get = alc_ch_mode_get,
7941 .put = alc_ch_mode_put,
7946 static struct hda_verb alc883_init_verbs[] = {
7947 /* ADC1: mute amp left and right */
7948 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7949 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7950 /* ADC2: mute amp left and right */
7951 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7952 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7953 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7954 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7955 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7956 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7958 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7959 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7960 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7962 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7963 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7964 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7966 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7967 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7968 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7970 /* mute analog input loopbacks */
7971 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7972 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7973 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7974 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7975 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7977 /* Front Pin: output 0 (0x0c) */
7978 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7979 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7980 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7981 /* Rear Pin: output 1 (0x0d) */
7982 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7983 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7984 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7985 /* CLFE Pin: output 2 (0x0e) */
7986 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7987 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7988 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7989 /* Side Pin: output 3 (0x0f) */
7990 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7991 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7992 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7993 /* Mic (rear) pin: input vref at 80% */
7994 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7995 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7996 /* Front Mic pin: input vref at 80% */
7997 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7998 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7999 /* Line In pin: input */
8000 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8001 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8002 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8003 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8004 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8005 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8006 /* CD pin widget for input */
8007 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8009 /* FIXME: use matrix-type input source selection */
8010 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8012 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8013 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8014 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8015 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8017 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8018 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8019 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8020 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8024 /* toggle speaker-output according to the hp-jack state */
8025 static void alc883_mitac_init_hook(struct hda_codec *codec)
8027 struct alc_spec *spec = codec->spec;
8029 spec->autocfg.hp_pins[0] = 0x15;
8030 spec->autocfg.speaker_pins[0] = 0x14;
8031 spec->autocfg.speaker_pins[1] = 0x17;
8032 alc_automute_amp(codec);
8035 /* auto-toggle front mic */
8037 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8039 unsigned int present;
8042 present = snd_hda_codec_read(codec, 0x18, 0,
8043 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8044 bits = present ? HDA_AMP_MUTE : 0;
8045 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8049 static struct hda_verb alc883_mitac_verbs[] = {
8051 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8052 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8054 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8055 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8057 /* enable unsolicited event */
8058 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8059 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8064 static struct hda_verb alc883_clevo_m720_verbs[] = {
8066 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8067 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8069 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8070 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8072 /* enable unsolicited event */
8073 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8074 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8079 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8081 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8082 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8084 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8085 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8087 /* enable unsolicited event */
8088 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8093 static struct hda_verb alc883_tagra_verbs[] = {
8094 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8095 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8097 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8098 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8100 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8101 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8102 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8104 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8105 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
8106 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
8107 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
8112 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8113 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8114 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8115 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8119 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8120 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8121 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8122 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8123 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8127 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8128 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8129 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8130 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8131 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8132 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8136 static struct hda_verb alc883_haier_w66_verbs[] = {
8137 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8138 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8140 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8142 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8143 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8144 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8145 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8149 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8150 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8151 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8152 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8153 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8154 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8155 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8156 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8157 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8161 static struct hda_verb alc888_6st_dell_verbs[] = {
8162 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8166 static void alc888_3st_hp_init_hook(struct hda_codec *codec)
8168 struct alc_spec *spec = codec->spec;
8170 spec->autocfg.hp_pins[0] = 0x1b;
8171 spec->autocfg.speaker_pins[0] = 0x14;
8172 spec->autocfg.speaker_pins[1] = 0x16;
8173 spec->autocfg.speaker_pins[2] = 0x18;
8174 alc_automute_amp(codec);
8177 static struct hda_verb alc888_3st_hp_verbs[] = {
8178 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8179 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8180 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8181 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8188 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8189 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8190 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8191 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8192 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8199 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8200 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8201 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8202 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8203 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8204 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8211 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8212 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8213 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8214 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8215 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8216 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8217 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8221 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8222 { 2, alc888_3st_hp_2ch_init },
8223 { 4, alc888_3st_hp_4ch_init },
8224 { 6, alc888_3st_hp_6ch_init },
8227 /* toggle front-jack and RCA according to the hp-jack state */
8228 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8230 unsigned int present;
8232 present = snd_hda_codec_read(codec, 0x1b, 0,
8233 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8234 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8235 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8236 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8237 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8240 /* toggle RCA according to the front-jack state */
8241 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8243 unsigned int present;
8245 present = snd_hda_codec_read(codec, 0x14, 0,
8246 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8247 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8248 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8251 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8254 if ((res >> 26) == ALC880_HP_EVENT)
8255 alc888_lenovo_ms7195_front_automute(codec);
8256 if ((res >> 26) == ALC880_FRONT_EVENT)
8257 alc888_lenovo_ms7195_rca_automute(codec);
8260 static struct hda_verb alc883_medion_md2_verbs[] = {
8261 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8262 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8264 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8266 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8270 /* toggle speaker-output according to the hp-jack state */
8271 static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8273 struct alc_spec *spec = codec->spec;
8275 spec->autocfg.hp_pins[0] = 0x14;
8276 spec->autocfg.speaker_pins[0] = 0x15;
8277 alc_automute_amp(codec);
8280 /* toggle speaker-output according to the hp-jack state */
8281 #define alc883_tagra_init_hook alc882_targa_init_hook
8282 #define alc883_tagra_unsol_event alc882_targa_unsol_event
8284 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8286 unsigned int present;
8288 present = snd_hda_codec_read(codec, 0x18, 0,
8289 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8290 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8291 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8294 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8296 struct alc_spec *spec = codec->spec;
8298 spec->autocfg.hp_pins[0] = 0x15;
8299 spec->autocfg.speaker_pins[0] = 0x14;
8300 alc_automute_amp(codec);
8301 alc883_clevo_m720_mic_automute(codec);
8304 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8307 switch (res >> 26) {
8308 case ALC880_MIC_EVENT:
8309 alc883_clevo_m720_mic_automute(codec);
8312 alc_automute_amp_unsol_event(codec, res);
8317 /* toggle speaker-output according to the hp-jack state */
8318 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec)
8320 struct alc_spec *spec = codec->spec;
8322 spec->autocfg.hp_pins[0] = 0x14;
8323 spec->autocfg.speaker_pins[0] = 0x15;
8324 alc_automute_amp(codec);
8327 static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8329 struct alc_spec *spec = codec->spec;
8331 spec->autocfg.hp_pins[0] = 0x1b;
8332 spec->autocfg.speaker_pins[0] = 0x14;
8333 alc_automute_amp(codec);
8336 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8338 unsigned int present;
8341 present = snd_hda_codec_read(codec, 0x14, 0,
8342 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8343 bits = present ? HDA_AMP_MUTE : 0;
8344 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8345 HDA_AMP_MUTE, bits);
8348 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8350 unsigned int present;
8353 present = snd_hda_codec_read(codec, 0x1b, 0,
8354 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8355 bits = present ? HDA_AMP_MUTE : 0;
8356 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8357 HDA_AMP_MUTE, bits);
8358 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8359 HDA_AMP_MUTE, bits);
8362 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8365 if ((res >> 26) == ALC880_HP_EVENT)
8366 alc883_lenovo_101e_all_automute(codec);
8367 if ((res >> 26) == ALC880_FRONT_EVENT)
8368 alc883_lenovo_101e_ispeaker_automute(codec);
8371 /* toggle speaker-output according to the hp-jack state */
8372 static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8374 struct alc_spec *spec = codec->spec;
8376 spec->autocfg.hp_pins[0] = 0x14;
8377 spec->autocfg.speaker_pins[0] = 0x15;
8378 spec->autocfg.speaker_pins[1] = 0x16;
8379 alc_automute_amp(codec);
8382 static struct hda_verb alc883_acer_eapd_verbs[] = {
8383 /* HP Pin: output 0 (0x0c) */
8384 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8385 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8386 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8387 /* Front Pin: output 0 (0x0c) */
8388 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8389 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8390 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8391 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8392 /* eanable EAPD on medion laptop */
8393 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8394 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8395 /* enable unsolicited event */
8396 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8400 static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8402 struct alc_spec *spec = codec->spec;
8404 spec->autocfg.hp_pins[0] = 0x1b;
8405 spec->autocfg.speaker_pins[0] = 0x14;
8406 spec->autocfg.speaker_pins[1] = 0x15;
8407 spec->autocfg.speaker_pins[2] = 0x16;
8408 spec->autocfg.speaker_pins[3] = 0x17;
8409 alc_automute_amp(codec);
8412 static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8414 struct alc_spec *spec = codec->spec;
8416 spec->autocfg.hp_pins[0] = 0x1b;
8417 spec->autocfg.speaker_pins[0] = 0x14;
8418 spec->autocfg.speaker_pins[1] = 0x15;
8419 spec->autocfg.speaker_pins[2] = 0x16;
8420 spec->autocfg.speaker_pins[3] = 0x17;
8421 spec->autocfg.speaker_pins[4] = 0x1a;
8422 alc_automute_amp(codec);
8426 * generic initialization of ADC, input mixers and output mixers
8428 static struct hda_verb alc883_auto_init_verbs[] = {
8430 * Unmute ADC0-2 and set the default input to mic-in
8432 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8433 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8434 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8435 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8437 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8439 * Note: PASD motherboards uses the Line In 2 as the input for
8440 * front panel mic (mic 2)
8442 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8443 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8444 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8445 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8446 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8447 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8450 * Set up output mixers (0x0c - 0x0f)
8452 /* set vol=0 to output mixers */
8453 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8454 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8455 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8456 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8457 /* set up input amps for analog loopback */
8458 /* Amp Indices: DAC = 0, mixer = 1 */
8459 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8460 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8461 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8462 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8463 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8464 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8465 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8466 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8467 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8468 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8470 /* FIXME: use matrix-type input source selection */
8471 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8473 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8474 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8475 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8476 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8477 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8479 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8480 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8482 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8488 static struct hda_verb alc888_asus_m90v_verbs[] = {
8489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8490 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8491 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8492 /* enable unsolicited event */
8493 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8494 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8498 static void alc883_nb_mic_automute(struct hda_codec *codec)
8500 unsigned int present;
8502 present = snd_hda_codec_read(codec, 0x18, 0,
8503 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8504 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8505 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8506 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8507 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8510 static void alc883_M90V_init_hook(struct hda_codec *codec)
8512 struct alc_spec *spec = codec->spec;
8514 spec->autocfg.hp_pins[0] = 0x1b;
8515 spec->autocfg.speaker_pins[0] = 0x14;
8516 spec->autocfg.speaker_pins[1] = 0x15;
8517 spec->autocfg.speaker_pins[2] = 0x16;
8518 alc_automute_pin(codec);
8521 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8524 switch (res >> 26) {
8525 case ALC880_MIC_EVENT:
8526 alc883_nb_mic_automute(codec);
8529 alc_sku_unsol_event(codec, res);
8534 static void alc883_mode2_inithook(struct hda_codec *codec)
8536 alc883_M90V_init_hook(codec);
8537 alc883_nb_mic_automute(codec);
8540 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8541 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8542 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8543 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8544 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8545 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8546 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8547 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8548 /* enable unsolicited event */
8549 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8553 static void alc883_eee1601_inithook(struct hda_codec *codec)
8555 struct alc_spec *spec = codec->spec;
8557 spec->autocfg.hp_pins[0] = 0x14;
8558 spec->autocfg.speaker_pins[0] = 0x1b;
8559 alc_automute_pin(codec);
8562 #ifdef CONFIG_SND_HDA_POWER_SAVE
8563 #define alc883_loopbacks alc880_loopbacks
8566 /* pcm configuration: identiacal with ALC880 */
8567 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8568 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8569 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8570 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8571 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8574 * configuration and preset
8576 static const char *alc883_models[ALC883_MODEL_LAST] = {
8577 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8578 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8579 [ALC883_3ST_6ch] = "3stack-6ch",
8580 [ALC883_6ST_DIG] = "6stack-dig",
8581 [ALC883_TARGA_DIG] = "targa-dig",
8582 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8583 [ALC883_ACER] = "acer",
8584 [ALC883_ACER_ASPIRE] = "acer-aspire",
8585 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8586 [ALC883_MEDION] = "medion",
8587 [ALC883_MEDION_MD2] = "medion-md2",
8588 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8589 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8590 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8591 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8592 [ALC888_LENOVO_SKY] = "lenovo-sky",
8593 [ALC883_HAIER_W66] = "haier-w66",
8594 [ALC888_3ST_HP] = "3stack-hp",
8595 [ALC888_6ST_DELL] = "6stack-dell",
8596 [ALC883_MITAC] = "mitac",
8597 [ALC883_CLEVO_M720] = "clevo-m720",
8598 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8599 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8600 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8601 [ALC1200_ASUS_P5Q] = "asus-p5q",
8602 [ALC883_AUTO] = "auto",
8605 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8606 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8607 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8608 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8609 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8610 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8611 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8612 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8613 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8614 ALC888_ACER_ASPIRE_4930G),
8615 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8616 ALC888_ACER_ASPIRE_4930G),
8617 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
8618 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
8619 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8620 ALC888_ACER_ASPIRE_4930G),
8621 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8622 ALC888_ACER_ASPIRE_4930G),
8623 /* default Acer -- disabled as it causes more problems.
8624 * model=auto should work fine now
8626 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8627 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8628 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8629 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8630 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8631 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8632 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8633 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8634 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8635 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8636 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8637 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8638 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8639 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8640 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8641 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8642 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8643 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8644 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8645 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8646 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8647 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8648 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8649 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8650 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8651 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8652 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8653 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8654 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8655 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8656 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8657 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8658 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8659 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8660 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8661 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8662 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8663 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8664 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8665 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8666 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8667 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8668 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8669 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8670 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8671 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8672 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8673 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8674 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8675 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8676 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8677 ALC883_FUJITSU_PI2515),
8678 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8679 ALC888_FUJITSU_XA3530),
8680 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8681 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8682 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8683 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8684 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8685 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8686 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8687 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8688 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8689 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8690 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8691 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8692 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8693 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8697 static hda_nid_t alc883_slave_dig_outs[] = {
8698 ALC1200_DIGOUT_NID, 0,
8701 static hda_nid_t alc1200_slave_dig_outs[] = {
8702 ALC883_DIGOUT_NID, 0,
8705 static struct alc_config_preset alc883_presets[] = {
8706 [ALC883_3ST_2ch_DIG] = {
8707 .mixers = { alc883_3ST_2ch_mixer },
8708 .init_verbs = { alc883_init_verbs },
8709 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8710 .dac_nids = alc883_dac_nids,
8711 .dig_out_nid = ALC883_DIGOUT_NID,
8712 .dig_in_nid = ALC883_DIGIN_NID,
8713 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8714 .channel_mode = alc883_3ST_2ch_modes,
8715 .input_mux = &alc883_capture_source,
8717 [ALC883_3ST_6ch_DIG] = {
8718 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8719 .init_verbs = { alc883_init_verbs },
8720 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8721 .dac_nids = alc883_dac_nids,
8722 .dig_out_nid = ALC883_DIGOUT_NID,
8723 .dig_in_nid = ALC883_DIGIN_NID,
8724 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8725 .channel_mode = alc883_3ST_6ch_modes,
8727 .input_mux = &alc883_capture_source,
8729 [ALC883_3ST_6ch] = {
8730 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8731 .init_verbs = { alc883_init_verbs },
8732 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8733 .dac_nids = alc883_dac_nids,
8734 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8735 .channel_mode = alc883_3ST_6ch_modes,
8737 .input_mux = &alc883_capture_source,
8739 [ALC883_3ST_6ch_INTEL] = {
8740 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8741 .init_verbs = { alc883_init_verbs },
8742 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8743 .dac_nids = alc883_dac_nids,
8744 .dig_out_nid = ALC883_DIGOUT_NID,
8745 .dig_in_nid = ALC883_DIGIN_NID,
8746 .slave_dig_outs = alc883_slave_dig_outs,
8747 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8748 .channel_mode = alc883_3ST_6ch_intel_modes,
8750 .input_mux = &alc883_3stack_6ch_intel,
8752 [ALC883_6ST_DIG] = {
8753 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8754 .init_verbs = { alc883_init_verbs },
8755 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8756 .dac_nids = alc883_dac_nids,
8757 .dig_out_nid = ALC883_DIGOUT_NID,
8758 .dig_in_nid = ALC883_DIGIN_NID,
8759 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8760 .channel_mode = alc883_sixstack_modes,
8761 .input_mux = &alc883_capture_source,
8763 [ALC883_TARGA_DIG] = {
8764 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8765 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8766 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8767 .dac_nids = alc883_dac_nids,
8768 .dig_out_nid = ALC883_DIGOUT_NID,
8769 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8770 .channel_mode = alc883_3ST_6ch_modes,
8772 .input_mux = &alc883_capture_source,
8773 .unsol_event = alc883_tagra_unsol_event,
8774 .init_hook = alc883_tagra_init_hook,
8776 [ALC883_TARGA_2ch_DIG] = {
8777 .mixers = { alc883_tagra_2ch_mixer},
8778 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8779 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8780 .dac_nids = alc883_dac_nids,
8781 .adc_nids = alc883_adc_nids_alt,
8782 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8783 .dig_out_nid = ALC883_DIGOUT_NID,
8784 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8785 .channel_mode = alc883_3ST_2ch_modes,
8786 .input_mux = &alc883_capture_source,
8787 .unsol_event = alc883_tagra_unsol_event,
8788 .init_hook = alc883_tagra_init_hook,
8791 .mixers = { alc883_base_mixer },
8792 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8793 * and the headphone jack. Turn this on and rely on the
8794 * standard mute methods whenever the user wants to turn
8795 * these outputs off.
8797 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8798 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8799 .dac_nids = alc883_dac_nids,
8800 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8801 .channel_mode = alc883_3ST_2ch_modes,
8802 .input_mux = &alc883_capture_source,
8804 [ALC883_ACER_ASPIRE] = {
8805 .mixers = { alc883_acer_aspire_mixer },
8806 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8807 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8808 .dac_nids = alc883_dac_nids,
8809 .dig_out_nid = ALC883_DIGOUT_NID,
8810 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8811 .channel_mode = alc883_3ST_2ch_modes,
8812 .input_mux = &alc883_capture_source,
8813 .unsol_event = alc_automute_amp_unsol_event,
8814 .init_hook = alc883_acer_aspire_init_hook,
8816 [ALC888_ACER_ASPIRE_4930G] = {
8817 .mixers = { alc888_base_mixer,
8818 alc883_chmode_mixer },
8819 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8820 alc888_acer_aspire_4930g_verbs },
8821 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8822 .dac_nids = alc883_dac_nids,
8823 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8824 .adc_nids = alc883_adc_nids_rev,
8825 .capsrc_nids = alc883_capsrc_nids_rev,
8826 .dig_out_nid = ALC883_DIGOUT_NID,
8827 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8828 .channel_mode = alc883_3ST_6ch_modes,
8831 ARRAY_SIZE(alc888_2_capture_sources),
8832 .input_mux = alc888_2_capture_sources,
8833 .unsol_event = alc_automute_amp_unsol_event,
8834 .init_hook = alc888_acer_aspire_4930g_init_hook,
8837 .mixers = { alc883_fivestack_mixer,
8838 alc883_chmode_mixer },
8839 .init_verbs = { alc883_init_verbs,
8840 alc883_medion_eapd_verbs },
8841 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8842 .dac_nids = alc883_dac_nids,
8843 .adc_nids = alc883_adc_nids_alt,
8844 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8845 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8846 .channel_mode = alc883_sixstack_modes,
8847 .input_mux = &alc883_capture_source,
8849 [ALC883_MEDION_MD2] = {
8850 .mixers = { alc883_medion_md2_mixer},
8851 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8852 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8853 .dac_nids = alc883_dac_nids,
8854 .dig_out_nid = ALC883_DIGOUT_NID,
8855 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8856 .channel_mode = alc883_3ST_2ch_modes,
8857 .input_mux = &alc883_capture_source,
8858 .unsol_event = alc_automute_amp_unsol_event,
8859 .init_hook = alc883_medion_md2_init_hook,
8861 [ALC883_LAPTOP_EAPD] = {
8862 .mixers = { alc883_base_mixer },
8863 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8864 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8865 .dac_nids = alc883_dac_nids,
8866 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8867 .channel_mode = alc883_3ST_2ch_modes,
8868 .input_mux = &alc883_capture_source,
8870 [ALC883_CLEVO_M720] = {
8871 .mixers = { alc883_clevo_m720_mixer },
8872 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8873 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8874 .dac_nids = alc883_dac_nids,
8875 .dig_out_nid = ALC883_DIGOUT_NID,
8876 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8877 .channel_mode = alc883_3ST_2ch_modes,
8878 .input_mux = &alc883_capture_source,
8879 .unsol_event = alc883_clevo_m720_unsol_event,
8880 .init_hook = alc883_clevo_m720_init_hook,
8882 [ALC883_LENOVO_101E_2ch] = {
8883 .mixers = { alc883_lenovo_101e_2ch_mixer},
8884 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8885 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8886 .dac_nids = alc883_dac_nids,
8887 .adc_nids = alc883_adc_nids_alt,
8888 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8889 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8890 .channel_mode = alc883_3ST_2ch_modes,
8891 .input_mux = &alc883_lenovo_101e_capture_source,
8892 .unsol_event = alc883_lenovo_101e_unsol_event,
8893 .init_hook = alc883_lenovo_101e_all_automute,
8895 [ALC883_LENOVO_NB0763] = {
8896 .mixers = { alc883_lenovo_nb0763_mixer },
8897 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8898 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8899 .dac_nids = alc883_dac_nids,
8900 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8901 .channel_mode = alc883_3ST_2ch_modes,
8903 .input_mux = &alc883_lenovo_nb0763_capture_source,
8904 .unsol_event = alc_automute_amp_unsol_event,
8905 .init_hook = alc883_medion_md2_init_hook,
8907 [ALC888_LENOVO_MS7195_DIG] = {
8908 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8909 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8910 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8911 .dac_nids = alc883_dac_nids,
8912 .dig_out_nid = ALC883_DIGOUT_NID,
8913 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8914 .channel_mode = alc883_3ST_6ch_modes,
8916 .input_mux = &alc883_capture_source,
8917 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8918 .init_hook = alc888_lenovo_ms7195_front_automute,
8920 [ALC883_HAIER_W66] = {
8921 .mixers = { alc883_tagra_2ch_mixer},
8922 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8923 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8924 .dac_nids = alc883_dac_nids,
8925 .dig_out_nid = ALC883_DIGOUT_NID,
8926 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8927 .channel_mode = alc883_3ST_2ch_modes,
8928 .input_mux = &alc883_capture_source,
8929 .unsol_event = alc_automute_amp_unsol_event,
8930 .init_hook = alc883_haier_w66_init_hook,
8933 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8934 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8935 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8936 .dac_nids = alc883_dac_nids,
8937 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8938 .channel_mode = alc888_3st_hp_modes,
8940 .input_mux = &alc883_capture_source,
8941 .unsol_event = alc_automute_amp_unsol_event,
8942 .init_hook = alc888_3st_hp_init_hook,
8944 [ALC888_6ST_DELL] = {
8945 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8946 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8947 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8948 .dac_nids = alc883_dac_nids,
8949 .dig_out_nid = ALC883_DIGOUT_NID,
8950 .dig_in_nid = ALC883_DIGIN_NID,
8951 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8952 .channel_mode = alc883_sixstack_modes,
8953 .input_mux = &alc883_capture_source,
8954 .unsol_event = alc_automute_amp_unsol_event,
8955 .init_hook = alc888_6st_dell_init_hook,
8958 .mixers = { alc883_mitac_mixer },
8959 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8960 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8961 .dac_nids = alc883_dac_nids,
8962 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8963 .channel_mode = alc883_3ST_2ch_modes,
8964 .input_mux = &alc883_capture_source,
8965 .unsol_event = alc_automute_amp_unsol_event,
8966 .init_hook = alc883_mitac_init_hook,
8968 [ALC883_FUJITSU_PI2515] = {
8969 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8970 .init_verbs = { alc883_init_verbs,
8971 alc883_2ch_fujitsu_pi2515_verbs},
8972 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8973 .dac_nids = alc883_dac_nids,
8974 .dig_out_nid = ALC883_DIGOUT_NID,
8975 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8976 .channel_mode = alc883_3ST_2ch_modes,
8977 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8978 .unsol_event = alc_automute_amp_unsol_event,
8979 .init_hook = alc883_2ch_fujitsu_pi2515_init_hook,
8981 [ALC888_FUJITSU_XA3530] = {
8982 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8983 .init_verbs = { alc883_init_verbs,
8984 alc888_fujitsu_xa3530_verbs },
8985 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8986 .dac_nids = alc883_dac_nids,
8987 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8988 .adc_nids = alc883_adc_nids_rev,
8989 .capsrc_nids = alc883_capsrc_nids_rev,
8990 .dig_out_nid = ALC883_DIGOUT_NID,
8991 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8992 .channel_mode = alc888_4ST_8ch_intel_modes,
8994 ARRAY_SIZE(alc888_2_capture_sources),
8995 .input_mux = alc888_2_capture_sources,
8996 .unsol_event = alc_automute_amp_unsol_event,
8997 .init_hook = alc888_fujitsu_xa3530_init_hook,
8999 [ALC888_LENOVO_SKY] = {
9000 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9001 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9002 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9003 .dac_nids = alc883_dac_nids,
9004 .dig_out_nid = ALC883_DIGOUT_NID,
9005 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9006 .channel_mode = alc883_sixstack_modes,
9008 .input_mux = &alc883_lenovo_sky_capture_source,
9009 .unsol_event = alc_automute_amp_unsol_event,
9010 .init_hook = alc888_lenovo_sky_init_hook,
9012 [ALC888_ASUS_M90V] = {
9013 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9014 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9015 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9016 .dac_nids = alc883_dac_nids,
9017 .dig_out_nid = ALC883_DIGOUT_NID,
9018 .dig_in_nid = ALC883_DIGIN_NID,
9019 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9020 .channel_mode = alc883_3ST_6ch_modes,
9022 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9023 .unsol_event = alc883_mode2_unsol_event,
9024 .init_hook = alc883_mode2_inithook,
9026 [ALC888_ASUS_EEE1601] = {
9027 .mixers = { alc883_asus_eee1601_mixer },
9028 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9029 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9030 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9031 .dac_nids = alc883_dac_nids,
9032 .dig_out_nid = ALC883_DIGOUT_NID,
9033 .dig_in_nid = ALC883_DIGIN_NID,
9034 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9035 .channel_mode = alc883_3ST_2ch_modes,
9037 .input_mux = &alc883_asus_eee1601_capture_source,
9038 .unsol_event = alc_sku_unsol_event,
9039 .init_hook = alc883_eee1601_inithook,
9041 [ALC1200_ASUS_P5Q] = {
9042 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9043 .init_verbs = { alc883_init_verbs },
9044 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9045 .dac_nids = alc883_dac_nids,
9046 .dig_out_nid = ALC1200_DIGOUT_NID,
9047 .dig_in_nid = ALC883_DIGIN_NID,
9048 .slave_dig_outs = alc1200_slave_dig_outs,
9049 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9050 .channel_mode = alc883_sixstack_modes,
9051 .input_mux = &alc883_capture_source,
9057 * BIOS auto configuration
9059 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
9060 hda_nid_t nid, int pin_type,
9064 struct alc_spec *spec = codec->spec;
9067 alc_set_pin_output(codec, nid, pin_type);
9068 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9071 idx = spec->multiout.dac_nids[dac_idx] - 2;
9072 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9076 static void alc883_auto_init_multi_out(struct hda_codec *codec)
9078 struct alc_spec *spec = codec->spec;
9081 for (i = 0; i <= HDA_SIDE; i++) {
9082 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9083 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9085 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
9090 static void alc883_auto_init_hp_out(struct hda_codec *codec)
9092 struct alc_spec *spec = codec->spec;
9095 pin = spec->autocfg.hp_pins[0];
9096 if (pin) /* connect to front */
9098 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9099 pin = spec->autocfg.speaker_pins[0];
9101 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9104 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9105 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9107 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9109 struct alc_spec *spec = codec->spec;
9112 for (i = 0; i < AUTO_PIN_LAST; i++) {
9113 hda_nid_t nid = spec->autocfg.input_pins[i];
9114 if (alc883_is_input_pin(nid)) {
9115 alc_set_input_pin(codec, nid, i);
9116 if (nid != ALC883_PIN_CD_NID &&
9117 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
9118 snd_hda_codec_write(codec, nid, 0,
9119 AC_VERB_SET_AMP_GAIN_MUTE,
9125 #define alc883_auto_init_input_src alc882_auto_init_input_src
9127 /* almost identical with ALC880 parser... */
9128 static int alc883_parse_auto_config(struct hda_codec *codec)
9130 struct alc_spec *spec = codec->spec;
9131 int err = alc880_parse_auto_config(codec);
9132 struct auto_pin_cfg *cfg = &spec->autocfg;
9138 return 0; /* no config found */
9140 err = alc_auto_add_mic_boost(codec);
9144 /* hack - override the init verbs */
9145 spec->init_verbs[0] = alc883_auto_init_verbs;
9147 /* setup input_mux for ALC889 */
9148 if (codec->vendor_id == 0x10ec0889) {
9149 /* digital-mic input pin is excluded in alc880_auto_create..()
9150 * because it's under 0x18
9152 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9153 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9154 struct hda_input_mux *imux = &spec->private_imux[0];
9155 for (i = 1; i < 3; i++)
9156 memcpy(&spec->private_imux[i],
9157 &spec->private_imux[0],
9158 sizeof(spec->private_imux[0]));
9159 imux->items[imux->num_items].label = "Int DMic";
9160 imux->items[imux->num_items].index = 0x0b;
9162 spec->num_mux_defs = 3;
9163 spec->input_mux = spec->private_imux;
9167 return 1; /* config found */
9170 /* additional initialization for auto-configuration model */
9171 static void alc883_auto_init(struct hda_codec *codec)
9173 struct alc_spec *spec = codec->spec;
9174 alc883_auto_init_multi_out(codec);
9175 alc883_auto_init_hp_out(codec);
9176 alc883_auto_init_analog_input(codec);
9177 alc883_auto_init_input_src(codec);
9178 if (spec->unsol_event)
9179 alc_inithook(codec);
9182 static int patch_alc883(struct hda_codec *codec)
9184 struct alc_spec *spec;
9185 int err, board_config;
9187 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9193 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9195 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9198 if (board_config < 0) {
9199 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9200 "trying auto-probe from BIOS...\n");
9201 board_config = ALC883_AUTO;
9204 if (board_config == ALC883_AUTO) {
9205 /* automatic parse from the BIOS config */
9206 err = alc883_parse_auto_config(codec);
9212 "hda_codec: Cannot set up configuration "
9213 "from BIOS. Using base mode...\n");
9214 board_config = ALC883_3ST_2ch_DIG;
9218 err = snd_hda_attach_beep_device(codec, 0x1);
9224 if (board_config != ALC883_AUTO)
9225 setup_preset(spec, &alc883_presets[board_config]);
9227 switch (codec->vendor_id) {
9229 if (!spec->num_adc_nids) {
9230 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9231 spec->adc_nids = alc883_adc_nids;
9233 if (!spec->capsrc_nids)
9234 spec->capsrc_nids = alc883_capsrc_nids;
9235 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9236 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9239 if (!spec->num_adc_nids) {
9240 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9241 spec->adc_nids = alc889_adc_nids;
9243 if (!spec->capsrc_nids)
9244 spec->capsrc_nids = alc889_capsrc_nids;
9245 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9249 if (!spec->num_adc_nids) {
9250 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9251 spec->adc_nids = alc883_adc_nids;
9253 if (!spec->capsrc_nids)
9254 spec->capsrc_nids = alc883_capsrc_nids;
9255 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9259 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9260 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9261 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9263 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9264 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9266 if (!spec->cap_mixer)
9267 set_capture_mixer(spec);
9268 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9270 spec->vmaster_nid = 0x0c;
9272 codec->patch_ops = alc_patch_ops;
9273 if (board_config == ALC883_AUTO)
9274 spec->init_hook = alc883_auto_init;
9276 #ifdef CONFIG_SND_HDA_POWER_SAVE
9277 if (!spec->loopback.amplist)
9278 spec->loopback.amplist = alc883_loopbacks;
9280 codec->proc_widget_hook = print_realtek_coef;
9289 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9290 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9292 #define alc262_dac_nids alc260_dac_nids
9293 #define alc262_adc_nids alc882_adc_nids
9294 #define alc262_adc_nids_alt alc882_adc_nids_alt
9295 #define alc262_capsrc_nids alc882_capsrc_nids
9296 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9298 #define alc262_modes alc260_modes
9299 #define alc262_capture_source alc882_capture_source
9301 static hda_nid_t alc262_dmic_adc_nids[1] = {
9306 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9308 static struct snd_kcontrol_new alc262_base_mixer[] = {
9309 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9310 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9311 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9312 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9313 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9314 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9315 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9316 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9317 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9318 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9319 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9320 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9321 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9322 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9323 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9324 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9328 /* update HP, line and mono-out pins according to the master switch */
9329 static void alc262_hp_master_update(struct hda_codec *codec)
9331 struct alc_spec *spec = codec->spec;
9332 int val = spec->master_sw;
9335 snd_hda_codec_write_cache(codec, 0x1b, 0,
9336 AC_VERB_SET_PIN_WIDGET_CONTROL,
9338 snd_hda_codec_write_cache(codec, 0x15, 0,
9339 AC_VERB_SET_PIN_WIDGET_CONTROL,
9341 /* mono (speaker) depending on the HP jack sense */
9342 val = val && !spec->jack_present;
9343 snd_hda_codec_write_cache(codec, 0x16, 0,
9344 AC_VERB_SET_PIN_WIDGET_CONTROL,
9348 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9350 struct alc_spec *spec = codec->spec;
9351 unsigned int presence;
9352 presence = snd_hda_codec_read(codec, 0x1b, 0,
9353 AC_VERB_GET_PIN_SENSE, 0);
9354 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9355 alc262_hp_master_update(codec);
9358 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9360 if ((res >> 26) != ALC880_HP_EVENT)
9362 alc262_hp_bpc_automute(codec);
9365 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9367 struct alc_spec *spec = codec->spec;
9368 unsigned int presence;
9369 presence = snd_hda_codec_read(codec, 0x15, 0,
9370 AC_VERB_GET_PIN_SENSE, 0);
9371 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9372 alc262_hp_master_update(codec);
9375 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9378 if ((res >> 26) != ALC880_HP_EVENT)
9380 alc262_hp_wildwest_automute(codec);
9383 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9385 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9386 struct snd_ctl_elem_value *ucontrol)
9388 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9389 struct alc_spec *spec = codec->spec;
9390 int val = !!*ucontrol->value.integer.value;
9392 if (val == spec->master_sw)
9394 spec->master_sw = val;
9395 alc262_hp_master_update(codec);
9399 #define ALC262_HP_MASTER_SWITCH \
9401 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9402 .name = "Master Playback Switch", \
9403 .info = snd_ctl_boolean_mono_info, \
9404 .get = alc262_hp_master_sw_get, \
9405 .put = alc262_hp_master_sw_put, \
9408 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9409 ALC262_HP_MASTER_SWITCH,
9410 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9411 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9412 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9413 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9415 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9417 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9418 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9419 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9420 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9421 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9422 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9423 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9424 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9425 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9426 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9427 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9428 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9432 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9433 ALC262_HP_MASTER_SWITCH,
9434 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9435 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9436 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9437 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9438 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9440 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9442 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9443 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9444 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9445 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9446 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9447 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9448 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9452 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9453 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9454 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9455 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9459 /* mute/unmute internal speaker according to the hp jack and mute state */
9460 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9462 struct alc_spec *spec = codec->spec;
9464 spec->autocfg.hp_pins[0] = 0x15;
9465 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9466 alc_automute_amp(codec);
9469 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9470 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9471 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9472 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9473 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9474 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9475 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9476 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9480 static struct hda_verb alc262_hp_t5735_verbs[] = {
9481 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9482 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9484 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9488 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9489 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9490 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9491 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9492 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9493 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9494 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9498 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9499 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9500 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9501 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9502 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9503 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9504 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9505 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9506 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9507 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9508 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9512 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9519 /* bind hp and internal speaker mute (with plug check) as master switch */
9520 static void alc262_hippo_master_update(struct hda_codec *codec)
9522 struct alc_spec *spec = codec->spec;
9523 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9524 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9525 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9529 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
9530 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
9531 HDA_AMP_MUTE, mute);
9532 /* mute internal speaker per jack sense */
9533 if (spec->jack_present)
9534 mute = HDA_AMP_MUTE;
9536 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
9537 HDA_AMP_MUTE, mute);
9538 if (speaker_nid && speaker_nid != line_nid)
9539 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
9540 HDA_AMP_MUTE, mute);
9543 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
9545 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
9546 struct snd_ctl_elem_value *ucontrol)
9548 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9549 struct alc_spec *spec = codec->spec;
9550 int val = !!*ucontrol->value.integer.value;
9552 if (val == spec->master_sw)
9554 spec->master_sw = val;
9555 alc262_hippo_master_update(codec);
9559 #define ALC262_HIPPO_MASTER_SWITCH \
9561 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9562 .name = "Master Playback Switch", \
9563 .info = snd_ctl_boolean_mono_info, \
9564 .get = alc262_hippo_master_sw_get, \
9565 .put = alc262_hippo_master_sw_put, \
9568 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
9569 ALC262_HIPPO_MASTER_SWITCH,
9570 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9571 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9572 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9573 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9574 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9576 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9577 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9578 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9579 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9580 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9581 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9585 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9586 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9587 ALC262_HIPPO_MASTER_SWITCH,
9588 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9589 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9590 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9591 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9592 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9593 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9594 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9595 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9596 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9597 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9601 /* mute/unmute internal speaker according to the hp jack and mute state */
9602 static void alc262_hippo_automute(struct hda_codec *codec)
9604 struct alc_spec *spec = codec->spec;
9605 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9606 unsigned int present;
9608 /* need to execute and sync at first */
9609 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
9610 present = snd_hda_codec_read(codec, hp_nid, 0,
9611 AC_VERB_GET_PIN_SENSE, 0);
9612 spec->jack_present = (present & 0x80000000) != 0;
9613 alc262_hippo_master_update(codec);
9616 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
9618 if ((res >> 26) != ALC880_HP_EVENT)
9620 alc262_hippo_automute(codec);
9623 static void alc262_hippo_init_hook(struct hda_codec *codec)
9625 struct alc_spec *spec = codec->spec;
9627 spec->autocfg.hp_pins[0] = 0x15;
9628 spec->autocfg.speaker_pins[0] = 0x14;
9629 alc262_hippo_automute(codec);
9632 static void alc262_hippo1_init_hook(struct hda_codec *codec)
9634 struct alc_spec *spec = codec->spec;
9636 spec->autocfg.hp_pins[0] = 0x1b;
9637 spec->autocfg.speaker_pins[0] = 0x14;
9638 alc262_hippo_automute(codec);
9642 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9643 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9644 ALC262_HIPPO_MASTER_SWITCH,
9645 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9646 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9647 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9648 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9652 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9653 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9654 ALC262_HIPPO_MASTER_SWITCH,
9655 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9656 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9657 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9658 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9659 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9663 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9664 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9665 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9666 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9667 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9668 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9669 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9670 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9671 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9672 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9673 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9674 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9675 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9679 static struct hda_verb alc262_tyan_verbs[] = {
9680 /* Headphone automute */
9681 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9682 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9683 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9685 /* P11 AUX_IN, white 4-pin connector */
9686 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9687 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9688 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9689 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9694 /* unsolicited event for HP jack sensing */
9695 static void alc262_tyan_init_hook(struct hda_codec *codec)
9697 struct alc_spec *spec = codec->spec;
9699 spec->autocfg.hp_pins[0] = 0x1b;
9700 spec->autocfg.speaker_pins[0] = 0x15;
9701 alc_automute_amp(codec);
9705 #define alc262_capture_mixer alc882_capture_mixer
9706 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9709 * generic initialization of ADC, input mixers and output mixers
9711 static struct hda_verb alc262_init_verbs[] = {
9713 * Unmute ADC0-2 and set the default input to mic-in
9715 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9716 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9717 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9718 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9719 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9720 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9722 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9724 * Note: PASD motherboards uses the Line In 2 as the input for
9725 * front panel mic (mic 2)
9727 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9728 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9735 * Set up output mixers (0x0c - 0x0e)
9737 /* set vol=0 to output mixers */
9738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9739 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9740 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9741 /* set up input amps for analog loopback */
9742 /* Amp Indices: DAC = 0, mixer = 1 */
9743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9745 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9746 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9747 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9748 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9750 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9751 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9752 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9753 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9754 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9755 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9757 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9758 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9759 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9760 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9761 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9763 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9764 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9766 /* FIXME: use matrix-type input source selection */
9767 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9768 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9769 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9770 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9771 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9772 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9774 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9775 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9776 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9777 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9779 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9780 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9781 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9782 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9787 static struct hda_verb alc262_eapd_verbs[] = {
9788 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9789 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9793 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9794 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9795 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9799 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9800 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9801 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9802 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9804 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9805 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9809 static struct hda_verb alc262_sony_unsol_verbs[] = {
9810 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9811 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9812 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9814 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9815 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9819 static struct hda_input_mux alc262_dmic_capture_source = {
9822 { "Int DMic", 0x9 },
9827 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9828 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9829 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9830 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9832 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9836 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9837 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9838 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9839 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9840 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9841 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9842 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9843 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9844 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9848 static void alc262_dmic_automute(struct hda_codec *codec)
9850 unsigned int present;
9852 present = snd_hda_codec_read(codec, 0x18, 0,
9853 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9854 snd_hda_codec_write(codec, 0x22, 0,
9855 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9859 /* unsolicited event for HP jack sensing */
9860 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9863 if ((res >> 26) == ALC880_MIC_EVENT)
9864 alc262_dmic_automute(codec);
9866 alc_sku_unsol_event(codec, res);
9869 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9871 struct alc_spec *spec = codec->spec;
9873 spec->autocfg.hp_pins[0] = 0x15;
9874 spec->autocfg.speaker_pins[0] = 0x14;
9875 alc_automute_pin(codec);
9876 alc262_dmic_automute(codec);
9882 * 0x16 = internal speaker
9883 * 0x18 = external mic
9886 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9887 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9888 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9890 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9891 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9892 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9894 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9895 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9899 static struct hda_verb alc262_nec_verbs[] = {
9900 /* Unmute Speaker */
9901 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9904 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9905 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9907 /* External mic to headphone */
9908 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9909 /* External mic to speaker */
9910 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9916 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9917 * 0x1b = port replicator headphone out
9920 #define ALC_HP_EVENT 0x37
9922 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9923 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9924 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9925 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9926 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9930 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9931 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9932 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9936 static struct hda_input_mux alc262_fujitsu_capture_source = {
9945 static struct hda_input_mux alc262_HP_capture_source = {
9949 { "Front Mic", 0x1 },
9956 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9960 { "Front Mic", 0x2 },
9966 /* mute/unmute internal speaker according to the hp jacks and mute state */
9967 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9969 struct alc_spec *spec = codec->spec;
9972 if (force || !spec->sense_updated) {
9973 unsigned int present;
9974 /* need to execute and sync at first */
9975 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9976 /* check laptop HP jack */
9977 present = snd_hda_codec_read(codec, 0x14, 0,
9978 AC_VERB_GET_PIN_SENSE, 0);
9979 /* need to execute and sync at first */
9980 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9981 /* check docking HP jack */
9982 present |= snd_hda_codec_read(codec, 0x1b, 0,
9983 AC_VERB_GET_PIN_SENSE, 0);
9984 if (present & AC_PINSENSE_PRESENCE)
9985 spec->jack_present = 1;
9987 spec->jack_present = 0;
9988 spec->sense_updated = 1;
9990 /* unmute internal speaker only if both HPs are unplugged and
9991 * master switch is on
9993 if (spec->jack_present)
9994 mute = HDA_AMP_MUTE;
9996 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9997 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9998 HDA_AMP_MUTE, mute);
10001 /* unsolicited event for HP jack sensing */
10002 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10005 if ((res >> 26) != ALC_HP_EVENT)
10007 alc262_fujitsu_automute(codec, 1);
10010 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10012 alc262_fujitsu_automute(codec, 1);
10015 /* bind volumes of both NID 0x0c and 0x0d */
10016 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10017 .ops = &snd_hda_bind_vol,
10019 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10020 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10025 /* mute/unmute internal speaker according to the hp jack and mute state */
10026 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10028 struct alc_spec *spec = codec->spec;
10031 if (force || !spec->sense_updated) {
10032 unsigned int present_int_hp;
10033 /* need to execute and sync at first */
10034 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10035 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10036 AC_VERB_GET_PIN_SENSE, 0);
10037 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10038 spec->sense_updated = 1;
10040 if (spec->jack_present) {
10041 /* mute internal speaker */
10042 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10043 HDA_AMP_MUTE, HDA_AMP_MUTE);
10044 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10045 HDA_AMP_MUTE, HDA_AMP_MUTE);
10047 /* unmute internal speaker if necessary */
10048 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10049 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10050 HDA_AMP_MUTE, mute);
10051 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10052 HDA_AMP_MUTE, mute);
10056 /* unsolicited event for HP jack sensing */
10057 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10060 if ((res >> 26) != ALC_HP_EVENT)
10062 alc262_lenovo_3000_automute(codec, 1);
10065 /* bind hp and internal speaker mute (with plug check) */
10066 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10067 struct snd_ctl_elem_value *ucontrol)
10069 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10070 long *valp = ucontrol->value.integer.value;
10073 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10075 valp ? 0 : HDA_AMP_MUTE);
10076 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10078 valp ? 0 : HDA_AMP_MUTE);
10081 alc262_fujitsu_automute(codec, 0);
10085 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10086 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10088 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10089 .name = "Master Playback Switch",
10090 .info = snd_hda_mixer_amp_switch_info,
10091 .get = snd_hda_mixer_amp_switch_get,
10092 .put = alc262_fujitsu_master_sw_put,
10093 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10095 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10096 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10097 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10098 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10099 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10100 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10101 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10102 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10106 /* bind hp and internal speaker mute (with plug check) */
10107 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10108 struct snd_ctl_elem_value *ucontrol)
10110 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10111 long *valp = ucontrol->value.integer.value;
10114 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10116 valp ? 0 : HDA_AMP_MUTE);
10119 alc262_lenovo_3000_automute(codec, 0);
10123 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10124 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10126 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10127 .name = "Master Playback Switch",
10128 .info = snd_hda_mixer_amp_switch_info,
10129 .get = snd_hda_mixer_amp_switch_get,
10130 .put = alc262_lenovo_3000_master_sw_put,
10131 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10133 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10134 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10135 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10136 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10137 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10138 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10139 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10140 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10144 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10145 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10146 ALC262_HIPPO_MASTER_SWITCH,
10147 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10148 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10149 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10150 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10151 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10152 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10156 /* additional init verbs for Benq laptops */
10157 static struct hda_verb alc262_EAPD_verbs[] = {
10158 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10159 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10163 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10164 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10165 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10167 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10168 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10172 /* Samsung Q1 Ultra Vista model setup */
10173 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10174 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10175 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10176 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10177 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10178 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10179 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10183 static struct hda_verb alc262_ultra_verbs[] = {
10185 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10186 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10187 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10189 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10190 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10191 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10192 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10194 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10195 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10196 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10197 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10198 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10200 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10201 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10202 /* ADC, choose mic */
10203 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10204 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10205 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10206 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10207 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10208 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10209 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10210 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10211 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10212 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10216 /* mute/unmute internal speaker according to the hp jack and mute state */
10217 static void alc262_ultra_automute(struct hda_codec *codec)
10219 struct alc_spec *spec = codec->spec;
10223 /* auto-mute only when HP is used as HP */
10224 if (!spec->cur_mux[0]) {
10225 unsigned int present;
10226 /* need to execute and sync at first */
10227 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10228 present = snd_hda_codec_read(codec, 0x15, 0,
10229 AC_VERB_GET_PIN_SENSE, 0);
10230 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10231 if (spec->jack_present)
10232 mute = HDA_AMP_MUTE;
10234 /* mute/unmute internal speaker */
10235 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10236 HDA_AMP_MUTE, mute);
10237 /* mute/unmute HP */
10238 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10239 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10242 /* unsolicited event for HP jack sensing */
10243 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10246 if ((res >> 26) != ALC880_HP_EVENT)
10248 alc262_ultra_automute(codec);
10251 static struct hda_input_mux alc262_ultra_capture_source = {
10255 { "Headphone", 0x7 },
10259 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10260 struct snd_ctl_elem_value *ucontrol)
10262 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10263 struct alc_spec *spec = codec->spec;
10266 ret = alc_mux_enum_put(kcontrol, ucontrol);
10269 /* reprogram the HP pin as mic or HP according to the input source */
10270 snd_hda_codec_write_cache(codec, 0x15, 0,
10271 AC_VERB_SET_PIN_WIDGET_CONTROL,
10272 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10273 alc262_ultra_automute(codec); /* mute/unmute HP */
10277 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10278 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10279 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10281 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10282 .name = "Capture Source",
10283 .info = alc_mux_enum_info,
10284 .get = alc_mux_enum_get,
10285 .put = alc262_ultra_mux_enum_put,
10290 /* add playback controls from the parsed DAC table */
10291 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10292 const struct auto_pin_cfg *cfg)
10297 spec->multiout.num_dacs = 1; /* only use one dac */
10298 spec->multiout.dac_nids = spec->private_dac_nids;
10299 spec->multiout.dac_nids[0] = 2;
10301 nid = cfg->line_out_pins[0];
10303 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10304 "Front Playback Volume",
10305 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10308 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10309 "Front Playback Switch",
10310 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10315 nid = cfg->speaker_pins[0];
10318 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10319 "Speaker Playback Volume",
10320 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10324 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10325 "Speaker Playback Switch",
10326 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10331 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10332 "Speaker Playback Switch",
10333 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10339 nid = cfg->hp_pins[0];
10341 /* spec->multiout.hp_nid = 2; */
10343 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10344 "Headphone Playback Volume",
10345 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10349 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10350 "Headphone Playback Switch",
10351 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10356 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10357 "Headphone Playback Switch",
10358 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10367 /* identical with ALC880 */
10368 #define alc262_auto_create_analog_input_ctls \
10369 alc880_auto_create_analog_input_ctls
10372 * generic initialization of ADC, input mixers and output mixers
10374 static struct hda_verb alc262_volume_init_verbs[] = {
10376 * Unmute ADC0-2 and set the default input to mic-in
10378 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10379 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10380 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10381 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10382 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10383 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10385 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10387 * Note: PASD motherboards uses the Line In 2 as the input for
10388 * front panel mic (mic 2)
10390 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10391 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10392 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10393 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10394 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10395 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10398 * Set up output mixers (0x0c - 0x0f)
10400 /* set vol=0 to output mixers */
10401 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10402 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10403 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10405 /* set up input amps for analog loopback */
10406 /* Amp Indices: DAC = 0, mixer = 1 */
10407 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10408 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10409 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10410 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10411 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10412 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10414 /* FIXME: use matrix-type input source selection */
10415 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10416 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10417 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10418 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10420 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10422 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10423 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10424 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10425 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10427 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10428 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10429 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10430 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10435 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10437 * Unmute ADC0-2 and set the default input to mic-in
10439 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10440 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10441 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10442 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10443 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10444 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10446 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10448 * Note: PASD motherboards uses the Line In 2 as the input for
10449 * front panel mic (mic 2)
10451 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10452 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10453 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10454 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10455 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10456 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10457 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10461 * Set up output mixers (0x0c - 0x0e)
10463 /* set vol=0 to output mixers */
10464 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10465 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10466 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10468 /* set up input amps for analog loopback */
10469 /* Amp Indices: DAC = 0, mixer = 1 */
10470 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10471 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10472 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10473 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10474 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10475 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10477 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10478 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10479 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10481 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10482 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10484 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10485 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10487 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10488 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10489 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10490 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10491 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10493 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10494 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10495 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10496 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10497 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10498 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10501 /* FIXME: use matrix-type input source selection */
10502 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10503 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10504 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10505 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10506 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10507 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10509 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10510 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10511 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10512 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10515 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10516 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10517 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10519 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10524 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10526 * Unmute ADC0-2 and set the default input to mic-in
10528 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10529 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10530 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10531 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10532 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10533 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10535 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10537 * Note: PASD motherboards uses the Line In 2 as the input for front
10538 * panel mic (mic 2)
10540 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10541 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10542 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10543 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10544 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10550 * Set up output mixers (0x0c - 0x0e)
10552 /* set vol=0 to output mixers */
10553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10554 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10555 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10557 /* set up input amps for analog loopback */
10558 /* Amp Indices: DAC = 0, mixer = 1 */
10559 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10561 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10562 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10563 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10564 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10567 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10568 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10569 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10570 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10571 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10572 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10573 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10575 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10576 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10578 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10579 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10581 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10582 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10583 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10584 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10585 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10586 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10588 /* FIXME: use matrix-type input source selection */
10589 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10590 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10591 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10592 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10593 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10594 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10595 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10596 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10597 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10599 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10600 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10601 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10602 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10603 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10604 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10605 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10607 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10608 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10609 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10610 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10611 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10612 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10613 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10615 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10620 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10622 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10623 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10624 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10626 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10627 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10628 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10629 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10631 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10632 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10633 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10638 #ifdef CONFIG_SND_HDA_POWER_SAVE
10639 #define alc262_loopbacks alc880_loopbacks
10642 /* pcm configuration: identiacal with ALC880 */
10643 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10644 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10645 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10646 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10649 * BIOS auto configuration
10651 static int alc262_parse_auto_config(struct hda_codec *codec)
10653 struct alc_spec *spec = codec->spec;
10655 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10657 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10661 if (!spec->autocfg.line_outs) {
10662 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10663 spec->multiout.max_channels = 2;
10664 spec->no_analog = 1;
10667 return 0; /* can't find valid BIOS pin config */
10669 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10672 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10676 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10679 if (spec->autocfg.dig_outs) {
10680 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10681 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10683 if (spec->autocfg.dig_in_pin)
10684 spec->dig_in_nid = ALC262_DIGIN_NID;
10686 if (spec->kctls.list)
10687 add_mixer(spec, spec->kctls.list);
10689 add_verb(spec, alc262_volume_init_verbs);
10690 spec->num_mux_defs = 1;
10691 spec->input_mux = &spec->private_imux[0];
10693 err = alc_auto_add_mic_boost(codec);
10697 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
10702 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10703 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10704 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10705 #define alc262_auto_init_input_src alc882_auto_init_input_src
10708 /* init callback for auto-configuration model -- overriding the default init */
10709 static void alc262_auto_init(struct hda_codec *codec)
10711 struct alc_spec *spec = codec->spec;
10712 alc262_auto_init_multi_out(codec);
10713 alc262_auto_init_hp_out(codec);
10714 alc262_auto_init_analog_input(codec);
10715 alc262_auto_init_input_src(codec);
10716 if (spec->unsol_event)
10717 alc_inithook(codec);
10721 * configuration and preset
10723 static const char *alc262_models[ALC262_MODEL_LAST] = {
10724 [ALC262_BASIC] = "basic",
10725 [ALC262_HIPPO] = "hippo",
10726 [ALC262_HIPPO_1] = "hippo_1",
10727 [ALC262_FUJITSU] = "fujitsu",
10728 [ALC262_HP_BPC] = "hp-bpc",
10729 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10730 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10731 [ALC262_HP_RP5700] = "hp-rp5700",
10732 [ALC262_BENQ_ED8] = "benq",
10733 [ALC262_BENQ_T31] = "benq-t31",
10734 [ALC262_SONY_ASSAMD] = "sony-assamd",
10735 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10736 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10737 [ALC262_ULTRA] = "ultra",
10738 [ALC262_LENOVO_3000] = "lenovo-3000",
10739 [ALC262_NEC] = "nec",
10740 [ALC262_TYAN] = "tyan",
10741 [ALC262_AUTO] = "auto",
10744 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10745 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10746 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10747 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
10749 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
10751 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
10753 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10754 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10755 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10756 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10757 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10758 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10759 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10760 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10761 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10762 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10763 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10764 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10765 ALC262_HP_TC_T5735),
10766 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10767 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10768 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10769 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10770 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
10771 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
10772 ALC262_SONY_ASSAMD),
10773 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10774 ALC262_TOSHIBA_RX1),
10775 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10776 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10777 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10778 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10779 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
10781 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10782 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10783 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10784 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10785 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10789 static struct alc_config_preset alc262_presets[] = {
10791 .mixers = { alc262_base_mixer },
10792 .init_verbs = { alc262_init_verbs },
10793 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10794 .dac_nids = alc262_dac_nids,
10796 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10797 .channel_mode = alc262_modes,
10798 .input_mux = &alc262_capture_source,
10801 .mixers = { alc262_hippo_mixer },
10802 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10803 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10804 .dac_nids = alc262_dac_nids,
10806 .dig_out_nid = ALC262_DIGOUT_NID,
10807 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10808 .channel_mode = alc262_modes,
10809 .input_mux = &alc262_capture_source,
10810 .unsol_event = alc262_hippo_unsol_event,
10811 .init_hook = alc262_hippo_init_hook,
10813 [ALC262_HIPPO_1] = {
10814 .mixers = { alc262_hippo1_mixer },
10815 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10816 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10817 .dac_nids = alc262_dac_nids,
10819 .dig_out_nid = ALC262_DIGOUT_NID,
10820 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10821 .channel_mode = alc262_modes,
10822 .input_mux = &alc262_capture_source,
10823 .unsol_event = alc262_hippo_unsol_event,
10824 .init_hook = alc262_hippo1_init_hook,
10826 [ALC262_FUJITSU] = {
10827 .mixers = { alc262_fujitsu_mixer },
10828 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10829 alc262_fujitsu_unsol_verbs },
10830 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10831 .dac_nids = alc262_dac_nids,
10833 .dig_out_nid = ALC262_DIGOUT_NID,
10834 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10835 .channel_mode = alc262_modes,
10836 .input_mux = &alc262_fujitsu_capture_source,
10837 .unsol_event = alc262_fujitsu_unsol_event,
10838 .init_hook = alc262_fujitsu_init_hook,
10840 [ALC262_HP_BPC] = {
10841 .mixers = { alc262_HP_BPC_mixer },
10842 .init_verbs = { alc262_HP_BPC_init_verbs },
10843 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10844 .dac_nids = alc262_dac_nids,
10846 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10847 .channel_mode = alc262_modes,
10848 .input_mux = &alc262_HP_capture_source,
10849 .unsol_event = alc262_hp_bpc_unsol_event,
10850 .init_hook = alc262_hp_bpc_automute,
10852 [ALC262_HP_BPC_D7000_WF] = {
10853 .mixers = { alc262_HP_BPC_WildWest_mixer },
10854 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10855 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10856 .dac_nids = alc262_dac_nids,
10858 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10859 .channel_mode = alc262_modes,
10860 .input_mux = &alc262_HP_D7000_capture_source,
10861 .unsol_event = alc262_hp_wildwest_unsol_event,
10862 .init_hook = alc262_hp_wildwest_automute,
10864 [ALC262_HP_BPC_D7000_WL] = {
10865 .mixers = { alc262_HP_BPC_WildWest_mixer,
10866 alc262_HP_BPC_WildWest_option_mixer },
10867 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10868 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10869 .dac_nids = alc262_dac_nids,
10871 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10872 .channel_mode = alc262_modes,
10873 .input_mux = &alc262_HP_D7000_capture_source,
10874 .unsol_event = alc262_hp_wildwest_unsol_event,
10875 .init_hook = alc262_hp_wildwest_automute,
10877 [ALC262_HP_TC_T5735] = {
10878 .mixers = { alc262_hp_t5735_mixer },
10879 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10880 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10881 .dac_nids = alc262_dac_nids,
10883 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10884 .channel_mode = alc262_modes,
10885 .input_mux = &alc262_capture_source,
10886 .unsol_event = alc_automute_amp_unsol_event,
10887 .init_hook = alc262_hp_t5735_init_hook,
10889 [ALC262_HP_RP5700] = {
10890 .mixers = { alc262_hp_rp5700_mixer },
10891 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10892 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10893 .dac_nids = alc262_dac_nids,
10894 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10895 .channel_mode = alc262_modes,
10896 .input_mux = &alc262_hp_rp5700_capture_source,
10898 [ALC262_BENQ_ED8] = {
10899 .mixers = { alc262_base_mixer },
10900 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10901 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10902 .dac_nids = alc262_dac_nids,
10904 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10905 .channel_mode = alc262_modes,
10906 .input_mux = &alc262_capture_source,
10908 [ALC262_SONY_ASSAMD] = {
10909 .mixers = { alc262_sony_mixer },
10910 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10911 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10912 .dac_nids = alc262_dac_nids,
10914 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10915 .channel_mode = alc262_modes,
10916 .input_mux = &alc262_capture_source,
10917 .unsol_event = alc262_hippo_unsol_event,
10918 .init_hook = alc262_hippo_init_hook,
10920 [ALC262_BENQ_T31] = {
10921 .mixers = { alc262_benq_t31_mixer },
10922 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10923 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10924 .dac_nids = alc262_dac_nids,
10926 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10927 .channel_mode = alc262_modes,
10928 .input_mux = &alc262_capture_source,
10929 .unsol_event = alc262_hippo_unsol_event,
10930 .init_hook = alc262_hippo_init_hook,
10933 .mixers = { alc262_ultra_mixer },
10934 .cap_mixer = alc262_ultra_capture_mixer,
10935 .init_verbs = { alc262_ultra_verbs },
10936 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10937 .dac_nids = alc262_dac_nids,
10938 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10939 .channel_mode = alc262_modes,
10940 .input_mux = &alc262_ultra_capture_source,
10941 .adc_nids = alc262_adc_nids, /* ADC0 */
10942 .capsrc_nids = alc262_capsrc_nids,
10943 .num_adc_nids = 1, /* single ADC */
10944 .unsol_event = alc262_ultra_unsol_event,
10945 .init_hook = alc262_ultra_automute,
10947 [ALC262_LENOVO_3000] = {
10948 .mixers = { alc262_lenovo_3000_mixer },
10949 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10950 alc262_lenovo_3000_unsol_verbs },
10951 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10952 .dac_nids = alc262_dac_nids,
10954 .dig_out_nid = ALC262_DIGOUT_NID,
10955 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10956 .channel_mode = alc262_modes,
10957 .input_mux = &alc262_fujitsu_capture_source,
10958 .unsol_event = alc262_lenovo_3000_unsol_event,
10961 .mixers = { alc262_nec_mixer },
10962 .init_verbs = { alc262_nec_verbs },
10963 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10964 .dac_nids = alc262_dac_nids,
10966 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10967 .channel_mode = alc262_modes,
10968 .input_mux = &alc262_capture_source,
10970 [ALC262_TOSHIBA_S06] = {
10971 .mixers = { alc262_toshiba_s06_mixer },
10972 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10973 alc262_eapd_verbs },
10974 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10975 .capsrc_nids = alc262_dmic_capsrc_nids,
10976 .dac_nids = alc262_dac_nids,
10977 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10978 .dig_out_nid = ALC262_DIGOUT_NID,
10979 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10980 .channel_mode = alc262_modes,
10981 .input_mux = &alc262_dmic_capture_source,
10982 .unsol_event = alc262_toshiba_s06_unsol_event,
10983 .init_hook = alc262_toshiba_s06_init_hook,
10985 [ALC262_TOSHIBA_RX1] = {
10986 .mixers = { alc262_toshiba_rx1_mixer },
10987 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10988 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10989 .dac_nids = alc262_dac_nids,
10991 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10992 .channel_mode = alc262_modes,
10993 .input_mux = &alc262_capture_source,
10994 .unsol_event = alc262_hippo_unsol_event,
10995 .init_hook = alc262_hippo_init_hook,
10998 .mixers = { alc262_tyan_mixer },
10999 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11000 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11001 .dac_nids = alc262_dac_nids,
11003 .dig_out_nid = ALC262_DIGOUT_NID,
11004 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11005 .channel_mode = alc262_modes,
11006 .input_mux = &alc262_capture_source,
11007 .unsol_event = alc_automute_amp_unsol_event,
11008 .init_hook = alc262_tyan_init_hook,
11012 static int patch_alc262(struct hda_codec *codec)
11014 struct alc_spec *spec;
11018 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11022 codec->spec = spec;
11024 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11029 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11030 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11031 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11032 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11036 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11038 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11042 if (board_config < 0) {
11043 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
11044 "trying auto-probe from BIOS...\n");
11045 board_config = ALC262_AUTO;
11048 if (board_config == ALC262_AUTO) {
11049 /* automatic parse from the BIOS config */
11050 err = alc262_parse_auto_config(codec);
11056 "hda_codec: Cannot set up configuration "
11057 "from BIOS. Using base mode...\n");
11058 board_config = ALC262_BASIC;
11062 if (!spec->no_analog) {
11063 err = snd_hda_attach_beep_device(codec, 0x1);
11070 if (board_config != ALC262_AUTO)
11071 setup_preset(spec, &alc262_presets[board_config]);
11073 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11074 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11076 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11077 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11079 spec->capture_style = CAPT_MIX;
11080 if (!spec->adc_nids && spec->input_mux) {
11081 /* check whether NID 0x07 is valid */
11082 unsigned int wcap = get_wcaps(codec, 0x07);
11085 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11086 if (wcap != AC_WID_AUD_IN) {
11087 spec->adc_nids = alc262_adc_nids_alt;
11088 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11089 spec->capsrc_nids = alc262_capsrc_nids_alt;
11091 spec->adc_nids = alc262_adc_nids;
11092 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11093 spec->capsrc_nids = alc262_capsrc_nids;
11096 if (!spec->cap_mixer && !spec->no_analog)
11097 set_capture_mixer(spec);
11098 if (!spec->no_analog)
11099 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11101 spec->vmaster_nid = 0x0c;
11103 codec->patch_ops = alc_patch_ops;
11104 if (board_config == ALC262_AUTO)
11105 spec->init_hook = alc262_auto_init;
11106 #ifdef CONFIG_SND_HDA_POWER_SAVE
11107 if (!spec->loopback.amplist)
11108 spec->loopback.amplist = alc262_loopbacks;
11110 codec->proc_widget_hook = print_realtek_coef;
11116 * ALC268 channel source setting (2 channel)
11118 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11119 #define alc268_modes alc260_modes
11121 static hda_nid_t alc268_dac_nids[2] = {
11126 static hda_nid_t alc268_adc_nids[2] = {
11131 static hda_nid_t alc268_adc_nids_alt[1] = {
11136 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11138 static struct snd_kcontrol_new alc268_base_mixer[] = {
11139 /* output mixer control */
11140 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11141 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11142 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11143 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11144 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11145 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11146 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11150 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11151 /* output mixer control */
11152 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11153 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11154 ALC262_HIPPO_MASTER_SWITCH,
11155 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11156 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11157 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11161 /* bind Beep switches of both NID 0x0f and 0x10 */
11162 static struct hda_bind_ctls alc268_bind_beep_sw = {
11163 .ops = &snd_hda_bind_sw,
11165 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11166 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11171 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11172 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11173 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11177 static struct hda_verb alc268_eapd_verbs[] = {
11178 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11179 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11183 /* Toshiba specific */
11184 static struct hda_verb alc268_toshiba_verbs[] = {
11185 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11189 static struct hda_input_mux alc268_acer_lc_capture_source = {
11197 /* Acer specific */
11198 /* bind volumes of both NID 0x02 and 0x03 */
11199 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11200 .ops = &snd_hda_bind_vol,
11202 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11203 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11208 /* mute/unmute internal speaker according to the hp jack and mute state */
11209 static void alc268_acer_automute(struct hda_codec *codec, int force)
11211 struct alc_spec *spec = codec->spec;
11214 if (force || !spec->sense_updated) {
11215 unsigned int present;
11216 present = snd_hda_codec_read(codec, 0x14, 0,
11217 AC_VERB_GET_PIN_SENSE, 0);
11218 spec->jack_present = (present & 0x80000000) != 0;
11219 spec->sense_updated = 1;
11221 if (spec->jack_present)
11222 mute = HDA_AMP_MUTE; /* mute internal speaker */
11223 else /* unmute internal speaker if necessary */
11224 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11225 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11226 HDA_AMP_MUTE, mute);
11230 /* bind hp and internal speaker mute (with plug check) */
11231 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11232 struct snd_ctl_elem_value *ucontrol)
11234 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11235 long *valp = ucontrol->value.integer.value;
11238 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11240 valp[0] ? 0 : HDA_AMP_MUTE);
11241 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11243 valp[1] ? 0 : HDA_AMP_MUTE);
11245 alc268_acer_automute(codec, 0);
11249 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11250 /* output mixer control */
11251 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11253 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11254 .name = "Master Playback Switch",
11255 .info = snd_hda_mixer_amp_switch_info,
11256 .get = snd_hda_mixer_amp_switch_get,
11257 .put = alc268_acer_master_sw_put,
11258 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11260 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11264 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11265 /* output mixer control */
11266 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11268 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11269 .name = "Master Playback Switch",
11270 .info = snd_hda_mixer_amp_switch_info,
11271 .get = snd_hda_mixer_amp_switch_get,
11272 .put = alc268_acer_master_sw_put,
11273 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11275 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11276 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11277 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11281 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11282 /* output mixer control */
11283 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11285 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11286 .name = "Master Playback Switch",
11287 .info = snd_hda_mixer_amp_switch_info,
11288 .get = snd_hda_mixer_amp_switch_get,
11289 .put = alc268_acer_master_sw_put,
11290 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11292 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11293 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11297 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11298 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11299 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11300 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11301 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11302 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11307 static struct hda_verb alc268_acer_verbs[] = {
11308 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11309 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11310 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11311 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11312 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11313 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11314 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11318 /* unsolicited event for HP jack sensing */
11319 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11320 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11322 static void alc268_acer_unsol_event(struct hda_codec *codec,
11325 if ((res >> 26) != ALC880_HP_EVENT)
11327 alc268_acer_automute(codec, 1);
11330 static void alc268_acer_init_hook(struct hda_codec *codec)
11332 alc268_acer_automute(codec, 1);
11335 /* toggle speaker-output according to the hp-jack state */
11336 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11338 unsigned int present;
11339 unsigned char bits;
11341 present = snd_hda_codec_read(codec, 0x15, 0,
11342 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11343 bits = present ? AMP_IN_MUTE(0) : 0;
11344 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11345 AMP_IN_MUTE(0), bits);
11346 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11347 AMP_IN_MUTE(0), bits);
11351 static void alc268_acer_mic_automute(struct hda_codec *codec)
11353 unsigned int present;
11355 present = snd_hda_codec_read(codec, 0x18, 0,
11356 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11357 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11358 present ? 0x0 : 0x6);
11361 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11364 if ((res >> 26) == ALC880_HP_EVENT)
11365 alc268_aspire_one_speaker_automute(codec);
11366 if ((res >> 26) == ALC880_MIC_EVENT)
11367 alc268_acer_mic_automute(codec);
11370 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11372 alc268_aspire_one_speaker_automute(codec);
11373 alc268_acer_mic_automute(codec);
11376 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11377 /* output mixer control */
11378 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11379 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11380 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11381 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11382 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11383 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11387 static struct hda_verb alc268_dell_verbs[] = {
11388 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11389 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11390 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11394 /* mute/unmute internal speaker according to the hp jack and mute state */
11395 static void alc268_dell_init_hook(struct hda_codec *codec)
11397 struct alc_spec *spec = codec->spec;
11399 spec->autocfg.hp_pins[0] = 0x15;
11400 spec->autocfg.speaker_pins[0] = 0x14;
11401 alc_automute_pin(codec);
11404 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11405 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11406 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11407 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11408 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11409 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11410 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11411 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11412 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11416 static struct hda_verb alc267_quanta_il1_verbs[] = {
11417 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11418 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11422 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11424 unsigned int present;
11426 present = snd_hda_codec_read(codec, 0x18, 0,
11427 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11428 snd_hda_codec_write(codec, 0x23, 0,
11429 AC_VERB_SET_CONNECT_SEL,
11430 present ? 0x00 : 0x01);
11433 static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
11435 struct alc_spec *spec = codec->spec;
11437 spec->autocfg.hp_pins[0] = 0x15;
11438 spec->autocfg.speaker_pins[0] = 0x14;
11439 alc_automute_pin(codec);
11440 alc267_quanta_il1_mic_automute(codec);
11443 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11446 switch (res >> 26) {
11447 case ALC880_MIC_EVENT:
11448 alc267_quanta_il1_mic_automute(codec);
11451 alc_sku_unsol_event(codec, res);
11457 * generic initialization of ADC, input mixers and output mixers
11459 static struct hda_verb alc268_base_init_verbs[] = {
11460 /* Unmute DAC0-1 and set vol = 0 */
11461 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11462 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11465 * Set up output mixers (0x0c - 0x0e)
11467 /* set vol=0 to output mixers */
11468 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11469 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11471 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11472 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11474 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11476 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11477 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11478 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11479 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11480 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11481 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11483 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11484 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11485 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11486 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11487 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11489 /* set PCBEEP vol = 0, mute connections */
11490 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11491 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11492 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11494 /* Unmute Selector 23h,24h and set the default input to mic-in */
11496 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11497 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11498 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11499 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11505 * generic initialization of ADC, input mixers and output mixers
11507 static struct hda_verb alc268_volume_init_verbs[] = {
11508 /* set output DAC */
11509 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11510 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11512 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11513 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11514 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11515 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11516 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11518 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11519 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11520 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11522 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11523 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11525 /* set PCBEEP vol = 0, mute connections */
11526 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11527 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11528 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11533 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11534 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11535 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11537 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11538 /* The multiple "Capture Source" controls confuse alsamixer
11539 * So call somewhat different..
11541 /* .name = "Capture Source", */
11542 .name = "Input Source",
11544 .info = alc_mux_enum_info,
11545 .get = alc_mux_enum_get,
11546 .put = alc_mux_enum_put,
11551 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11552 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11553 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11554 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11555 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11557 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11558 /* The multiple "Capture Source" controls confuse alsamixer
11559 * So call somewhat different..
11561 /* .name = "Capture Source", */
11562 .name = "Input Source",
11564 .info = alc_mux_enum_info,
11565 .get = alc_mux_enum_get,
11566 .put = alc_mux_enum_put,
11571 static struct hda_input_mux alc268_capture_source = {
11575 { "Front Mic", 0x1 },
11581 static struct hda_input_mux alc268_acer_capture_source = {
11585 { "Internal Mic", 0x1 },
11590 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11594 { "Internal Mic", 0x6 },
11599 #ifdef CONFIG_SND_DEBUG
11600 static struct snd_kcontrol_new alc268_test_mixer[] = {
11601 /* Volume widgets */
11602 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11603 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11604 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11605 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11606 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11607 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11608 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11609 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11610 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11611 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11612 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11613 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11614 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11615 /* The below appears problematic on some hardwares */
11616 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11617 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11618 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11619 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11620 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11622 /* Modes for retasking pin widgets */
11623 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11624 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11625 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11626 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11628 /* Controls for GPIO pins, assuming they are configured as outputs */
11629 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11630 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11631 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11632 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11634 /* Switches to allow the digital SPDIF output pin to be enabled.
11635 * The ALC268 does not have an SPDIF input.
11637 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11639 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11640 * this output to turn on an external amplifier.
11642 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11643 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11649 /* create input playback/capture controls for the given pin */
11650 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11651 const char *ctlname, int idx)
11656 sprintf(name, "%s Playback Volume", ctlname);
11658 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11659 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11663 } else if (nid == 0x15) {
11664 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11665 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11671 sprintf(name, "%s Playback Switch", ctlname);
11672 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11673 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11679 /* add playback controls from the parsed DAC table */
11680 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11681 const struct auto_pin_cfg *cfg)
11686 spec->multiout.num_dacs = 2; /* only use one dac */
11687 spec->multiout.dac_nids = spec->private_dac_nids;
11688 spec->multiout.dac_nids[0] = 2;
11689 spec->multiout.dac_nids[1] = 3;
11691 nid = cfg->line_out_pins[0];
11693 alc268_new_analog_output(spec, nid, "Front", 0);
11695 nid = cfg->speaker_pins[0];
11697 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11698 "Speaker Playback Volume",
11699 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11703 nid = cfg->hp_pins[0];
11705 alc268_new_analog_output(spec, nid, "Headphone", 0);
11707 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11709 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11710 "Mono Playback Switch",
11711 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11718 /* create playback/capture controls for input pins */
11719 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11720 const struct auto_pin_cfg *cfg)
11722 struct hda_input_mux *imux = &spec->private_imux[0];
11725 for (i = 0; i < AUTO_PIN_LAST; i++) {
11726 switch(cfg->input_pins[i]) {
11728 idx1 = 0; /* Mic 1 */
11731 idx1 = 1; /* Mic 2 */
11734 idx1 = 2; /* Line In */
11741 idx1 = 6; /* digital mics */
11746 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11747 imux->items[imux->num_items].index = idx1;
11753 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11755 struct alc_spec *spec = codec->spec;
11756 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11757 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11758 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11759 unsigned int dac_vol1, dac_vol2;
11762 snd_hda_codec_write(codec, speaker_nid, 0,
11763 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11764 snd_hda_codec_write(codec, 0x0f, 0,
11765 AC_VERB_SET_AMP_GAIN_MUTE,
11767 snd_hda_codec_write(codec, 0x10, 0,
11768 AC_VERB_SET_AMP_GAIN_MUTE,
11771 snd_hda_codec_write(codec, 0x0f, 0,
11772 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11773 snd_hda_codec_write(codec, 0x10, 0,
11774 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11777 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11778 if (line_nid == 0x14)
11779 dac_vol2 = AMP_OUT_ZERO;
11780 else if (line_nid == 0x15)
11781 dac_vol1 = AMP_OUT_ZERO;
11782 if (hp_nid == 0x14)
11783 dac_vol2 = AMP_OUT_ZERO;
11784 else if (hp_nid == 0x15)
11785 dac_vol1 = AMP_OUT_ZERO;
11786 if (line_nid != 0x16 || hp_nid != 0x16 ||
11787 spec->autocfg.line_out_pins[1] != 0x16 ||
11788 spec->autocfg.line_out_pins[2] != 0x16)
11789 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11791 snd_hda_codec_write(codec, 0x02, 0,
11792 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11793 snd_hda_codec_write(codec, 0x03, 0,
11794 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11797 /* pcm configuration: identiacal with ALC880 */
11798 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11799 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11800 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11801 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11804 * BIOS auto configuration
11806 static int alc268_parse_auto_config(struct hda_codec *codec)
11808 struct alc_spec *spec = codec->spec;
11810 static hda_nid_t alc268_ignore[] = { 0 };
11812 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11816 if (!spec->autocfg.line_outs) {
11817 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11818 spec->multiout.max_channels = 2;
11819 spec->no_analog = 1;
11822 return 0; /* can't find valid BIOS pin config */
11824 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11827 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11831 spec->multiout.max_channels = 2;
11834 /* digital only support output */
11835 if (spec->autocfg.dig_outs) {
11836 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11837 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11839 if (spec->kctls.list)
11840 add_mixer(spec, spec->kctls.list);
11842 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
11843 add_mixer(spec, alc268_beep_mixer);
11845 add_verb(spec, alc268_volume_init_verbs);
11846 spec->num_mux_defs = 1;
11847 spec->input_mux = &spec->private_imux[0];
11849 err = alc_auto_add_mic_boost(codec);
11856 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11857 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11858 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11860 /* init callback for auto-configuration model -- overriding the default init */
11861 static void alc268_auto_init(struct hda_codec *codec)
11863 struct alc_spec *spec = codec->spec;
11864 alc268_auto_init_multi_out(codec);
11865 alc268_auto_init_hp_out(codec);
11866 alc268_auto_init_mono_speaker_out(codec);
11867 alc268_auto_init_analog_input(codec);
11868 if (spec->unsol_event)
11869 alc_inithook(codec);
11873 * configuration and preset
11875 static const char *alc268_models[ALC268_MODEL_LAST] = {
11876 [ALC267_QUANTA_IL1] = "quanta-il1",
11877 [ALC268_3ST] = "3stack",
11878 [ALC268_TOSHIBA] = "toshiba",
11879 [ALC268_ACER] = "acer",
11880 [ALC268_ACER_DMIC] = "acer-dmic",
11881 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11882 [ALC268_DELL] = "dell",
11883 [ALC268_ZEPTO] = "zepto",
11884 #ifdef CONFIG_SND_DEBUG
11885 [ALC268_TEST] = "test",
11887 [ALC268_AUTO] = "auto",
11890 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11891 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11892 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11893 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11894 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11895 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11896 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11897 ALC268_ACER_ASPIRE_ONE),
11898 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11899 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
11900 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11901 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11902 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11903 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11904 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11905 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11906 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11907 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11908 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11912 static struct alc_config_preset alc268_presets[] = {
11913 [ALC267_QUANTA_IL1] = {
11914 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
11915 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11916 alc267_quanta_il1_verbs },
11917 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11918 .dac_nids = alc268_dac_nids,
11919 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11920 .adc_nids = alc268_adc_nids_alt,
11922 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11923 .channel_mode = alc268_modes,
11924 .input_mux = &alc268_capture_source,
11925 .unsol_event = alc267_quanta_il1_unsol_event,
11926 .init_hook = alc267_quanta_il1_init_hook,
11929 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11930 alc268_beep_mixer },
11931 .init_verbs = { alc268_base_init_verbs },
11932 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11933 .dac_nids = alc268_dac_nids,
11934 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11935 .adc_nids = alc268_adc_nids_alt,
11936 .capsrc_nids = alc268_capsrc_nids,
11938 .dig_out_nid = ALC268_DIGOUT_NID,
11939 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11940 .channel_mode = alc268_modes,
11941 .input_mux = &alc268_capture_source,
11943 [ALC268_TOSHIBA] = {
11944 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
11945 alc268_beep_mixer },
11946 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11947 alc268_toshiba_verbs },
11948 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11949 .dac_nids = alc268_dac_nids,
11950 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11951 .adc_nids = alc268_adc_nids_alt,
11952 .capsrc_nids = alc268_capsrc_nids,
11954 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11955 .channel_mode = alc268_modes,
11956 .input_mux = &alc268_capture_source,
11957 .unsol_event = alc268_toshiba_unsol_event,
11958 .init_hook = alc268_toshiba_init_hook,
11961 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11962 alc268_beep_mixer },
11963 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11964 alc268_acer_verbs },
11965 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11966 .dac_nids = alc268_dac_nids,
11967 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11968 .adc_nids = alc268_adc_nids_alt,
11969 .capsrc_nids = alc268_capsrc_nids,
11971 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11972 .channel_mode = alc268_modes,
11973 .input_mux = &alc268_acer_capture_source,
11974 .unsol_event = alc268_acer_unsol_event,
11975 .init_hook = alc268_acer_init_hook,
11977 [ALC268_ACER_DMIC] = {
11978 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11979 alc268_beep_mixer },
11980 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11981 alc268_acer_verbs },
11982 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11983 .dac_nids = alc268_dac_nids,
11984 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11985 .adc_nids = alc268_adc_nids_alt,
11986 .capsrc_nids = alc268_capsrc_nids,
11988 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11989 .channel_mode = alc268_modes,
11990 .input_mux = &alc268_acer_dmic_capture_source,
11991 .unsol_event = alc268_acer_unsol_event,
11992 .init_hook = alc268_acer_init_hook,
11994 [ALC268_ACER_ASPIRE_ONE] = {
11995 .mixers = { alc268_acer_aspire_one_mixer,
11997 alc268_capture_alt_mixer },
11998 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11999 alc268_acer_aspire_one_verbs },
12000 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12001 .dac_nids = alc268_dac_nids,
12002 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12003 .adc_nids = alc268_adc_nids_alt,
12004 .capsrc_nids = alc268_capsrc_nids,
12006 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12007 .channel_mode = alc268_modes,
12008 .input_mux = &alc268_acer_lc_capture_source,
12009 .unsol_event = alc268_acer_lc_unsol_event,
12010 .init_hook = alc268_acer_lc_init_hook,
12013 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12014 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12015 alc268_dell_verbs },
12016 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12017 .dac_nids = alc268_dac_nids,
12019 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12020 .channel_mode = alc268_modes,
12021 .unsol_event = alc_sku_unsol_event,
12022 .init_hook = alc268_dell_init_hook,
12023 .input_mux = &alc268_capture_source,
12026 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12027 alc268_beep_mixer },
12028 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12029 alc268_toshiba_verbs },
12030 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12031 .dac_nids = alc268_dac_nids,
12032 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12033 .adc_nids = alc268_adc_nids_alt,
12034 .capsrc_nids = alc268_capsrc_nids,
12036 .dig_out_nid = ALC268_DIGOUT_NID,
12037 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12038 .channel_mode = alc268_modes,
12039 .input_mux = &alc268_capture_source,
12040 .unsol_event = alc268_toshiba_unsol_event,
12041 .init_hook = alc268_toshiba_init_hook
12043 #ifdef CONFIG_SND_DEBUG
12045 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12046 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12047 alc268_volume_init_verbs },
12048 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12049 .dac_nids = alc268_dac_nids,
12050 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12051 .adc_nids = alc268_adc_nids_alt,
12052 .capsrc_nids = alc268_capsrc_nids,
12054 .dig_out_nid = ALC268_DIGOUT_NID,
12055 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12056 .channel_mode = alc268_modes,
12057 .input_mux = &alc268_capture_source,
12062 static int patch_alc268(struct hda_codec *codec)
12064 struct alc_spec *spec;
12066 int i, has_beep, err;
12068 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12072 codec->spec = spec;
12074 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12078 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12079 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
12080 "trying auto-probe from BIOS...\n");
12081 board_config = ALC268_AUTO;
12084 if (board_config == ALC268_AUTO) {
12085 /* automatic parse from the BIOS config */
12086 err = alc268_parse_auto_config(codec);
12092 "hda_codec: Cannot set up configuration "
12093 "from BIOS. Using base mode...\n");
12094 board_config = ALC268_3ST;
12098 if (board_config != ALC268_AUTO)
12099 setup_preset(spec, &alc268_presets[board_config]);
12101 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12102 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12103 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12105 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12108 for (i = 0; i < spec->num_mixers; i++) {
12109 if (spec->mixers[i] == alc268_beep_mixer) {
12116 err = snd_hda_attach_beep_device(codec, 0x1);
12121 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12122 /* override the amp caps for beep generator */
12123 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12124 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12125 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12126 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12127 (0 << AC_AMPCAP_MUTE_SHIFT));
12130 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12131 /* check whether NID 0x07 is valid */
12132 unsigned int wcap = get_wcaps(codec, 0x07);
12136 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12137 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12138 spec->adc_nids = alc268_adc_nids_alt;
12139 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12140 add_mixer(spec, alc268_capture_alt_mixer);
12142 spec->adc_nids = alc268_adc_nids;
12143 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12144 add_mixer(spec, alc268_capture_mixer);
12146 spec->capsrc_nids = alc268_capsrc_nids;
12147 /* set default input source */
12148 for (i = 0; i < spec->num_adc_nids; i++)
12149 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12150 0, AC_VERB_SET_CONNECT_SEL,
12151 spec->input_mux->items[0].index);
12154 spec->vmaster_nid = 0x02;
12156 codec->patch_ops = alc_patch_ops;
12157 if (board_config == ALC268_AUTO)
12158 spec->init_hook = alc268_auto_init;
12160 codec->proc_widget_hook = print_realtek_coef;
12166 * ALC269 channel source setting (2 channel)
12168 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12170 #define alc269_dac_nids alc260_dac_nids
12172 static hda_nid_t alc269_adc_nids[1] = {
12177 static hda_nid_t alc269_capsrc_nids[1] = {
12181 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12185 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12193 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12201 #define alc269_modes alc260_modes
12202 #define alc269_capture_source alc880_lg_lw_capture_source
12204 static struct snd_kcontrol_new alc269_base_mixer[] = {
12205 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12206 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12207 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12208 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12209 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12210 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12211 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12212 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12213 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12214 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12215 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12216 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12220 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12221 /* output mixer control */
12222 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12224 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12225 .name = "Master Playback Switch",
12226 .info = snd_hda_mixer_amp_switch_info,
12227 .get = snd_hda_mixer_amp_switch_get,
12228 .put = alc268_acer_master_sw_put,
12229 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12232 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12233 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12234 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12235 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12236 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12240 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12241 /* output mixer control */
12242 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12244 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12245 .name = "Master Playback Switch",
12246 .info = snd_hda_mixer_amp_switch_info,
12247 .get = snd_hda_mixer_amp_switch_get,
12248 .put = alc268_acer_master_sw_put,
12249 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12252 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12253 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12254 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12255 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12256 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12257 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12258 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12259 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12263 /* bind volumes of both NID 0x0c and 0x0d */
12264 static struct hda_bind_ctls alc269_epc_bind_vol = {
12265 .ops = &snd_hda_bind_vol,
12267 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12268 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12273 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12274 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12275 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12276 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12280 /* capture mixer elements */
12281 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12282 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12283 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12284 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12289 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12290 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12291 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12292 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12296 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12297 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12298 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12299 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12300 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12301 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12302 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12306 static struct hda_verb alc269_lifebook_verbs[] = {
12307 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12308 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12309 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12310 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12311 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12312 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12313 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12314 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12315 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12316 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12320 /* toggle speaker-output according to the hp-jack state */
12321 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12323 unsigned int present;
12324 unsigned char bits;
12326 present = snd_hda_codec_read(codec, 0x15, 0,
12327 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12328 bits = present ? AMP_IN_MUTE(0) : 0;
12329 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12330 AMP_IN_MUTE(0), bits);
12331 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12332 AMP_IN_MUTE(0), bits);
12334 snd_hda_codec_write(codec, 0x20, 0,
12335 AC_VERB_SET_COEF_INDEX, 0x0c);
12336 snd_hda_codec_write(codec, 0x20, 0,
12337 AC_VERB_SET_PROC_COEF, 0x680);
12339 snd_hda_codec_write(codec, 0x20, 0,
12340 AC_VERB_SET_COEF_INDEX, 0x0c);
12341 snd_hda_codec_write(codec, 0x20, 0,
12342 AC_VERB_SET_PROC_COEF, 0x480);
12345 /* toggle speaker-output according to the hp-jacks state */
12346 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12348 unsigned int present;
12349 unsigned char bits;
12351 /* Check laptop headphone socket */
12352 present = snd_hda_codec_read(codec, 0x15, 0,
12353 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12355 /* Check port replicator headphone socket */
12356 present |= snd_hda_codec_read(codec, 0x1a, 0,
12357 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12359 bits = present ? AMP_IN_MUTE(0) : 0;
12360 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12361 AMP_IN_MUTE(0), bits);
12362 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12363 AMP_IN_MUTE(0), bits);
12365 snd_hda_codec_write(codec, 0x20, 0,
12366 AC_VERB_SET_COEF_INDEX, 0x0c);
12367 snd_hda_codec_write(codec, 0x20, 0,
12368 AC_VERB_SET_PROC_COEF, 0x680);
12370 snd_hda_codec_write(codec, 0x20, 0,
12371 AC_VERB_SET_COEF_INDEX, 0x0c);
12372 snd_hda_codec_write(codec, 0x20, 0,
12373 AC_VERB_SET_PROC_COEF, 0x480);
12376 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12378 unsigned int present;
12380 present = snd_hda_codec_read(codec, 0x18, 0,
12381 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12382 snd_hda_codec_write(codec, 0x23, 0,
12383 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12386 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12388 unsigned int present_laptop;
12389 unsigned int present_dock;
12391 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12392 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12394 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12395 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12397 /* Laptop mic port overrides dock mic port, design decision */
12399 snd_hda_codec_write(codec, 0x23, 0,
12400 AC_VERB_SET_CONNECT_SEL, 0x3);
12401 if (present_laptop)
12402 snd_hda_codec_write(codec, 0x23, 0,
12403 AC_VERB_SET_CONNECT_SEL, 0x0);
12404 if (!present_dock && !present_laptop)
12405 snd_hda_codec_write(codec, 0x23, 0,
12406 AC_VERB_SET_CONNECT_SEL, 0x1);
12409 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12412 if ((res >> 26) == ALC880_HP_EVENT)
12413 alc269_quanta_fl1_speaker_automute(codec);
12414 if ((res >> 26) == ALC880_MIC_EVENT)
12415 alc269_quanta_fl1_mic_automute(codec);
12418 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12421 if ((res >> 26) == ALC880_HP_EVENT)
12422 alc269_lifebook_speaker_automute(codec);
12423 if ((res >> 26) == ALC880_MIC_EVENT)
12424 alc269_lifebook_mic_autoswitch(codec);
12427 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12429 alc269_quanta_fl1_speaker_automute(codec);
12430 alc269_quanta_fl1_mic_automute(codec);
12433 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12435 alc269_lifebook_speaker_automute(codec);
12436 alc269_lifebook_mic_autoswitch(codec);
12439 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12440 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12441 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12442 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12443 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12444 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12445 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12446 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12450 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12451 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12452 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12453 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12454 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12455 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12456 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12460 /* toggle speaker-output according to the hp-jack state */
12461 static void alc269_speaker_automute(struct hda_codec *codec)
12463 unsigned int present;
12464 unsigned char bits;
12466 present = snd_hda_codec_read(codec, 0x15, 0,
12467 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12468 bits = present ? AMP_IN_MUTE(0) : 0;
12469 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12470 AMP_IN_MUTE(0), bits);
12471 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12472 AMP_IN_MUTE(0), bits);
12475 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12477 unsigned int present;
12479 present = snd_hda_codec_read(codec, 0x18, 0,
12480 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12481 snd_hda_codec_write(codec, 0x23, 0,
12482 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12485 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12487 unsigned int present;
12489 present = snd_hda_codec_read(codec, 0x18, 0,
12490 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12491 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12492 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12493 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12494 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12497 /* unsolicited event for HP jack sensing */
12498 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12501 if ((res >> 26) == ALC880_HP_EVENT)
12502 alc269_speaker_automute(codec);
12504 if ((res >> 26) == ALC880_MIC_EVENT)
12505 alc269_eeepc_dmic_automute(codec);
12508 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12510 alc269_speaker_automute(codec);
12511 alc269_eeepc_dmic_automute(codec);
12514 /* unsolicited event for HP jack sensing */
12515 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12518 if ((res >> 26) == ALC880_HP_EVENT)
12519 alc269_speaker_automute(codec);
12521 if ((res >> 26) == ALC880_MIC_EVENT)
12522 alc269_eeepc_amic_automute(codec);
12525 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12527 alc269_speaker_automute(codec);
12528 alc269_eeepc_amic_automute(codec);
12532 * generic initialization of ADC, input mixers and output mixers
12534 static struct hda_verb alc269_init_verbs[] = {
12536 * Unmute ADC0 and set the default input to mic-in
12538 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12540 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12541 * analog-loopback mixer widget
12542 * Note: PASD motherboards uses the Line In 2 as the input for
12543 * front panel mic (mic 2)
12545 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12550 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12553 * Set up output mixers (0x0c - 0x0e)
12555 /* set vol=0 to output mixers */
12556 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12557 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12559 /* set up input amps for analog loopback */
12560 /* Amp Indices: DAC = 0, mixer = 1 */
12561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12563 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12564 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12565 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12568 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12569 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12570 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12571 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12572 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12573 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12574 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12576 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12577 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12578 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12579 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12580 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12581 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12582 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12584 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12585 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12587 /* FIXME: use matrix-type input source selection */
12588 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12589 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12590 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12591 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12592 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12593 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12596 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12597 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12601 /* add playback controls from the parsed DAC table */
12602 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12603 const struct auto_pin_cfg *cfg)
12608 spec->multiout.num_dacs = 1; /* only use one dac */
12609 spec->multiout.dac_nids = spec->private_dac_nids;
12610 spec->multiout.dac_nids[0] = 2;
12612 nid = cfg->line_out_pins[0];
12614 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12615 "Front Playback Volume",
12616 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12619 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12620 "Front Playback Switch",
12621 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12626 nid = cfg->speaker_pins[0];
12628 if (!cfg->line_out_pins[0]) {
12629 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12630 "Speaker Playback Volume",
12631 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12637 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12638 "Speaker Playback Switch",
12639 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12644 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12645 "Speaker Playback Switch",
12646 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12652 nid = cfg->hp_pins[0];
12654 /* spec->multiout.hp_nid = 2; */
12655 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12656 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12657 "Headphone Playback Volume",
12658 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12664 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12665 "Headphone Playback Switch",
12666 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12671 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12672 "Headphone Playback Switch",
12673 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12682 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12683 const struct auto_pin_cfg *cfg)
12687 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12690 /* digital-mic input pin is excluded in alc880_auto_create..()
12691 * because it's under 0x18
12693 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12694 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12695 struct hda_input_mux *imux = &spec->private_imux[0];
12696 imux->items[imux->num_items].label = "Int Mic";
12697 imux->items[imux->num_items].index = 0x05;
12703 #ifdef CONFIG_SND_HDA_POWER_SAVE
12704 #define alc269_loopbacks alc880_loopbacks
12707 /* pcm configuration: identiacal with ALC880 */
12708 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12709 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12710 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12711 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12713 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
12717 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12718 /* NID is set in alc_build_pcms */
12720 .open = alc880_playback_pcm_open,
12721 .prepare = alc880_playback_pcm_prepare,
12722 .cleanup = alc880_playback_pcm_cleanup
12726 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
12730 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12731 /* NID is set in alc_build_pcms */
12735 * BIOS auto configuration
12737 static int alc269_parse_auto_config(struct hda_codec *codec)
12739 struct alc_spec *spec = codec->spec;
12741 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12743 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12748 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12751 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12755 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12757 if (spec->autocfg.dig_outs)
12758 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12760 if (spec->kctls.list)
12761 add_mixer(spec, spec->kctls.list);
12763 add_verb(spec, alc269_init_verbs);
12764 spec->num_mux_defs = 1;
12765 spec->input_mux = &spec->private_imux[0];
12766 /* set default input source */
12767 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12768 0, AC_VERB_SET_CONNECT_SEL,
12769 spec->input_mux->items[0].index);
12771 err = alc_auto_add_mic_boost(codec);
12775 if (!spec->cap_mixer && !spec->no_analog)
12776 set_capture_mixer(spec);
12781 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12782 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12783 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12786 /* init callback for auto-configuration model -- overriding the default init */
12787 static void alc269_auto_init(struct hda_codec *codec)
12789 struct alc_spec *spec = codec->spec;
12790 alc269_auto_init_multi_out(codec);
12791 alc269_auto_init_hp_out(codec);
12792 alc269_auto_init_analog_input(codec);
12793 if (spec->unsol_event)
12794 alc_inithook(codec);
12798 * configuration and preset
12800 static const char *alc269_models[ALC269_MODEL_LAST] = {
12801 [ALC269_BASIC] = "basic",
12802 [ALC269_QUANTA_FL1] = "quanta",
12803 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12804 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12805 [ALC269_FUJITSU] = "fujitsu",
12806 [ALC269_LIFEBOOK] = "lifebook"
12809 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12810 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12811 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12812 ALC269_ASUS_EEEPC_P703),
12813 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
12814 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
12815 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
12816 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
12817 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
12818 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
12819 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12820 ALC269_ASUS_EEEPC_P901),
12821 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12822 ALC269_ASUS_EEEPC_P901),
12823 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
12824 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12825 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12829 static struct alc_config_preset alc269_presets[] = {
12831 .mixers = { alc269_base_mixer },
12832 .init_verbs = { alc269_init_verbs },
12833 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12834 .dac_nids = alc269_dac_nids,
12836 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12837 .channel_mode = alc269_modes,
12838 .input_mux = &alc269_capture_source,
12840 [ALC269_QUANTA_FL1] = {
12841 .mixers = { alc269_quanta_fl1_mixer },
12842 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12843 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12844 .dac_nids = alc269_dac_nids,
12846 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12847 .channel_mode = alc269_modes,
12848 .input_mux = &alc269_capture_source,
12849 .unsol_event = alc269_quanta_fl1_unsol_event,
12850 .init_hook = alc269_quanta_fl1_init_hook,
12852 [ALC269_ASUS_EEEPC_P703] = {
12853 .mixers = { alc269_eeepc_mixer },
12854 .cap_mixer = alc269_epc_capture_mixer,
12855 .init_verbs = { alc269_init_verbs,
12856 alc269_eeepc_amic_init_verbs },
12857 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12858 .dac_nids = alc269_dac_nids,
12860 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12861 .channel_mode = alc269_modes,
12862 .input_mux = &alc269_eeepc_amic_capture_source,
12863 .unsol_event = alc269_eeepc_amic_unsol_event,
12864 .init_hook = alc269_eeepc_amic_inithook,
12866 [ALC269_ASUS_EEEPC_P901] = {
12867 .mixers = { alc269_eeepc_mixer },
12868 .cap_mixer = alc269_epc_capture_mixer,
12869 .init_verbs = { alc269_init_verbs,
12870 alc269_eeepc_dmic_init_verbs },
12871 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12872 .dac_nids = alc269_dac_nids,
12874 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12875 .channel_mode = alc269_modes,
12876 .input_mux = &alc269_eeepc_dmic_capture_source,
12877 .unsol_event = alc269_eeepc_dmic_unsol_event,
12878 .init_hook = alc269_eeepc_dmic_inithook,
12880 [ALC269_FUJITSU] = {
12881 .mixers = { alc269_fujitsu_mixer },
12882 .cap_mixer = alc269_epc_capture_mixer,
12883 .init_verbs = { alc269_init_verbs,
12884 alc269_eeepc_dmic_init_verbs },
12885 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12886 .dac_nids = alc269_dac_nids,
12888 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12889 .channel_mode = alc269_modes,
12890 .input_mux = &alc269_eeepc_dmic_capture_source,
12891 .unsol_event = alc269_eeepc_dmic_unsol_event,
12892 .init_hook = alc269_eeepc_dmic_inithook,
12894 [ALC269_LIFEBOOK] = {
12895 .mixers = { alc269_lifebook_mixer },
12896 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12897 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12898 .dac_nids = alc269_dac_nids,
12900 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12901 .channel_mode = alc269_modes,
12902 .input_mux = &alc269_capture_source,
12903 .unsol_event = alc269_lifebook_unsol_event,
12904 .init_hook = alc269_lifebook_init_hook,
12908 static int patch_alc269(struct hda_codec *codec)
12910 struct alc_spec *spec;
12914 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12918 codec->spec = spec;
12920 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12922 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12926 if (board_config < 0) {
12927 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12928 "trying auto-probe from BIOS...\n");
12929 board_config = ALC269_AUTO;
12932 if (board_config == ALC269_AUTO) {
12933 /* automatic parse from the BIOS config */
12934 err = alc269_parse_auto_config(codec);
12940 "hda_codec: Cannot set up configuration "
12941 "from BIOS. Using base mode...\n");
12942 board_config = ALC269_BASIC;
12946 err = snd_hda_attach_beep_device(codec, 0x1);
12952 if (board_config != ALC269_AUTO)
12953 setup_preset(spec, &alc269_presets[board_config]);
12955 if (codec->subsystem_id == 0x17aa3bf8) {
12956 /* Due to a hardware problem on Lenovo Ideadpad, we need to
12957 * fix the sample rate of analog I/O to 44.1kHz
12959 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
12960 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
12962 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12963 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12965 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12966 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12968 spec->adc_nids = alc269_adc_nids;
12969 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12970 spec->capsrc_nids = alc269_capsrc_nids;
12971 if (!spec->cap_mixer)
12972 set_capture_mixer(spec);
12973 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12975 codec->patch_ops = alc_patch_ops;
12976 if (board_config == ALC269_AUTO)
12977 spec->init_hook = alc269_auto_init;
12978 #ifdef CONFIG_SND_HDA_POWER_SAVE
12979 if (!spec->loopback.amplist)
12980 spec->loopback.amplist = alc269_loopbacks;
12982 codec->proc_widget_hook = print_realtek_coef;
12988 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12992 * set the path ways for 2 channel output
12993 * need to set the codec line out and mic 1 pin widgets to inputs
12995 static struct hda_verb alc861_threestack_ch2_init[] = {
12996 /* set pin widget 1Ah (line in) for input */
12997 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12998 /* set pin widget 18h (mic1/2) for input, for mic also enable
13001 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13003 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13005 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13006 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13012 * need to set the codec line out and mic 1 pin widgets to outputs
13014 static struct hda_verb alc861_threestack_ch6_init[] = {
13015 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13016 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13017 /* set pin widget 18h (mic1) for output (CLFE)*/
13018 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13020 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13021 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13023 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13025 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13026 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13031 static struct hda_channel_mode alc861_threestack_modes[2] = {
13032 { 2, alc861_threestack_ch2_init },
13033 { 6, alc861_threestack_ch6_init },
13035 /* Set mic1 as input and unmute the mixer */
13036 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13037 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13038 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13041 /* Set mic1 as output and mute mixer */
13042 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13043 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13044 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13048 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13049 { 2, alc861_uniwill_m31_ch2_init },
13050 { 4, alc861_uniwill_m31_ch4_init },
13053 /* Set mic1 and line-in as input and unmute the mixer */
13054 static struct hda_verb alc861_asus_ch2_init[] = {
13055 /* set pin widget 1Ah (line in) for input */
13056 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13057 /* set pin widget 18h (mic1/2) for input, for mic also enable
13060 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13062 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13064 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13065 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13069 /* Set mic1 nad line-in as output and mute mixer */
13070 static struct hda_verb alc861_asus_ch6_init[] = {
13071 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13072 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13073 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13074 /* set pin widget 18h (mic1) for output (CLFE)*/
13075 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13076 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13077 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13078 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13080 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13082 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13083 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13088 static struct hda_channel_mode alc861_asus_modes[2] = {
13089 { 2, alc861_asus_ch2_init },
13090 { 6, alc861_asus_ch6_init },
13095 static struct snd_kcontrol_new alc861_base_mixer[] = {
13096 /* output mixer control */
13097 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13098 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13099 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13100 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13101 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13103 /*Input mixer control */
13104 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13105 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13106 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13107 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13108 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13109 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13111 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13112 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13113 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13118 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13119 /* output mixer control */
13120 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13121 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13122 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13123 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13124 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13126 /* Input mixer control */
13127 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13128 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13129 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13130 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13131 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13132 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13134 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13135 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13136 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13139 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13140 .name = "Channel Mode",
13141 .info = alc_ch_mode_info,
13142 .get = alc_ch_mode_get,
13143 .put = alc_ch_mode_put,
13144 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13149 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13150 /* output mixer control */
13151 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13153 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13158 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13159 /* output mixer control */
13160 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13161 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13162 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13163 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13164 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13166 /* Input mixer control */
13167 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13168 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13169 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13170 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13171 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13172 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13173 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13174 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13175 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13176 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13179 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13180 .name = "Channel Mode",
13181 .info = alc_ch_mode_info,
13182 .get = alc_ch_mode_get,
13183 .put = alc_ch_mode_put,
13184 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13189 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13190 /* output mixer control */
13191 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13192 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13193 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13194 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13195 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13197 /* Input mixer control */
13198 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13199 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13200 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13201 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13202 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13203 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13204 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13205 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13206 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13207 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13210 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13211 .name = "Channel Mode",
13212 .info = alc_ch_mode_info,
13213 .get = alc_ch_mode_get,
13214 .put = alc_ch_mode_put,
13215 .private_value = ARRAY_SIZE(alc861_asus_modes),
13220 /* additional mixer */
13221 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13222 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13223 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13228 * generic initialization of ADC, input mixers and output mixers
13230 static struct hda_verb alc861_base_init_verbs[] = {
13232 * Unmute ADC0 and set the default input to mic-in
13234 /* port-A for surround (rear panel) */
13235 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13236 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13237 /* port-B for mic-in (rear panel) with vref */
13238 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13239 /* port-C for line-in (rear panel) */
13240 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13241 /* port-D for Front */
13242 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13243 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13244 /* port-E for HP out (front panel) */
13245 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13246 /* route front PCM to HP */
13247 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13248 /* port-F for mic-in (front panel) with vref */
13249 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13250 /* port-G for CLFE (rear panel) */
13251 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13252 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13253 /* port-H for side (rear panel) */
13254 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13255 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13257 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13258 /* route front mic to ADC1*/
13259 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13260 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13262 /* Unmute DAC0~3 & spdif out*/
13263 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13264 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13265 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13266 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13267 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13269 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13270 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13271 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13272 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13273 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13275 /* Unmute Stereo Mixer 15 */
13276 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13277 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13278 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13279 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13281 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13282 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13283 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13284 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13285 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13286 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13287 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13288 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13289 /* hp used DAC 3 (Front) */
13290 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13291 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13296 static struct hda_verb alc861_threestack_init_verbs[] = {
13298 * Unmute ADC0 and set the default input to mic-in
13300 /* port-A for surround (rear panel) */
13301 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13302 /* port-B for mic-in (rear panel) with vref */
13303 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13304 /* port-C for line-in (rear panel) */
13305 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13306 /* port-D for Front */
13307 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13308 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13309 /* port-E for HP out (front panel) */
13310 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13311 /* route front PCM to HP */
13312 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13313 /* port-F for mic-in (front panel) with vref */
13314 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13315 /* port-G for CLFE (rear panel) */
13316 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13317 /* port-H for side (rear panel) */
13318 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13320 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13321 /* route front mic to ADC1*/
13322 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13323 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13324 /* Unmute DAC0~3 & spdif out*/
13325 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13326 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13327 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13328 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13331 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13332 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13333 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13334 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13335 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13337 /* Unmute Stereo Mixer 15 */
13338 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13339 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13340 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13341 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13343 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13344 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13345 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13346 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13347 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13348 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13349 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13350 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13351 /* hp used DAC 3 (Front) */
13352 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13353 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13357 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13359 * Unmute ADC0 and set the default input to mic-in
13361 /* port-A for surround (rear panel) */
13362 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13363 /* port-B for mic-in (rear panel) with vref */
13364 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13365 /* port-C for line-in (rear panel) */
13366 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13367 /* port-D for Front */
13368 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13369 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13370 /* port-E for HP out (front panel) */
13371 /* this has to be set to VREF80 */
13372 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13373 /* route front PCM to HP */
13374 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13375 /* port-F for mic-in (front panel) with vref */
13376 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13377 /* port-G for CLFE (rear panel) */
13378 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13379 /* port-H for side (rear panel) */
13380 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13382 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13383 /* route front mic to ADC1*/
13384 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13385 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13386 /* Unmute DAC0~3 & spdif out*/
13387 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13388 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13389 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13390 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13391 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13393 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13394 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13395 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13396 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13397 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13399 /* Unmute Stereo Mixer 15 */
13400 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13401 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13402 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13403 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13405 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13406 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13407 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13408 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13409 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13410 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13411 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13412 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13413 /* hp used DAC 3 (Front) */
13414 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13415 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13419 static struct hda_verb alc861_asus_init_verbs[] = {
13421 * Unmute ADC0 and set the default input to mic-in
13423 /* port-A for surround (rear panel)
13424 * according to codec#0 this is the HP jack
13426 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13427 /* route front PCM to HP */
13428 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13429 /* port-B for mic-in (rear panel) with vref */
13430 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13431 /* port-C for line-in (rear panel) */
13432 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13433 /* port-D for Front */
13434 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13435 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13436 /* port-E for HP out (front panel) */
13437 /* this has to be set to VREF80 */
13438 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13439 /* route front PCM to HP */
13440 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13441 /* port-F for mic-in (front panel) with vref */
13442 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13443 /* port-G for CLFE (rear panel) */
13444 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13445 /* port-H for side (rear panel) */
13446 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13448 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13449 /* route front mic to ADC1*/
13450 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13451 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13452 /* Unmute DAC0~3 & spdif out*/
13453 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13454 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13455 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13456 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13458 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13459 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13460 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13461 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13462 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13464 /* Unmute Stereo Mixer 15 */
13465 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13466 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13467 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13468 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13470 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13471 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13472 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13473 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13474 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13475 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13476 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13477 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13478 /* hp used DAC 3 (Front) */
13479 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13480 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13484 /* additional init verbs for ASUS laptops */
13485 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13486 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13487 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13492 * generic initialization of ADC, input mixers and output mixers
13494 static struct hda_verb alc861_auto_init_verbs[] = {
13496 * Unmute ADC0 and set the default input to mic-in
13498 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13499 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13501 /* Unmute DAC0~3 & spdif out*/
13502 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13503 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13504 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13505 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13506 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13508 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13509 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13510 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13511 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13512 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13514 /* Unmute Stereo Mixer 15 */
13515 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13516 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13517 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13518 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13520 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13521 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13522 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13523 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13524 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13525 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13526 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13527 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13529 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13530 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13531 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13532 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13533 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13534 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13535 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13536 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13538 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13543 static struct hda_verb alc861_toshiba_init_verbs[] = {
13544 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13549 /* toggle speaker-output according to the hp-jack state */
13550 static void alc861_toshiba_automute(struct hda_codec *codec)
13552 unsigned int present;
13554 present = snd_hda_codec_read(codec, 0x0f, 0,
13555 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13556 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13557 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13558 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13559 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13562 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13565 if ((res >> 26) == ALC880_HP_EVENT)
13566 alc861_toshiba_automute(codec);
13569 /* pcm configuration: identiacal with ALC880 */
13570 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13571 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13572 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13573 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13576 #define ALC861_DIGOUT_NID 0x07
13578 static struct hda_channel_mode alc861_8ch_modes[1] = {
13582 static hda_nid_t alc861_dac_nids[4] = {
13583 /* front, surround, clfe, side */
13584 0x03, 0x06, 0x05, 0x04
13587 static hda_nid_t alc660_dac_nids[3] = {
13588 /* front, clfe, surround */
13592 static hda_nid_t alc861_adc_nids[1] = {
13597 static struct hda_input_mux alc861_capture_source = {
13601 { "Front Mic", 0x3 },
13608 /* fill in the dac_nids table from the parsed pin configuration */
13609 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13610 const struct auto_pin_cfg *cfg)
13615 spec->multiout.dac_nids = spec->private_dac_nids;
13616 for (i = 0; i < cfg->line_outs; i++) {
13617 nid = cfg->line_out_pins[i];
13619 if (i >= ARRAY_SIZE(alc861_dac_nids))
13621 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13624 spec->multiout.num_dacs = cfg->line_outs;
13628 /* add playback controls from the parsed DAC table */
13629 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13630 const struct auto_pin_cfg *cfg)
13633 static const char *chname[4] = {
13634 "Front", "Surround", NULL /*CLFE*/, "Side"
13639 for (i = 0; i < cfg->line_outs; i++) {
13640 nid = spec->multiout.dac_nids[i];
13645 err = add_control(spec, ALC_CTL_BIND_MUTE,
13646 "Center Playback Switch",
13647 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13651 err = add_control(spec, ALC_CTL_BIND_MUTE,
13652 "LFE Playback Switch",
13653 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13658 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13660 if (nid == alc861_dac_nids[idx])
13662 sprintf(name, "%s Playback Switch", chname[idx]);
13663 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13664 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13673 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13681 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13683 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13684 "Headphone Playback Switch",
13685 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13688 spec->multiout.hp_nid = nid;
13693 /* create playback/capture controls for input pins */
13694 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13695 const struct auto_pin_cfg *cfg)
13697 struct hda_input_mux *imux = &spec->private_imux[0];
13698 int i, err, idx, idx1;
13700 for (i = 0; i < AUTO_PIN_LAST; i++) {
13701 switch (cfg->input_pins[i]) {
13704 idx = 2; /* Line In */
13708 idx = 2; /* Line In */
13712 idx = 1; /* Mic In */
13716 idx = 1; /* Mic In */
13726 err = new_analog_input(spec, cfg->input_pins[i],
13727 auto_pin_cfg_labels[i], idx, 0x15);
13731 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13732 imux->items[imux->num_items].index = idx1;
13738 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13740 int pin_type, int dac_idx)
13742 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13744 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13748 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13750 struct alc_spec *spec = codec->spec;
13753 for (i = 0; i < spec->autocfg.line_outs; i++) {
13754 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13755 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13757 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13758 spec->multiout.dac_nids[i]);
13762 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13764 struct alc_spec *spec = codec->spec;
13767 pin = spec->autocfg.hp_pins[0];
13768 if (pin) /* connect to front */
13769 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13770 spec->multiout.dac_nids[0]);
13771 pin = spec->autocfg.speaker_pins[0];
13773 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13776 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13778 struct alc_spec *spec = codec->spec;
13781 for (i = 0; i < AUTO_PIN_LAST; i++) {
13782 hda_nid_t nid = spec->autocfg.input_pins[i];
13783 if (nid >= 0x0c && nid <= 0x11)
13784 alc_set_input_pin(codec, nid, i);
13788 /* parse the BIOS configuration and set up the alc_spec */
13789 /* return 1 if successful, 0 if the proper config is not found,
13790 * or a negative error code
13792 static int alc861_parse_auto_config(struct hda_codec *codec)
13794 struct alc_spec *spec = codec->spec;
13796 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13798 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13802 if (!spec->autocfg.line_outs)
13803 return 0; /* can't find valid BIOS pin config */
13805 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13808 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13811 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13814 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13818 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13820 if (spec->autocfg.dig_outs)
13821 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13823 if (spec->kctls.list)
13824 add_mixer(spec, spec->kctls.list);
13826 add_verb(spec, alc861_auto_init_verbs);
13828 spec->num_mux_defs = 1;
13829 spec->input_mux = &spec->private_imux[0];
13831 spec->adc_nids = alc861_adc_nids;
13832 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13833 set_capture_mixer(spec);
13835 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
13840 /* additional initialization for auto-configuration model */
13841 static void alc861_auto_init(struct hda_codec *codec)
13843 struct alc_spec *spec = codec->spec;
13844 alc861_auto_init_multi_out(codec);
13845 alc861_auto_init_hp_out(codec);
13846 alc861_auto_init_analog_input(codec);
13847 if (spec->unsol_event)
13848 alc_inithook(codec);
13851 #ifdef CONFIG_SND_HDA_POWER_SAVE
13852 static struct hda_amp_list alc861_loopbacks[] = {
13853 { 0x15, HDA_INPUT, 0 },
13854 { 0x15, HDA_INPUT, 1 },
13855 { 0x15, HDA_INPUT, 2 },
13856 { 0x15, HDA_INPUT, 3 },
13863 * configuration and preset
13865 static const char *alc861_models[ALC861_MODEL_LAST] = {
13866 [ALC861_3ST] = "3stack",
13867 [ALC660_3ST] = "3stack-660",
13868 [ALC861_3ST_DIG] = "3stack-dig",
13869 [ALC861_6ST_DIG] = "6stack-dig",
13870 [ALC861_UNIWILL_M31] = "uniwill-m31",
13871 [ALC861_TOSHIBA] = "toshiba",
13872 [ALC861_ASUS] = "asus",
13873 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13874 [ALC861_AUTO] = "auto",
13877 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13878 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13879 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13880 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13881 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13882 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13883 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13884 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13885 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13886 * Any other models that need this preset?
13888 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13889 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13890 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13891 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13892 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13893 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13894 /* FIXME: the below seems conflict */
13895 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13896 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13897 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13901 static struct alc_config_preset alc861_presets[] = {
13903 .mixers = { alc861_3ST_mixer },
13904 .init_verbs = { alc861_threestack_init_verbs },
13905 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13906 .dac_nids = alc861_dac_nids,
13907 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13908 .channel_mode = alc861_threestack_modes,
13910 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13911 .adc_nids = alc861_adc_nids,
13912 .input_mux = &alc861_capture_source,
13914 [ALC861_3ST_DIG] = {
13915 .mixers = { alc861_base_mixer },
13916 .init_verbs = { alc861_threestack_init_verbs },
13917 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13918 .dac_nids = alc861_dac_nids,
13919 .dig_out_nid = ALC861_DIGOUT_NID,
13920 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13921 .channel_mode = alc861_threestack_modes,
13923 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13924 .adc_nids = alc861_adc_nids,
13925 .input_mux = &alc861_capture_source,
13927 [ALC861_6ST_DIG] = {
13928 .mixers = { alc861_base_mixer },
13929 .init_verbs = { alc861_base_init_verbs },
13930 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13931 .dac_nids = alc861_dac_nids,
13932 .dig_out_nid = ALC861_DIGOUT_NID,
13933 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13934 .channel_mode = alc861_8ch_modes,
13935 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13936 .adc_nids = alc861_adc_nids,
13937 .input_mux = &alc861_capture_source,
13940 .mixers = { alc861_3ST_mixer },
13941 .init_verbs = { alc861_threestack_init_verbs },
13942 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13943 .dac_nids = alc660_dac_nids,
13944 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13945 .channel_mode = alc861_threestack_modes,
13947 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13948 .adc_nids = alc861_adc_nids,
13949 .input_mux = &alc861_capture_source,
13951 [ALC861_UNIWILL_M31] = {
13952 .mixers = { alc861_uniwill_m31_mixer },
13953 .init_verbs = { alc861_uniwill_m31_init_verbs },
13954 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13955 .dac_nids = alc861_dac_nids,
13956 .dig_out_nid = ALC861_DIGOUT_NID,
13957 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13958 .channel_mode = alc861_uniwill_m31_modes,
13960 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13961 .adc_nids = alc861_adc_nids,
13962 .input_mux = &alc861_capture_source,
13964 [ALC861_TOSHIBA] = {
13965 .mixers = { alc861_toshiba_mixer },
13966 .init_verbs = { alc861_base_init_verbs,
13967 alc861_toshiba_init_verbs },
13968 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13969 .dac_nids = alc861_dac_nids,
13970 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13971 .channel_mode = alc883_3ST_2ch_modes,
13972 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13973 .adc_nids = alc861_adc_nids,
13974 .input_mux = &alc861_capture_source,
13975 .unsol_event = alc861_toshiba_unsol_event,
13976 .init_hook = alc861_toshiba_automute,
13979 .mixers = { alc861_asus_mixer },
13980 .init_verbs = { alc861_asus_init_verbs },
13981 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13982 .dac_nids = alc861_dac_nids,
13983 .dig_out_nid = ALC861_DIGOUT_NID,
13984 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13985 .channel_mode = alc861_asus_modes,
13988 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13989 .adc_nids = alc861_adc_nids,
13990 .input_mux = &alc861_capture_source,
13992 [ALC861_ASUS_LAPTOP] = {
13993 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13994 .init_verbs = { alc861_asus_init_verbs,
13995 alc861_asus_laptop_init_verbs },
13996 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13997 .dac_nids = alc861_dac_nids,
13998 .dig_out_nid = ALC861_DIGOUT_NID,
13999 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14000 .channel_mode = alc883_3ST_2ch_modes,
14002 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14003 .adc_nids = alc861_adc_nids,
14004 .input_mux = &alc861_capture_source,
14009 static int patch_alc861(struct hda_codec *codec)
14011 struct alc_spec *spec;
14015 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14019 codec->spec = spec;
14021 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14025 if (board_config < 0) {
14026 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
14027 "trying auto-probe from BIOS...\n");
14028 board_config = ALC861_AUTO;
14031 if (board_config == ALC861_AUTO) {
14032 /* automatic parse from the BIOS config */
14033 err = alc861_parse_auto_config(codec);
14039 "hda_codec: Cannot set up configuration "
14040 "from BIOS. Using base mode...\n");
14041 board_config = ALC861_3ST_DIG;
14045 err = snd_hda_attach_beep_device(codec, 0x23);
14051 if (board_config != ALC861_AUTO)
14052 setup_preset(spec, &alc861_presets[board_config]);
14054 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14055 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14057 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14058 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14060 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14062 spec->vmaster_nid = 0x03;
14064 codec->patch_ops = alc_patch_ops;
14065 if (board_config == ALC861_AUTO)
14066 spec->init_hook = alc861_auto_init;
14067 #ifdef CONFIG_SND_HDA_POWER_SAVE
14068 if (!spec->loopback.amplist)
14069 spec->loopback.amplist = alc861_loopbacks;
14071 codec->proc_widget_hook = print_realtek_coef;
14077 * ALC861-VD support
14081 * In addition, an independent DAC
14083 #define ALC861VD_DIGOUT_NID 0x06
14085 static hda_nid_t alc861vd_dac_nids[4] = {
14086 /* front, surr, clfe, side surr */
14087 0x02, 0x03, 0x04, 0x05
14090 /* dac_nids for ALC660vd are in a different order - according to
14091 * Realtek's driver.
14092 * This should probably tesult in a different mixer for 6stack models
14093 * of ALC660vd codecs, but for now there is only 3stack mixer
14094 * - and it is the same as in 861vd.
14095 * adc_nids in ALC660vd are (is) the same as in 861vd
14097 static hda_nid_t alc660vd_dac_nids[3] = {
14098 /* front, rear, clfe, rear_surr */
14102 static hda_nid_t alc861vd_adc_nids[1] = {
14107 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14110 /* FIXME: should be a matrix-type input source selection */
14111 static struct hda_input_mux alc861vd_capture_source = {
14115 { "Front Mic", 0x1 },
14121 static struct hda_input_mux alc861vd_dallas_capture_source = {
14124 { "Ext Mic", 0x0 },
14125 { "Int Mic", 0x1 },
14129 static struct hda_input_mux alc861vd_hp_capture_source = {
14132 { "Front Mic", 0x0 },
14133 { "ATAPI Mic", 0x1 },
14140 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14147 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14148 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14149 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14150 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14151 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14158 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14159 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14160 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14161 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14162 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14166 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14167 { 6, alc861vd_6stack_ch6_init },
14168 { 8, alc861vd_6stack_ch8_init },
14171 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14173 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14174 .name = "Channel Mode",
14175 .info = alc_ch_mode_info,
14176 .get = alc_ch_mode_get,
14177 .put = alc_ch_mode_put,
14182 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14183 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14185 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14186 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14187 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14189 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14190 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14192 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14194 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14196 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14197 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14199 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14200 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14202 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14204 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14205 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14206 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14208 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14209 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14210 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14212 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14213 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14215 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14216 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14221 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14222 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14223 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14225 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14227 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14229 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14231 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14232 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14233 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14235 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14236 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14238 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14239 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14244 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14245 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14246 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14247 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14249 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14251 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14253 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14255 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14256 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14257 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14259 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14260 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14265 /* Pin assignment: Speaker=0x14, HP = 0x15,
14266 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14268 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14269 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14270 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14271 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14272 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14273 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14274 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14275 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14276 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14277 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14278 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14282 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14283 * Front Mic=0x18, ATAPI Mic = 0x19,
14285 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14286 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14287 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14288 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14289 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14290 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14291 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14292 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14293 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14299 * generic initialization of ADC, input mixers and output mixers
14301 static struct hda_verb alc861vd_volume_init_verbs[] = {
14303 * Unmute ADC0 and set the default input to mic-in
14305 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14306 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14308 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14309 * the analog-loopback mixer widget
14311 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14312 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14313 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14314 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14315 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14316 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14318 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14319 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14320 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14321 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14325 * Set up output mixers (0x02 - 0x05)
14327 /* set vol=0 to output mixers */
14328 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14329 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14330 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14331 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14333 /* set up input amps for analog loopback */
14334 /* Amp Indices: DAC = 0, mixer = 1 */
14335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14336 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14337 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14338 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14339 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14340 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14341 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14342 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14348 * 3-stack pin configuration:
14349 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14351 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14353 * Set pin mode and muting
14355 /* set front pin widgets 0x14 for output */
14356 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14357 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14358 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14360 /* Mic (rear) pin: input vref at 80% */
14361 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14362 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14363 /* Front Mic pin: input vref at 80% */
14364 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14365 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14366 /* Line In pin: input */
14367 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14368 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14369 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14370 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14371 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14372 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14373 /* CD pin widget for input */
14374 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14380 * 6-stack pin configuration:
14382 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14384 * Set pin mode and muting
14386 /* set front pin widgets 0x14 for output */
14387 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14388 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14389 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14391 /* Rear Pin: output 1 (0x0d) */
14392 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14393 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14394 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14395 /* CLFE Pin: output 2 (0x0e) */
14396 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14397 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14398 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14399 /* Side Pin: output 3 (0x0f) */
14400 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14401 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14402 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14404 /* Mic (rear) pin: input vref at 80% */
14405 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14406 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14407 /* Front Mic pin: input vref at 80% */
14408 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14409 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14410 /* Line In pin: input */
14411 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14412 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14413 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14414 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14415 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14416 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14417 /* CD pin widget for input */
14418 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14423 static struct hda_verb alc861vd_eapd_verbs[] = {
14424 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14428 static struct hda_verb alc660vd_eapd_verbs[] = {
14429 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14430 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14434 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14435 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14436 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14437 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14438 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14439 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14443 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14445 unsigned int present;
14446 unsigned char bits;
14448 present = snd_hda_codec_read(codec, 0x18, 0,
14449 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14450 bits = present ? HDA_AMP_MUTE : 0;
14451 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14452 HDA_AMP_MUTE, bits);
14455 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14457 struct alc_spec *spec = codec->spec;
14459 spec->autocfg.hp_pins[0] = 0x1b;
14460 spec->autocfg.speaker_pins[0] = 0x14;
14461 alc_automute_amp(codec);
14462 alc861vd_lenovo_mic_automute(codec);
14465 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14468 switch (res >> 26) {
14469 case ALC880_MIC_EVENT:
14470 alc861vd_lenovo_mic_automute(codec);
14473 alc_automute_amp_unsol_event(codec, res);
14478 static struct hda_verb alc861vd_dallas_verbs[] = {
14479 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14480 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14481 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14482 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14484 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14485 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14486 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14487 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14488 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14489 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14490 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14491 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14493 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14494 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14495 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14496 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14497 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14498 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14499 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14500 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14502 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14503 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14504 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14505 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14506 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14508 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14509 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14511 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14512 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14516 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14517 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14518 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14523 /* toggle speaker-output according to the hp-jack state */
14524 static void alc861vd_dallas_init_hook(struct hda_codec *codec)
14526 struct alc_spec *spec = codec->spec;
14528 spec->autocfg.hp_pins[0] = 0x15;
14529 spec->autocfg.speaker_pins[0] = 0x14;
14530 alc_automute_amp(codec);
14533 #ifdef CONFIG_SND_HDA_POWER_SAVE
14534 #define alc861vd_loopbacks alc880_loopbacks
14537 /* pcm configuration: identiacal with ALC880 */
14538 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14539 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14540 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14541 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14544 * configuration and preset
14546 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14547 [ALC660VD_3ST] = "3stack-660",
14548 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14549 [ALC660VD_ASUS_V1S] = "asus-v1s",
14550 [ALC861VD_3ST] = "3stack",
14551 [ALC861VD_3ST_DIG] = "3stack-digout",
14552 [ALC861VD_6ST_DIG] = "6stack-digout",
14553 [ALC861VD_LENOVO] = "lenovo",
14554 [ALC861VD_DALLAS] = "dallas",
14555 [ALC861VD_HP] = "hp",
14556 [ALC861VD_AUTO] = "auto",
14559 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14560 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14561 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14562 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14563 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14564 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14565 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14566 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14567 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14568 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14569 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14570 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14571 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14572 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14573 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14574 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14578 static struct alc_config_preset alc861vd_presets[] = {
14580 .mixers = { alc861vd_3st_mixer },
14581 .init_verbs = { alc861vd_volume_init_verbs,
14582 alc861vd_3stack_init_verbs },
14583 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14584 .dac_nids = alc660vd_dac_nids,
14585 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14586 .channel_mode = alc861vd_3stack_2ch_modes,
14587 .input_mux = &alc861vd_capture_source,
14589 [ALC660VD_3ST_DIG] = {
14590 .mixers = { alc861vd_3st_mixer },
14591 .init_verbs = { alc861vd_volume_init_verbs,
14592 alc861vd_3stack_init_verbs },
14593 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14594 .dac_nids = alc660vd_dac_nids,
14595 .dig_out_nid = ALC861VD_DIGOUT_NID,
14596 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14597 .channel_mode = alc861vd_3stack_2ch_modes,
14598 .input_mux = &alc861vd_capture_source,
14601 .mixers = { alc861vd_3st_mixer },
14602 .init_verbs = { alc861vd_volume_init_verbs,
14603 alc861vd_3stack_init_verbs },
14604 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14605 .dac_nids = alc861vd_dac_nids,
14606 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14607 .channel_mode = alc861vd_3stack_2ch_modes,
14608 .input_mux = &alc861vd_capture_source,
14610 [ALC861VD_3ST_DIG] = {
14611 .mixers = { alc861vd_3st_mixer },
14612 .init_verbs = { alc861vd_volume_init_verbs,
14613 alc861vd_3stack_init_verbs },
14614 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14615 .dac_nids = alc861vd_dac_nids,
14616 .dig_out_nid = ALC861VD_DIGOUT_NID,
14617 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14618 .channel_mode = alc861vd_3stack_2ch_modes,
14619 .input_mux = &alc861vd_capture_source,
14621 [ALC861VD_6ST_DIG] = {
14622 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14623 .init_verbs = { alc861vd_volume_init_verbs,
14624 alc861vd_6stack_init_verbs },
14625 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14626 .dac_nids = alc861vd_dac_nids,
14627 .dig_out_nid = ALC861VD_DIGOUT_NID,
14628 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14629 .channel_mode = alc861vd_6stack_modes,
14630 .input_mux = &alc861vd_capture_source,
14632 [ALC861VD_LENOVO] = {
14633 .mixers = { alc861vd_lenovo_mixer },
14634 .init_verbs = { alc861vd_volume_init_verbs,
14635 alc861vd_3stack_init_verbs,
14636 alc861vd_eapd_verbs,
14637 alc861vd_lenovo_unsol_verbs },
14638 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14639 .dac_nids = alc660vd_dac_nids,
14640 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14641 .channel_mode = alc861vd_3stack_2ch_modes,
14642 .input_mux = &alc861vd_capture_source,
14643 .unsol_event = alc861vd_lenovo_unsol_event,
14644 .init_hook = alc861vd_lenovo_init_hook,
14646 [ALC861VD_DALLAS] = {
14647 .mixers = { alc861vd_dallas_mixer },
14648 .init_verbs = { alc861vd_dallas_verbs },
14649 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14650 .dac_nids = alc861vd_dac_nids,
14651 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14652 .channel_mode = alc861vd_3stack_2ch_modes,
14653 .input_mux = &alc861vd_dallas_capture_source,
14654 .unsol_event = alc_automute_amp_unsol_event,
14655 .init_hook = alc861vd_dallas_init_hook,
14658 .mixers = { alc861vd_hp_mixer },
14659 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14660 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14661 .dac_nids = alc861vd_dac_nids,
14662 .dig_out_nid = ALC861VD_DIGOUT_NID,
14663 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14664 .channel_mode = alc861vd_3stack_2ch_modes,
14665 .input_mux = &alc861vd_hp_capture_source,
14666 .unsol_event = alc_automute_amp_unsol_event,
14667 .init_hook = alc861vd_dallas_init_hook,
14669 [ALC660VD_ASUS_V1S] = {
14670 .mixers = { alc861vd_lenovo_mixer },
14671 .init_verbs = { alc861vd_volume_init_verbs,
14672 alc861vd_3stack_init_verbs,
14673 alc861vd_eapd_verbs,
14674 alc861vd_lenovo_unsol_verbs },
14675 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14676 .dac_nids = alc660vd_dac_nids,
14677 .dig_out_nid = ALC861VD_DIGOUT_NID,
14678 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14679 .channel_mode = alc861vd_3stack_2ch_modes,
14680 .input_mux = &alc861vd_capture_source,
14681 .unsol_event = alc861vd_lenovo_unsol_event,
14682 .init_hook = alc861vd_lenovo_init_hook,
14687 * BIOS auto configuration
14689 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14690 hda_nid_t nid, int pin_type, int dac_idx)
14692 alc_set_pin_output(codec, nid, pin_type);
14695 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14697 struct alc_spec *spec = codec->spec;
14700 for (i = 0; i <= HDA_SIDE; i++) {
14701 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14702 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14704 alc861vd_auto_set_output_and_unmute(codec, nid,
14710 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14712 struct alc_spec *spec = codec->spec;
14715 pin = spec->autocfg.hp_pins[0];
14716 if (pin) /* connect to front and use dac 0 */
14717 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14718 pin = spec->autocfg.speaker_pins[0];
14720 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14723 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14724 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14726 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14728 struct alc_spec *spec = codec->spec;
14731 for (i = 0; i < AUTO_PIN_LAST; i++) {
14732 hda_nid_t nid = spec->autocfg.input_pins[i];
14733 if (alc861vd_is_input_pin(nid)) {
14734 alc_set_input_pin(codec, nid, i);
14735 if (nid != ALC861VD_PIN_CD_NID &&
14736 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
14737 snd_hda_codec_write(codec, nid, 0,
14738 AC_VERB_SET_AMP_GAIN_MUTE,
14744 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14746 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14747 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14749 /* add playback controls from the parsed DAC table */
14750 /* Based on ALC880 version. But ALC861VD has separate,
14751 * different NIDs for mute/unmute switch and volume control */
14752 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14753 const struct auto_pin_cfg *cfg)
14756 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14757 hda_nid_t nid_v, nid_s;
14760 for (i = 0; i < cfg->line_outs; i++) {
14761 if (!spec->multiout.dac_nids[i])
14763 nid_v = alc861vd_idx_to_mixer_vol(
14765 spec->multiout.dac_nids[i]));
14766 nid_s = alc861vd_idx_to_mixer_switch(
14768 spec->multiout.dac_nids[i]));
14772 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14773 "Center Playback Volume",
14774 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14778 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14779 "LFE Playback Volume",
14780 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14784 err = add_control(spec, ALC_CTL_BIND_MUTE,
14785 "Center Playback Switch",
14786 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14790 err = add_control(spec, ALC_CTL_BIND_MUTE,
14791 "LFE Playback Switch",
14792 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14797 sprintf(name, "%s Playback Volume", chname[i]);
14798 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14799 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14803 sprintf(name, "%s Playback Switch", chname[i]);
14804 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14805 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14814 /* add playback controls for speaker and HP outputs */
14815 /* Based on ALC880 version. But ALC861VD has separate,
14816 * different NIDs for mute/unmute switch and volume control */
14817 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14818 hda_nid_t pin, const char *pfx)
14820 hda_nid_t nid_v, nid_s;
14827 if (alc880_is_fixed_pin(pin)) {
14828 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14829 /* specify the DAC as the extra output */
14830 if (!spec->multiout.hp_nid)
14831 spec->multiout.hp_nid = nid_v;
14833 spec->multiout.extra_out_nid[0] = nid_v;
14834 /* control HP volume/switch on the output mixer amp */
14835 nid_v = alc861vd_idx_to_mixer_vol(
14836 alc880_fixed_pin_idx(pin));
14837 nid_s = alc861vd_idx_to_mixer_switch(
14838 alc880_fixed_pin_idx(pin));
14840 sprintf(name, "%s Playback Volume", pfx);
14841 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14842 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14845 sprintf(name, "%s Playback Switch", pfx);
14846 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14847 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14850 } else if (alc880_is_multi_pin(pin)) {
14851 /* set manual connection */
14852 /* we have only a switch on HP-out PIN */
14853 sprintf(name, "%s Playback Switch", pfx);
14854 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14855 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14862 /* parse the BIOS configuration and set up the alc_spec
14863 * return 1 if successful, 0 if the proper config is not found,
14864 * or a negative error code
14865 * Based on ALC880 version - had to change it to override
14866 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14867 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14869 struct alc_spec *spec = codec->spec;
14871 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14873 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14877 if (!spec->autocfg.line_outs)
14878 return 0; /* can't find valid BIOS pin config */
14880 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14883 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14886 err = alc861vd_auto_create_extra_out(spec,
14887 spec->autocfg.speaker_pins[0],
14891 err = alc861vd_auto_create_extra_out(spec,
14892 spec->autocfg.hp_pins[0],
14896 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14900 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14902 if (spec->autocfg.dig_outs)
14903 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14905 if (spec->kctls.list)
14906 add_mixer(spec, spec->kctls.list);
14908 add_verb(spec, alc861vd_volume_init_verbs);
14910 spec->num_mux_defs = 1;
14911 spec->input_mux = &spec->private_imux[0];
14913 err = alc_auto_add_mic_boost(codec);
14917 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
14922 /* additional initialization for auto-configuration model */
14923 static void alc861vd_auto_init(struct hda_codec *codec)
14925 struct alc_spec *spec = codec->spec;
14926 alc861vd_auto_init_multi_out(codec);
14927 alc861vd_auto_init_hp_out(codec);
14928 alc861vd_auto_init_analog_input(codec);
14929 alc861vd_auto_init_input_src(codec);
14930 if (spec->unsol_event)
14931 alc_inithook(codec);
14934 static int patch_alc861vd(struct hda_codec *codec)
14936 struct alc_spec *spec;
14937 int err, board_config;
14939 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14943 codec->spec = spec;
14945 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14949 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14950 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14951 "ALC861VD, trying auto-probe from BIOS...\n");
14952 board_config = ALC861VD_AUTO;
14955 if (board_config == ALC861VD_AUTO) {
14956 /* automatic parse from the BIOS config */
14957 err = alc861vd_parse_auto_config(codec);
14963 "hda_codec: Cannot set up configuration "
14964 "from BIOS. Using base mode...\n");
14965 board_config = ALC861VD_3ST;
14969 err = snd_hda_attach_beep_device(codec, 0x23);
14975 if (board_config != ALC861VD_AUTO)
14976 setup_preset(spec, &alc861vd_presets[board_config]);
14978 if (codec->vendor_id == 0x10ec0660) {
14979 /* always turn on EAPD */
14980 add_verb(spec, alc660vd_eapd_verbs);
14983 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14984 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14986 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14987 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14989 spec->adc_nids = alc861vd_adc_nids;
14990 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14991 spec->capsrc_nids = alc861vd_capsrc_nids;
14992 spec->capture_style = CAPT_MIX;
14994 set_capture_mixer(spec);
14995 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
14997 spec->vmaster_nid = 0x02;
14999 codec->patch_ops = alc_patch_ops;
15001 if (board_config == ALC861VD_AUTO)
15002 spec->init_hook = alc861vd_auto_init;
15003 #ifdef CONFIG_SND_HDA_POWER_SAVE
15004 if (!spec->loopback.amplist)
15005 spec->loopback.amplist = alc861vd_loopbacks;
15007 codec->proc_widget_hook = print_realtek_coef;
15015 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15016 * configuration. Each pin widget can choose any input DACs and a mixer.
15017 * Each ADC is connected from a mixer of all inputs. This makes possible
15018 * 6-channel independent captures.
15020 * In addition, an independent DAC for the multi-playback (not used in this
15023 #define ALC662_DIGOUT_NID 0x06
15024 #define ALC662_DIGIN_NID 0x0a
15026 static hda_nid_t alc662_dac_nids[4] = {
15027 /* front, rear, clfe, rear_surr */
15031 static hda_nid_t alc272_dac_nids[2] = {
15035 static hda_nid_t alc662_adc_nids[1] = {
15040 static hda_nid_t alc272_adc_nids[1] = {
15045 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15046 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15050 /* FIXME: should be a matrix-type input source selection */
15051 static struct hda_input_mux alc662_capture_source = {
15055 { "Front Mic", 0x1 },
15061 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15069 static struct hda_input_mux alc662_eeepc_capture_source = {
15077 static struct hda_input_mux alc663_capture_source = {
15081 { "Front Mic", 0x1 },
15086 static struct hda_input_mux alc663_m51va_capture_source = {
15089 { "Ext-Mic", 0x0 },
15094 #if 1 /* set to 0 for testing other input sources below */
15095 static struct hda_input_mux alc272_nc10_capture_source = {
15098 { "Autoselect Mic", 0x0 },
15099 { "Internal Mic", 0x1 },
15103 static struct hda_input_mux alc272_nc10_capture_source = {
15106 { "Autoselect Mic", 0x0 },
15107 { "Internal Mic", 0x1 },
15108 { "In-0x02", 0x2 },
15109 { "In-0x03", 0x3 },
15110 { "In-0x04", 0x4 },
15111 { "In-0x05", 0x5 },
15112 { "In-0x06", 0x6 },
15113 { "In-0x07", 0x7 },
15114 { "In-0x08", 0x8 },
15115 { "In-0x09", 0x9 },
15116 { "In-0x0a", 0x0a },
15117 { "In-0x0b", 0x0b },
15118 { "In-0x0c", 0x0c },
15119 { "In-0x0d", 0x0d },
15120 { "In-0x0e", 0x0e },
15121 { "In-0x0f", 0x0f },
15129 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15136 static struct hda_verb alc662_3ST_ch2_init[] = {
15137 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15138 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15139 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15140 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15147 static struct hda_verb alc662_3ST_ch6_init[] = {
15148 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15149 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15150 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15151 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15152 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15153 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15157 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15158 { 2, alc662_3ST_ch2_init },
15159 { 6, alc662_3ST_ch6_init },
15165 static struct hda_verb alc662_sixstack_ch6_init[] = {
15166 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15167 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15168 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15175 static struct hda_verb alc662_sixstack_ch8_init[] = {
15176 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15177 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15178 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15182 static struct hda_channel_mode alc662_5stack_modes[2] = {
15183 { 2, alc662_sixstack_ch6_init },
15184 { 6, alc662_sixstack_ch8_init },
15187 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15188 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15191 static struct snd_kcontrol_new alc662_base_mixer[] = {
15192 /* output mixer control */
15193 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15194 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15195 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15196 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15197 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15198 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15199 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15200 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15201 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15203 /*Input mixer control */
15204 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15205 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15206 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15207 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15208 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15209 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15210 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15211 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15215 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15216 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15217 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15218 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15219 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15220 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15221 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15222 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15225 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15226 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15230 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15231 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15232 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15233 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15234 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15235 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15236 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15237 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15238 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15239 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15240 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15241 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15242 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15243 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15244 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15245 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15246 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15247 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15251 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15252 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15253 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15254 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15255 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15256 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15257 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15258 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15259 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15260 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15264 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15265 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15266 ALC262_HIPPO_MASTER_SWITCH,
15268 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15269 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15270 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15272 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15273 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15274 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15278 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15279 ALC262_HIPPO_MASTER_SWITCH,
15280 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15281 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15282 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15283 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15284 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15285 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15286 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15287 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15288 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15292 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15293 .ops = &snd_hda_bind_vol,
15295 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15296 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15301 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15302 .ops = &snd_hda_bind_sw,
15304 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15305 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15310 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15311 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15312 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15313 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15314 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15318 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15319 .ops = &snd_hda_bind_sw,
15321 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15322 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15323 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15328 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15329 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15330 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15332 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15333 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15334 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15339 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15340 .ops = &snd_hda_bind_sw,
15342 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15343 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15344 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15349 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15350 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15351 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15354 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15355 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15359 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15360 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15361 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15362 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15363 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15364 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15365 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15366 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15370 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15371 .ops = &snd_hda_bind_vol,
15373 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15374 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15379 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15380 .ops = &snd_hda_bind_sw,
15382 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15383 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15388 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15389 HDA_BIND_VOL("Master Playback Volume",
15390 &alc663_asus_two_bind_master_vol),
15391 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15392 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15393 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15394 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15395 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15399 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15400 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15401 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15402 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15403 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15404 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15405 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15409 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15410 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15411 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15412 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15413 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15414 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15416 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15417 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15418 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15419 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15423 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15424 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15425 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15426 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15429 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15430 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15431 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15432 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15433 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15437 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15439 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15440 .name = "Channel Mode",
15441 .info = alc_ch_mode_info,
15442 .get = alc_ch_mode_get,
15443 .put = alc_ch_mode_put,
15448 static struct hda_verb alc662_init_verbs[] = {
15449 /* ADC: mute amp left and right */
15450 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15451 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15452 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15454 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15455 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15456 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15457 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15460 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15461 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15462 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15463 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15464 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15465 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15467 /* Front Pin: output 0 (0x0c) */
15468 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15469 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15471 /* Rear Pin: output 1 (0x0d) */
15472 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15473 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15475 /* CLFE Pin: output 2 (0x0e) */
15476 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15477 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15479 /* Mic (rear) pin: input vref at 80% */
15480 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15481 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15482 /* Front Mic pin: input vref at 80% */
15483 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15484 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15485 /* Line In pin: input */
15486 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15487 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15488 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15489 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15490 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15491 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15492 /* CD pin widget for input */
15493 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15495 /* FIXME: use matrix-type input source selection */
15496 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15498 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15499 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15501 /* always trun on EAPD */
15502 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15503 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15508 static struct hda_verb alc662_sue_init_verbs[] = {
15509 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15510 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15514 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15515 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15516 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15520 /* Set Unsolicited Event*/
15521 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15522 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15523 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15528 * generic initialization of ADC, input mixers and output mixers
15530 static struct hda_verb alc662_auto_init_verbs[] = {
15532 * Unmute ADC and set the default input to mic-in
15534 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15535 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15537 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15539 * Note: PASD motherboards uses the Line In 2 as the input for front
15540 * panel mic (mic 2)
15542 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15543 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15544 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15550 * Set up output mixers (0x0c - 0x0f)
15552 /* set vol=0 to output mixers */
15553 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15554 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15555 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15557 /* set up input amps for analog loopback */
15558 /* Amp Indices: DAC = 0, mixer = 1 */
15559 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15561 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15562 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15563 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15564 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15567 /* FIXME: use matrix-type input source selection */
15568 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15571 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15575 /* additional verbs for ALC663 */
15576 static struct hda_verb alc663_auto_init_verbs[] = {
15577 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15578 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15582 static struct hda_verb alc663_m51va_init_verbs[] = {
15583 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15584 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15585 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15586 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15587 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15588 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15589 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15590 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15591 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15595 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15596 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15597 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15598 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15599 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15601 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15602 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15606 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15607 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15608 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15609 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15610 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15611 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15612 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15613 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15614 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15618 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15619 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15620 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15621 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15624 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15625 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15629 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15630 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15631 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15632 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15633 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15634 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15635 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15636 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15637 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15638 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15639 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15640 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15641 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15645 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15646 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15647 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15648 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15649 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15650 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15651 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15652 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15655 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15656 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15657 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15661 static struct hda_verb alc663_g71v_init_verbs[] = {
15662 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15663 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15664 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15666 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15667 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15668 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15670 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15671 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15672 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15676 static struct hda_verb alc663_g50v_init_verbs[] = {
15677 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15678 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15679 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15681 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15682 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15686 static struct hda_verb alc662_ecs_init_verbs[] = {
15687 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15688 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15689 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15690 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15694 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
15695 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15696 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15697 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15698 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15699 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15700 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15701 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15702 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15703 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15704 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15705 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15709 static struct hda_verb alc272_dell_init_verbs[] = {
15710 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15711 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15712 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15713 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15714 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15715 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15716 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15717 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15718 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15719 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15720 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15724 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15725 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15726 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15730 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
15731 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
15732 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
15736 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15738 unsigned int present;
15739 unsigned char bits;
15741 present = snd_hda_codec_read(codec, 0x14, 0,
15742 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15743 bits = present ? HDA_AMP_MUTE : 0;
15744 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15745 HDA_AMP_MUTE, bits);
15748 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15750 unsigned int present;
15751 unsigned char bits;
15753 present = snd_hda_codec_read(codec, 0x1b, 0,
15754 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15755 bits = present ? HDA_AMP_MUTE : 0;
15756 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15757 HDA_AMP_MUTE, bits);
15758 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15759 HDA_AMP_MUTE, bits);
15762 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15765 if ((res >> 26) == ALC880_HP_EVENT)
15766 alc662_lenovo_101e_all_automute(codec);
15767 if ((res >> 26) == ALC880_FRONT_EVENT)
15768 alc662_lenovo_101e_ispeaker_automute(codec);
15771 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15773 unsigned int present;
15775 present = snd_hda_codec_read(codec, 0x18, 0,
15776 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15777 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15778 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15779 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15780 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15781 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15782 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15783 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15784 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15787 /* unsolicited event for HP jack sensing */
15788 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15791 if ((res >> 26) == ALC880_MIC_EVENT)
15792 alc662_eeepc_mic_automute(codec);
15794 alc262_hippo_unsol_event(codec, res);
15797 static void alc662_eeepc_inithook(struct hda_codec *codec)
15799 alc262_hippo1_init_hook(codec);
15800 alc662_eeepc_mic_automute(codec);
15803 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15805 struct alc_spec *spec = codec->spec;
15807 spec->autocfg.hp_pins[0] = 0x14;
15808 spec->autocfg.speaker_pins[0] = 0x1b;
15809 alc262_hippo_master_update(codec);
15812 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15814 unsigned int present;
15815 unsigned char bits;
15817 present = snd_hda_codec_read(codec, 0x21, 0,
15818 AC_VERB_GET_PIN_SENSE, 0)
15819 & AC_PINSENSE_PRESENCE;
15820 bits = present ? HDA_AMP_MUTE : 0;
15821 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15822 AMP_IN_MUTE(0), bits);
15823 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15824 AMP_IN_MUTE(0), bits);
15827 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15829 unsigned int present;
15830 unsigned char bits;
15832 present = snd_hda_codec_read(codec, 0x21, 0,
15833 AC_VERB_GET_PIN_SENSE, 0)
15834 & AC_PINSENSE_PRESENCE;
15835 bits = present ? HDA_AMP_MUTE : 0;
15836 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15837 AMP_IN_MUTE(0), bits);
15838 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15839 AMP_IN_MUTE(0), bits);
15840 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15841 AMP_IN_MUTE(0), bits);
15842 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15843 AMP_IN_MUTE(0), bits);
15846 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15848 unsigned int present;
15849 unsigned char bits;
15851 present = snd_hda_codec_read(codec, 0x15, 0,
15852 AC_VERB_GET_PIN_SENSE, 0)
15853 & AC_PINSENSE_PRESENCE;
15854 bits = present ? HDA_AMP_MUTE : 0;
15855 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15856 AMP_IN_MUTE(0), bits);
15857 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15858 AMP_IN_MUTE(0), bits);
15859 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15860 AMP_IN_MUTE(0), bits);
15861 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15862 AMP_IN_MUTE(0), bits);
15865 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15867 unsigned int present;
15868 unsigned char bits;
15870 present = snd_hda_codec_read(codec, 0x1b, 0,
15871 AC_VERB_GET_PIN_SENSE, 0)
15872 & AC_PINSENSE_PRESENCE;
15873 bits = present ? 0 : PIN_OUT;
15874 snd_hda_codec_write(codec, 0x14, 0,
15875 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15878 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15880 unsigned int present1, present2;
15882 present1 = snd_hda_codec_read(codec, 0x21, 0,
15883 AC_VERB_GET_PIN_SENSE, 0)
15884 & AC_PINSENSE_PRESENCE;
15885 present2 = snd_hda_codec_read(codec, 0x15, 0,
15886 AC_VERB_GET_PIN_SENSE, 0)
15887 & AC_PINSENSE_PRESENCE;
15889 if (present1 || present2) {
15890 snd_hda_codec_write_cache(codec, 0x14, 0,
15891 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15893 snd_hda_codec_write_cache(codec, 0x14, 0,
15894 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15898 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15900 unsigned int present1, present2;
15902 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15903 AC_VERB_GET_PIN_SENSE, 0)
15904 & AC_PINSENSE_PRESENCE;
15905 present2 = snd_hda_codec_read(codec, 0x15, 0,
15906 AC_VERB_GET_PIN_SENSE, 0)
15907 & AC_PINSENSE_PRESENCE;
15909 if (present1 || present2) {
15910 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15911 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15912 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15913 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15915 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15916 AMP_IN_MUTE(0), 0);
15917 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15918 AMP_IN_MUTE(0), 0);
15922 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15924 unsigned int present;
15926 present = snd_hda_codec_read(codec, 0x18, 0,
15927 AC_VERB_GET_PIN_SENSE, 0)
15928 & AC_PINSENSE_PRESENCE;
15929 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15930 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15931 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15932 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15933 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15934 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15935 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15936 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15939 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15942 switch (res >> 26) {
15943 case ALC880_HP_EVENT:
15944 alc663_m51va_speaker_automute(codec);
15946 case ALC880_MIC_EVENT:
15947 alc663_m51va_mic_automute(codec);
15952 static void alc663_m51va_inithook(struct hda_codec *codec)
15954 alc663_m51va_speaker_automute(codec);
15955 alc663_m51va_mic_automute(codec);
15958 /* ***************** Mode1 ******************************/
15959 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15962 switch (res >> 26) {
15963 case ALC880_HP_EVENT:
15964 alc663_m51va_speaker_automute(codec);
15966 case ALC880_MIC_EVENT:
15967 alc662_eeepc_mic_automute(codec);
15972 static void alc663_mode1_inithook(struct hda_codec *codec)
15974 alc663_m51va_speaker_automute(codec);
15975 alc662_eeepc_mic_automute(codec);
15977 /* ***************** Mode2 ******************************/
15978 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15981 switch (res >> 26) {
15982 case ALC880_HP_EVENT:
15983 alc662_f5z_speaker_automute(codec);
15985 case ALC880_MIC_EVENT:
15986 alc662_eeepc_mic_automute(codec);
15991 static void alc662_mode2_inithook(struct hda_codec *codec)
15993 alc662_f5z_speaker_automute(codec);
15994 alc662_eeepc_mic_automute(codec);
15996 /* ***************** Mode3 ******************************/
15997 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16000 switch (res >> 26) {
16001 case ALC880_HP_EVENT:
16002 alc663_two_hp_m1_speaker_automute(codec);
16004 case ALC880_MIC_EVENT:
16005 alc662_eeepc_mic_automute(codec);
16010 static void alc663_mode3_inithook(struct hda_codec *codec)
16012 alc663_two_hp_m1_speaker_automute(codec);
16013 alc662_eeepc_mic_automute(codec);
16015 /* ***************** Mode4 ******************************/
16016 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16019 switch (res >> 26) {
16020 case ALC880_HP_EVENT:
16021 alc663_21jd_two_speaker_automute(codec);
16023 case ALC880_MIC_EVENT:
16024 alc662_eeepc_mic_automute(codec);
16029 static void alc663_mode4_inithook(struct hda_codec *codec)
16031 alc663_21jd_two_speaker_automute(codec);
16032 alc662_eeepc_mic_automute(codec);
16034 /* ***************** Mode5 ******************************/
16035 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16038 switch (res >> 26) {
16039 case ALC880_HP_EVENT:
16040 alc663_15jd_two_speaker_automute(codec);
16042 case ALC880_MIC_EVENT:
16043 alc662_eeepc_mic_automute(codec);
16048 static void alc663_mode5_inithook(struct hda_codec *codec)
16050 alc663_15jd_two_speaker_automute(codec);
16051 alc662_eeepc_mic_automute(codec);
16053 /* ***************** Mode6 ******************************/
16054 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16057 switch (res >> 26) {
16058 case ALC880_HP_EVENT:
16059 alc663_two_hp_m2_speaker_automute(codec);
16061 case ALC880_MIC_EVENT:
16062 alc662_eeepc_mic_automute(codec);
16067 static void alc663_mode6_inithook(struct hda_codec *codec)
16069 alc663_two_hp_m2_speaker_automute(codec);
16070 alc662_eeepc_mic_automute(codec);
16073 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16075 unsigned int present;
16076 unsigned char bits;
16078 present = snd_hda_codec_read(codec, 0x21, 0,
16079 AC_VERB_GET_PIN_SENSE, 0)
16080 & AC_PINSENSE_PRESENCE;
16081 bits = present ? HDA_AMP_MUTE : 0;
16082 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16083 HDA_AMP_MUTE, bits);
16084 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16085 HDA_AMP_MUTE, bits);
16088 static void alc663_g71v_front_automute(struct hda_codec *codec)
16090 unsigned int present;
16091 unsigned char bits;
16093 present = snd_hda_codec_read(codec, 0x15, 0,
16094 AC_VERB_GET_PIN_SENSE, 0)
16095 & AC_PINSENSE_PRESENCE;
16096 bits = present ? HDA_AMP_MUTE : 0;
16097 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16098 HDA_AMP_MUTE, bits);
16101 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16104 switch (res >> 26) {
16105 case ALC880_HP_EVENT:
16106 alc663_g71v_hp_automute(codec);
16108 case ALC880_FRONT_EVENT:
16109 alc663_g71v_front_automute(codec);
16111 case ALC880_MIC_EVENT:
16112 alc662_eeepc_mic_automute(codec);
16117 static void alc663_g71v_inithook(struct hda_codec *codec)
16119 alc663_g71v_front_automute(codec);
16120 alc663_g71v_hp_automute(codec);
16121 alc662_eeepc_mic_automute(codec);
16124 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16127 switch (res >> 26) {
16128 case ALC880_HP_EVENT:
16129 alc663_m51va_speaker_automute(codec);
16131 case ALC880_MIC_EVENT:
16132 alc662_eeepc_mic_automute(codec);
16137 static void alc663_g50v_inithook(struct hda_codec *codec)
16139 alc663_m51va_speaker_automute(codec);
16140 alc662_eeepc_mic_automute(codec);
16143 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16144 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16145 ALC262_HIPPO_MASTER_SWITCH,
16147 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16148 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16149 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16151 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16152 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16153 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16157 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16158 /* Master Playback automatically created from Speaker and Headphone */
16159 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16160 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16161 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16162 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16164 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16165 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16166 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16168 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16169 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16170 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16174 #ifdef CONFIG_SND_HDA_POWER_SAVE
16175 #define alc662_loopbacks alc880_loopbacks
16179 /* pcm configuration: identiacal with ALC880 */
16180 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16181 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16182 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16183 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16186 * configuration and preset
16188 static const char *alc662_models[ALC662_MODEL_LAST] = {
16189 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16190 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16191 [ALC662_3ST_6ch] = "3stack-6ch",
16192 [ALC662_5ST_DIG] = "6stack-dig",
16193 [ALC662_LENOVO_101E] = "lenovo-101e",
16194 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16195 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16196 [ALC662_ECS] = "ecs",
16197 [ALC663_ASUS_M51VA] = "m51va",
16198 [ALC663_ASUS_G71V] = "g71v",
16199 [ALC663_ASUS_H13] = "h13",
16200 [ALC663_ASUS_G50V] = "g50v",
16201 [ALC663_ASUS_MODE1] = "asus-mode1",
16202 [ALC662_ASUS_MODE2] = "asus-mode2",
16203 [ALC663_ASUS_MODE3] = "asus-mode3",
16204 [ALC663_ASUS_MODE4] = "asus-mode4",
16205 [ALC663_ASUS_MODE5] = "asus-mode5",
16206 [ALC663_ASUS_MODE6] = "asus-mode6",
16207 [ALC272_DELL] = "dell",
16208 [ALC272_DELL_ZM1] = "dell-zm1",
16209 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16210 [ALC662_AUTO] = "auto",
16213 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16214 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16215 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16216 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16217 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16218 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16219 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16220 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16221 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16222 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16223 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16224 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16225 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16226 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16227 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16228 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16229 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16230 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16231 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16232 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16233 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16234 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16235 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16236 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16237 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16238 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16239 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16240 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16241 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16242 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16243 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16244 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16245 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16246 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16247 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16248 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16249 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16250 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16251 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16252 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16253 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16254 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16255 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16256 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16257 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16258 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16259 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16260 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16261 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16262 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16263 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16264 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16265 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16266 ALC662_3ST_6ch_DIG),
16267 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16268 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16269 ALC662_3ST_6ch_DIG),
16270 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16271 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16272 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16273 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16274 ALC662_3ST_6ch_DIG),
16275 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16280 static struct alc_config_preset alc662_presets[] = {
16281 [ALC662_3ST_2ch_DIG] = {
16282 .mixers = { alc662_3ST_2ch_mixer },
16283 .init_verbs = { alc662_init_verbs },
16284 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16285 .dac_nids = alc662_dac_nids,
16286 .dig_out_nid = ALC662_DIGOUT_NID,
16287 .dig_in_nid = ALC662_DIGIN_NID,
16288 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16289 .channel_mode = alc662_3ST_2ch_modes,
16290 .input_mux = &alc662_capture_source,
16292 [ALC662_3ST_6ch_DIG] = {
16293 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16294 .init_verbs = { alc662_init_verbs },
16295 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16296 .dac_nids = alc662_dac_nids,
16297 .dig_out_nid = ALC662_DIGOUT_NID,
16298 .dig_in_nid = ALC662_DIGIN_NID,
16299 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16300 .channel_mode = alc662_3ST_6ch_modes,
16302 .input_mux = &alc662_capture_source,
16304 [ALC662_3ST_6ch] = {
16305 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16306 .init_verbs = { alc662_init_verbs },
16307 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16308 .dac_nids = alc662_dac_nids,
16309 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16310 .channel_mode = alc662_3ST_6ch_modes,
16312 .input_mux = &alc662_capture_source,
16314 [ALC662_5ST_DIG] = {
16315 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16316 .init_verbs = { alc662_init_verbs },
16317 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16318 .dac_nids = alc662_dac_nids,
16319 .dig_out_nid = ALC662_DIGOUT_NID,
16320 .dig_in_nid = ALC662_DIGIN_NID,
16321 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16322 .channel_mode = alc662_5stack_modes,
16323 .input_mux = &alc662_capture_source,
16325 [ALC662_LENOVO_101E] = {
16326 .mixers = { alc662_lenovo_101e_mixer },
16327 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16328 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16329 .dac_nids = alc662_dac_nids,
16330 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16331 .channel_mode = alc662_3ST_2ch_modes,
16332 .input_mux = &alc662_lenovo_101e_capture_source,
16333 .unsol_event = alc662_lenovo_101e_unsol_event,
16334 .init_hook = alc662_lenovo_101e_all_automute,
16336 [ALC662_ASUS_EEEPC_P701] = {
16337 .mixers = { alc662_eeepc_p701_mixer },
16338 .init_verbs = { alc662_init_verbs,
16339 alc662_eeepc_sue_init_verbs },
16340 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16341 .dac_nids = alc662_dac_nids,
16342 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16343 .channel_mode = alc662_3ST_2ch_modes,
16344 .input_mux = &alc662_eeepc_capture_source,
16345 .unsol_event = alc662_eeepc_unsol_event,
16346 .init_hook = alc662_eeepc_inithook,
16348 [ALC662_ASUS_EEEPC_EP20] = {
16349 .mixers = { alc662_eeepc_ep20_mixer,
16350 alc662_chmode_mixer },
16351 .init_verbs = { alc662_init_verbs,
16352 alc662_eeepc_ep20_sue_init_verbs },
16353 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16354 .dac_nids = alc662_dac_nids,
16355 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16356 .channel_mode = alc662_3ST_6ch_modes,
16357 .input_mux = &alc662_lenovo_101e_capture_source,
16358 .unsol_event = alc662_eeepc_unsol_event,
16359 .init_hook = alc662_eeepc_ep20_inithook,
16362 .mixers = { alc662_ecs_mixer },
16363 .init_verbs = { alc662_init_verbs,
16364 alc662_ecs_init_verbs },
16365 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16366 .dac_nids = alc662_dac_nids,
16367 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16368 .channel_mode = alc662_3ST_2ch_modes,
16369 .input_mux = &alc662_eeepc_capture_source,
16370 .unsol_event = alc662_eeepc_unsol_event,
16371 .init_hook = alc662_eeepc_inithook,
16373 [ALC663_ASUS_M51VA] = {
16374 .mixers = { alc663_m51va_mixer },
16375 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16376 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16377 .dac_nids = alc662_dac_nids,
16378 .dig_out_nid = ALC662_DIGOUT_NID,
16379 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16380 .channel_mode = alc662_3ST_2ch_modes,
16381 .input_mux = &alc663_m51va_capture_source,
16382 .unsol_event = alc663_m51va_unsol_event,
16383 .init_hook = alc663_m51va_inithook,
16385 [ALC663_ASUS_G71V] = {
16386 .mixers = { alc663_g71v_mixer },
16387 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16388 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16389 .dac_nids = alc662_dac_nids,
16390 .dig_out_nid = ALC662_DIGOUT_NID,
16391 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16392 .channel_mode = alc662_3ST_2ch_modes,
16393 .input_mux = &alc662_eeepc_capture_source,
16394 .unsol_event = alc663_g71v_unsol_event,
16395 .init_hook = alc663_g71v_inithook,
16397 [ALC663_ASUS_H13] = {
16398 .mixers = { alc663_m51va_mixer },
16399 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16400 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16401 .dac_nids = alc662_dac_nids,
16402 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16403 .channel_mode = alc662_3ST_2ch_modes,
16404 .input_mux = &alc663_m51va_capture_source,
16405 .unsol_event = alc663_m51va_unsol_event,
16406 .init_hook = alc663_m51va_inithook,
16408 [ALC663_ASUS_G50V] = {
16409 .mixers = { alc663_g50v_mixer },
16410 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16411 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16412 .dac_nids = alc662_dac_nids,
16413 .dig_out_nid = ALC662_DIGOUT_NID,
16414 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16415 .channel_mode = alc662_3ST_6ch_modes,
16416 .input_mux = &alc663_capture_source,
16417 .unsol_event = alc663_g50v_unsol_event,
16418 .init_hook = alc663_g50v_inithook,
16420 [ALC663_ASUS_MODE1] = {
16421 .mixers = { alc663_m51va_mixer },
16422 .cap_mixer = alc662_auto_capture_mixer,
16423 .init_verbs = { alc662_init_verbs,
16424 alc663_21jd_amic_init_verbs },
16425 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16427 .dac_nids = alc662_dac_nids,
16428 .dig_out_nid = ALC662_DIGOUT_NID,
16429 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16430 .channel_mode = alc662_3ST_2ch_modes,
16431 .input_mux = &alc662_eeepc_capture_source,
16432 .unsol_event = alc663_mode1_unsol_event,
16433 .init_hook = alc663_mode1_inithook,
16435 [ALC662_ASUS_MODE2] = {
16436 .mixers = { alc662_1bjd_mixer },
16437 .cap_mixer = alc662_auto_capture_mixer,
16438 .init_verbs = { alc662_init_verbs,
16439 alc662_1bjd_amic_init_verbs },
16440 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16441 .dac_nids = alc662_dac_nids,
16442 .dig_out_nid = ALC662_DIGOUT_NID,
16443 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16444 .channel_mode = alc662_3ST_2ch_modes,
16445 .input_mux = &alc662_eeepc_capture_source,
16446 .unsol_event = alc662_mode2_unsol_event,
16447 .init_hook = alc662_mode2_inithook,
16449 [ALC663_ASUS_MODE3] = {
16450 .mixers = { alc663_two_hp_m1_mixer },
16451 .cap_mixer = alc662_auto_capture_mixer,
16452 .init_verbs = { alc662_init_verbs,
16453 alc663_two_hp_amic_m1_init_verbs },
16454 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16456 .dac_nids = alc662_dac_nids,
16457 .dig_out_nid = ALC662_DIGOUT_NID,
16458 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16459 .channel_mode = alc662_3ST_2ch_modes,
16460 .input_mux = &alc662_eeepc_capture_source,
16461 .unsol_event = alc663_mode3_unsol_event,
16462 .init_hook = alc663_mode3_inithook,
16464 [ALC663_ASUS_MODE4] = {
16465 .mixers = { alc663_asus_21jd_clfe_mixer },
16466 .cap_mixer = alc662_auto_capture_mixer,
16467 .init_verbs = { alc662_init_verbs,
16468 alc663_21jd_amic_init_verbs},
16469 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16471 .dac_nids = alc662_dac_nids,
16472 .dig_out_nid = ALC662_DIGOUT_NID,
16473 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16474 .channel_mode = alc662_3ST_2ch_modes,
16475 .input_mux = &alc662_eeepc_capture_source,
16476 .unsol_event = alc663_mode4_unsol_event,
16477 .init_hook = alc663_mode4_inithook,
16479 [ALC663_ASUS_MODE5] = {
16480 .mixers = { alc663_asus_15jd_clfe_mixer },
16481 .cap_mixer = alc662_auto_capture_mixer,
16482 .init_verbs = { alc662_init_verbs,
16483 alc663_15jd_amic_init_verbs },
16484 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16486 .dac_nids = alc662_dac_nids,
16487 .dig_out_nid = ALC662_DIGOUT_NID,
16488 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16489 .channel_mode = alc662_3ST_2ch_modes,
16490 .input_mux = &alc662_eeepc_capture_source,
16491 .unsol_event = alc663_mode5_unsol_event,
16492 .init_hook = alc663_mode5_inithook,
16494 [ALC663_ASUS_MODE6] = {
16495 .mixers = { alc663_two_hp_m2_mixer },
16496 .cap_mixer = alc662_auto_capture_mixer,
16497 .init_verbs = { alc662_init_verbs,
16498 alc663_two_hp_amic_m2_init_verbs },
16499 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16501 .dac_nids = alc662_dac_nids,
16502 .dig_out_nid = ALC662_DIGOUT_NID,
16503 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16504 .channel_mode = alc662_3ST_2ch_modes,
16505 .input_mux = &alc662_eeepc_capture_source,
16506 .unsol_event = alc663_mode6_unsol_event,
16507 .init_hook = alc663_mode6_inithook,
16510 .mixers = { alc663_m51va_mixer },
16511 .cap_mixer = alc272_auto_capture_mixer,
16512 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16513 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16514 .dac_nids = alc662_dac_nids,
16515 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16516 .adc_nids = alc272_adc_nids,
16517 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16518 .capsrc_nids = alc272_capsrc_nids,
16519 .channel_mode = alc662_3ST_2ch_modes,
16520 .input_mux = &alc663_m51va_capture_source,
16521 .unsol_event = alc663_m51va_unsol_event,
16522 .init_hook = alc663_m51va_inithook,
16524 [ALC272_DELL_ZM1] = {
16525 .mixers = { alc663_m51va_mixer },
16526 .cap_mixer = alc662_auto_capture_mixer,
16527 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16528 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16529 .dac_nids = alc662_dac_nids,
16530 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16531 .adc_nids = alc662_adc_nids,
16532 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
16533 .capsrc_nids = alc662_capsrc_nids,
16534 .channel_mode = alc662_3ST_2ch_modes,
16535 .input_mux = &alc663_m51va_capture_source,
16536 .unsol_event = alc663_m51va_unsol_event,
16537 .init_hook = alc663_m51va_inithook,
16539 [ALC272_SAMSUNG_NC10] = {
16540 .mixers = { alc272_nc10_mixer },
16541 .init_verbs = { alc662_init_verbs,
16542 alc663_21jd_amic_init_verbs },
16543 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16544 .dac_nids = alc272_dac_nids,
16545 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16546 .channel_mode = alc662_3ST_2ch_modes,
16547 .input_mux = &alc272_nc10_capture_source,
16548 .unsol_event = alc663_mode4_unsol_event,
16549 .init_hook = alc663_mode4_inithook,
16555 * BIOS auto configuration
16558 /* add playback controls from the parsed DAC table */
16559 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16560 const struct auto_pin_cfg *cfg)
16563 static const char *chname[4] = {
16564 "Front", "Surround", NULL /*CLFE*/, "Side"
16569 for (i = 0; i < cfg->line_outs; i++) {
16570 if (!spec->multiout.dac_nids[i])
16572 nid = alc880_idx_to_dac(i);
16575 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16576 "Center Playback Volume",
16577 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16581 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16582 "LFE Playback Volume",
16583 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16587 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16588 "Center Playback Switch",
16589 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16593 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16594 "LFE Playback Switch",
16595 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16600 sprintf(name, "%s Playback Volume", chname[i]);
16601 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16602 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16606 sprintf(name, "%s Playback Switch", chname[i]);
16607 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16608 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16617 /* add playback controls for speaker and HP outputs */
16618 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16629 /* ALC663 has a mono output pin on 0x17 */
16630 sprintf(name, "%s Playback Switch", pfx);
16631 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16632 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16636 if (alc880_is_fixed_pin(pin)) {
16637 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16638 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16639 /* specify the DAC as the extra output */
16640 if (!spec->multiout.hp_nid)
16641 spec->multiout.hp_nid = nid;
16643 spec->multiout.extra_out_nid[0] = nid;
16644 /* control HP volume/switch on the output mixer amp */
16645 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16646 sprintf(name, "%s Playback Volume", pfx);
16647 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16648 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16651 sprintf(name, "%s Playback Switch", pfx);
16652 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16653 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16656 } else if (alc880_is_multi_pin(pin)) {
16657 /* set manual connection */
16658 /* we have only a switch on HP-out PIN */
16659 sprintf(name, "%s Playback Switch", pfx);
16660 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16661 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16668 /* return the index of the src widget from the connection list of the nid.
16669 * return -1 if not found
16671 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
16674 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
16677 conns = snd_hda_get_connections(codec, nid, conn_list,
16678 ARRAY_SIZE(conn_list));
16681 for (i = 0; i < conns; i++)
16682 if (conn_list[i] == src)
16687 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
16689 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
16690 return (pincap & AC_PINCAP_IN) != 0;
16693 /* create playback/capture controls for input pins */
16694 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
16695 const struct auto_pin_cfg *cfg)
16697 struct alc_spec *spec = codec->spec;
16698 struct hda_input_mux *imux = &spec->private_imux[0];
16701 for (i = 0; i < AUTO_PIN_LAST; i++) {
16702 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
16703 idx = alc662_input_pin_idx(codec, 0x0b,
16704 cfg->input_pins[i]);
16706 err = new_analog_input(spec, cfg->input_pins[i],
16707 auto_pin_cfg_labels[i],
16712 idx = alc662_input_pin_idx(codec, 0x22,
16713 cfg->input_pins[i]);
16715 imux->items[imux->num_items].label =
16716 auto_pin_cfg_labels[i];
16717 imux->items[imux->num_items].index = idx;
16725 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16726 hda_nid_t nid, int pin_type,
16729 alc_set_pin_output(codec, nid, pin_type);
16730 /* need the manual connection? */
16731 if (alc880_is_multi_pin(nid)) {
16732 struct alc_spec *spec = codec->spec;
16733 int idx = alc880_multi_pin_idx(nid);
16734 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16735 AC_VERB_SET_CONNECT_SEL,
16736 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16740 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16742 struct alc_spec *spec = codec->spec;
16745 for (i = 0; i <= HDA_SIDE; i++) {
16746 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16747 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16749 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16754 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16756 struct alc_spec *spec = codec->spec;
16759 pin = spec->autocfg.hp_pins[0];
16760 if (pin) /* connect to front */
16762 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16763 pin = spec->autocfg.speaker_pins[0];
16765 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16768 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16770 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16772 struct alc_spec *spec = codec->spec;
16775 for (i = 0; i < AUTO_PIN_LAST; i++) {
16776 hda_nid_t nid = spec->autocfg.input_pins[i];
16777 if (alc662_is_input_pin(codec, nid)) {
16778 alc_set_input_pin(codec, nid, i);
16779 if (nid != ALC662_PIN_CD_NID &&
16780 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16781 snd_hda_codec_write(codec, nid, 0,
16782 AC_VERB_SET_AMP_GAIN_MUTE,
16788 #define alc662_auto_init_input_src alc882_auto_init_input_src
16790 static int alc662_parse_auto_config(struct hda_codec *codec)
16792 struct alc_spec *spec = codec->spec;
16794 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16796 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16800 if (!spec->autocfg.line_outs)
16801 return 0; /* can't find valid BIOS pin config */
16803 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16806 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16809 err = alc662_auto_create_extra_out(spec,
16810 spec->autocfg.speaker_pins[0],
16814 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16818 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
16822 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16824 if (spec->autocfg.dig_outs)
16825 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16827 if (spec->kctls.list)
16828 add_mixer(spec, spec->kctls.list);
16830 spec->num_mux_defs = 1;
16831 spec->input_mux = &spec->private_imux[0];
16833 add_verb(spec, alc662_auto_init_verbs);
16834 if (codec->vendor_id == 0x10ec0663)
16835 add_verb(spec, alc663_auto_init_verbs);
16837 err = alc_auto_add_mic_boost(codec);
16841 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
16846 /* additional initialization for auto-configuration model */
16847 static void alc662_auto_init(struct hda_codec *codec)
16849 struct alc_spec *spec = codec->spec;
16850 alc662_auto_init_multi_out(codec);
16851 alc662_auto_init_hp_out(codec);
16852 alc662_auto_init_analog_input(codec);
16853 alc662_auto_init_input_src(codec);
16854 if (spec->unsol_event)
16855 alc_inithook(codec);
16858 static int patch_alc662(struct hda_codec *codec)
16860 struct alc_spec *spec;
16861 int err, board_config;
16863 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16867 codec->spec = spec;
16869 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16871 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16874 if (board_config < 0) {
16875 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16876 "trying auto-probe from BIOS...\n");
16877 board_config = ALC662_AUTO;
16880 if (board_config == ALC662_AUTO) {
16881 /* automatic parse from the BIOS config */
16882 err = alc662_parse_auto_config(codec);
16888 "hda_codec: Cannot set up configuration "
16889 "from BIOS. Using base mode...\n");
16890 board_config = ALC662_3ST_2ch_DIG;
16894 err = snd_hda_attach_beep_device(codec, 0x1);
16900 if (board_config != ALC662_AUTO)
16901 setup_preset(spec, &alc662_presets[board_config]);
16903 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16904 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16906 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16907 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16909 spec->adc_nids = alc662_adc_nids;
16910 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16911 spec->capsrc_nids = alc662_capsrc_nids;
16912 spec->capture_style = CAPT_MIX;
16914 if (!spec->cap_mixer)
16915 set_capture_mixer(spec);
16916 if (codec->vendor_id == 0x10ec0662)
16917 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16919 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
16921 spec->vmaster_nid = 0x02;
16923 codec->patch_ops = alc_patch_ops;
16924 if (board_config == ALC662_AUTO)
16925 spec->init_hook = alc662_auto_init;
16926 #ifdef CONFIG_SND_HDA_POWER_SAVE
16927 if (!spec->loopback.amplist)
16928 spec->loopback.amplist = alc662_loopbacks;
16930 codec->proc_widget_hook = print_realtek_coef;
16938 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16939 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16940 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16941 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16942 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16943 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16944 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16945 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16946 .patch = patch_alc861 },
16947 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16948 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16949 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16950 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16951 .patch = patch_alc883 },
16952 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16953 .patch = patch_alc662 },
16954 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16955 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16956 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16957 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16958 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16959 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16960 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16961 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16962 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16963 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16964 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16965 .patch = patch_alc883 },
16966 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16967 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16968 {} /* terminator */
16971 MODULE_ALIAS("snd-hda-codec-id:10ec*");
16973 MODULE_LICENSE("GPL");
16974 MODULE_DESCRIPTION("Realtek HD-audio codec");
16976 static struct hda_codec_preset_list realtek_list = {
16977 .preset = snd_hda_preset_realtek,
16978 .owner = THIS_MODULE,
16981 static int __init patch_realtek_init(void)
16983 return snd_hda_add_codec_preset(&realtek_list);
16986 static void __exit patch_realtek_exit(void)
16988 snd_hda_delete_codec_preset(&realtek_list);
16991 module_init(patch_realtek_init)
16992 module_exit(patch_realtek_exit)