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; /* 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; /* 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 info->name = spec->stream_name_analog;
3173 if (spec->stream_analog_playback) {
3174 if (snd_BUG_ON(!spec->multiout.dac_nids))
3176 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3177 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3179 if (spec->stream_analog_capture) {
3180 if (snd_BUG_ON(!spec->adc_nids))
3182 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3183 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3186 if (spec->channel_mode) {
3187 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3188 for (i = 0; i < spec->num_channel_mode; i++) {
3189 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3190 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3196 /* SPDIF for stream index #1 */
3197 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3198 codec->num_pcms = 2;
3199 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3200 info = spec->pcm_rec + 1;
3201 info->name = spec->stream_name_digital;
3202 if (spec->dig_out_type)
3203 info->pcm_type = spec->dig_out_type;
3205 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3206 if (spec->multiout.dig_out_nid &&
3207 spec->stream_digital_playback) {
3208 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3209 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3211 if (spec->dig_in_nid &&
3212 spec->stream_digital_capture) {
3213 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3214 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3216 /* FIXME: do we need this for all Realtek codec models? */
3217 codec->spdif_status_reset = 1;
3220 if (spec->no_analog)
3223 /* If the use of more than one ADC is requested for the current
3224 * model, configure a second analog capture-only PCM.
3226 /* Additional Analaog capture for index #2 */
3227 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3228 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3229 codec->num_pcms = 3;
3230 info = spec->pcm_rec + 2;
3231 info->name = spec->stream_name_analog;
3232 if (spec->alt_dac_nid) {
3233 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3234 *spec->stream_analog_alt_playback;
3235 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3238 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3239 alc_pcm_null_stream;
3240 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3242 if (spec->num_adc_nids > 1) {
3243 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3244 *spec->stream_analog_alt_capture;
3245 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3247 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3248 spec->num_adc_nids - 1;
3250 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3251 alc_pcm_null_stream;
3252 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3259 static void alc_free_kctls(struct hda_codec *codec)
3261 struct alc_spec *spec = codec->spec;
3263 if (spec->kctls.list) {
3264 struct snd_kcontrol_new *kctl = spec->kctls.list;
3266 for (i = 0; i < spec->kctls.used; i++)
3267 kfree(kctl[i].name);
3269 snd_array_free(&spec->kctls);
3272 static void alc_free(struct hda_codec *codec)
3274 struct alc_spec *spec = codec->spec;
3279 alc_free_kctls(codec);
3281 snd_hda_detach_beep_device(codec);
3284 #ifdef SND_HDA_NEEDS_RESUME
3285 static int alc_resume(struct hda_codec *codec)
3287 codec->patch_ops.init(codec);
3288 snd_hda_codec_resume_amp(codec);
3289 snd_hda_codec_resume_cache(codec);
3296 static struct hda_codec_ops alc_patch_ops = {
3297 .build_controls = alc_build_controls,
3298 .build_pcms = alc_build_pcms,
3301 .unsol_event = alc_unsol_event,
3302 #ifdef SND_HDA_NEEDS_RESUME
3303 .resume = alc_resume,
3305 #ifdef CONFIG_SND_HDA_POWER_SAVE
3306 .check_power_status = alc_check_power_status,
3312 * Test configuration for debugging
3314 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3317 #ifdef CONFIG_SND_DEBUG
3318 static hda_nid_t alc880_test_dac_nids[4] = {
3319 0x02, 0x03, 0x04, 0x05
3322 static struct hda_input_mux alc880_test_capture_source = {
3331 { "Surround", 0x6 },
3335 static struct hda_channel_mode alc880_test_modes[4] = {
3342 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3343 struct snd_ctl_elem_info *uinfo)
3345 static char *texts[] = {
3346 "N/A", "Line Out", "HP Out",
3347 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3349 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3351 uinfo->value.enumerated.items = 8;
3352 if (uinfo->value.enumerated.item >= 8)
3353 uinfo->value.enumerated.item = 7;
3354 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3358 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3359 struct snd_ctl_elem_value *ucontrol)
3361 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3362 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3363 unsigned int pin_ctl, item = 0;
3365 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3366 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3367 if (pin_ctl & AC_PINCTL_OUT_EN) {
3368 if (pin_ctl & AC_PINCTL_HP_EN)
3372 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3373 switch (pin_ctl & AC_PINCTL_VREFEN) {
3374 case AC_PINCTL_VREF_HIZ: item = 3; break;
3375 case AC_PINCTL_VREF_50: item = 4; break;
3376 case AC_PINCTL_VREF_GRD: item = 5; break;
3377 case AC_PINCTL_VREF_80: item = 6; break;
3378 case AC_PINCTL_VREF_100: item = 7; break;
3381 ucontrol->value.enumerated.item[0] = item;
3385 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3386 struct snd_ctl_elem_value *ucontrol)
3388 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3389 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3390 static unsigned int ctls[] = {
3391 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3392 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3393 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3394 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3395 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3396 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3398 unsigned int old_ctl, new_ctl;
3400 old_ctl = snd_hda_codec_read(codec, nid, 0,
3401 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3402 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3403 if (old_ctl != new_ctl) {
3405 snd_hda_codec_write_cache(codec, nid, 0,
3406 AC_VERB_SET_PIN_WIDGET_CONTROL,
3408 val = ucontrol->value.enumerated.item[0] >= 3 ?
3410 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3417 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3418 struct snd_ctl_elem_info *uinfo)
3420 static char *texts[] = {
3421 "Front", "Surround", "CLFE", "Side"
3423 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3425 uinfo->value.enumerated.items = 4;
3426 if (uinfo->value.enumerated.item >= 4)
3427 uinfo->value.enumerated.item = 3;
3428 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3432 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3433 struct snd_ctl_elem_value *ucontrol)
3435 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3436 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3439 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3440 ucontrol->value.enumerated.item[0] = sel & 3;
3444 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3445 struct snd_ctl_elem_value *ucontrol)
3447 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3448 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3451 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3452 if (ucontrol->value.enumerated.item[0] != sel) {
3453 sel = ucontrol->value.enumerated.item[0] & 3;
3454 snd_hda_codec_write_cache(codec, nid, 0,
3455 AC_VERB_SET_CONNECT_SEL, sel);
3461 #define PIN_CTL_TEST(xname,nid) { \
3462 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3464 .info = alc_test_pin_ctl_info, \
3465 .get = alc_test_pin_ctl_get, \
3466 .put = alc_test_pin_ctl_put, \
3467 .private_value = nid \
3470 #define PIN_SRC_TEST(xname,nid) { \
3471 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3473 .info = alc_test_pin_src_info, \
3474 .get = alc_test_pin_src_get, \
3475 .put = alc_test_pin_src_put, \
3476 .private_value = nid \
3479 static struct snd_kcontrol_new alc880_test_mixer[] = {
3480 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3481 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3482 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3483 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3484 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3485 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3486 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3487 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3488 PIN_CTL_TEST("Front Pin Mode", 0x14),
3489 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3490 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3491 PIN_CTL_TEST("Side Pin Mode", 0x17),
3492 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3493 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3494 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3495 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3496 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3497 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3498 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3499 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3500 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3501 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3502 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3503 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3504 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3505 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3506 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3507 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3508 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3509 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3511 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3512 .name = "Channel Mode",
3513 .info = alc_ch_mode_info,
3514 .get = alc_ch_mode_get,
3515 .put = alc_ch_mode_put,
3520 static struct hda_verb alc880_test_init_verbs[] = {
3521 /* Unmute inputs of 0x0c - 0x0f */
3522 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3523 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3524 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3525 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3526 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3527 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3528 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3529 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3530 /* Vol output for 0x0c-0x0f */
3531 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3532 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3533 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3534 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3535 /* Set output pins 0x14-0x17 */
3536 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3537 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3538 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3539 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3540 /* Unmute output pins 0x14-0x17 */
3541 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3542 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3543 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3544 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3545 /* Set input pins 0x18-0x1c */
3546 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3547 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3548 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3549 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3550 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3551 /* Mute input pins 0x18-0x1b */
3552 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3553 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3554 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3555 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3557 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3558 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3559 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3560 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3561 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3562 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3563 /* Analog input/passthru */
3564 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3565 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3566 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3567 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3568 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3576 static const char *alc880_models[ALC880_MODEL_LAST] = {
3577 [ALC880_3ST] = "3stack",
3578 [ALC880_TCL_S700] = "tcl",
3579 [ALC880_3ST_DIG] = "3stack-digout",
3580 [ALC880_CLEVO] = "clevo",
3581 [ALC880_5ST] = "5stack",
3582 [ALC880_5ST_DIG] = "5stack-digout",
3583 [ALC880_W810] = "w810",
3584 [ALC880_Z71V] = "z71v",
3585 [ALC880_6ST] = "6stack",
3586 [ALC880_6ST_DIG] = "6stack-digout",
3587 [ALC880_ASUS] = "asus",
3588 [ALC880_ASUS_W1V] = "asus-w1v",
3589 [ALC880_ASUS_DIG] = "asus-dig",
3590 [ALC880_ASUS_DIG2] = "asus-dig2",
3591 [ALC880_UNIWILL_DIG] = "uniwill",
3592 [ALC880_UNIWILL_P53] = "uniwill-p53",
3593 [ALC880_FUJITSU] = "fujitsu",
3594 [ALC880_F1734] = "F1734",
3596 [ALC880_LG_LW] = "lg-lw",
3597 [ALC880_MEDION_RIM] = "medion",
3598 #ifdef CONFIG_SND_DEBUG
3599 [ALC880_TEST] = "test",
3601 [ALC880_AUTO] = "auto",
3604 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3605 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3606 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3607 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3608 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3609 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3610 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3611 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3612 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3613 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3614 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3615 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3616 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3617 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3618 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3619 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3620 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3621 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3622 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3623 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3624 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3625 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3626 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3627 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3628 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3629 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3630 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3631 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3632 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3633 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3634 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3635 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3636 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3637 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3638 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3639 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3640 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3641 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3642 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3643 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3644 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3645 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3646 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3647 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3648 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3649 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3650 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3651 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3652 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3653 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3654 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3655 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3656 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3657 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3658 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3659 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3660 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3661 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3662 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3663 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3664 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3665 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3666 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3667 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3668 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3669 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3670 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3671 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3672 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3674 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3675 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3676 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3681 * ALC880 codec presets
3683 static struct alc_config_preset alc880_presets[] = {
3685 .mixers = { alc880_three_stack_mixer },
3686 .init_verbs = { alc880_volume_init_verbs,
3687 alc880_pin_3stack_init_verbs },
3688 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3689 .dac_nids = alc880_dac_nids,
3690 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3691 .channel_mode = alc880_threestack_modes,
3693 .input_mux = &alc880_capture_source,
3695 [ALC880_3ST_DIG] = {
3696 .mixers = { alc880_three_stack_mixer },
3697 .init_verbs = { alc880_volume_init_verbs,
3698 alc880_pin_3stack_init_verbs },
3699 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3700 .dac_nids = alc880_dac_nids,
3701 .dig_out_nid = ALC880_DIGOUT_NID,
3702 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3703 .channel_mode = alc880_threestack_modes,
3705 .input_mux = &alc880_capture_source,
3707 [ALC880_TCL_S700] = {
3708 .mixers = { alc880_tcl_s700_mixer },
3709 .init_verbs = { alc880_volume_init_verbs,
3710 alc880_pin_tcl_S700_init_verbs,
3711 alc880_gpio2_init_verbs },
3712 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3713 .dac_nids = alc880_dac_nids,
3714 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3715 .num_adc_nids = 1, /* single ADC */
3717 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3718 .channel_mode = alc880_2_jack_modes,
3719 .input_mux = &alc880_capture_source,
3722 .mixers = { alc880_three_stack_mixer,
3723 alc880_five_stack_mixer},
3724 .init_verbs = { alc880_volume_init_verbs,
3725 alc880_pin_5stack_init_verbs },
3726 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3727 .dac_nids = alc880_dac_nids,
3728 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3729 .channel_mode = alc880_fivestack_modes,
3730 .input_mux = &alc880_capture_source,
3732 [ALC880_5ST_DIG] = {
3733 .mixers = { alc880_three_stack_mixer,
3734 alc880_five_stack_mixer },
3735 .init_verbs = { alc880_volume_init_verbs,
3736 alc880_pin_5stack_init_verbs },
3737 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3738 .dac_nids = alc880_dac_nids,
3739 .dig_out_nid = ALC880_DIGOUT_NID,
3740 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3741 .channel_mode = alc880_fivestack_modes,
3742 .input_mux = &alc880_capture_source,
3745 .mixers = { alc880_six_stack_mixer },
3746 .init_verbs = { alc880_volume_init_verbs,
3747 alc880_pin_6stack_init_verbs },
3748 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3749 .dac_nids = alc880_6st_dac_nids,
3750 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3751 .channel_mode = alc880_sixstack_modes,
3752 .input_mux = &alc880_6stack_capture_source,
3754 [ALC880_6ST_DIG] = {
3755 .mixers = { alc880_six_stack_mixer },
3756 .init_verbs = { alc880_volume_init_verbs,
3757 alc880_pin_6stack_init_verbs },
3758 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3759 .dac_nids = alc880_6st_dac_nids,
3760 .dig_out_nid = ALC880_DIGOUT_NID,
3761 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3762 .channel_mode = alc880_sixstack_modes,
3763 .input_mux = &alc880_6stack_capture_source,
3766 .mixers = { alc880_w810_base_mixer },
3767 .init_verbs = { alc880_volume_init_verbs,
3768 alc880_pin_w810_init_verbs,
3769 alc880_gpio2_init_verbs },
3770 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3771 .dac_nids = alc880_w810_dac_nids,
3772 .dig_out_nid = ALC880_DIGOUT_NID,
3773 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3774 .channel_mode = alc880_w810_modes,
3775 .input_mux = &alc880_capture_source,
3778 .mixers = { alc880_z71v_mixer },
3779 .init_verbs = { alc880_volume_init_verbs,
3780 alc880_pin_z71v_init_verbs },
3781 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3782 .dac_nids = alc880_z71v_dac_nids,
3783 .dig_out_nid = ALC880_DIGOUT_NID,
3785 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3786 .channel_mode = alc880_2_jack_modes,
3787 .input_mux = &alc880_capture_source,
3790 .mixers = { alc880_f1734_mixer },
3791 .init_verbs = { alc880_volume_init_verbs,
3792 alc880_pin_f1734_init_verbs },
3793 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3794 .dac_nids = alc880_f1734_dac_nids,
3796 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3797 .channel_mode = alc880_2_jack_modes,
3798 .input_mux = &alc880_f1734_capture_source,
3799 .unsol_event = alc880_uniwill_p53_unsol_event,
3800 .init_hook = alc880_uniwill_p53_init_hook,
3803 .mixers = { alc880_asus_mixer },
3804 .init_verbs = { alc880_volume_init_verbs,
3805 alc880_pin_asus_init_verbs,
3806 alc880_gpio1_init_verbs },
3807 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3808 .dac_nids = alc880_asus_dac_nids,
3809 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3810 .channel_mode = alc880_asus_modes,
3812 .input_mux = &alc880_capture_source,
3814 [ALC880_ASUS_DIG] = {
3815 .mixers = { alc880_asus_mixer },
3816 .init_verbs = { alc880_volume_init_verbs,
3817 alc880_pin_asus_init_verbs,
3818 alc880_gpio1_init_verbs },
3819 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3820 .dac_nids = alc880_asus_dac_nids,
3821 .dig_out_nid = ALC880_DIGOUT_NID,
3822 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3823 .channel_mode = alc880_asus_modes,
3825 .input_mux = &alc880_capture_source,
3827 [ALC880_ASUS_DIG2] = {
3828 .mixers = { alc880_asus_mixer },
3829 .init_verbs = { alc880_volume_init_verbs,
3830 alc880_pin_asus_init_verbs,
3831 alc880_gpio2_init_verbs }, /* use GPIO2 */
3832 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3833 .dac_nids = alc880_asus_dac_nids,
3834 .dig_out_nid = ALC880_DIGOUT_NID,
3835 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3836 .channel_mode = alc880_asus_modes,
3838 .input_mux = &alc880_capture_source,
3840 [ALC880_ASUS_W1V] = {
3841 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3842 .init_verbs = { alc880_volume_init_verbs,
3843 alc880_pin_asus_init_verbs,
3844 alc880_gpio1_init_verbs },
3845 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3846 .dac_nids = alc880_asus_dac_nids,
3847 .dig_out_nid = ALC880_DIGOUT_NID,
3848 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3849 .channel_mode = alc880_asus_modes,
3851 .input_mux = &alc880_capture_source,
3853 [ALC880_UNIWILL_DIG] = {
3854 .mixers = { alc880_asus_mixer },
3855 .init_verbs = { alc880_volume_init_verbs,
3856 alc880_pin_asus_init_verbs },
3857 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3858 .dac_nids = alc880_asus_dac_nids,
3859 .dig_out_nid = ALC880_DIGOUT_NID,
3860 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3861 .channel_mode = alc880_asus_modes,
3863 .input_mux = &alc880_capture_source,
3865 [ALC880_UNIWILL] = {
3866 .mixers = { alc880_uniwill_mixer },
3867 .init_verbs = { alc880_volume_init_verbs,
3868 alc880_uniwill_init_verbs },
3869 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3870 .dac_nids = alc880_asus_dac_nids,
3871 .dig_out_nid = ALC880_DIGOUT_NID,
3872 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3873 .channel_mode = alc880_threestack_modes,
3875 .input_mux = &alc880_capture_source,
3876 .unsol_event = alc880_uniwill_unsol_event,
3877 .init_hook = alc880_uniwill_init_hook,
3879 [ALC880_UNIWILL_P53] = {
3880 .mixers = { alc880_uniwill_p53_mixer },
3881 .init_verbs = { alc880_volume_init_verbs,
3882 alc880_uniwill_p53_init_verbs },
3883 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3884 .dac_nids = alc880_asus_dac_nids,
3885 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3886 .channel_mode = alc880_threestack_modes,
3887 .input_mux = &alc880_capture_source,
3888 .unsol_event = alc880_uniwill_p53_unsol_event,
3889 .init_hook = alc880_uniwill_p53_init_hook,
3891 [ALC880_FUJITSU] = {
3892 .mixers = { alc880_fujitsu_mixer },
3893 .init_verbs = { alc880_volume_init_verbs,
3894 alc880_uniwill_p53_init_verbs,
3895 alc880_beep_init_verbs },
3896 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3897 .dac_nids = alc880_dac_nids,
3898 .dig_out_nid = ALC880_DIGOUT_NID,
3899 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3900 .channel_mode = alc880_2_jack_modes,
3901 .input_mux = &alc880_capture_source,
3902 .unsol_event = alc880_uniwill_p53_unsol_event,
3903 .init_hook = alc880_uniwill_p53_init_hook,
3906 .mixers = { alc880_three_stack_mixer },
3907 .init_verbs = { alc880_volume_init_verbs,
3908 alc880_pin_clevo_init_verbs },
3909 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3910 .dac_nids = alc880_dac_nids,
3912 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3913 .channel_mode = alc880_threestack_modes,
3915 .input_mux = &alc880_capture_source,
3918 .mixers = { alc880_lg_mixer },
3919 .init_verbs = { alc880_volume_init_verbs,
3920 alc880_lg_init_verbs },
3921 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3922 .dac_nids = alc880_lg_dac_nids,
3923 .dig_out_nid = ALC880_DIGOUT_NID,
3924 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3925 .channel_mode = alc880_lg_ch_modes,
3927 .input_mux = &alc880_lg_capture_source,
3928 .unsol_event = alc_automute_amp_unsol_event,
3929 .init_hook = alc880_lg_init_hook,
3930 #ifdef CONFIG_SND_HDA_POWER_SAVE
3931 .loopbacks = alc880_lg_loopbacks,
3935 .mixers = { alc880_lg_lw_mixer },
3936 .init_verbs = { alc880_volume_init_verbs,
3937 alc880_lg_lw_init_verbs },
3938 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3939 .dac_nids = alc880_dac_nids,
3940 .dig_out_nid = ALC880_DIGOUT_NID,
3941 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3942 .channel_mode = alc880_lg_lw_modes,
3943 .input_mux = &alc880_lg_lw_capture_source,
3944 .unsol_event = alc_automute_amp_unsol_event,
3945 .init_hook = alc880_lg_lw_init_hook,
3947 [ALC880_MEDION_RIM] = {
3948 .mixers = { alc880_medion_rim_mixer },
3949 .init_verbs = { alc880_volume_init_verbs,
3950 alc880_medion_rim_init_verbs,
3951 alc_gpio2_init_verbs },
3952 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3953 .dac_nids = alc880_dac_nids,
3954 .dig_out_nid = ALC880_DIGOUT_NID,
3955 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3956 .channel_mode = alc880_2_jack_modes,
3957 .input_mux = &alc880_medion_rim_capture_source,
3958 .unsol_event = alc880_medion_rim_unsol_event,
3959 .init_hook = alc880_medion_rim_init_hook,
3961 #ifdef CONFIG_SND_DEBUG
3963 .mixers = { alc880_test_mixer },
3964 .init_verbs = { alc880_test_init_verbs },
3965 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3966 .dac_nids = alc880_test_dac_nids,
3967 .dig_out_nid = ALC880_DIGOUT_NID,
3968 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3969 .channel_mode = alc880_test_modes,
3970 .input_mux = &alc880_test_capture_source,
3976 * Automatic parse of I/O pins from the BIOS configuration
3981 ALC_CTL_WIDGET_MUTE,
3984 static struct snd_kcontrol_new alc880_control_templates[] = {
3985 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3986 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3987 HDA_BIND_MUTE(NULL, 0, 0, 0),
3990 /* add dynamic controls */
3991 static int add_control(struct alc_spec *spec, int type, const char *name,
3994 struct snd_kcontrol_new *knew;
3996 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3997 knew = snd_array_new(&spec->kctls);
4000 *knew = alc880_control_templates[type];
4001 knew->name = kstrdup(name, GFP_KERNEL);
4004 knew->private_value = val;
4008 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4009 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4010 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4011 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4012 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4013 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4014 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4015 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4016 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4017 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4018 #define ALC880_PIN_CD_NID 0x1c
4020 /* fill in the dac_nids table from the parsed pin configuration */
4021 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4022 const struct auto_pin_cfg *cfg)
4028 memset(assigned, 0, sizeof(assigned));
4029 spec->multiout.dac_nids = spec->private_dac_nids;
4031 /* check the pins hardwired to audio widget */
4032 for (i = 0; i < cfg->line_outs; i++) {
4033 nid = cfg->line_out_pins[i];
4034 if (alc880_is_fixed_pin(nid)) {
4035 int idx = alc880_fixed_pin_idx(nid);
4036 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4040 /* left pins can be connect to any audio widget */
4041 for (i = 0; i < cfg->line_outs; i++) {
4042 nid = cfg->line_out_pins[i];
4043 if (alc880_is_fixed_pin(nid))
4045 /* search for an empty channel */
4046 for (j = 0; j < cfg->line_outs; j++) {
4048 spec->multiout.dac_nids[i] =
4049 alc880_idx_to_dac(j);
4055 spec->multiout.num_dacs = cfg->line_outs;
4059 /* add playback controls from the parsed DAC table */
4060 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4061 const struct auto_pin_cfg *cfg)
4064 static const char *chname[4] = {
4065 "Front", "Surround", NULL /*CLFE*/, "Side"
4070 for (i = 0; i < cfg->line_outs; i++) {
4071 if (!spec->multiout.dac_nids[i])
4073 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4076 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4077 "Center Playback Volume",
4078 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4082 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4083 "LFE Playback Volume",
4084 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4088 err = add_control(spec, ALC_CTL_BIND_MUTE,
4089 "Center Playback Switch",
4090 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4094 err = add_control(spec, ALC_CTL_BIND_MUTE,
4095 "LFE Playback Switch",
4096 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4101 sprintf(name, "%s Playback Volume", chname[i]);
4102 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4103 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4107 sprintf(name, "%s Playback Switch", chname[i]);
4108 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4109 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4118 /* add playback controls for speaker and HP outputs */
4119 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4129 if (alc880_is_fixed_pin(pin)) {
4130 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4131 /* specify the DAC as the extra output */
4132 if (!spec->multiout.hp_nid)
4133 spec->multiout.hp_nid = nid;
4135 spec->multiout.extra_out_nid[0] = nid;
4136 /* control HP volume/switch on the output mixer amp */
4137 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4138 sprintf(name, "%s Playback Volume", pfx);
4139 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4140 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4143 sprintf(name, "%s Playback Switch", pfx);
4144 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4145 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4148 } else if (alc880_is_multi_pin(pin)) {
4149 /* set manual connection */
4150 /* we have only a switch on HP-out PIN */
4151 sprintf(name, "%s Playback Switch", pfx);
4152 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4153 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4160 /* create input playback/capture controls for the given pin */
4161 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4162 const char *ctlname,
4163 int idx, hda_nid_t mix_nid)
4168 sprintf(name, "%s Playback Volume", ctlname);
4169 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4170 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4173 sprintf(name, "%s Playback Switch", ctlname);
4174 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4175 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4181 /* create playback/capture controls for input pins */
4182 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4183 const struct auto_pin_cfg *cfg)
4185 struct hda_input_mux *imux = &spec->private_imux[0];
4188 for (i = 0; i < AUTO_PIN_LAST; i++) {
4189 if (alc880_is_input_pin(cfg->input_pins[i])) {
4190 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4191 err = new_analog_input(spec, cfg->input_pins[i],
4192 auto_pin_cfg_labels[i],
4196 imux->items[imux->num_items].label =
4197 auto_pin_cfg_labels[i];
4198 imux->items[imux->num_items].index =
4199 alc880_input_pin_idx(cfg->input_pins[i]);
4206 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4207 unsigned int pin_type)
4209 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4212 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4216 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4217 hda_nid_t nid, int pin_type,
4220 alc_set_pin_output(codec, nid, pin_type);
4221 /* need the manual connection? */
4222 if (alc880_is_multi_pin(nid)) {
4223 struct alc_spec *spec = codec->spec;
4224 int idx = alc880_multi_pin_idx(nid);
4225 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4226 AC_VERB_SET_CONNECT_SEL,
4227 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4231 static int get_pin_type(int line_out_type)
4233 if (line_out_type == AUTO_PIN_HP_OUT)
4239 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4241 struct alc_spec *spec = codec->spec;
4244 for (i = 0; i < spec->autocfg.line_outs; i++) {
4245 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4246 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4247 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4251 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4253 struct alc_spec *spec = codec->spec;
4256 pin = spec->autocfg.speaker_pins[0];
4257 if (pin) /* connect to front */
4258 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4259 pin = spec->autocfg.hp_pins[0];
4260 if (pin) /* connect to front */
4261 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4264 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4266 struct alc_spec *spec = codec->spec;
4269 for (i = 0; i < AUTO_PIN_LAST; i++) {
4270 hda_nid_t nid = spec->autocfg.input_pins[i];
4271 if (alc880_is_input_pin(nid)) {
4272 alc_set_input_pin(codec, nid, i);
4273 if (nid != ALC880_PIN_CD_NID &&
4274 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4275 snd_hda_codec_write(codec, nid, 0,
4276 AC_VERB_SET_AMP_GAIN_MUTE,
4282 /* parse the BIOS configuration and set up the alc_spec */
4283 /* return 1 if successful, 0 if the proper config is not found,
4284 * or a negative error code
4286 static int alc880_parse_auto_config(struct hda_codec *codec)
4288 struct alc_spec *spec = codec->spec;
4290 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4292 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4296 if (!spec->autocfg.line_outs)
4297 return 0; /* can't find valid BIOS pin config */
4299 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4302 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4305 err = alc880_auto_create_extra_out(spec,
4306 spec->autocfg.speaker_pins[0],
4310 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4314 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4318 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4320 /* check multiple SPDIF-out (for recent codecs) */
4321 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4323 err = snd_hda_get_connections(codec,
4324 spec->autocfg.dig_out_pins[i],
4329 spec->multiout.dig_out_nid = dig_nid;
4331 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4332 spec->slave_dig_outs[i - 1] = dig_nid;
4333 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4337 if (spec->autocfg.dig_in_pin)
4338 spec->dig_in_nid = ALC880_DIGIN_NID;
4340 if (spec->kctls.list)
4341 add_mixer(spec, spec->kctls.list);
4343 add_verb(spec, alc880_volume_init_verbs);
4345 spec->num_mux_defs = 1;
4346 spec->input_mux = &spec->private_imux[0];
4348 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4353 /* additional initialization for auto-configuration model */
4354 static void alc880_auto_init(struct hda_codec *codec)
4356 struct alc_spec *spec = codec->spec;
4357 alc880_auto_init_multi_out(codec);
4358 alc880_auto_init_extra_out(codec);
4359 alc880_auto_init_analog_input(codec);
4360 if (spec->unsol_event)
4361 alc_inithook(codec);
4364 static void set_capture_mixer(struct alc_spec *spec)
4366 static struct snd_kcontrol_new *caps[2][3] = {
4367 { alc_capture_mixer_nosrc1,
4368 alc_capture_mixer_nosrc2,
4369 alc_capture_mixer_nosrc3 },
4370 { alc_capture_mixer1,
4372 alc_capture_mixer3 },
4374 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4376 if (spec->input_mux && spec->input_mux->num_items > 1)
4380 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4384 #define set_beep_amp(spec, nid, idx, dir) \
4385 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4388 * OK, here we have finally the patch for ALC880
4391 static int patch_alc880(struct hda_codec *codec)
4393 struct alc_spec *spec;
4397 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4403 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4406 if (board_config < 0) {
4407 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4408 "trying auto-probe from BIOS...\n");
4409 board_config = ALC880_AUTO;
4412 if (board_config == ALC880_AUTO) {
4413 /* automatic parse from the BIOS config */
4414 err = alc880_parse_auto_config(codec);
4420 "hda_codec: Cannot set up configuration "
4421 "from BIOS. Using 3-stack mode...\n");
4422 board_config = ALC880_3ST;
4426 err = snd_hda_attach_beep_device(codec, 0x1);
4432 if (board_config != ALC880_AUTO)
4433 setup_preset(spec, &alc880_presets[board_config]);
4435 spec->stream_name_analog = "ALC880 Analog";
4436 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4437 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4438 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4440 spec->stream_name_digital = "ALC880 Digital";
4441 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4442 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4444 if (!spec->adc_nids && spec->input_mux) {
4445 /* check whether NID 0x07 is valid */
4446 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4448 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4449 if (wcap != AC_WID_AUD_IN) {
4450 spec->adc_nids = alc880_adc_nids_alt;
4451 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4453 spec->adc_nids = alc880_adc_nids;
4454 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4457 set_capture_mixer(spec);
4458 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4460 spec->vmaster_nid = 0x0c;
4462 codec->patch_ops = alc_patch_ops;
4463 if (board_config == ALC880_AUTO)
4464 spec->init_hook = alc880_auto_init;
4465 #ifdef CONFIG_SND_HDA_POWER_SAVE
4466 if (!spec->loopback.amplist)
4467 spec->loopback.amplist = alc880_loopbacks;
4469 codec->proc_widget_hook = print_realtek_coef;
4479 static hda_nid_t alc260_dac_nids[1] = {
4484 static hda_nid_t alc260_adc_nids[1] = {
4489 static hda_nid_t alc260_adc_nids_alt[1] = {
4494 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4495 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4497 static hda_nid_t alc260_dual_adc_nids[2] = {
4502 #define ALC260_DIGOUT_NID 0x03
4503 #define ALC260_DIGIN_NID 0x06
4505 static struct hda_input_mux alc260_capture_source = {
4509 { "Front Mic", 0x1 },
4515 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4516 * headphone jack and the internal CD lines since these are the only pins at
4517 * which audio can appear. For flexibility, also allow the option of
4518 * recording the mixer output on the second ADC (ADC0 doesn't have a
4519 * connection to the mixer output).
4521 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4525 { "Mic/Line", 0x0 },
4527 { "Headphone", 0x2 },
4533 { "Mic/Line", 0x0 },
4535 { "Headphone", 0x2 },
4542 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4543 * the Fujitsu S702x, but jacks are marked differently.
4545 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4552 { "Headphone", 0x5 },
4561 { "Headphone", 0x6 },
4567 /* Maxdata Favorit 100XS */
4568 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4572 { "Line/Mic", 0x0 },
4579 { "Line/Mic", 0x0 },
4587 * This is just place-holder, so there's something for alc_build_pcms to look
4588 * at when it calculates the maximum number of channels. ALC260 has no mixer
4589 * element which allows changing the channel mode, so the verb list is
4592 static struct hda_channel_mode alc260_modes[1] = {
4597 /* Mixer combinations
4599 * basic: base_output + input + pc_beep + capture
4600 * HP: base_output + input + capture_alt
4601 * HP_3013: hp_3013 + input + capture
4602 * fujitsu: fujitsu + capture
4603 * acer: acer + capture
4606 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4607 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4608 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4609 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4610 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4611 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4612 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4616 static struct snd_kcontrol_new alc260_input_mixer[] = {
4617 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4618 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4619 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4620 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4621 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4622 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4623 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4624 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4628 /* update HP, line and mono out pins according to the master switch */
4629 static void alc260_hp_master_update(struct hda_codec *codec,
4630 hda_nid_t hp, hda_nid_t line,
4633 struct alc_spec *spec = codec->spec;
4634 unsigned int val = spec->master_sw ? PIN_HP : 0;
4635 /* change HP and line-out pins */
4636 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4638 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4640 /* mono (speaker) depending on the HP jack sense */
4641 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4642 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4646 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4647 struct snd_ctl_elem_value *ucontrol)
4649 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4650 struct alc_spec *spec = codec->spec;
4651 *ucontrol->value.integer.value = spec->master_sw;
4655 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4656 struct snd_ctl_elem_value *ucontrol)
4658 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4659 struct alc_spec *spec = codec->spec;
4660 int val = !!*ucontrol->value.integer.value;
4661 hda_nid_t hp, line, mono;
4663 if (val == spec->master_sw)
4665 spec->master_sw = val;
4666 hp = (kcontrol->private_value >> 16) & 0xff;
4667 line = (kcontrol->private_value >> 8) & 0xff;
4668 mono = kcontrol->private_value & 0xff;
4669 alc260_hp_master_update(codec, hp, line, mono);
4673 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4675 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4676 .name = "Master Playback Switch",
4677 .info = snd_ctl_boolean_mono_info,
4678 .get = alc260_hp_master_sw_get,
4679 .put = alc260_hp_master_sw_put,
4680 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4682 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4683 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4684 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4685 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4686 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4688 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4692 static struct hda_verb alc260_hp_unsol_verbs[] = {
4693 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4697 static void alc260_hp_automute(struct hda_codec *codec)
4699 struct alc_spec *spec = codec->spec;
4700 unsigned int present;
4702 present = snd_hda_codec_read(codec, 0x10, 0,
4703 AC_VERB_GET_PIN_SENSE, 0);
4704 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4705 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4708 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4710 if ((res >> 26) == ALC880_HP_EVENT)
4711 alc260_hp_automute(codec);
4714 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4716 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4717 .name = "Master Playback Switch",
4718 .info = snd_ctl_boolean_mono_info,
4719 .get = alc260_hp_master_sw_get,
4720 .put = alc260_hp_master_sw_put,
4721 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4723 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4724 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4725 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4726 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4727 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4728 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4729 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4730 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4734 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4735 .ops = &snd_hda_bind_vol,
4737 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4738 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4739 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4744 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4745 .ops = &snd_hda_bind_sw,
4747 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4748 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4753 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4754 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4755 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4756 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4757 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4761 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4762 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4766 static void alc260_hp_3013_automute(struct hda_codec *codec)
4768 struct alc_spec *spec = codec->spec;
4769 unsigned int present;
4771 present = snd_hda_codec_read(codec, 0x15, 0,
4772 AC_VERB_GET_PIN_SENSE, 0);
4773 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4774 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4777 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4780 if ((res >> 26) == ALC880_HP_EVENT)
4781 alc260_hp_3013_automute(codec);
4784 static void alc260_hp_3012_automute(struct hda_codec *codec)
4786 unsigned int present, bits;
4788 present = snd_hda_codec_read(codec, 0x10, 0,
4789 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4791 bits = present ? 0 : PIN_OUT;
4792 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4794 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4796 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4800 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4803 if ((res >> 26) == ALC880_HP_EVENT)
4804 alc260_hp_3012_automute(codec);
4807 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4808 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4810 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4811 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4812 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4813 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4814 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4815 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4816 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4817 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4818 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4819 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4820 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4824 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4825 * versions of the ALC260 don't act on requests to enable mic bias from NID
4826 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4827 * datasheet doesn't mention this restriction. At this stage it's not clear
4828 * whether this behaviour is intentional or is a hardware bug in chip
4829 * revisions available in early 2006. Therefore for now allow the
4830 * "Headphone Jack Mode" control to span all choices, but if it turns out
4831 * that the lack of mic bias for this NID is intentional we could change the
4832 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4834 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4835 * don't appear to make the mic bias available from the "line" jack, even
4836 * though the NID used for this jack (0x14) can supply it. The theory is
4837 * that perhaps Acer have included blocking capacitors between the ALC260
4838 * and the output jack. If this turns out to be the case for all such
4839 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4840 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4842 * The C20x Tablet series have a mono internal speaker which is controlled
4843 * via the chip's Mono sum widget and pin complex, so include the necessary
4844 * controls for such models. On models without a "mono speaker" the control
4845 * won't do anything.
4847 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4848 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4849 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4850 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4851 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4853 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4855 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4856 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4857 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4858 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4859 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4860 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4861 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4862 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4866 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
4868 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
4869 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4870 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4871 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4872 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4873 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4874 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4878 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4879 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4881 static struct snd_kcontrol_new alc260_will_mixer[] = {
4882 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4883 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4884 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4885 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4886 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4887 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4888 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4889 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4890 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4891 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4895 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4896 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4898 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4899 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4900 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4901 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4902 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4903 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4904 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4905 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4906 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4907 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4908 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4913 * initialization verbs
4915 static struct hda_verb alc260_init_verbs[] = {
4916 /* Line In pin widget for input */
4917 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4918 /* CD pin widget for input */
4919 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4920 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4921 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4922 /* Mic2 (front panel) pin widget for input and vref at 80% */
4923 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4924 /* LINE-2 is used for line-out in rear */
4925 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4926 /* select line-out */
4927 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4929 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4931 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4933 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4934 /* mute capture amp left and right */
4935 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4936 /* set connection select to line in (default select for this ADC) */
4937 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4938 /* mute capture amp left and right */
4939 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4940 /* set connection select to line in (default select for this ADC) */
4941 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4942 /* set vol=0 Line-Out mixer amp left and right */
4943 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4944 /* unmute pin widget amp left and right (no gain on this amp) */
4945 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4946 /* set vol=0 HP mixer amp left and right */
4947 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4948 /* unmute pin widget amp left and right (no gain on this amp) */
4949 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4950 /* set vol=0 Mono mixer amp left and right */
4951 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4952 /* unmute pin widget amp left and right (no gain on this amp) */
4953 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4954 /* unmute LINE-2 out pin */
4955 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4956 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4959 /* mute analog inputs */
4960 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4961 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4962 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4963 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4964 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4965 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4966 /* mute Front out path */
4967 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4968 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4969 /* mute Headphone out path */
4970 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4971 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4972 /* mute Mono out path */
4973 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4974 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4978 #if 0 /* should be identical with alc260_init_verbs? */
4979 static struct hda_verb alc260_hp_init_verbs[] = {
4980 /* Headphone and output */
4981 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4983 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4984 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4985 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4986 /* Mic2 (front panel) pin widget for input and vref at 80% */
4987 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4988 /* Line In pin widget for input */
4989 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4990 /* Line-2 pin widget for output */
4991 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4992 /* CD pin widget for input */
4993 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4994 /* unmute amp left and right */
4995 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4996 /* set connection select to line in (default select for this ADC) */
4997 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4998 /* unmute Line-Out mixer amp left and right (volume = 0) */
4999 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5000 /* mute pin widget amp left and right (no gain on this amp) */
5001 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5002 /* unmute HP mixer amp left and right (volume = 0) */
5003 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5004 /* mute pin widget amp left and right (no gain on this amp) */
5005 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5006 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5009 /* mute analog inputs */
5010 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5011 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5012 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5013 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5014 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5015 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5016 /* Unmute Front out path */
5017 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5018 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5019 /* Unmute Headphone out path */
5020 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5021 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5022 /* Unmute Mono out path */
5023 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5024 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5029 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5030 /* Line out and output */
5031 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5033 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5034 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5035 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5036 /* Mic2 (front panel) pin widget for input and vref at 80% */
5037 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5038 /* Line In pin widget for input */
5039 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5040 /* Headphone pin widget for output */
5041 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5042 /* CD pin widget for input */
5043 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5044 /* unmute amp left and right */
5045 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5046 /* set connection select to line in (default select for this ADC) */
5047 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5048 /* unmute Line-Out mixer amp left and right (volume = 0) */
5049 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5050 /* mute pin widget amp left and right (no gain on this amp) */
5051 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5052 /* unmute HP mixer amp left and right (volume = 0) */
5053 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5054 /* mute pin widget amp left and right (no gain on this amp) */
5055 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5056 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5059 /* mute analog inputs */
5060 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5061 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5062 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5063 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5064 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5065 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5066 /* Unmute Front out path */
5067 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5068 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5069 /* Unmute Headphone out path */
5070 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5071 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5072 /* Unmute Mono out path */
5073 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5074 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5078 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5079 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5080 * audio = 0x16, internal speaker = 0x10.
5082 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5083 /* Disable all GPIOs */
5084 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5085 /* Internal speaker is connected to headphone pin */
5086 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5087 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5088 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5089 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5090 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5091 /* Ensure all other unused pins are disabled and muted. */
5092 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5093 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5094 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5095 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5096 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5097 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5098 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5099 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5101 /* Disable digital (SPDIF) pins */
5102 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5103 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5105 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5106 * when acting as an output.
5108 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5110 /* Start with output sum widgets muted and their output gains at min */
5111 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5112 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5113 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5114 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5115 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5116 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5117 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5118 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5119 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5121 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5122 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5123 /* Unmute Line1 pin widget output buffer since it starts as an output.
5124 * If the pin mode is changed by the user the pin mode control will
5125 * take care of enabling the pin's input/output buffers as needed.
5126 * Therefore there's no need to enable the input buffer at this
5129 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5130 /* Unmute input buffer of pin widget used for Line-in (no equiv
5133 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5135 /* Mute capture amp left and right */
5136 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5137 /* Set ADC connection select to match default mixer setting - line
5140 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5142 /* Do the same for the second ADC: mute capture input amp and
5143 * set ADC connection to line in (on mic1 pin)
5145 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5146 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5148 /* Mute all inputs to mixer widget (even unconnected ones) */
5149 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5150 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5151 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5152 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5153 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5154 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5155 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5156 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5161 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5162 * similar laptops (adapted from Fujitsu init verbs).
5164 static struct hda_verb alc260_acer_init_verbs[] = {
5165 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5166 * the headphone jack. Turn this on and rely on the standard mute
5167 * methods whenever the user wants to turn these outputs off.
5169 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5170 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5171 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5172 /* Internal speaker/Headphone jack is connected to Line-out pin */
5173 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5174 /* Internal microphone/Mic jack is connected to Mic1 pin */
5175 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5176 /* Line In jack is connected to Line1 pin */
5177 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5178 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5179 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5180 /* Ensure all other unused pins are disabled and muted. */
5181 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5182 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5183 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5184 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5185 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5186 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5187 /* Disable digital (SPDIF) pins */
5188 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5189 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5191 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5192 * bus when acting as outputs.
5194 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5195 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5197 /* Start with output sum widgets muted and their output gains at min */
5198 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5199 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5200 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5201 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5202 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5203 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5204 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5205 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5206 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5208 /* Unmute Line-out pin widget amp left and right
5209 * (no equiv mixer ctrl)
5211 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5212 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5213 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5214 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5215 * inputs. If the pin mode is changed by the user the pin mode control
5216 * will take care of enabling the pin's input/output buffers as needed.
5217 * Therefore there's no need to enable the input buffer at this
5220 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5221 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5223 /* Mute capture amp left and right */
5224 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5225 /* Set ADC connection select to match default mixer setting - mic
5228 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5230 /* Do similar with the second ADC: mute capture input amp and
5231 * set ADC connection to mic to match ALSA's default state.
5233 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5234 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5236 /* Mute all inputs to mixer widget (even unconnected ones) */
5237 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5239 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5240 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5241 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5242 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5243 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5244 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5249 /* Initialisation sequence for Maxdata Favorit 100XS
5250 * (adapted from Acer init verbs).
5252 static struct hda_verb alc260_favorit100_init_verbs[] = {
5253 /* GPIO 0 enables the output jack.
5254 * Turn this on and rely on the standard mute
5255 * methods whenever the user wants to turn these outputs off.
5257 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5258 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5259 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5260 /* Line/Mic input jack is connected to Mic1 pin */
5261 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5262 /* Ensure all other unused pins are disabled and muted. */
5263 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5264 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5265 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5266 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5267 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5268 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5269 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5270 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5271 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5272 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5273 /* Disable digital (SPDIF) pins */
5274 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5275 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5277 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5278 * bus when acting as outputs.
5280 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5281 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5283 /* Start with output sum widgets muted and their output gains at min */
5284 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5285 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5286 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5287 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5288 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5289 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5290 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5291 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5292 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5294 /* Unmute Line-out pin widget amp left and right
5295 * (no equiv mixer ctrl)
5297 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5298 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5299 * inputs. If the pin mode is changed by the user the pin mode control
5300 * will take care of enabling the pin's input/output buffers as needed.
5301 * Therefore there's no need to enable the input buffer at this
5304 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5306 /* Mute capture amp left and right */
5307 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5308 /* Set ADC connection select to match default mixer setting - mic
5311 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5313 /* Do similar with the second ADC: mute capture input amp and
5314 * set ADC connection to mic to match ALSA's default state.
5316 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5317 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5319 /* Mute all inputs to mixer widget (even unconnected ones) */
5320 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5321 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5322 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5323 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5324 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5325 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5326 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5327 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5332 static struct hda_verb alc260_will_verbs[] = {
5333 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5334 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5335 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5336 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5337 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5338 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5342 static struct hda_verb alc260_replacer_672v_verbs[] = {
5343 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5344 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5345 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5347 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5348 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5349 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5351 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5355 /* toggle speaker-output according to the hp-jack state */
5356 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5358 unsigned int present;
5360 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5361 present = snd_hda_codec_read(codec, 0x0f, 0,
5362 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5364 snd_hda_codec_write_cache(codec, 0x01, 0,
5365 AC_VERB_SET_GPIO_DATA, 1);
5366 snd_hda_codec_write_cache(codec, 0x0f, 0,
5367 AC_VERB_SET_PIN_WIDGET_CONTROL,
5370 snd_hda_codec_write_cache(codec, 0x01, 0,
5371 AC_VERB_SET_GPIO_DATA, 0);
5372 snd_hda_codec_write_cache(codec, 0x0f, 0,
5373 AC_VERB_SET_PIN_WIDGET_CONTROL,
5378 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5381 if ((res >> 26) == ALC880_HP_EVENT)
5382 alc260_replacer_672v_automute(codec);
5385 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5386 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5387 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5388 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5389 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5390 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5391 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5392 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5393 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5394 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5395 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5399 /* Test configuration for debugging, modelled after the ALC880 test
5402 #ifdef CONFIG_SND_DEBUG
5403 static hda_nid_t alc260_test_dac_nids[1] = {
5406 static hda_nid_t alc260_test_adc_nids[2] = {
5409 /* For testing the ALC260, each input MUX needs its own definition since
5410 * the signal assignments are different. This assumes that the first ADC
5413 static struct hda_input_mux alc260_test_capture_sources[2] = {
5417 { "MIC1 pin", 0x0 },
5418 { "MIC2 pin", 0x1 },
5419 { "LINE1 pin", 0x2 },
5420 { "LINE2 pin", 0x3 },
5422 { "LINE-OUT pin", 0x5 },
5423 { "HP-OUT pin", 0x6 },
5429 { "MIC1 pin", 0x0 },
5430 { "MIC2 pin", 0x1 },
5431 { "LINE1 pin", 0x2 },
5432 { "LINE2 pin", 0x3 },
5435 { "LINE-OUT pin", 0x6 },
5436 { "HP-OUT pin", 0x7 },
5440 static struct snd_kcontrol_new alc260_test_mixer[] = {
5441 /* Output driver widgets */
5442 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5443 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5444 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5445 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5446 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5447 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5449 /* Modes for retasking pin widgets
5450 * Note: the ALC260 doesn't seem to act on requests to enable mic
5451 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5452 * mention this restriction. At this stage it's not clear whether
5453 * this behaviour is intentional or is a hardware bug in chip
5454 * revisions available at least up until early 2006. Therefore for
5455 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5456 * choices, but if it turns out that the lack of mic bias for these
5457 * NIDs is intentional we could change their modes from
5458 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5460 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5461 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5462 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5463 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5464 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5465 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5467 /* Loopback mixer controls */
5468 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5469 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5470 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5471 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5472 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5473 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5474 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5475 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5476 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5477 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5478 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5479 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5480 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5481 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5483 /* Controls for GPIO pins, assuming they are configured as outputs */
5484 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5485 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5486 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5487 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5489 /* Switches to allow the digital IO pins to be enabled. The datasheet
5490 * is ambigious as to which NID is which; testing on laptops which
5491 * make this output available should provide clarification.
5493 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5494 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5496 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5497 * this output to turn on an external amplifier.
5499 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5500 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5504 static struct hda_verb alc260_test_init_verbs[] = {
5505 /* Enable all GPIOs as outputs with an initial value of 0 */
5506 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5507 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5508 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5510 /* Enable retasking pins as output, initially without power amp */
5511 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5512 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5513 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5514 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5515 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5516 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5518 /* Disable digital (SPDIF) pins initially, but users can enable
5519 * them via a mixer switch. In the case of SPDIF-out, this initverb
5520 * payload also sets the generation to 0, output to be in "consumer"
5521 * PCM format, copyright asserted, no pre-emphasis and no validity
5524 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5525 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5527 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5528 * OUT1 sum bus when acting as an output.
5530 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5531 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5532 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5533 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5535 /* Start with output sum widgets muted and their output gains at min */
5536 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5537 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5538 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5539 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5540 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5541 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5542 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5543 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5544 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5546 /* Unmute retasking pin widget output buffers since the default
5547 * state appears to be output. As the pin mode is changed by the
5548 * user the pin mode control will take care of enabling the pin's
5549 * input/output buffers as needed.
5551 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5552 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5553 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5554 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5555 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5556 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5557 /* Also unmute the mono-out pin widget */
5558 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5560 /* Mute capture amp left and right */
5561 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5562 /* Set ADC connection select to match default mixer setting (mic1
5565 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5567 /* Do the same for the second ADC: mute capture input amp and
5568 * set ADC connection to mic1 pin
5570 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5571 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5573 /* Mute all inputs to mixer widget (even unconnected ones) */
5574 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5575 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5576 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5577 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5578 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5579 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5587 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5588 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5590 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5591 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5594 * for BIOS auto-configuration
5597 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5598 const char *pfx, int *vol_bits)
5601 unsigned long vol_val, sw_val;
5605 if (nid >= 0x0f && nid < 0x11) {
5606 nid_vol = nid - 0x7;
5607 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5608 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5609 } else if (nid == 0x11) {
5610 nid_vol = nid - 0x7;
5611 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5612 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5613 } else if (nid >= 0x12 && nid <= 0x15) {
5615 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5616 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5620 if (!(*vol_bits & (1 << nid_vol))) {
5621 /* first control for the volume widget */
5622 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5623 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5626 *vol_bits |= (1 << nid_vol);
5628 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5629 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5635 /* add playback controls from the parsed DAC table */
5636 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5637 const struct auto_pin_cfg *cfg)
5643 spec->multiout.num_dacs = 1;
5644 spec->multiout.dac_nids = spec->private_dac_nids;
5645 spec->multiout.dac_nids[0] = 0x02;
5647 nid = cfg->line_out_pins[0];
5649 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5654 nid = cfg->speaker_pins[0];
5656 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5661 nid = cfg->hp_pins[0];
5663 err = alc260_add_playback_controls(spec, nid, "Headphone",
5671 /* create playback/capture controls for input pins */
5672 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5673 const struct auto_pin_cfg *cfg)
5675 struct hda_input_mux *imux = &spec->private_imux[0];
5678 for (i = 0; i < AUTO_PIN_LAST; i++) {
5679 if (cfg->input_pins[i] >= 0x12) {
5680 idx = cfg->input_pins[i] - 0x12;
5681 err = new_analog_input(spec, cfg->input_pins[i],
5682 auto_pin_cfg_labels[i], idx,
5686 imux->items[imux->num_items].label =
5687 auto_pin_cfg_labels[i];
5688 imux->items[imux->num_items].index = idx;
5691 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5692 idx = cfg->input_pins[i] - 0x09;
5693 err = new_analog_input(spec, cfg->input_pins[i],
5694 auto_pin_cfg_labels[i], idx,
5698 imux->items[imux->num_items].label =
5699 auto_pin_cfg_labels[i];
5700 imux->items[imux->num_items].index = idx;
5707 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5708 hda_nid_t nid, int pin_type,
5711 alc_set_pin_output(codec, nid, pin_type);
5712 /* need the manual connection? */
5714 int idx = nid - 0x12;
5715 snd_hda_codec_write(codec, idx + 0x0b, 0,
5716 AC_VERB_SET_CONNECT_SEL, sel_idx);
5720 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5722 struct alc_spec *spec = codec->spec;
5725 nid = spec->autocfg.line_out_pins[0];
5727 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5728 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5731 nid = spec->autocfg.speaker_pins[0];
5733 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5735 nid = spec->autocfg.hp_pins[0];
5737 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5740 #define ALC260_PIN_CD_NID 0x16
5741 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5743 struct alc_spec *spec = codec->spec;
5746 for (i = 0; i < AUTO_PIN_LAST; i++) {
5747 hda_nid_t nid = spec->autocfg.input_pins[i];
5749 alc_set_input_pin(codec, nid, i);
5750 if (nid != ALC260_PIN_CD_NID &&
5751 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5752 snd_hda_codec_write(codec, nid, 0,
5753 AC_VERB_SET_AMP_GAIN_MUTE,
5760 * generic initialization of ADC, input mixers and output mixers
5762 static struct hda_verb alc260_volume_init_verbs[] = {
5764 * Unmute ADC0-1 and set the default input to mic-in
5766 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5767 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5768 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5769 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5771 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5773 * Note: PASD motherboards uses the Line In 2 as the input for
5774 * front panel mic (mic 2)
5776 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5777 /* mute analog inputs */
5778 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5779 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5780 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5781 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5782 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5785 * Set up output mixers (0x08 - 0x0a)
5787 /* set vol=0 to output mixers */
5788 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5789 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5790 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5791 /* set up input amps for analog loopback */
5792 /* Amp Indices: DAC = 0, mixer = 1 */
5793 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5794 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5795 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5796 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5797 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5798 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5803 static int alc260_parse_auto_config(struct hda_codec *codec)
5805 struct alc_spec *spec = codec->spec;
5807 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5809 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5813 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5816 if (!spec->kctls.list)
5817 return 0; /* can't find valid BIOS pin config */
5818 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5822 spec->multiout.max_channels = 2;
5824 if (spec->autocfg.dig_outs)
5825 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5826 if (spec->kctls.list)
5827 add_mixer(spec, spec->kctls.list);
5829 add_verb(spec, alc260_volume_init_verbs);
5831 spec->num_mux_defs = 1;
5832 spec->input_mux = &spec->private_imux[0];
5834 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
5839 /* additional initialization for auto-configuration model */
5840 static void alc260_auto_init(struct hda_codec *codec)
5842 struct alc_spec *spec = codec->spec;
5843 alc260_auto_init_multi_out(codec);
5844 alc260_auto_init_analog_input(codec);
5845 if (spec->unsol_event)
5846 alc_inithook(codec);
5849 #ifdef CONFIG_SND_HDA_POWER_SAVE
5850 static struct hda_amp_list alc260_loopbacks[] = {
5851 { 0x07, HDA_INPUT, 0 },
5852 { 0x07, HDA_INPUT, 1 },
5853 { 0x07, HDA_INPUT, 2 },
5854 { 0x07, HDA_INPUT, 3 },
5855 { 0x07, HDA_INPUT, 4 },
5861 * ALC260 configurations
5863 static const char *alc260_models[ALC260_MODEL_LAST] = {
5864 [ALC260_BASIC] = "basic",
5866 [ALC260_HP_3013] = "hp-3013",
5867 [ALC260_HP_DC7600] = "hp-dc7600",
5868 [ALC260_FUJITSU_S702X] = "fujitsu",
5869 [ALC260_ACER] = "acer",
5870 [ALC260_WILL] = "will",
5871 [ALC260_REPLACER_672V] = "replacer",
5872 [ALC260_FAVORIT100] = "favorit100",
5873 #ifdef CONFIG_SND_DEBUG
5874 [ALC260_TEST] = "test",
5876 [ALC260_AUTO] = "auto",
5879 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5880 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5881 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5882 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
5883 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5884 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5885 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5886 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5887 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5888 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5889 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5890 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5891 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5892 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5893 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5894 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5895 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5896 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5897 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5898 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5902 static struct alc_config_preset alc260_presets[] = {
5904 .mixers = { alc260_base_output_mixer,
5905 alc260_input_mixer },
5906 .init_verbs = { alc260_init_verbs },
5907 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5908 .dac_nids = alc260_dac_nids,
5909 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5910 .adc_nids = alc260_adc_nids,
5911 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5912 .channel_mode = alc260_modes,
5913 .input_mux = &alc260_capture_source,
5916 .mixers = { alc260_hp_output_mixer,
5917 alc260_input_mixer },
5918 .init_verbs = { alc260_init_verbs,
5919 alc260_hp_unsol_verbs },
5920 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5921 .dac_nids = alc260_dac_nids,
5922 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5923 .adc_nids = alc260_adc_nids_alt,
5924 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5925 .channel_mode = alc260_modes,
5926 .input_mux = &alc260_capture_source,
5927 .unsol_event = alc260_hp_unsol_event,
5928 .init_hook = alc260_hp_automute,
5930 [ALC260_HP_DC7600] = {
5931 .mixers = { alc260_hp_dc7600_mixer,
5932 alc260_input_mixer },
5933 .init_verbs = { alc260_init_verbs,
5934 alc260_hp_dc7600_verbs },
5935 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5936 .dac_nids = alc260_dac_nids,
5937 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5938 .adc_nids = alc260_adc_nids_alt,
5939 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5940 .channel_mode = alc260_modes,
5941 .input_mux = &alc260_capture_source,
5942 .unsol_event = alc260_hp_3012_unsol_event,
5943 .init_hook = alc260_hp_3012_automute,
5945 [ALC260_HP_3013] = {
5946 .mixers = { alc260_hp_3013_mixer,
5947 alc260_input_mixer },
5948 .init_verbs = { alc260_hp_3013_init_verbs,
5949 alc260_hp_3013_unsol_verbs },
5950 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5951 .dac_nids = alc260_dac_nids,
5952 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5953 .adc_nids = alc260_adc_nids_alt,
5954 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5955 .channel_mode = alc260_modes,
5956 .input_mux = &alc260_capture_source,
5957 .unsol_event = alc260_hp_3013_unsol_event,
5958 .init_hook = alc260_hp_3013_automute,
5960 [ALC260_FUJITSU_S702X] = {
5961 .mixers = { alc260_fujitsu_mixer },
5962 .init_verbs = { alc260_fujitsu_init_verbs },
5963 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5964 .dac_nids = alc260_dac_nids,
5965 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5966 .adc_nids = alc260_dual_adc_nids,
5967 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5968 .channel_mode = alc260_modes,
5969 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5970 .input_mux = alc260_fujitsu_capture_sources,
5973 .mixers = { alc260_acer_mixer },
5974 .init_verbs = { alc260_acer_init_verbs },
5975 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5976 .dac_nids = alc260_dac_nids,
5977 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5978 .adc_nids = alc260_dual_adc_nids,
5979 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5980 .channel_mode = alc260_modes,
5981 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5982 .input_mux = alc260_acer_capture_sources,
5984 [ALC260_FAVORIT100] = {
5985 .mixers = { alc260_favorit100_mixer },
5986 .init_verbs = { alc260_favorit100_init_verbs },
5987 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5988 .dac_nids = alc260_dac_nids,
5989 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5990 .adc_nids = alc260_dual_adc_nids,
5991 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5992 .channel_mode = alc260_modes,
5993 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
5994 .input_mux = alc260_favorit100_capture_sources,
5997 .mixers = { alc260_will_mixer },
5998 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5999 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6000 .dac_nids = alc260_dac_nids,
6001 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6002 .adc_nids = alc260_adc_nids,
6003 .dig_out_nid = ALC260_DIGOUT_NID,
6004 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6005 .channel_mode = alc260_modes,
6006 .input_mux = &alc260_capture_source,
6008 [ALC260_REPLACER_672V] = {
6009 .mixers = { alc260_replacer_672v_mixer },
6010 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6011 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6012 .dac_nids = alc260_dac_nids,
6013 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6014 .adc_nids = alc260_adc_nids,
6015 .dig_out_nid = ALC260_DIGOUT_NID,
6016 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6017 .channel_mode = alc260_modes,
6018 .input_mux = &alc260_capture_source,
6019 .unsol_event = alc260_replacer_672v_unsol_event,
6020 .init_hook = alc260_replacer_672v_automute,
6022 #ifdef CONFIG_SND_DEBUG
6024 .mixers = { alc260_test_mixer },
6025 .init_verbs = { alc260_test_init_verbs },
6026 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6027 .dac_nids = alc260_test_dac_nids,
6028 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6029 .adc_nids = alc260_test_adc_nids,
6030 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6031 .channel_mode = alc260_modes,
6032 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6033 .input_mux = alc260_test_capture_sources,
6038 static int patch_alc260(struct hda_codec *codec)
6040 struct alc_spec *spec;
6041 int err, board_config;
6043 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6049 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6052 if (board_config < 0) {
6053 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
6054 "trying auto-probe from BIOS...\n");
6055 board_config = ALC260_AUTO;
6058 if (board_config == ALC260_AUTO) {
6059 /* automatic parse from the BIOS config */
6060 err = alc260_parse_auto_config(codec);
6066 "hda_codec: Cannot set up configuration "
6067 "from BIOS. Using base mode...\n");
6068 board_config = ALC260_BASIC;
6072 err = snd_hda_attach_beep_device(codec, 0x1);
6078 if (board_config != ALC260_AUTO)
6079 setup_preset(spec, &alc260_presets[board_config]);
6081 spec->stream_name_analog = "ALC260 Analog";
6082 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6083 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6085 spec->stream_name_digital = "ALC260 Digital";
6086 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6087 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6089 if (!spec->adc_nids && spec->input_mux) {
6090 /* check whether NID 0x04 is valid */
6091 unsigned int wcap = get_wcaps(codec, 0x04);
6092 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6094 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6095 spec->adc_nids = alc260_adc_nids_alt;
6096 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6098 spec->adc_nids = alc260_adc_nids;
6099 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6102 set_capture_mixer(spec);
6103 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6105 spec->vmaster_nid = 0x08;
6107 codec->patch_ops = alc_patch_ops;
6108 if (board_config == ALC260_AUTO)
6109 spec->init_hook = alc260_auto_init;
6110 #ifdef CONFIG_SND_HDA_POWER_SAVE
6111 if (!spec->loopback.amplist)
6112 spec->loopback.amplist = alc260_loopbacks;
6114 codec->proc_widget_hook = print_realtek_coef;
6123 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6124 * configuration. Each pin widget can choose any input DACs and a mixer.
6125 * Each ADC is connected from a mixer of all inputs. This makes possible
6126 * 6-channel independent captures.
6128 * In addition, an independent DAC for the multi-playback (not used in this
6131 #define ALC882_DIGOUT_NID 0x06
6132 #define ALC882_DIGIN_NID 0x0a
6134 static struct hda_channel_mode alc882_ch_modes[1] = {
6138 static hda_nid_t alc882_dac_nids[4] = {
6139 /* front, rear, clfe, rear_surr */
6140 0x02, 0x03, 0x04, 0x05
6143 /* identical with ALC880 */
6144 #define alc882_adc_nids alc880_adc_nids
6145 #define alc882_adc_nids_alt alc880_adc_nids_alt
6147 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6148 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6151 /* FIXME: should be a matrix-type input source selection */
6153 static struct hda_input_mux alc882_capture_source = {
6157 { "Front Mic", 0x1 },
6163 static struct hda_input_mux mb5_capture_source = {
6175 static struct hda_verb alc882_3ST_ch2_init[] = {
6176 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6177 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6178 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6179 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6186 static struct hda_verb alc882_3ST_ch6_init[] = {
6187 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6188 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6189 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6190 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6191 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6192 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6196 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6197 { 2, alc882_3ST_ch2_init },
6198 { 6, alc882_3ST_ch6_init },
6204 static struct hda_verb alc882_sixstack_ch6_init[] = {
6205 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6206 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6207 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6208 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6215 static struct hda_verb alc882_sixstack_ch8_init[] = {
6216 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6217 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6218 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6219 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6223 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6224 { 6, alc882_sixstack_ch6_init },
6225 { 8, alc882_sixstack_ch8_init },
6229 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6235 static struct hda_verb alc885_mbp_ch2_init[] = {
6236 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6237 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6238 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6245 static struct hda_verb alc885_mbp_ch6_init[] = {
6246 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6247 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6248 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6249 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6250 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6254 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6255 { 2, alc885_mbp_ch2_init },
6256 { 6, alc885_mbp_ch6_init },
6260 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6261 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6263 static struct snd_kcontrol_new alc882_base_mixer[] = {
6264 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6265 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6266 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6267 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6268 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6269 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6270 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6271 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6272 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6273 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6274 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6275 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6276 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6277 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6278 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6279 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6280 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6281 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6282 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6283 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6284 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6288 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6289 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6290 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6291 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6292 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6293 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6294 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6296 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6297 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6298 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6302 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6303 HDA_CODEC_VOLUME("Front Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6304 HDA_BIND_MUTE ("Front Playback Switch", 0x0d, 0x02, HDA_INPUT),
6305 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6306 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
6307 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6308 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6309 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6310 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6311 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6312 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6315 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6316 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6317 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6318 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6319 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6320 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6321 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6322 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6323 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6324 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6328 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6329 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6330 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6331 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6332 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6333 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6334 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6335 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6336 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6337 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6338 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6339 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6340 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6341 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6345 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6346 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6348 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6349 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6350 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6351 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6352 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6353 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6354 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6355 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6356 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6357 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6358 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6359 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6360 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6361 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6365 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6366 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6367 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6368 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6369 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6370 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6371 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6372 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6373 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6374 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6379 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6381 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6382 .name = "Channel Mode",
6383 .info = alc_ch_mode_info,
6384 .get = alc_ch_mode_get,
6385 .put = alc_ch_mode_put,
6390 static struct hda_verb alc882_init_verbs[] = {
6391 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6392 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6393 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6394 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6396 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6397 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6398 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6400 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6401 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6402 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6404 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6405 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6406 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6408 /* Front Pin: output 0 (0x0c) */
6409 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6410 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6411 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6412 /* Rear Pin: output 1 (0x0d) */
6413 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6414 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6415 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6416 /* CLFE Pin: output 2 (0x0e) */
6417 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6418 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6419 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6420 /* Side Pin: output 3 (0x0f) */
6421 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6422 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6423 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6424 /* Mic (rear) pin: input vref at 80% */
6425 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6426 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6427 /* Front Mic pin: input vref at 80% */
6428 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6429 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6430 /* Line In pin: input */
6431 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6432 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6433 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6434 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6435 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6436 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6437 /* CD pin widget for input */
6438 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6440 /* FIXME: use matrix-type input source selection */
6441 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6442 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6443 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6444 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6445 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6446 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6448 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6449 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6450 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6451 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6453 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6454 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6455 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6457 /* ADC1: mute amp left and right */
6458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6459 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6460 /* ADC2: mute amp left and right */
6461 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6462 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6463 /* ADC3: mute amp left and right */
6464 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6465 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6470 static struct hda_verb alc882_eapd_verbs[] = {
6471 /* change to EAPD mode */
6472 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6473 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6478 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6479 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6480 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6481 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6482 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6483 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6484 /* FIXME: this looks suspicious...
6485 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6486 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6491 static struct hda_verb alc882_macpro_init_verbs[] = {
6492 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6493 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6494 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6495 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6496 /* Front Pin: output 0 (0x0c) */
6497 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6498 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6499 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6500 /* Front Mic pin: input vref at 80% */
6501 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6502 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6503 /* Speaker: output */
6504 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6505 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6506 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6507 /* Headphone output (output 0 - 0x0c) */
6508 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6509 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6510 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6512 /* FIXME: use matrix-type input source selection */
6513 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6514 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6515 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6516 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6518 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6520 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6521 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6522 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6525 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6526 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6529 /* ADC1: mute amp left and right */
6530 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6531 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6532 /* ADC2: mute amp left and right */
6533 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6534 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6535 /* ADC3: mute amp left and right */
6536 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6537 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6543 static struct hda_verb alc885_mb5_init_verbs[] = {
6545 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6546 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6547 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6549 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6550 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6551 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6552 /* Front Pin: output 0 (0x0d) */
6553 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
6554 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6555 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01},
6556 /* HP Pin: output 0 (0x0c) */
6557 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6558 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6559 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6560 /* Front Mic pin: input vref at 80% */
6561 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6562 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6564 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6565 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6567 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6568 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6569 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6570 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6574 /* Macbook Pro rev3 */
6575 static struct hda_verb alc885_mbp3_init_verbs[] = {
6576 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6578 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6579 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6581 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6582 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6583 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6584 /* Front Pin: output 0 (0x0c) */
6585 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6586 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6587 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6588 /* HP Pin: output 0 (0x0d) */
6589 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6590 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6591 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6592 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6593 /* Mic (rear) pin: input vref at 80% */
6594 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6595 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6596 /* Front Mic pin: input vref at 80% */
6597 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6598 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6599 /* Line In pin: use output 1 when in LineOut mode */
6600 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6601 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6602 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6604 /* FIXME: use matrix-type input source selection */
6605 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6606 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6607 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6608 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6609 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6610 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6612 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6613 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6614 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6615 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6617 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6621 /* ADC1: mute amp left and right */
6622 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6623 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6624 /* ADC2: mute amp left and right */
6625 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6626 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6627 /* ADC3: mute amp left and right */
6628 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6629 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6634 /* iMac 24 mixer. */
6635 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6636 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6637 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6641 /* iMac 24 init verbs. */
6642 static struct hda_verb alc885_imac24_init_verbs[] = {
6643 /* Internal speakers: output 0 (0x0c) */
6644 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6645 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6646 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6647 /* Internal speakers: output 0 (0x0c) */
6648 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6649 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6650 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6651 /* Headphone: output 0 (0x0c) */
6652 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6653 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6654 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6655 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6656 /* Front Mic: input vref at 80% */
6657 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6658 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6662 /* Toggle speaker-output according to the hp-jack state */
6663 static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
6665 struct alc_spec *spec = codec->spec;
6667 spec->autocfg.hp_pins[0] = 0x14;
6668 spec->autocfg.speaker_pins[0] = 0x18;
6669 spec->autocfg.speaker_pins[1] = 0x1a;
6670 alc_automute_amp(codec);
6673 static void alc885_mbp3_init_hook(struct hda_codec *codec)
6675 struct alc_spec *spec = codec->spec;
6677 spec->autocfg.hp_pins[0] = 0x15;
6678 spec->autocfg.speaker_pins[0] = 0x14;
6679 alc_automute_amp(codec);
6683 static struct hda_verb alc882_targa_verbs[] = {
6684 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6685 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6687 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6688 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6690 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6691 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6692 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6694 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6695 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6696 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6697 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6701 /* toggle speaker-output according to the hp-jack state */
6702 static void alc882_targa_automute(struct hda_codec *codec)
6704 struct alc_spec *spec = codec->spec;
6705 alc_automute_amp(codec);
6706 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6707 spec->jack_present ? 1 : 3);
6710 static void alc882_targa_init_hook(struct hda_codec *codec)
6712 struct alc_spec *spec = codec->spec;
6714 spec->autocfg.hp_pins[0] = 0x14;
6715 spec->autocfg.speaker_pins[0] = 0x1b;
6716 alc882_targa_automute(codec);
6719 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6721 if ((res >> 26) == ALC880_HP_EVENT)
6722 alc882_targa_automute(codec);
6725 static struct hda_verb alc882_asus_a7j_verbs[] = {
6726 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6727 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6729 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6730 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6731 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6733 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6734 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6735 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6737 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6738 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6739 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6743 static struct hda_verb alc882_asus_a7m_verbs[] = {
6744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6747 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6748 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6749 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6751 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6752 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6753 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6755 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6756 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6757 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6761 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6763 unsigned int gpiostate, gpiomask, gpiodir;
6765 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6766 AC_VERB_GET_GPIO_DATA, 0);
6769 gpiostate |= (1 << pin);
6771 gpiostate &= ~(1 << pin);
6773 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6774 AC_VERB_GET_GPIO_MASK, 0);
6775 gpiomask |= (1 << pin);
6777 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6778 AC_VERB_GET_GPIO_DIRECTION, 0);
6779 gpiodir |= (1 << pin);
6782 snd_hda_codec_write(codec, codec->afg, 0,
6783 AC_VERB_SET_GPIO_MASK, gpiomask);
6784 snd_hda_codec_write(codec, codec->afg, 0,
6785 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6789 snd_hda_codec_write(codec, codec->afg, 0,
6790 AC_VERB_SET_GPIO_DATA, gpiostate);
6793 /* set up GPIO at initialization */
6794 static void alc885_macpro_init_hook(struct hda_codec *codec)
6796 alc882_gpio_mute(codec, 0, 0);
6797 alc882_gpio_mute(codec, 1, 0);
6800 /* set up GPIO and update auto-muting at initialization */
6801 static void alc885_imac24_init_hook(struct hda_codec *codec)
6803 alc885_macpro_init_hook(codec);
6804 alc885_imac24_automute_init_hook(codec);
6808 * generic initialization of ADC, input mixers and output mixers
6810 static struct hda_verb alc882_auto_init_verbs[] = {
6812 * Unmute ADC0-2 and set the default input to mic-in
6814 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6815 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6816 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6817 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6818 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6819 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6821 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6823 * Note: PASD motherboards uses the Line In 2 as the input for
6824 * front panel mic (mic 2)
6826 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6827 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6828 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6829 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6830 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6831 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6834 * Set up output mixers (0x0c - 0x0f)
6836 /* set vol=0 to output mixers */
6837 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6838 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6839 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6840 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6841 /* set up input amps for analog loopback */
6842 /* Amp Indices: DAC = 0, mixer = 1 */
6843 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6844 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6845 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6846 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6847 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6848 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6849 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6850 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6851 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6852 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6854 /* FIXME: use matrix-type input source selection */
6855 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6856 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6857 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6858 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6859 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6860 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6862 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6863 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6864 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6865 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6867 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6868 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6869 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6870 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6875 #ifdef CONFIG_SND_HDA_POWER_SAVE
6876 #define alc882_loopbacks alc880_loopbacks
6879 /* pcm configuration: identiacal with ALC880 */
6880 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6881 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6882 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6883 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6886 * configuration and preset
6888 static const char *alc882_models[ALC882_MODEL_LAST] = {
6889 [ALC882_3ST_DIG] = "3stack-dig",
6890 [ALC882_6ST_DIG] = "6stack-dig",
6891 [ALC882_ARIMA] = "arima",
6892 [ALC882_W2JC] = "w2jc",
6893 [ALC882_TARGA] = "targa",
6894 [ALC882_ASUS_A7J] = "asus-a7j",
6895 [ALC882_ASUS_A7M] = "asus-a7m",
6896 [ALC885_MACPRO] = "macpro",
6897 [ALC885_MB5] = "mb5",
6898 [ALC885_MBP3] = "mbp3",
6899 [ALC885_IMAC24] = "imac24",
6900 [ALC882_AUTO] = "auto",
6903 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6904 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6905 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6906 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6907 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6908 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6909 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6910 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6911 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6912 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6913 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6914 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6915 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6919 static struct alc_config_preset alc882_presets[] = {
6920 [ALC882_3ST_DIG] = {
6921 .mixers = { alc882_base_mixer },
6922 .init_verbs = { alc882_init_verbs },
6923 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6924 .dac_nids = alc882_dac_nids,
6925 .dig_out_nid = ALC882_DIGOUT_NID,
6926 .dig_in_nid = ALC882_DIGIN_NID,
6927 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6928 .channel_mode = alc882_ch_modes,
6930 .input_mux = &alc882_capture_source,
6932 [ALC882_6ST_DIG] = {
6933 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6934 .init_verbs = { alc882_init_verbs },
6935 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6936 .dac_nids = alc882_dac_nids,
6937 .dig_out_nid = ALC882_DIGOUT_NID,
6938 .dig_in_nid = ALC882_DIGIN_NID,
6939 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6940 .channel_mode = alc882_sixstack_modes,
6941 .input_mux = &alc882_capture_source,
6944 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6945 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6946 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6947 .dac_nids = alc882_dac_nids,
6948 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6949 .channel_mode = alc882_sixstack_modes,
6950 .input_mux = &alc882_capture_source,
6953 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6954 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6955 alc880_gpio1_init_verbs },
6956 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6957 .dac_nids = alc882_dac_nids,
6958 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6959 .channel_mode = alc880_threestack_modes,
6961 .input_mux = &alc882_capture_source,
6962 .dig_out_nid = ALC882_DIGOUT_NID,
6965 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6966 .init_verbs = { alc885_mbp3_init_verbs,
6967 alc880_gpio1_init_verbs },
6968 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6969 .dac_nids = alc882_dac_nids,
6970 .channel_mode = alc885_mbp_6ch_modes,
6971 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6972 .input_mux = &alc882_capture_source,
6973 .dig_out_nid = ALC882_DIGOUT_NID,
6974 .dig_in_nid = ALC882_DIGIN_NID,
6975 .unsol_event = alc_automute_amp_unsol_event,
6976 .init_hook = alc885_mbp3_init_hook,
6979 .mixers = { alc885_mb5_mixer },
6980 .init_verbs = { alc885_mb5_init_verbs,
6981 alc880_gpio1_init_verbs },
6982 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6983 .dac_nids = alc882_dac_nids,
6984 .channel_mode = alc885_mbp_6ch_modes,
6985 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6986 .input_mux = &mb5_capture_source,
6987 .dig_out_nid = ALC882_DIGOUT_NID,
6988 .dig_in_nid = ALC882_DIGIN_NID,
6991 .mixers = { alc882_macpro_mixer },
6992 .init_verbs = { alc882_macpro_init_verbs },
6993 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6994 .dac_nids = alc882_dac_nids,
6995 .dig_out_nid = ALC882_DIGOUT_NID,
6996 .dig_in_nid = ALC882_DIGIN_NID,
6997 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6998 .channel_mode = alc882_ch_modes,
6999 .input_mux = &alc882_capture_source,
7000 .init_hook = alc885_macpro_init_hook,
7003 .mixers = { alc885_imac24_mixer },
7004 .init_verbs = { alc885_imac24_init_verbs },
7005 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7006 .dac_nids = alc882_dac_nids,
7007 .dig_out_nid = ALC882_DIGOUT_NID,
7008 .dig_in_nid = ALC882_DIGIN_NID,
7009 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7010 .channel_mode = alc882_ch_modes,
7011 .input_mux = &alc882_capture_source,
7012 .unsol_event = alc_automute_amp_unsol_event,
7013 .init_hook = alc885_imac24_init_hook,
7016 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
7017 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
7018 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7019 .dac_nids = alc882_dac_nids,
7020 .dig_out_nid = ALC882_DIGOUT_NID,
7021 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7022 .adc_nids = alc882_adc_nids,
7023 .capsrc_nids = alc882_capsrc_nids,
7024 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7025 .channel_mode = alc882_3ST_6ch_modes,
7027 .input_mux = &alc882_capture_source,
7028 .unsol_event = alc882_targa_unsol_event,
7029 .init_hook = alc882_targa_init_hook,
7031 [ALC882_ASUS_A7J] = {
7032 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
7033 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
7034 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7035 .dac_nids = alc882_dac_nids,
7036 .dig_out_nid = ALC882_DIGOUT_NID,
7037 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7038 .adc_nids = alc882_adc_nids,
7039 .capsrc_nids = alc882_capsrc_nids,
7040 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7041 .channel_mode = alc882_3ST_6ch_modes,
7043 .input_mux = &alc882_capture_source,
7045 [ALC882_ASUS_A7M] = {
7046 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
7047 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
7048 alc880_gpio1_init_verbs,
7049 alc882_asus_a7m_verbs },
7050 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7051 .dac_nids = alc882_dac_nids,
7052 .dig_out_nid = ALC882_DIGOUT_NID,
7053 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
7054 .channel_mode = alc880_threestack_modes,
7056 .input_mux = &alc882_capture_source,
7065 PINFIX_ABIT_AW9D_MAX
7068 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
7069 { 0x15, 0x01080104 }, /* side */
7070 { 0x16, 0x01011012 }, /* rear */
7071 { 0x17, 0x01016011 }, /* clfe */
7075 static const struct alc_pincfg *alc882_pin_fixes[] = {
7076 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
7079 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
7080 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
7085 * BIOS auto configuration
7087 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
7088 hda_nid_t nid, int pin_type,
7092 struct alc_spec *spec = codec->spec;
7095 alc_set_pin_output(codec, nid, pin_type);
7096 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7099 idx = spec->multiout.dac_nids[dac_idx] - 2;
7100 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7104 static void alc882_auto_init_multi_out(struct hda_codec *codec)
7106 struct alc_spec *spec = codec->spec;
7109 for (i = 0; i <= HDA_SIDE; i++) {
7110 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7111 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7113 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
7118 static void alc882_auto_init_hp_out(struct hda_codec *codec)
7120 struct alc_spec *spec = codec->spec;
7123 pin = spec->autocfg.hp_pins[0];
7124 if (pin) /* connect to front */
7126 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7127 pin = spec->autocfg.speaker_pins[0];
7129 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7132 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7133 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7135 static void alc882_auto_init_analog_input(struct hda_codec *codec)
7137 struct alc_spec *spec = codec->spec;
7140 for (i = 0; i < AUTO_PIN_LAST; i++) {
7141 hda_nid_t nid = spec->autocfg.input_pins[i];
7144 alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/);
7145 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
7146 snd_hda_codec_write(codec, nid, 0,
7147 AC_VERB_SET_AMP_GAIN_MUTE,
7152 static void alc882_auto_init_input_src(struct hda_codec *codec)
7154 struct alc_spec *spec = codec->spec;
7157 for (c = 0; c < spec->num_adc_nids; c++) {
7158 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
7159 hda_nid_t nid = spec->capsrc_nids[c];
7160 unsigned int mux_idx;
7161 const struct hda_input_mux *imux;
7162 int conns, mute, idx, item;
7164 conns = snd_hda_get_connections(codec, nid, conn_list,
7165 ARRAY_SIZE(conn_list));
7168 mux_idx = c >= spec->num_mux_defs ? 0 : c;
7169 imux = &spec->input_mux[mux_idx];
7170 for (idx = 0; idx < conns; idx++) {
7171 /* if the current connection is the selected one,
7172 * unmute it as default - otherwise mute it
7174 mute = AMP_IN_MUTE(idx);
7175 for (item = 0; item < imux->num_items; item++) {
7176 if (imux->items[item].index == idx) {
7177 if (spec->cur_mux[c] == item)
7178 mute = AMP_IN_UNMUTE(idx);
7182 /* check if we have a selector or mixer
7183 * we could check for the widget type instead, but
7184 * just check for Amp-In presence (in case of mixer
7185 * without amp-in there is something wrong, this
7186 * function shouldn't be used or capsrc nid is wrong)
7188 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
7189 snd_hda_codec_write(codec, nid, 0,
7190 AC_VERB_SET_AMP_GAIN_MUTE,
7192 else if (mute != AMP_IN_MUTE(idx))
7193 snd_hda_codec_write(codec, nid, 0,
7194 AC_VERB_SET_CONNECT_SEL,
7200 /* add mic boosts if needed */
7201 static int alc_auto_add_mic_boost(struct hda_codec *codec)
7203 struct alc_spec *spec = codec->spec;
7207 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7208 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7209 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7211 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7215 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7216 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7217 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7219 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7226 /* almost identical with ALC880 parser... */
7227 static int alc882_parse_auto_config(struct hda_codec *codec)
7229 struct alc_spec *spec = codec->spec;
7230 int err = alc880_parse_auto_config(codec);
7235 return 0; /* no config found */
7237 err = alc_auto_add_mic_boost(codec);
7241 /* hack - override the init verbs */
7242 spec->init_verbs[0] = alc882_auto_init_verbs;
7244 return 1; /* config found */
7247 /* additional initialization for auto-configuration model */
7248 static void alc882_auto_init(struct hda_codec *codec)
7250 struct alc_spec *spec = codec->spec;
7251 alc882_auto_init_multi_out(codec);
7252 alc882_auto_init_hp_out(codec);
7253 alc882_auto_init_analog_input(codec);
7254 alc882_auto_init_input_src(codec);
7255 if (spec->unsol_event)
7256 alc_inithook(codec);
7259 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7261 static int patch_alc882(struct hda_codec *codec)
7263 struct alc_spec *spec;
7264 int err, board_config;
7266 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7272 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7276 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7277 /* Pick up systems that don't supply PCI SSID */
7278 switch (codec->subsystem_id) {
7279 case 0x106b0c00: /* Mac Pro */
7280 board_config = ALC885_MACPRO;
7282 case 0x106b1000: /* iMac 24 */
7283 case 0x106b2800: /* AppleTV */
7284 case 0x106b3e00: /* iMac 24 Aluminium */
7285 board_config = ALC885_IMAC24;
7287 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7288 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7289 case 0x106b00a4: /* MacbookPro4,1 */
7290 case 0x106b2c00: /* Macbook Pro rev3 */
7291 case 0x106b3600: /* Macbook 3.1 */
7292 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7293 board_config = ALC885_MBP3;
7295 case 0x106b3f00: /* Macbook 5,1 */
7296 board_config = ALC885_MB5;
7299 /* ALC889A is handled better as ALC888-compatible */
7300 if (codec->revision_id == 0x100101 ||
7301 codec->revision_id == 0x100103) {
7303 return patch_alc883(codec);
7305 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7306 "trying auto-probe from BIOS...\n");
7307 board_config = ALC882_AUTO;
7311 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7313 if (board_config == ALC882_AUTO) {
7314 /* automatic parse from the BIOS config */
7315 err = alc882_parse_auto_config(codec);
7321 "hda_codec: Cannot set up configuration "
7322 "from BIOS. Using base mode...\n");
7323 board_config = ALC882_3ST_DIG;
7327 err = snd_hda_attach_beep_device(codec, 0x1);
7333 if (board_config != ALC882_AUTO)
7334 setup_preset(spec, &alc882_presets[board_config]);
7336 if (codec->vendor_id == 0x10ec0885) {
7337 spec->stream_name_analog = "ALC885 Analog";
7338 spec->stream_name_digital = "ALC885 Digital";
7340 spec->stream_name_analog = "ALC882 Analog";
7341 spec->stream_name_digital = "ALC882 Digital";
7344 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7345 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7346 /* FIXME: setup DAC5 */
7347 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7348 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7350 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7351 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7353 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7354 if (!spec->adc_nids && spec->input_mux) {
7355 /* check whether NID 0x07 is valid */
7356 unsigned int wcap = get_wcaps(codec, 0x07);
7358 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7359 if (wcap != AC_WID_AUD_IN) {
7360 spec->adc_nids = alc882_adc_nids_alt;
7361 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7362 spec->capsrc_nids = alc882_capsrc_nids_alt;
7364 spec->adc_nids = alc882_adc_nids;
7365 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7366 spec->capsrc_nids = alc882_capsrc_nids;
7369 set_capture_mixer(spec);
7370 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7372 spec->vmaster_nid = 0x0c;
7374 codec->patch_ops = alc_patch_ops;
7375 if (board_config == ALC882_AUTO)
7376 spec->init_hook = alc882_auto_init;
7377 #ifdef CONFIG_SND_HDA_POWER_SAVE
7378 if (!spec->loopback.amplist)
7379 spec->loopback.amplist = alc882_loopbacks;
7381 codec->proc_widget_hook = print_realtek_coef;
7389 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7390 * configuration. Each pin widget can choose any input DACs and a mixer.
7391 * Each ADC is connected from a mixer of all inputs. This makes possible
7392 * 6-channel independent captures.
7394 * In addition, an independent DAC for the multi-playback (not used in this
7397 #define ALC883_DIGOUT_NID 0x06
7398 #define ALC883_DIGIN_NID 0x0a
7400 #define ALC1200_DIGOUT_NID 0x10
7402 static hda_nid_t alc883_dac_nids[4] = {
7403 /* front, rear, clfe, rear_surr */
7404 0x02, 0x03, 0x04, 0x05
7407 static hda_nid_t alc883_adc_nids[2] = {
7412 static hda_nid_t alc883_adc_nids_alt[1] = {
7417 static hda_nid_t alc883_adc_nids_rev[2] = {
7422 #define alc889_adc_nids alc880_adc_nids
7424 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7426 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7428 #define alc889_capsrc_nids alc882_capsrc_nids
7431 /* FIXME: should be a matrix-type input source selection */
7433 static struct hda_input_mux alc883_capture_source = {
7437 { "Front Mic", 0x1 },
7443 static struct hda_input_mux alc883_3stack_6ch_intel = {
7447 { "Front Mic", 0x0 },
7453 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7461 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7471 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7479 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7483 { "Front Mic", 0x1 },
7488 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7499 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7506 static struct hda_verb alc883_3ST_ch2_init[] = {
7507 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7508 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7509 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7510 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7517 static struct hda_verb alc883_3ST_ch4_init[] = {
7518 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7519 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7520 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7521 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7522 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7529 static struct hda_verb alc883_3ST_ch6_init[] = {
7530 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7531 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7532 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7533 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7534 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7535 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7539 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7540 { 2, alc883_3ST_ch2_init },
7541 { 4, alc883_3ST_ch4_init },
7542 { 6, alc883_3ST_ch6_init },
7548 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7549 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7550 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7551 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7552 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7559 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7560 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7561 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7562 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7563 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7564 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7571 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7572 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7573 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7574 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7575 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7576 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7577 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7581 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7582 { 2, alc883_3ST_ch2_intel_init },
7583 { 4, alc883_3ST_ch4_intel_init },
7584 { 6, alc883_3ST_ch6_intel_init },
7590 static struct hda_verb alc883_sixstack_ch6_init[] = {
7591 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7592 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7593 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7594 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7601 static struct hda_verb alc883_sixstack_ch8_init[] = {
7602 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7603 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7604 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7605 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7609 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7610 { 6, alc883_sixstack_ch6_init },
7611 { 8, alc883_sixstack_ch8_init },
7614 static struct hda_verb alc883_medion_eapd_verbs[] = {
7615 /* eanable EAPD on medion laptop */
7616 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7617 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7621 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7622 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7625 static struct snd_kcontrol_new alc883_base_mixer[] = {
7626 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7627 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7628 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7629 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7630 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7631 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7632 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7633 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7634 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7635 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7636 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7637 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7638 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7639 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7640 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7641 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7642 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7643 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7644 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7645 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7646 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7650 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7651 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7652 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7653 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7654 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7655 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7656 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7657 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7658 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7659 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7660 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7661 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7662 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7663 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7667 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7668 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7669 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7670 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7671 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7672 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7673 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7674 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7675 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7676 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7677 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7681 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7682 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7683 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7684 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7685 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7686 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7687 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7688 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7689 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7690 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7691 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7695 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7696 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7697 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7698 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7699 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7700 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7701 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7702 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7703 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7704 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7705 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7706 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7707 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7708 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7712 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7713 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7714 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7715 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7716 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7717 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7718 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7719 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7720 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7721 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7722 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7723 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7724 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7725 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7726 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7727 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7728 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7729 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7730 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7731 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7735 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7736 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7737 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7738 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7739 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7740 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7742 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7743 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7744 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7745 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7746 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7747 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7748 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7749 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7750 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7751 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7752 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7753 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7754 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7755 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7759 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7760 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7761 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7762 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7763 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7764 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7765 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7766 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7767 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7768 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7769 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7770 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7771 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7772 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7774 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7775 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7776 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7777 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7778 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7782 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7783 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7784 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7785 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7786 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7787 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7788 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7789 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7790 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7791 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7792 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7793 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7794 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7795 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7796 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7797 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7798 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7802 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7803 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7804 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7805 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7806 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7807 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7808 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7809 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7810 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7811 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7812 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7813 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7817 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7818 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7819 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7820 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7821 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7822 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7823 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7824 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7829 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7830 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7831 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7832 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7833 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7834 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7835 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7836 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7837 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7838 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7842 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7843 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7844 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7845 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7846 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7847 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7848 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7849 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7850 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7851 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7855 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7856 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7857 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7858 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7859 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7860 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7861 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7862 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7863 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7867 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7868 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7869 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7870 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7871 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7872 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7873 0x0d, 1, 0x0, HDA_OUTPUT),
7874 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7875 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7876 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7877 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7878 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7879 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7880 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7881 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7882 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7883 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7884 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7885 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7886 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7887 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7888 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7892 static struct hda_bind_ctls alc883_bind_cap_vol = {
7893 .ops = &snd_hda_bind_vol,
7895 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7896 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7901 static struct hda_bind_ctls alc883_bind_cap_switch = {
7902 .ops = &snd_hda_bind_sw,
7904 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7905 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7910 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7911 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7912 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7913 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7914 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7915 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7916 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7917 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7918 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7922 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7923 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7924 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7926 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7927 /* .name = "Capture Source", */
7928 .name = "Input Source",
7930 .info = alc_mux_enum_info,
7931 .get = alc_mux_enum_get,
7932 .put = alc_mux_enum_put,
7937 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7939 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7940 .name = "Channel Mode",
7941 .info = alc_ch_mode_info,
7942 .get = alc_ch_mode_get,
7943 .put = alc_ch_mode_put,
7948 static struct hda_verb alc883_init_verbs[] = {
7949 /* ADC1: mute amp left and right */
7950 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7951 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7952 /* ADC2: mute amp left and right */
7953 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7954 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7955 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7956 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7957 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7958 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7960 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7961 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7962 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7964 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7965 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7966 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7968 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7969 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7970 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7972 /* mute analog input loopbacks */
7973 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7974 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7975 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7976 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7977 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7979 /* Front Pin: output 0 (0x0c) */
7980 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7981 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7982 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7983 /* Rear Pin: output 1 (0x0d) */
7984 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7985 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7986 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7987 /* CLFE Pin: output 2 (0x0e) */
7988 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7989 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7990 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7991 /* Side Pin: output 3 (0x0f) */
7992 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7993 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7994 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7995 /* Mic (rear) pin: input vref at 80% */
7996 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7997 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7998 /* Front Mic pin: input vref at 80% */
7999 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8000 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8001 /* Line In pin: input */
8002 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8003 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8004 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8005 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8006 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8007 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8008 /* CD pin widget for input */
8009 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8011 /* FIXME: use matrix-type input source selection */
8012 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8014 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8015 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8016 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8017 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8019 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8020 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8021 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8022 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8026 /* toggle speaker-output according to the hp-jack state */
8027 static void alc883_mitac_init_hook(struct hda_codec *codec)
8029 struct alc_spec *spec = codec->spec;
8031 spec->autocfg.hp_pins[0] = 0x15;
8032 spec->autocfg.speaker_pins[0] = 0x14;
8033 spec->autocfg.speaker_pins[1] = 0x17;
8034 alc_automute_amp(codec);
8037 /* auto-toggle front mic */
8039 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8041 unsigned int present;
8044 present = snd_hda_codec_read(codec, 0x18, 0,
8045 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8046 bits = present ? HDA_AMP_MUTE : 0;
8047 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8051 static struct hda_verb alc883_mitac_verbs[] = {
8053 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8054 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8056 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8057 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8059 /* enable unsolicited event */
8060 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8061 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8066 static struct hda_verb alc883_clevo_m720_verbs[] = {
8068 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8069 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8071 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8072 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8074 /* enable unsolicited event */
8075 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8076 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8081 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8083 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8084 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8086 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8087 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8089 /* enable unsolicited event */
8090 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8095 static struct hda_verb alc883_tagra_verbs[] = {
8096 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8097 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8099 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8100 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8102 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8103 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8104 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8106 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8107 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
8108 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
8109 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
8114 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8115 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8116 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8117 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8121 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8122 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8123 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8124 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8125 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8129 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8130 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8131 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8132 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8133 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8134 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8138 static struct hda_verb alc883_haier_w66_verbs[] = {
8139 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8140 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8142 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8144 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8145 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8146 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8147 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8151 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8152 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8153 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8154 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8155 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8156 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8157 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8158 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8159 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8163 static struct hda_verb alc888_6st_dell_verbs[] = {
8164 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8168 static void alc888_3st_hp_init_hook(struct hda_codec *codec)
8170 struct alc_spec *spec = codec->spec;
8172 spec->autocfg.hp_pins[0] = 0x1b;
8173 spec->autocfg.speaker_pins[0] = 0x14;
8174 spec->autocfg.speaker_pins[1] = 0x16;
8175 spec->autocfg.speaker_pins[2] = 0x18;
8176 alc_automute_amp(codec);
8179 static struct hda_verb alc888_3st_hp_verbs[] = {
8180 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8181 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8182 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8183 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8190 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8191 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8192 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8193 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8194 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8201 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8202 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8203 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8204 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8205 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8206 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8213 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8214 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8215 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8216 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8217 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8218 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8219 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8223 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8224 { 2, alc888_3st_hp_2ch_init },
8225 { 4, alc888_3st_hp_4ch_init },
8226 { 6, alc888_3st_hp_6ch_init },
8229 /* toggle front-jack and RCA according to the hp-jack state */
8230 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8232 unsigned int present;
8234 present = snd_hda_codec_read(codec, 0x1b, 0,
8235 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8236 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8237 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8238 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8239 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8242 /* toggle RCA according to the front-jack state */
8243 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8245 unsigned int present;
8247 present = snd_hda_codec_read(codec, 0x14, 0,
8248 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8249 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8250 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8253 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8256 if ((res >> 26) == ALC880_HP_EVENT)
8257 alc888_lenovo_ms7195_front_automute(codec);
8258 if ((res >> 26) == ALC880_FRONT_EVENT)
8259 alc888_lenovo_ms7195_rca_automute(codec);
8262 static struct hda_verb alc883_medion_md2_verbs[] = {
8263 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8264 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8266 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8268 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8272 /* toggle speaker-output according to the hp-jack state */
8273 static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8275 struct alc_spec *spec = codec->spec;
8277 spec->autocfg.hp_pins[0] = 0x14;
8278 spec->autocfg.speaker_pins[0] = 0x15;
8279 alc_automute_amp(codec);
8282 /* toggle speaker-output according to the hp-jack state */
8283 #define alc883_tagra_init_hook alc882_targa_init_hook
8284 #define alc883_tagra_unsol_event alc882_targa_unsol_event
8286 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8288 unsigned int present;
8290 present = snd_hda_codec_read(codec, 0x18, 0,
8291 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8292 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8293 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8296 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8298 struct alc_spec *spec = codec->spec;
8300 spec->autocfg.hp_pins[0] = 0x15;
8301 spec->autocfg.speaker_pins[0] = 0x14;
8302 alc_automute_amp(codec);
8303 alc883_clevo_m720_mic_automute(codec);
8306 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8309 switch (res >> 26) {
8310 case ALC880_MIC_EVENT:
8311 alc883_clevo_m720_mic_automute(codec);
8314 alc_automute_amp_unsol_event(codec, res);
8319 /* toggle speaker-output according to the hp-jack state */
8320 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec)
8322 struct alc_spec *spec = codec->spec;
8324 spec->autocfg.hp_pins[0] = 0x14;
8325 spec->autocfg.speaker_pins[0] = 0x15;
8326 alc_automute_amp(codec);
8329 static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8331 struct alc_spec *spec = codec->spec;
8333 spec->autocfg.hp_pins[0] = 0x1b;
8334 spec->autocfg.speaker_pins[0] = 0x14;
8335 alc_automute_amp(codec);
8338 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8340 unsigned int present;
8343 present = snd_hda_codec_read(codec, 0x14, 0,
8344 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8345 bits = present ? HDA_AMP_MUTE : 0;
8346 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8347 HDA_AMP_MUTE, bits);
8350 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8352 unsigned int present;
8355 present = snd_hda_codec_read(codec, 0x1b, 0,
8356 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8357 bits = present ? HDA_AMP_MUTE : 0;
8358 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8359 HDA_AMP_MUTE, bits);
8360 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8361 HDA_AMP_MUTE, bits);
8364 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8367 if ((res >> 26) == ALC880_HP_EVENT)
8368 alc883_lenovo_101e_all_automute(codec);
8369 if ((res >> 26) == ALC880_FRONT_EVENT)
8370 alc883_lenovo_101e_ispeaker_automute(codec);
8373 /* toggle speaker-output according to the hp-jack state */
8374 static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8376 struct alc_spec *spec = codec->spec;
8378 spec->autocfg.hp_pins[0] = 0x14;
8379 spec->autocfg.speaker_pins[0] = 0x15;
8380 spec->autocfg.speaker_pins[1] = 0x16;
8381 alc_automute_amp(codec);
8384 static struct hda_verb alc883_acer_eapd_verbs[] = {
8385 /* HP Pin: output 0 (0x0c) */
8386 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8387 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8388 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8389 /* Front Pin: output 0 (0x0c) */
8390 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8391 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8392 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8393 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8394 /* eanable EAPD on medion laptop */
8395 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8396 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8397 /* enable unsolicited event */
8398 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8402 static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8404 struct alc_spec *spec = codec->spec;
8406 spec->autocfg.hp_pins[0] = 0x1b;
8407 spec->autocfg.speaker_pins[0] = 0x14;
8408 spec->autocfg.speaker_pins[1] = 0x15;
8409 spec->autocfg.speaker_pins[2] = 0x16;
8410 spec->autocfg.speaker_pins[3] = 0x17;
8411 alc_automute_amp(codec);
8414 static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8416 struct alc_spec *spec = codec->spec;
8418 spec->autocfg.hp_pins[0] = 0x1b;
8419 spec->autocfg.speaker_pins[0] = 0x14;
8420 spec->autocfg.speaker_pins[1] = 0x15;
8421 spec->autocfg.speaker_pins[2] = 0x16;
8422 spec->autocfg.speaker_pins[3] = 0x17;
8423 spec->autocfg.speaker_pins[4] = 0x1a;
8424 alc_automute_amp(codec);
8428 * generic initialization of ADC, input mixers and output mixers
8430 static struct hda_verb alc883_auto_init_verbs[] = {
8432 * Unmute ADC0-2 and set the default input to mic-in
8434 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8435 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8436 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8437 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8439 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8441 * Note: PASD motherboards uses the Line In 2 as the input for
8442 * front panel mic (mic 2)
8444 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8445 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8446 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8447 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8448 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8449 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8452 * Set up output mixers (0x0c - 0x0f)
8454 /* set vol=0 to output mixers */
8455 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8456 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8457 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8458 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8459 /* set up input amps for analog loopback */
8460 /* Amp Indices: DAC = 0, mixer = 1 */
8461 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8463 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8464 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8465 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8466 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8467 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8468 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8469 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8470 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8472 /* FIXME: use matrix-type input source selection */
8473 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8475 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8476 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8477 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8478 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8479 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8484 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8485 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8490 static struct hda_verb alc888_asus_m90v_verbs[] = {
8491 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8492 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8493 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8494 /* enable unsolicited event */
8495 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8496 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8500 static void alc883_nb_mic_automute(struct hda_codec *codec)
8502 unsigned int present;
8504 present = snd_hda_codec_read(codec, 0x18, 0,
8505 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8506 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8507 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8508 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8509 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8512 static void alc883_M90V_init_hook(struct hda_codec *codec)
8514 struct alc_spec *spec = codec->spec;
8516 spec->autocfg.hp_pins[0] = 0x1b;
8517 spec->autocfg.speaker_pins[0] = 0x14;
8518 spec->autocfg.speaker_pins[1] = 0x15;
8519 spec->autocfg.speaker_pins[2] = 0x16;
8520 alc_automute_pin(codec);
8523 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8526 switch (res >> 26) {
8527 case ALC880_MIC_EVENT:
8528 alc883_nb_mic_automute(codec);
8531 alc_sku_unsol_event(codec, res);
8536 static void alc883_mode2_inithook(struct hda_codec *codec)
8538 alc883_M90V_init_hook(codec);
8539 alc883_nb_mic_automute(codec);
8542 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8543 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8544 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8545 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8546 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8547 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8548 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8549 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8550 /* enable unsolicited event */
8551 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8555 static void alc883_eee1601_inithook(struct hda_codec *codec)
8557 struct alc_spec *spec = codec->spec;
8559 spec->autocfg.hp_pins[0] = 0x14;
8560 spec->autocfg.speaker_pins[0] = 0x1b;
8561 alc_automute_pin(codec);
8564 #ifdef CONFIG_SND_HDA_POWER_SAVE
8565 #define alc883_loopbacks alc880_loopbacks
8568 /* pcm configuration: identiacal with ALC880 */
8569 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8570 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8571 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8572 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8573 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8576 * configuration and preset
8578 static const char *alc883_models[ALC883_MODEL_LAST] = {
8579 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8580 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8581 [ALC883_3ST_6ch] = "3stack-6ch",
8582 [ALC883_6ST_DIG] = "6stack-dig",
8583 [ALC883_TARGA_DIG] = "targa-dig",
8584 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8585 [ALC883_ACER] = "acer",
8586 [ALC883_ACER_ASPIRE] = "acer-aspire",
8587 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8588 [ALC883_MEDION] = "medion",
8589 [ALC883_MEDION_MD2] = "medion-md2",
8590 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8591 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8592 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8593 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8594 [ALC888_LENOVO_SKY] = "lenovo-sky",
8595 [ALC883_HAIER_W66] = "haier-w66",
8596 [ALC888_3ST_HP] = "3stack-hp",
8597 [ALC888_6ST_DELL] = "6stack-dell",
8598 [ALC883_MITAC] = "mitac",
8599 [ALC883_CLEVO_M720] = "clevo-m720",
8600 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8601 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8602 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8603 [ALC1200_ASUS_P5Q] = "asus-p5q",
8604 [ALC883_AUTO] = "auto",
8607 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8608 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8609 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8610 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8611 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8612 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8613 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8614 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8615 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8616 ALC888_ACER_ASPIRE_4930G),
8617 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8618 ALC888_ACER_ASPIRE_4930G),
8619 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
8620 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
8621 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8622 ALC888_ACER_ASPIRE_4930G),
8623 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8624 ALC888_ACER_ASPIRE_4930G),
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 (codec->revision_id == 0x100101) {
9230 spec->stream_name_analog = "ALC1200 Analog";
9231 spec->stream_name_digital = "ALC1200 Digital";
9233 spec->stream_name_analog = "ALC888 Analog";
9234 spec->stream_name_digital = "ALC888 Digital";
9236 if (!spec->num_adc_nids) {
9237 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9238 spec->adc_nids = alc883_adc_nids;
9240 if (!spec->capsrc_nids)
9241 spec->capsrc_nids = alc883_capsrc_nids;
9242 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9243 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9246 spec->stream_name_analog = "ALC889 Analog";
9247 spec->stream_name_digital = "ALC889 Digital";
9248 if (!spec->num_adc_nids) {
9249 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9250 spec->adc_nids = alc889_adc_nids;
9252 if (!spec->capsrc_nids)
9253 spec->capsrc_nids = alc889_capsrc_nids;
9254 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9258 spec->stream_name_analog = "ALC883 Analog";
9259 spec->stream_name_digital = "ALC883 Digital";
9260 if (!spec->num_adc_nids) {
9261 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9262 spec->adc_nids = alc883_adc_nids;
9264 if (!spec->capsrc_nids)
9265 spec->capsrc_nids = alc883_capsrc_nids;
9266 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9270 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9271 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9272 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9274 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9275 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9277 if (!spec->cap_mixer)
9278 set_capture_mixer(spec);
9279 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9281 spec->vmaster_nid = 0x0c;
9283 codec->patch_ops = alc_patch_ops;
9284 if (board_config == ALC883_AUTO)
9285 spec->init_hook = alc883_auto_init;
9287 #ifdef CONFIG_SND_HDA_POWER_SAVE
9288 if (!spec->loopback.amplist)
9289 spec->loopback.amplist = alc883_loopbacks;
9291 codec->proc_widget_hook = print_realtek_coef;
9300 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9301 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9303 #define alc262_dac_nids alc260_dac_nids
9304 #define alc262_adc_nids alc882_adc_nids
9305 #define alc262_adc_nids_alt alc882_adc_nids_alt
9306 #define alc262_capsrc_nids alc882_capsrc_nids
9307 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9309 #define alc262_modes alc260_modes
9310 #define alc262_capture_source alc882_capture_source
9312 static hda_nid_t alc262_dmic_adc_nids[1] = {
9317 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9319 static struct snd_kcontrol_new alc262_base_mixer[] = {
9320 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9321 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9322 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9323 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9324 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9325 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9327 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9328 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9329 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9330 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9331 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9332 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9333 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9334 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9335 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9339 /* update HP, line and mono-out pins according to the master switch */
9340 static void alc262_hp_master_update(struct hda_codec *codec)
9342 struct alc_spec *spec = codec->spec;
9343 int val = spec->master_sw;
9346 snd_hda_codec_write_cache(codec, 0x1b, 0,
9347 AC_VERB_SET_PIN_WIDGET_CONTROL,
9349 snd_hda_codec_write_cache(codec, 0x15, 0,
9350 AC_VERB_SET_PIN_WIDGET_CONTROL,
9352 /* mono (speaker) depending on the HP jack sense */
9353 val = val && !spec->jack_present;
9354 snd_hda_codec_write_cache(codec, 0x16, 0,
9355 AC_VERB_SET_PIN_WIDGET_CONTROL,
9359 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9361 struct alc_spec *spec = codec->spec;
9362 unsigned int presence;
9363 presence = snd_hda_codec_read(codec, 0x1b, 0,
9364 AC_VERB_GET_PIN_SENSE, 0);
9365 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9366 alc262_hp_master_update(codec);
9369 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9371 if ((res >> 26) != ALC880_HP_EVENT)
9373 alc262_hp_bpc_automute(codec);
9376 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9378 struct alc_spec *spec = codec->spec;
9379 unsigned int presence;
9380 presence = snd_hda_codec_read(codec, 0x15, 0,
9381 AC_VERB_GET_PIN_SENSE, 0);
9382 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9383 alc262_hp_master_update(codec);
9386 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9389 if ((res >> 26) != ALC880_HP_EVENT)
9391 alc262_hp_wildwest_automute(codec);
9394 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9396 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9397 struct snd_ctl_elem_value *ucontrol)
9399 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9400 struct alc_spec *spec = codec->spec;
9401 int val = !!*ucontrol->value.integer.value;
9403 if (val == spec->master_sw)
9405 spec->master_sw = val;
9406 alc262_hp_master_update(codec);
9410 #define ALC262_HP_MASTER_SWITCH \
9412 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9413 .name = "Master Playback Switch", \
9414 .info = snd_ctl_boolean_mono_info, \
9415 .get = alc262_hp_master_sw_get, \
9416 .put = alc262_hp_master_sw_put, \
9419 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9420 ALC262_HP_MASTER_SWITCH,
9421 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9422 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9423 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9424 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9426 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9429 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9430 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9431 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9432 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9433 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9434 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9435 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9436 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9437 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9438 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9439 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9443 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9444 ALC262_HP_MASTER_SWITCH,
9445 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9446 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9447 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9448 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9449 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9451 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9453 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9454 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9455 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9456 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9457 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9458 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9459 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9463 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9464 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9465 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9466 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9470 /* mute/unmute internal speaker according to the hp jack and mute state */
9471 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9473 struct alc_spec *spec = codec->spec;
9475 spec->autocfg.hp_pins[0] = 0x15;
9476 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9477 alc_automute_amp(codec);
9480 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9481 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9482 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9483 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9484 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9485 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9486 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9487 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9491 static struct hda_verb alc262_hp_t5735_verbs[] = {
9492 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9493 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9495 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9499 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9500 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9501 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9502 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9503 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9504 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9505 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9509 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9510 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9511 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9512 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9513 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9514 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9515 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9516 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9518 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9523 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9530 /* bind hp and internal speaker mute (with plug check) as master switch */
9531 static void alc262_hippo_master_update(struct hda_codec *codec)
9533 struct alc_spec *spec = codec->spec;
9534 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9535 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9536 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9540 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
9541 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
9542 HDA_AMP_MUTE, mute);
9543 /* mute internal speaker per jack sense */
9544 if (spec->jack_present)
9545 mute = HDA_AMP_MUTE;
9547 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
9548 HDA_AMP_MUTE, mute);
9549 if (speaker_nid && speaker_nid != line_nid)
9550 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
9551 HDA_AMP_MUTE, mute);
9554 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
9556 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
9557 struct snd_ctl_elem_value *ucontrol)
9559 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9560 struct alc_spec *spec = codec->spec;
9561 int val = !!*ucontrol->value.integer.value;
9563 if (val == spec->master_sw)
9565 spec->master_sw = val;
9566 alc262_hippo_master_update(codec);
9570 #define ALC262_HIPPO_MASTER_SWITCH \
9572 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9573 .name = "Master Playback Switch", \
9574 .info = snd_ctl_boolean_mono_info, \
9575 .get = alc262_hippo_master_sw_get, \
9576 .put = alc262_hippo_master_sw_put, \
9579 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
9580 ALC262_HIPPO_MASTER_SWITCH,
9581 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9582 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9583 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9584 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9585 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9586 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9587 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9588 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9589 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9590 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9591 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9592 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9596 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9597 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9598 ALC262_HIPPO_MASTER_SWITCH,
9599 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9600 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9601 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9602 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9603 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9604 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9605 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9606 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9607 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9608 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9612 /* mute/unmute internal speaker according to the hp jack and mute state */
9613 static void alc262_hippo_automute(struct hda_codec *codec)
9615 struct alc_spec *spec = codec->spec;
9616 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9617 unsigned int present;
9619 /* need to execute and sync at first */
9620 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
9621 present = snd_hda_codec_read(codec, hp_nid, 0,
9622 AC_VERB_GET_PIN_SENSE, 0);
9623 spec->jack_present = (present & 0x80000000) != 0;
9624 alc262_hippo_master_update(codec);
9627 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
9629 if ((res >> 26) != ALC880_HP_EVENT)
9631 alc262_hippo_automute(codec);
9634 static void alc262_hippo_init_hook(struct hda_codec *codec)
9636 struct alc_spec *spec = codec->spec;
9638 spec->autocfg.hp_pins[0] = 0x15;
9639 spec->autocfg.speaker_pins[0] = 0x14;
9640 alc262_hippo_automute(codec);
9643 static void alc262_hippo1_init_hook(struct hda_codec *codec)
9645 struct alc_spec *spec = codec->spec;
9647 spec->autocfg.hp_pins[0] = 0x1b;
9648 spec->autocfg.speaker_pins[0] = 0x14;
9649 alc262_hippo_automute(codec);
9653 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9654 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9655 ALC262_HIPPO_MASTER_SWITCH,
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_benq_t31_mixer[] = {
9664 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9665 ALC262_HIPPO_MASTER_SWITCH,
9666 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9667 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9668 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9669 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9670 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9674 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9675 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9676 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9677 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9678 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9679 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9680 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9681 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9682 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9683 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9684 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9685 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9686 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9690 static struct hda_verb alc262_tyan_verbs[] = {
9691 /* Headphone automute */
9692 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9693 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9694 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9696 /* P11 AUX_IN, white 4-pin connector */
9697 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9698 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9699 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9700 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9705 /* unsolicited event for HP jack sensing */
9706 static void alc262_tyan_init_hook(struct hda_codec *codec)
9708 struct alc_spec *spec = codec->spec;
9710 spec->autocfg.hp_pins[0] = 0x1b;
9711 spec->autocfg.speaker_pins[0] = 0x15;
9712 alc_automute_amp(codec);
9716 #define alc262_capture_mixer alc882_capture_mixer
9717 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9720 * generic initialization of ADC, input mixers and output mixers
9722 static struct hda_verb alc262_init_verbs[] = {
9724 * Unmute ADC0-2 and set the default input to mic-in
9726 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9727 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9728 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9729 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9730 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9731 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9733 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9735 * Note: PASD motherboards uses the Line In 2 as the input for
9736 * front panel mic (mic 2)
9738 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9739 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9740 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9741 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9742 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9743 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9746 * Set up output mixers (0x0c - 0x0e)
9748 /* set vol=0 to output mixers */
9749 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9750 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9751 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9752 /* set up input amps for analog loopback */
9753 /* Amp Indices: DAC = 0, mixer = 1 */
9754 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9755 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9756 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9757 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9758 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9759 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9761 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9762 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9763 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9764 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9765 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9766 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9768 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9769 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9770 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9771 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9772 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9774 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9775 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9777 /* FIXME: use matrix-type input source selection */
9778 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9779 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9780 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9781 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9782 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9783 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9785 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9786 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9787 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9788 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9791 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9792 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9793 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9798 static struct hda_verb alc262_eapd_verbs[] = {
9799 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9800 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9804 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9805 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9806 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9810 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9811 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9812 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9813 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9815 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9816 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9820 static struct hda_verb alc262_sony_unsol_verbs[] = {
9821 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9822 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9823 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9825 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9826 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9830 static struct hda_input_mux alc262_dmic_capture_source = {
9833 { "Int DMic", 0x9 },
9838 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9839 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9840 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9841 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9842 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9843 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9847 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9848 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9849 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9850 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9851 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9852 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9853 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9854 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9855 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9859 static void alc262_dmic_automute(struct hda_codec *codec)
9861 unsigned int present;
9863 present = snd_hda_codec_read(codec, 0x18, 0,
9864 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9865 snd_hda_codec_write(codec, 0x22, 0,
9866 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9870 /* unsolicited event for HP jack sensing */
9871 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9874 if ((res >> 26) == ALC880_MIC_EVENT)
9875 alc262_dmic_automute(codec);
9877 alc_sku_unsol_event(codec, res);
9880 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9882 struct alc_spec *spec = codec->spec;
9884 spec->autocfg.hp_pins[0] = 0x15;
9885 spec->autocfg.speaker_pins[0] = 0x14;
9886 alc_automute_pin(codec);
9887 alc262_dmic_automute(codec);
9893 * 0x16 = internal speaker
9894 * 0x18 = external mic
9897 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9898 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9899 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9901 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9902 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9903 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9905 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9906 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9910 static struct hda_verb alc262_nec_verbs[] = {
9911 /* Unmute Speaker */
9912 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9915 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9916 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9918 /* External mic to headphone */
9919 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9920 /* External mic to speaker */
9921 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9927 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9928 * 0x1b = port replicator headphone out
9931 #define ALC_HP_EVENT 0x37
9933 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9934 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9935 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9936 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9937 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9941 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9942 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9943 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9947 static struct hda_input_mux alc262_fujitsu_capture_source = {
9956 static struct hda_input_mux alc262_HP_capture_source = {
9960 { "Front Mic", 0x1 },
9967 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9971 { "Front Mic", 0x2 },
9977 /* mute/unmute internal speaker according to the hp jacks and mute state */
9978 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9980 struct alc_spec *spec = codec->spec;
9983 if (force || !spec->sense_updated) {
9984 unsigned int present;
9985 /* need to execute and sync at first */
9986 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9987 /* check laptop HP jack */
9988 present = snd_hda_codec_read(codec, 0x14, 0,
9989 AC_VERB_GET_PIN_SENSE, 0);
9990 /* need to execute and sync at first */
9991 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9992 /* check docking HP jack */
9993 present |= snd_hda_codec_read(codec, 0x1b, 0,
9994 AC_VERB_GET_PIN_SENSE, 0);
9995 if (present & AC_PINSENSE_PRESENCE)
9996 spec->jack_present = 1;
9998 spec->jack_present = 0;
9999 spec->sense_updated = 1;
10001 /* unmute internal speaker only if both HPs are unplugged and
10002 * master switch is on
10004 if (spec->jack_present)
10005 mute = HDA_AMP_MUTE;
10007 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10008 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10009 HDA_AMP_MUTE, mute);
10012 /* unsolicited event for HP jack sensing */
10013 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10016 if ((res >> 26) != ALC_HP_EVENT)
10018 alc262_fujitsu_automute(codec, 1);
10021 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10023 alc262_fujitsu_automute(codec, 1);
10026 /* bind volumes of both NID 0x0c and 0x0d */
10027 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10028 .ops = &snd_hda_bind_vol,
10030 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10031 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10036 /* mute/unmute internal speaker according to the hp jack and mute state */
10037 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10039 struct alc_spec *spec = codec->spec;
10042 if (force || !spec->sense_updated) {
10043 unsigned int present_int_hp;
10044 /* need to execute and sync at first */
10045 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10046 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10047 AC_VERB_GET_PIN_SENSE, 0);
10048 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10049 spec->sense_updated = 1;
10051 if (spec->jack_present) {
10052 /* mute internal speaker */
10053 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10054 HDA_AMP_MUTE, HDA_AMP_MUTE);
10055 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10056 HDA_AMP_MUTE, HDA_AMP_MUTE);
10058 /* unmute internal speaker if necessary */
10059 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10060 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10061 HDA_AMP_MUTE, mute);
10062 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10063 HDA_AMP_MUTE, mute);
10067 /* unsolicited event for HP jack sensing */
10068 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10071 if ((res >> 26) != ALC_HP_EVENT)
10073 alc262_lenovo_3000_automute(codec, 1);
10076 /* bind hp and internal speaker mute (with plug check) */
10077 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10078 struct snd_ctl_elem_value *ucontrol)
10080 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10081 long *valp = ucontrol->value.integer.value;
10084 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10086 valp ? 0 : HDA_AMP_MUTE);
10087 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10089 valp ? 0 : HDA_AMP_MUTE);
10092 alc262_fujitsu_automute(codec, 0);
10096 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10097 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10099 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10100 .name = "Master Playback Switch",
10101 .info = snd_hda_mixer_amp_switch_info,
10102 .get = snd_hda_mixer_amp_switch_get,
10103 .put = alc262_fujitsu_master_sw_put,
10104 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10106 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10107 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10108 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10109 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10110 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10111 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10112 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10113 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10117 /* bind hp and internal speaker mute (with plug check) */
10118 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10119 struct snd_ctl_elem_value *ucontrol)
10121 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10122 long *valp = ucontrol->value.integer.value;
10125 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10127 valp ? 0 : HDA_AMP_MUTE);
10130 alc262_lenovo_3000_automute(codec, 0);
10134 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10135 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10137 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10138 .name = "Master Playback Switch",
10139 .info = snd_hda_mixer_amp_switch_info,
10140 .get = snd_hda_mixer_amp_switch_get,
10141 .put = alc262_lenovo_3000_master_sw_put,
10142 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10144 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10145 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10146 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
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("Int Mic Boost", 0x19, 0, HDA_INPUT),
10150 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10151 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10155 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10156 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10157 ALC262_HIPPO_MASTER_SWITCH,
10158 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10159 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10160 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10161 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10162 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10163 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10167 /* additional init verbs for Benq laptops */
10168 static struct hda_verb alc262_EAPD_verbs[] = {
10169 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10170 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10174 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10175 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10176 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10178 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10179 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10183 /* Samsung Q1 Ultra Vista model setup */
10184 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10185 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10186 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10187 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10188 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10189 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10190 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10194 static struct hda_verb alc262_ultra_verbs[] = {
10196 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10197 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10198 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10200 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10201 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10202 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10203 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10205 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10206 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10207 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10208 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10209 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10211 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10212 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10213 /* ADC, choose mic */
10214 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10215 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10216 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10217 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10218 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10219 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10220 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10221 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10222 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10223 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10227 /* mute/unmute internal speaker according to the hp jack and mute state */
10228 static void alc262_ultra_automute(struct hda_codec *codec)
10230 struct alc_spec *spec = codec->spec;
10234 /* auto-mute only when HP is used as HP */
10235 if (!spec->cur_mux[0]) {
10236 unsigned int present;
10237 /* need to execute and sync at first */
10238 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10239 present = snd_hda_codec_read(codec, 0x15, 0,
10240 AC_VERB_GET_PIN_SENSE, 0);
10241 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10242 if (spec->jack_present)
10243 mute = HDA_AMP_MUTE;
10245 /* mute/unmute internal speaker */
10246 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10247 HDA_AMP_MUTE, mute);
10248 /* mute/unmute HP */
10249 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10250 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10253 /* unsolicited event for HP jack sensing */
10254 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10257 if ((res >> 26) != ALC880_HP_EVENT)
10259 alc262_ultra_automute(codec);
10262 static struct hda_input_mux alc262_ultra_capture_source = {
10266 { "Headphone", 0x7 },
10270 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10271 struct snd_ctl_elem_value *ucontrol)
10273 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10274 struct alc_spec *spec = codec->spec;
10277 ret = alc_mux_enum_put(kcontrol, ucontrol);
10280 /* reprogram the HP pin as mic or HP according to the input source */
10281 snd_hda_codec_write_cache(codec, 0x15, 0,
10282 AC_VERB_SET_PIN_WIDGET_CONTROL,
10283 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10284 alc262_ultra_automute(codec); /* mute/unmute HP */
10288 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10289 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10290 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10292 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10293 .name = "Capture Source",
10294 .info = alc_mux_enum_info,
10295 .get = alc_mux_enum_get,
10296 .put = alc262_ultra_mux_enum_put,
10301 /* add playback controls from the parsed DAC table */
10302 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10303 const struct auto_pin_cfg *cfg)
10308 spec->multiout.num_dacs = 1; /* only use one dac */
10309 spec->multiout.dac_nids = spec->private_dac_nids;
10310 spec->multiout.dac_nids[0] = 2;
10312 nid = cfg->line_out_pins[0];
10314 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10315 "Front Playback Volume",
10316 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10319 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10320 "Front Playback Switch",
10321 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10326 nid = cfg->speaker_pins[0];
10329 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10330 "Speaker Playback Volume",
10331 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10335 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10336 "Speaker Playback Switch",
10337 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10342 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10343 "Speaker Playback Switch",
10344 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10350 nid = cfg->hp_pins[0];
10352 /* spec->multiout.hp_nid = 2; */
10354 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10355 "Headphone Playback Volume",
10356 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10360 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10361 "Headphone Playback Switch",
10362 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10367 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10368 "Headphone Playback Switch",
10369 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10378 /* identical with ALC880 */
10379 #define alc262_auto_create_analog_input_ctls \
10380 alc880_auto_create_analog_input_ctls
10383 * generic initialization of ADC, input mixers and output mixers
10385 static struct hda_verb alc262_volume_init_verbs[] = {
10387 * Unmute ADC0-2 and set the default input to mic-in
10389 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10390 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10391 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10392 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10393 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10394 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10396 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10398 * Note: PASD motherboards uses the Line In 2 as the input for
10399 * front panel mic (mic 2)
10401 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10402 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10403 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10404 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10405 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10406 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10409 * Set up output mixers (0x0c - 0x0f)
10411 /* set vol=0 to output mixers */
10412 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10413 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10414 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10416 /* set up input amps for analog loopback */
10417 /* Amp Indices: DAC = 0, mixer = 1 */
10418 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10420 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10421 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10422 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10423 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10425 /* FIXME: use matrix-type input source selection */
10426 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10427 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10428 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10429 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10430 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10431 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10433 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10434 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10435 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10436 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10438 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10439 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10440 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10441 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10446 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10448 * Unmute ADC0-2 and set the default input to mic-in
10450 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10451 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10452 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10453 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10454 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10455 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10457 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10459 * Note: PASD motherboards uses the Line In 2 as the input for
10460 * front panel mic (mic 2)
10462 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10463 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10464 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10465 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10466 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10467 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10468 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10469 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10472 * Set up output mixers (0x0c - 0x0e)
10474 /* set vol=0 to output mixers */
10475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10476 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10477 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10479 /* set up input amps for analog loopback */
10480 /* Amp Indices: DAC = 0, mixer = 1 */
10481 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10482 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10483 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10484 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10485 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10486 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10488 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10489 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10490 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10492 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10493 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10495 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10496 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10498 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10499 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10500 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10501 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10502 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10504 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10505 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10506 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10507 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10508 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10509 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10512 /* FIXME: use matrix-type input source selection */
10513 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10514 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10515 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10516 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10518 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10520 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10521 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10522 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10525 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10526 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10530 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10535 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10537 * Unmute ADC0-2 and set the default input to mic-in
10539 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10540 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10541 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10542 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10543 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10544 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10546 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10548 * Note: PASD motherboards uses the Line In 2 as the input for front
10549 * panel mic (mic 2)
10551 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10552 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10553 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10554 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10555 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10556 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10557 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10558 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10559 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10561 * Set up output mixers (0x0c - 0x0e)
10563 /* set vol=0 to output mixers */
10564 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10565 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10568 /* set up input amps for analog loopback */
10569 /* Amp Indices: DAC = 0, mixer = 1 */
10570 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10571 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10572 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10573 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10574 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10575 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10578 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10579 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10580 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10581 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10582 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10583 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10584 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10586 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10587 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10589 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10590 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10592 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10593 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10594 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10595 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10596 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10597 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10599 /* FIXME: use matrix-type input source selection */
10600 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10601 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10602 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10603 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10604 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10605 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10606 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10607 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10608 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10610 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10611 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10612 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10613 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10614 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10615 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10616 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10623 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10626 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10631 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10633 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10634 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10635 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10637 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10638 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10639 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10640 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10642 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10643 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10644 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10649 #ifdef CONFIG_SND_HDA_POWER_SAVE
10650 #define alc262_loopbacks alc880_loopbacks
10653 /* pcm configuration: identiacal with ALC880 */
10654 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10655 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10656 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10657 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10660 * BIOS auto configuration
10662 static int alc262_parse_auto_config(struct hda_codec *codec)
10664 struct alc_spec *spec = codec->spec;
10666 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10668 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10672 if (!spec->autocfg.line_outs) {
10673 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10674 spec->multiout.max_channels = 2;
10675 spec->no_analog = 1;
10678 return 0; /* can't find valid BIOS pin config */
10680 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10683 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10687 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10690 if (spec->autocfg.dig_outs) {
10691 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10692 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10694 if (spec->autocfg.dig_in_pin)
10695 spec->dig_in_nid = ALC262_DIGIN_NID;
10697 if (spec->kctls.list)
10698 add_mixer(spec, spec->kctls.list);
10700 add_verb(spec, alc262_volume_init_verbs);
10701 spec->num_mux_defs = 1;
10702 spec->input_mux = &spec->private_imux[0];
10704 err = alc_auto_add_mic_boost(codec);
10708 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
10713 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10714 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10715 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10716 #define alc262_auto_init_input_src alc882_auto_init_input_src
10719 /* init callback for auto-configuration model -- overriding the default init */
10720 static void alc262_auto_init(struct hda_codec *codec)
10722 struct alc_spec *spec = codec->spec;
10723 alc262_auto_init_multi_out(codec);
10724 alc262_auto_init_hp_out(codec);
10725 alc262_auto_init_analog_input(codec);
10726 alc262_auto_init_input_src(codec);
10727 if (spec->unsol_event)
10728 alc_inithook(codec);
10732 * configuration and preset
10734 static const char *alc262_models[ALC262_MODEL_LAST] = {
10735 [ALC262_BASIC] = "basic",
10736 [ALC262_HIPPO] = "hippo",
10737 [ALC262_HIPPO_1] = "hippo_1",
10738 [ALC262_FUJITSU] = "fujitsu",
10739 [ALC262_HP_BPC] = "hp-bpc",
10740 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10741 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10742 [ALC262_HP_RP5700] = "hp-rp5700",
10743 [ALC262_BENQ_ED8] = "benq",
10744 [ALC262_BENQ_T31] = "benq-t31",
10745 [ALC262_SONY_ASSAMD] = "sony-assamd",
10746 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10747 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10748 [ALC262_ULTRA] = "ultra",
10749 [ALC262_LENOVO_3000] = "lenovo-3000",
10750 [ALC262_NEC] = "nec",
10751 [ALC262_TYAN] = "tyan",
10752 [ALC262_AUTO] = "auto",
10755 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10756 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10757 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10758 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
10760 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
10762 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
10764 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10765 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10766 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10767 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10768 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10769 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10770 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10771 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10772 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10773 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10774 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10775 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10776 ALC262_HP_TC_T5735),
10777 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10778 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10779 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10780 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10781 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
10782 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
10783 ALC262_SONY_ASSAMD),
10784 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10785 ALC262_TOSHIBA_RX1),
10786 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10787 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10788 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10789 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10790 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
10792 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10793 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10794 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10795 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10796 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10800 static struct alc_config_preset alc262_presets[] = {
10802 .mixers = { alc262_base_mixer },
10803 .init_verbs = { alc262_init_verbs },
10804 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10805 .dac_nids = alc262_dac_nids,
10807 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10808 .channel_mode = alc262_modes,
10809 .input_mux = &alc262_capture_source,
10812 .mixers = { alc262_hippo_mixer },
10813 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10814 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10815 .dac_nids = alc262_dac_nids,
10817 .dig_out_nid = ALC262_DIGOUT_NID,
10818 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10819 .channel_mode = alc262_modes,
10820 .input_mux = &alc262_capture_source,
10821 .unsol_event = alc262_hippo_unsol_event,
10822 .init_hook = alc262_hippo_init_hook,
10824 [ALC262_HIPPO_1] = {
10825 .mixers = { alc262_hippo1_mixer },
10826 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10827 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10828 .dac_nids = alc262_dac_nids,
10830 .dig_out_nid = ALC262_DIGOUT_NID,
10831 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10832 .channel_mode = alc262_modes,
10833 .input_mux = &alc262_capture_source,
10834 .unsol_event = alc262_hippo_unsol_event,
10835 .init_hook = alc262_hippo1_init_hook,
10837 [ALC262_FUJITSU] = {
10838 .mixers = { alc262_fujitsu_mixer },
10839 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10840 alc262_fujitsu_unsol_verbs },
10841 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10842 .dac_nids = alc262_dac_nids,
10844 .dig_out_nid = ALC262_DIGOUT_NID,
10845 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10846 .channel_mode = alc262_modes,
10847 .input_mux = &alc262_fujitsu_capture_source,
10848 .unsol_event = alc262_fujitsu_unsol_event,
10849 .init_hook = alc262_fujitsu_init_hook,
10851 [ALC262_HP_BPC] = {
10852 .mixers = { alc262_HP_BPC_mixer },
10853 .init_verbs = { alc262_HP_BPC_init_verbs },
10854 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10855 .dac_nids = alc262_dac_nids,
10857 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10858 .channel_mode = alc262_modes,
10859 .input_mux = &alc262_HP_capture_source,
10860 .unsol_event = alc262_hp_bpc_unsol_event,
10861 .init_hook = alc262_hp_bpc_automute,
10863 [ALC262_HP_BPC_D7000_WF] = {
10864 .mixers = { alc262_HP_BPC_WildWest_mixer },
10865 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10866 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10867 .dac_nids = alc262_dac_nids,
10869 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10870 .channel_mode = alc262_modes,
10871 .input_mux = &alc262_HP_D7000_capture_source,
10872 .unsol_event = alc262_hp_wildwest_unsol_event,
10873 .init_hook = alc262_hp_wildwest_automute,
10875 [ALC262_HP_BPC_D7000_WL] = {
10876 .mixers = { alc262_HP_BPC_WildWest_mixer,
10877 alc262_HP_BPC_WildWest_option_mixer },
10878 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10879 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10880 .dac_nids = alc262_dac_nids,
10882 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10883 .channel_mode = alc262_modes,
10884 .input_mux = &alc262_HP_D7000_capture_source,
10885 .unsol_event = alc262_hp_wildwest_unsol_event,
10886 .init_hook = alc262_hp_wildwest_automute,
10888 [ALC262_HP_TC_T5735] = {
10889 .mixers = { alc262_hp_t5735_mixer },
10890 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10891 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10892 .dac_nids = alc262_dac_nids,
10894 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10895 .channel_mode = alc262_modes,
10896 .input_mux = &alc262_capture_source,
10897 .unsol_event = alc_automute_amp_unsol_event,
10898 .init_hook = alc262_hp_t5735_init_hook,
10900 [ALC262_HP_RP5700] = {
10901 .mixers = { alc262_hp_rp5700_mixer },
10902 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10903 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10904 .dac_nids = alc262_dac_nids,
10905 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10906 .channel_mode = alc262_modes,
10907 .input_mux = &alc262_hp_rp5700_capture_source,
10909 [ALC262_BENQ_ED8] = {
10910 .mixers = { alc262_base_mixer },
10911 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10912 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10913 .dac_nids = alc262_dac_nids,
10915 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10916 .channel_mode = alc262_modes,
10917 .input_mux = &alc262_capture_source,
10919 [ALC262_SONY_ASSAMD] = {
10920 .mixers = { alc262_sony_mixer },
10921 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10922 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10923 .dac_nids = alc262_dac_nids,
10925 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10926 .channel_mode = alc262_modes,
10927 .input_mux = &alc262_capture_source,
10928 .unsol_event = alc262_hippo_unsol_event,
10929 .init_hook = alc262_hippo_init_hook,
10931 [ALC262_BENQ_T31] = {
10932 .mixers = { alc262_benq_t31_mixer },
10933 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10934 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10935 .dac_nids = alc262_dac_nids,
10937 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10938 .channel_mode = alc262_modes,
10939 .input_mux = &alc262_capture_source,
10940 .unsol_event = alc262_hippo_unsol_event,
10941 .init_hook = alc262_hippo_init_hook,
10944 .mixers = { alc262_ultra_mixer },
10945 .cap_mixer = alc262_ultra_capture_mixer,
10946 .init_verbs = { alc262_ultra_verbs },
10947 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10948 .dac_nids = alc262_dac_nids,
10949 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10950 .channel_mode = alc262_modes,
10951 .input_mux = &alc262_ultra_capture_source,
10952 .adc_nids = alc262_adc_nids, /* ADC0 */
10953 .capsrc_nids = alc262_capsrc_nids,
10954 .num_adc_nids = 1, /* single ADC */
10955 .unsol_event = alc262_ultra_unsol_event,
10956 .init_hook = alc262_ultra_automute,
10958 [ALC262_LENOVO_3000] = {
10959 .mixers = { alc262_lenovo_3000_mixer },
10960 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10961 alc262_lenovo_3000_unsol_verbs },
10962 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10963 .dac_nids = alc262_dac_nids,
10965 .dig_out_nid = ALC262_DIGOUT_NID,
10966 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10967 .channel_mode = alc262_modes,
10968 .input_mux = &alc262_fujitsu_capture_source,
10969 .unsol_event = alc262_lenovo_3000_unsol_event,
10972 .mixers = { alc262_nec_mixer },
10973 .init_verbs = { alc262_nec_verbs },
10974 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10975 .dac_nids = alc262_dac_nids,
10977 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10978 .channel_mode = alc262_modes,
10979 .input_mux = &alc262_capture_source,
10981 [ALC262_TOSHIBA_S06] = {
10982 .mixers = { alc262_toshiba_s06_mixer },
10983 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10984 alc262_eapd_verbs },
10985 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10986 .capsrc_nids = alc262_dmic_capsrc_nids,
10987 .dac_nids = alc262_dac_nids,
10988 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10989 .dig_out_nid = ALC262_DIGOUT_NID,
10990 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10991 .channel_mode = alc262_modes,
10992 .input_mux = &alc262_dmic_capture_source,
10993 .unsol_event = alc262_toshiba_s06_unsol_event,
10994 .init_hook = alc262_toshiba_s06_init_hook,
10996 [ALC262_TOSHIBA_RX1] = {
10997 .mixers = { alc262_toshiba_rx1_mixer },
10998 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10999 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11000 .dac_nids = alc262_dac_nids,
11002 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11003 .channel_mode = alc262_modes,
11004 .input_mux = &alc262_capture_source,
11005 .unsol_event = alc262_hippo_unsol_event,
11006 .init_hook = alc262_hippo_init_hook,
11009 .mixers = { alc262_tyan_mixer },
11010 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11011 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11012 .dac_nids = alc262_dac_nids,
11014 .dig_out_nid = ALC262_DIGOUT_NID,
11015 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11016 .channel_mode = alc262_modes,
11017 .input_mux = &alc262_capture_source,
11018 .unsol_event = alc_automute_amp_unsol_event,
11019 .init_hook = alc262_tyan_init_hook,
11023 static int patch_alc262(struct hda_codec *codec)
11025 struct alc_spec *spec;
11029 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11033 codec->spec = spec;
11035 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11040 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11041 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11042 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11043 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11047 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11049 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11053 if (board_config < 0) {
11054 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
11055 "trying auto-probe from BIOS...\n");
11056 board_config = ALC262_AUTO;
11059 if (board_config == ALC262_AUTO) {
11060 /* automatic parse from the BIOS config */
11061 err = alc262_parse_auto_config(codec);
11067 "hda_codec: Cannot set up configuration "
11068 "from BIOS. Using base mode...\n");
11069 board_config = ALC262_BASIC;
11073 if (!spec->no_analog) {
11074 err = snd_hda_attach_beep_device(codec, 0x1);
11081 if (board_config != ALC262_AUTO)
11082 setup_preset(spec, &alc262_presets[board_config]);
11084 spec->stream_name_analog = "ALC262 Analog";
11085 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11086 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11088 spec->stream_name_digital = "ALC262 Digital";
11089 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11090 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11092 spec->capture_style = CAPT_MIX;
11093 if (!spec->adc_nids && spec->input_mux) {
11094 /* check whether NID 0x07 is valid */
11095 unsigned int wcap = get_wcaps(codec, 0x07);
11098 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11099 if (wcap != AC_WID_AUD_IN) {
11100 spec->adc_nids = alc262_adc_nids_alt;
11101 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11102 spec->capsrc_nids = alc262_capsrc_nids_alt;
11104 spec->adc_nids = alc262_adc_nids;
11105 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11106 spec->capsrc_nids = alc262_capsrc_nids;
11109 if (!spec->cap_mixer && !spec->no_analog)
11110 set_capture_mixer(spec);
11111 if (!spec->no_analog)
11112 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11114 spec->vmaster_nid = 0x0c;
11116 codec->patch_ops = alc_patch_ops;
11117 if (board_config == ALC262_AUTO)
11118 spec->init_hook = alc262_auto_init;
11119 #ifdef CONFIG_SND_HDA_POWER_SAVE
11120 if (!spec->loopback.amplist)
11121 spec->loopback.amplist = alc262_loopbacks;
11123 codec->proc_widget_hook = print_realtek_coef;
11129 * ALC268 channel source setting (2 channel)
11131 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11132 #define alc268_modes alc260_modes
11134 static hda_nid_t alc268_dac_nids[2] = {
11139 static hda_nid_t alc268_adc_nids[2] = {
11144 static hda_nid_t alc268_adc_nids_alt[1] = {
11149 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11151 static struct snd_kcontrol_new alc268_base_mixer[] = {
11152 /* output mixer control */
11153 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11154 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11155 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11156 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11157 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11158 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11159 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11163 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11164 /* output mixer control */
11165 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11166 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11167 ALC262_HIPPO_MASTER_SWITCH,
11168 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11169 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11170 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11174 /* bind Beep switches of both NID 0x0f and 0x10 */
11175 static struct hda_bind_ctls alc268_bind_beep_sw = {
11176 .ops = &snd_hda_bind_sw,
11178 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11179 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11184 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11185 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11186 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11190 static struct hda_verb alc268_eapd_verbs[] = {
11191 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11192 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11196 /* Toshiba specific */
11197 static struct hda_verb alc268_toshiba_verbs[] = {
11198 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11202 static struct hda_input_mux alc268_acer_lc_capture_source = {
11210 /* Acer specific */
11211 /* bind volumes of both NID 0x02 and 0x03 */
11212 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11213 .ops = &snd_hda_bind_vol,
11215 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11216 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11221 /* mute/unmute internal speaker according to the hp jack and mute state */
11222 static void alc268_acer_automute(struct hda_codec *codec, int force)
11224 struct alc_spec *spec = codec->spec;
11227 if (force || !spec->sense_updated) {
11228 unsigned int present;
11229 present = snd_hda_codec_read(codec, 0x14, 0,
11230 AC_VERB_GET_PIN_SENSE, 0);
11231 spec->jack_present = (present & 0x80000000) != 0;
11232 spec->sense_updated = 1;
11234 if (spec->jack_present)
11235 mute = HDA_AMP_MUTE; /* mute internal speaker */
11236 else /* unmute internal speaker if necessary */
11237 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11238 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11239 HDA_AMP_MUTE, mute);
11243 /* bind hp and internal speaker mute (with plug check) */
11244 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11245 struct snd_ctl_elem_value *ucontrol)
11247 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11248 long *valp = ucontrol->value.integer.value;
11251 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11253 valp[0] ? 0 : HDA_AMP_MUTE);
11254 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11256 valp[1] ? 0 : HDA_AMP_MUTE);
11258 alc268_acer_automute(codec, 0);
11262 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11263 /* output mixer control */
11264 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11266 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11267 .name = "Master Playback Switch",
11268 .info = snd_hda_mixer_amp_switch_info,
11269 .get = snd_hda_mixer_amp_switch_get,
11270 .put = alc268_acer_master_sw_put,
11271 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11273 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11277 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11278 /* output mixer control */
11279 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11281 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11282 .name = "Master Playback Switch",
11283 .info = snd_hda_mixer_amp_switch_info,
11284 .get = snd_hda_mixer_amp_switch_get,
11285 .put = alc268_acer_master_sw_put,
11286 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11288 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11289 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11290 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11294 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11295 /* output mixer control */
11296 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11298 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11299 .name = "Master Playback Switch",
11300 .info = snd_hda_mixer_amp_switch_info,
11301 .get = snd_hda_mixer_amp_switch_get,
11302 .put = alc268_acer_master_sw_put,
11303 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11305 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11306 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11310 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11311 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11312 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11313 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11314 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11315 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11316 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11320 static struct hda_verb alc268_acer_verbs[] = {
11321 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11322 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11323 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11324 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11325 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11326 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11327 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11331 /* unsolicited event for HP jack sensing */
11332 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11333 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11335 static void alc268_acer_unsol_event(struct hda_codec *codec,
11338 if ((res >> 26) != ALC880_HP_EVENT)
11340 alc268_acer_automute(codec, 1);
11343 static void alc268_acer_init_hook(struct hda_codec *codec)
11345 alc268_acer_automute(codec, 1);
11348 /* toggle speaker-output according to the hp-jack state */
11349 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11351 unsigned int present;
11352 unsigned char bits;
11354 present = snd_hda_codec_read(codec, 0x15, 0,
11355 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11356 bits = present ? AMP_IN_MUTE(0) : 0;
11357 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11358 AMP_IN_MUTE(0), bits);
11359 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11360 AMP_IN_MUTE(0), bits);
11364 static void alc268_acer_mic_automute(struct hda_codec *codec)
11366 unsigned int present;
11368 present = snd_hda_codec_read(codec, 0x18, 0,
11369 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11370 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11371 present ? 0x0 : 0x6);
11374 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11377 if ((res >> 26) == ALC880_HP_EVENT)
11378 alc268_aspire_one_speaker_automute(codec);
11379 if ((res >> 26) == ALC880_MIC_EVENT)
11380 alc268_acer_mic_automute(codec);
11383 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11385 alc268_aspire_one_speaker_automute(codec);
11386 alc268_acer_mic_automute(codec);
11389 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11390 /* output mixer control */
11391 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11392 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11393 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11394 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11395 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11396 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11400 static struct hda_verb alc268_dell_verbs[] = {
11401 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11402 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11403 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11407 /* mute/unmute internal speaker according to the hp jack and mute state */
11408 static void alc268_dell_init_hook(struct hda_codec *codec)
11410 struct alc_spec *spec = codec->spec;
11412 spec->autocfg.hp_pins[0] = 0x15;
11413 spec->autocfg.speaker_pins[0] = 0x14;
11414 alc_automute_pin(codec);
11417 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11418 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11419 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11420 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11421 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11422 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11423 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11424 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11425 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11429 static struct hda_verb alc267_quanta_il1_verbs[] = {
11430 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11431 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11435 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11437 unsigned int present;
11439 present = snd_hda_codec_read(codec, 0x18, 0,
11440 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11441 snd_hda_codec_write(codec, 0x23, 0,
11442 AC_VERB_SET_CONNECT_SEL,
11443 present ? 0x00 : 0x01);
11446 static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
11448 struct alc_spec *spec = codec->spec;
11450 spec->autocfg.hp_pins[0] = 0x15;
11451 spec->autocfg.speaker_pins[0] = 0x14;
11452 alc_automute_pin(codec);
11453 alc267_quanta_il1_mic_automute(codec);
11456 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11459 switch (res >> 26) {
11460 case ALC880_MIC_EVENT:
11461 alc267_quanta_il1_mic_automute(codec);
11464 alc_sku_unsol_event(codec, res);
11470 * generic initialization of ADC, input mixers and output mixers
11472 static struct hda_verb alc268_base_init_verbs[] = {
11473 /* Unmute DAC0-1 and set vol = 0 */
11474 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11475 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11478 * Set up output mixers (0x0c - 0x0e)
11480 /* set vol=0 to output mixers */
11481 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11482 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11484 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11485 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11487 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11488 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11489 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11490 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11491 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11492 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11493 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11494 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11497 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11498 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11499 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11500 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11502 /* set PCBEEP vol = 0, mute connections */
11503 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11504 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11505 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11507 /* Unmute Selector 23h,24h and set the default input to mic-in */
11509 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11510 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11511 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11512 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11518 * generic initialization of ADC, input mixers and output mixers
11520 static struct hda_verb alc268_volume_init_verbs[] = {
11521 /* set output DAC */
11522 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11523 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11525 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11526 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11527 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11528 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11529 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11531 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11532 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11533 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11535 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11536 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11538 /* set PCBEEP vol = 0, mute connections */
11539 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11540 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11541 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11546 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11547 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11548 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11550 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11551 /* The multiple "Capture Source" controls confuse alsamixer
11552 * So call somewhat different..
11554 /* .name = "Capture Source", */
11555 .name = "Input Source",
11557 .info = alc_mux_enum_info,
11558 .get = alc_mux_enum_get,
11559 .put = alc_mux_enum_put,
11564 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11565 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11566 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11567 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11568 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11570 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11571 /* The multiple "Capture Source" controls confuse alsamixer
11572 * So call somewhat different..
11574 /* .name = "Capture Source", */
11575 .name = "Input Source",
11577 .info = alc_mux_enum_info,
11578 .get = alc_mux_enum_get,
11579 .put = alc_mux_enum_put,
11584 static struct hda_input_mux alc268_capture_source = {
11588 { "Front Mic", 0x1 },
11594 static struct hda_input_mux alc268_acer_capture_source = {
11598 { "Internal Mic", 0x1 },
11603 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11607 { "Internal Mic", 0x6 },
11612 #ifdef CONFIG_SND_DEBUG
11613 static struct snd_kcontrol_new alc268_test_mixer[] = {
11614 /* Volume widgets */
11615 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11616 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11617 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11618 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11619 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11620 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11621 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11622 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11623 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11624 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11625 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11626 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11627 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11628 /* The below appears problematic on some hardwares */
11629 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11630 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11631 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11632 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11633 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11635 /* Modes for retasking pin widgets */
11636 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11637 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11638 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11639 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11641 /* Controls for GPIO pins, assuming they are configured as outputs */
11642 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11643 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11644 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11645 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11647 /* Switches to allow the digital SPDIF output pin to be enabled.
11648 * The ALC268 does not have an SPDIF input.
11650 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11652 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11653 * this output to turn on an external amplifier.
11655 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11656 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11662 /* create input playback/capture controls for the given pin */
11663 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11664 const char *ctlname, int idx)
11669 sprintf(name, "%s Playback Volume", ctlname);
11671 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11672 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11676 } else if (nid == 0x15) {
11677 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11678 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11684 sprintf(name, "%s Playback Switch", ctlname);
11685 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11686 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11692 /* add playback controls from the parsed DAC table */
11693 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11694 const struct auto_pin_cfg *cfg)
11699 spec->multiout.num_dacs = 2; /* only use one dac */
11700 spec->multiout.dac_nids = spec->private_dac_nids;
11701 spec->multiout.dac_nids[0] = 2;
11702 spec->multiout.dac_nids[1] = 3;
11704 nid = cfg->line_out_pins[0];
11706 alc268_new_analog_output(spec, nid, "Front", 0);
11708 nid = cfg->speaker_pins[0];
11710 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11711 "Speaker Playback Volume",
11712 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11716 nid = cfg->hp_pins[0];
11718 alc268_new_analog_output(spec, nid, "Headphone", 0);
11720 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11722 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11723 "Mono Playback Switch",
11724 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11731 /* create playback/capture controls for input pins */
11732 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11733 const struct auto_pin_cfg *cfg)
11735 struct hda_input_mux *imux = &spec->private_imux[0];
11738 for (i = 0; i < AUTO_PIN_LAST; i++) {
11739 switch(cfg->input_pins[i]) {
11741 idx1 = 0; /* Mic 1 */
11744 idx1 = 1; /* Mic 2 */
11747 idx1 = 2; /* Line In */
11754 idx1 = 6; /* digital mics */
11759 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11760 imux->items[imux->num_items].index = idx1;
11766 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11768 struct alc_spec *spec = codec->spec;
11769 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11770 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11771 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11772 unsigned int dac_vol1, dac_vol2;
11775 snd_hda_codec_write(codec, speaker_nid, 0,
11776 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11777 snd_hda_codec_write(codec, 0x0f, 0,
11778 AC_VERB_SET_AMP_GAIN_MUTE,
11780 snd_hda_codec_write(codec, 0x10, 0,
11781 AC_VERB_SET_AMP_GAIN_MUTE,
11784 snd_hda_codec_write(codec, 0x0f, 0,
11785 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11786 snd_hda_codec_write(codec, 0x10, 0,
11787 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11790 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11791 if (line_nid == 0x14)
11792 dac_vol2 = AMP_OUT_ZERO;
11793 else if (line_nid == 0x15)
11794 dac_vol1 = AMP_OUT_ZERO;
11795 if (hp_nid == 0x14)
11796 dac_vol2 = AMP_OUT_ZERO;
11797 else if (hp_nid == 0x15)
11798 dac_vol1 = AMP_OUT_ZERO;
11799 if (line_nid != 0x16 || hp_nid != 0x16 ||
11800 spec->autocfg.line_out_pins[1] != 0x16 ||
11801 spec->autocfg.line_out_pins[2] != 0x16)
11802 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11804 snd_hda_codec_write(codec, 0x02, 0,
11805 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11806 snd_hda_codec_write(codec, 0x03, 0,
11807 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11810 /* pcm configuration: identiacal with ALC880 */
11811 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11812 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11813 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11814 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11817 * BIOS auto configuration
11819 static int alc268_parse_auto_config(struct hda_codec *codec)
11821 struct alc_spec *spec = codec->spec;
11823 static hda_nid_t alc268_ignore[] = { 0 };
11825 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11829 if (!spec->autocfg.line_outs) {
11830 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11831 spec->multiout.max_channels = 2;
11832 spec->no_analog = 1;
11835 return 0; /* can't find valid BIOS pin config */
11837 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11840 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11844 spec->multiout.max_channels = 2;
11847 /* digital only support output */
11848 if (spec->autocfg.dig_outs) {
11849 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11850 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11852 if (spec->kctls.list)
11853 add_mixer(spec, spec->kctls.list);
11855 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
11856 add_mixer(spec, alc268_beep_mixer);
11858 add_verb(spec, alc268_volume_init_verbs);
11859 spec->num_mux_defs = 1;
11860 spec->input_mux = &spec->private_imux[0];
11862 err = alc_auto_add_mic_boost(codec);
11869 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11870 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11871 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11873 /* init callback for auto-configuration model -- overriding the default init */
11874 static void alc268_auto_init(struct hda_codec *codec)
11876 struct alc_spec *spec = codec->spec;
11877 alc268_auto_init_multi_out(codec);
11878 alc268_auto_init_hp_out(codec);
11879 alc268_auto_init_mono_speaker_out(codec);
11880 alc268_auto_init_analog_input(codec);
11881 if (spec->unsol_event)
11882 alc_inithook(codec);
11886 * configuration and preset
11888 static const char *alc268_models[ALC268_MODEL_LAST] = {
11889 [ALC267_QUANTA_IL1] = "quanta-il1",
11890 [ALC268_3ST] = "3stack",
11891 [ALC268_TOSHIBA] = "toshiba",
11892 [ALC268_ACER] = "acer",
11893 [ALC268_ACER_DMIC] = "acer-dmic",
11894 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11895 [ALC268_DELL] = "dell",
11896 [ALC268_ZEPTO] = "zepto",
11897 #ifdef CONFIG_SND_DEBUG
11898 [ALC268_TEST] = "test",
11900 [ALC268_AUTO] = "auto",
11903 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11904 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11905 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11906 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11907 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11908 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11909 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11910 ALC268_ACER_ASPIRE_ONE),
11911 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11912 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
11913 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11914 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11915 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11916 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11917 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11918 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11919 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11920 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11921 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11925 static struct alc_config_preset alc268_presets[] = {
11926 [ALC267_QUANTA_IL1] = {
11927 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
11928 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11929 alc267_quanta_il1_verbs },
11930 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11931 .dac_nids = alc268_dac_nids,
11932 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11933 .adc_nids = alc268_adc_nids_alt,
11935 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11936 .channel_mode = alc268_modes,
11937 .input_mux = &alc268_capture_source,
11938 .unsol_event = alc267_quanta_il1_unsol_event,
11939 .init_hook = alc267_quanta_il1_init_hook,
11942 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11943 alc268_beep_mixer },
11944 .init_verbs = { alc268_base_init_verbs },
11945 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11946 .dac_nids = alc268_dac_nids,
11947 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11948 .adc_nids = alc268_adc_nids_alt,
11949 .capsrc_nids = alc268_capsrc_nids,
11951 .dig_out_nid = ALC268_DIGOUT_NID,
11952 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11953 .channel_mode = alc268_modes,
11954 .input_mux = &alc268_capture_source,
11956 [ALC268_TOSHIBA] = {
11957 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
11958 alc268_beep_mixer },
11959 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11960 alc268_toshiba_verbs },
11961 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11962 .dac_nids = alc268_dac_nids,
11963 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11964 .adc_nids = alc268_adc_nids_alt,
11965 .capsrc_nids = alc268_capsrc_nids,
11967 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11968 .channel_mode = alc268_modes,
11969 .input_mux = &alc268_capture_source,
11970 .unsol_event = alc268_toshiba_unsol_event,
11971 .init_hook = alc268_toshiba_init_hook,
11974 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11975 alc268_beep_mixer },
11976 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11977 alc268_acer_verbs },
11978 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11979 .dac_nids = alc268_dac_nids,
11980 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11981 .adc_nids = alc268_adc_nids_alt,
11982 .capsrc_nids = alc268_capsrc_nids,
11984 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11985 .channel_mode = alc268_modes,
11986 .input_mux = &alc268_acer_capture_source,
11987 .unsol_event = alc268_acer_unsol_event,
11988 .init_hook = alc268_acer_init_hook,
11990 [ALC268_ACER_DMIC] = {
11991 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11992 alc268_beep_mixer },
11993 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11994 alc268_acer_verbs },
11995 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11996 .dac_nids = alc268_dac_nids,
11997 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11998 .adc_nids = alc268_adc_nids_alt,
11999 .capsrc_nids = alc268_capsrc_nids,
12001 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12002 .channel_mode = alc268_modes,
12003 .input_mux = &alc268_acer_dmic_capture_source,
12004 .unsol_event = alc268_acer_unsol_event,
12005 .init_hook = alc268_acer_init_hook,
12007 [ALC268_ACER_ASPIRE_ONE] = {
12008 .mixers = { alc268_acer_aspire_one_mixer,
12010 alc268_capture_alt_mixer },
12011 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12012 alc268_acer_aspire_one_verbs },
12013 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12014 .dac_nids = alc268_dac_nids,
12015 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12016 .adc_nids = alc268_adc_nids_alt,
12017 .capsrc_nids = alc268_capsrc_nids,
12019 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12020 .channel_mode = alc268_modes,
12021 .input_mux = &alc268_acer_lc_capture_source,
12022 .unsol_event = alc268_acer_lc_unsol_event,
12023 .init_hook = alc268_acer_lc_init_hook,
12026 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12027 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12028 alc268_dell_verbs },
12029 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12030 .dac_nids = alc268_dac_nids,
12032 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12033 .channel_mode = alc268_modes,
12034 .unsol_event = alc_sku_unsol_event,
12035 .init_hook = alc268_dell_init_hook,
12036 .input_mux = &alc268_capture_source,
12039 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12040 alc268_beep_mixer },
12041 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12042 alc268_toshiba_verbs },
12043 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12044 .dac_nids = alc268_dac_nids,
12045 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12046 .adc_nids = alc268_adc_nids_alt,
12047 .capsrc_nids = alc268_capsrc_nids,
12049 .dig_out_nid = ALC268_DIGOUT_NID,
12050 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12051 .channel_mode = alc268_modes,
12052 .input_mux = &alc268_capture_source,
12053 .unsol_event = alc268_toshiba_unsol_event,
12054 .init_hook = alc268_toshiba_init_hook
12056 #ifdef CONFIG_SND_DEBUG
12058 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12059 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12060 alc268_volume_init_verbs },
12061 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12062 .dac_nids = alc268_dac_nids,
12063 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12064 .adc_nids = alc268_adc_nids_alt,
12065 .capsrc_nids = alc268_capsrc_nids,
12067 .dig_out_nid = ALC268_DIGOUT_NID,
12068 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12069 .channel_mode = alc268_modes,
12070 .input_mux = &alc268_capture_source,
12075 static int patch_alc268(struct hda_codec *codec)
12077 struct alc_spec *spec;
12079 int i, has_beep, err;
12081 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12085 codec->spec = spec;
12087 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12091 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12092 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
12093 "trying auto-probe from BIOS...\n");
12094 board_config = ALC268_AUTO;
12097 if (board_config == ALC268_AUTO) {
12098 /* automatic parse from the BIOS config */
12099 err = alc268_parse_auto_config(codec);
12105 "hda_codec: Cannot set up configuration "
12106 "from BIOS. Using base mode...\n");
12107 board_config = ALC268_3ST;
12111 if (board_config != ALC268_AUTO)
12112 setup_preset(spec, &alc268_presets[board_config]);
12114 if (codec->vendor_id == 0x10ec0267) {
12115 spec->stream_name_analog = "ALC267 Analog";
12116 spec->stream_name_digital = "ALC267 Digital";
12118 spec->stream_name_analog = "ALC268 Analog";
12119 spec->stream_name_digital = "ALC268 Digital";
12122 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12123 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12124 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12126 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12129 for (i = 0; i < spec->num_mixers; i++) {
12130 if (spec->mixers[i] == alc268_beep_mixer) {
12137 err = snd_hda_attach_beep_device(codec, 0x1);
12142 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12143 /* override the amp caps for beep generator */
12144 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12145 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12146 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12147 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12148 (0 << AC_AMPCAP_MUTE_SHIFT));
12151 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12152 /* check whether NID 0x07 is valid */
12153 unsigned int wcap = get_wcaps(codec, 0x07);
12157 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12158 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12159 spec->adc_nids = alc268_adc_nids_alt;
12160 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12161 add_mixer(spec, alc268_capture_alt_mixer);
12163 spec->adc_nids = alc268_adc_nids;
12164 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12165 add_mixer(spec, alc268_capture_mixer);
12167 spec->capsrc_nids = alc268_capsrc_nids;
12168 /* set default input source */
12169 for (i = 0; i < spec->num_adc_nids; i++)
12170 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12171 0, AC_VERB_SET_CONNECT_SEL,
12172 spec->input_mux->items[0].index);
12175 spec->vmaster_nid = 0x02;
12177 codec->patch_ops = alc_patch_ops;
12178 if (board_config == ALC268_AUTO)
12179 spec->init_hook = alc268_auto_init;
12181 codec->proc_widget_hook = print_realtek_coef;
12187 * ALC269 channel source setting (2 channel)
12189 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12191 #define alc269_dac_nids alc260_dac_nids
12193 static hda_nid_t alc269_adc_nids[1] = {
12198 static hda_nid_t alc269_capsrc_nids[1] = {
12202 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12206 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12214 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12222 #define alc269_modes alc260_modes
12223 #define alc269_capture_source alc880_lg_lw_capture_source
12225 static struct snd_kcontrol_new alc269_base_mixer[] = {
12226 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12227 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12228 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12229 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12230 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12231 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12232 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12233 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12234 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12235 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12236 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12237 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12241 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12242 /* output mixer control */
12243 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12245 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12246 .name = "Master Playback Switch",
12247 .info = snd_hda_mixer_amp_switch_info,
12248 .get = snd_hda_mixer_amp_switch_get,
12249 .put = alc268_acer_master_sw_put,
12250 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12253 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12254 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12255 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12256 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12257 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12261 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12262 /* output mixer control */
12263 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12265 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12266 .name = "Master Playback Switch",
12267 .info = snd_hda_mixer_amp_switch_info,
12268 .get = snd_hda_mixer_amp_switch_get,
12269 .put = alc268_acer_master_sw_put,
12270 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12273 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12274 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12275 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12276 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12277 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12278 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12279 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12280 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12284 /* bind volumes of both NID 0x0c and 0x0d */
12285 static struct hda_bind_ctls alc269_epc_bind_vol = {
12286 .ops = &snd_hda_bind_vol,
12288 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12289 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12294 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12295 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12296 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12297 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12301 /* capture mixer elements */
12302 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12303 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12304 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12305 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12310 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12311 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12312 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12313 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12317 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12318 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12319 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12320 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12321 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12322 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12323 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12327 static struct hda_verb alc269_lifebook_verbs[] = {
12328 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12329 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12330 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12331 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12332 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12333 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12334 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12335 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12336 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12337 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12341 /* toggle speaker-output according to the hp-jack state */
12342 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12344 unsigned int present;
12345 unsigned char bits;
12347 present = snd_hda_codec_read(codec, 0x15, 0,
12348 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12349 bits = present ? AMP_IN_MUTE(0) : 0;
12350 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12351 AMP_IN_MUTE(0), bits);
12352 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12353 AMP_IN_MUTE(0), bits);
12355 snd_hda_codec_write(codec, 0x20, 0,
12356 AC_VERB_SET_COEF_INDEX, 0x0c);
12357 snd_hda_codec_write(codec, 0x20, 0,
12358 AC_VERB_SET_PROC_COEF, 0x680);
12360 snd_hda_codec_write(codec, 0x20, 0,
12361 AC_VERB_SET_COEF_INDEX, 0x0c);
12362 snd_hda_codec_write(codec, 0x20, 0,
12363 AC_VERB_SET_PROC_COEF, 0x480);
12366 /* toggle speaker-output according to the hp-jacks state */
12367 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12369 unsigned int present;
12370 unsigned char bits;
12372 /* Check laptop headphone socket */
12373 present = snd_hda_codec_read(codec, 0x15, 0,
12374 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12376 /* Check port replicator headphone socket */
12377 present |= snd_hda_codec_read(codec, 0x1a, 0,
12378 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12380 bits = present ? AMP_IN_MUTE(0) : 0;
12381 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12382 AMP_IN_MUTE(0), bits);
12383 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12384 AMP_IN_MUTE(0), bits);
12386 snd_hda_codec_write(codec, 0x20, 0,
12387 AC_VERB_SET_COEF_INDEX, 0x0c);
12388 snd_hda_codec_write(codec, 0x20, 0,
12389 AC_VERB_SET_PROC_COEF, 0x680);
12391 snd_hda_codec_write(codec, 0x20, 0,
12392 AC_VERB_SET_COEF_INDEX, 0x0c);
12393 snd_hda_codec_write(codec, 0x20, 0,
12394 AC_VERB_SET_PROC_COEF, 0x480);
12397 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12399 unsigned int present;
12401 present = snd_hda_codec_read(codec, 0x18, 0,
12402 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12403 snd_hda_codec_write(codec, 0x23, 0,
12404 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12407 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12409 unsigned int present_laptop;
12410 unsigned int present_dock;
12412 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12413 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12415 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12416 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12418 /* Laptop mic port overrides dock mic port, design decision */
12420 snd_hda_codec_write(codec, 0x23, 0,
12421 AC_VERB_SET_CONNECT_SEL, 0x3);
12422 if (present_laptop)
12423 snd_hda_codec_write(codec, 0x23, 0,
12424 AC_VERB_SET_CONNECT_SEL, 0x0);
12425 if (!present_dock && !present_laptop)
12426 snd_hda_codec_write(codec, 0x23, 0,
12427 AC_VERB_SET_CONNECT_SEL, 0x1);
12430 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12433 if ((res >> 26) == ALC880_HP_EVENT)
12434 alc269_quanta_fl1_speaker_automute(codec);
12435 if ((res >> 26) == ALC880_MIC_EVENT)
12436 alc269_quanta_fl1_mic_automute(codec);
12439 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12442 if ((res >> 26) == ALC880_HP_EVENT)
12443 alc269_lifebook_speaker_automute(codec);
12444 if ((res >> 26) == ALC880_MIC_EVENT)
12445 alc269_lifebook_mic_autoswitch(codec);
12448 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12450 alc269_quanta_fl1_speaker_automute(codec);
12451 alc269_quanta_fl1_mic_automute(codec);
12454 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12456 alc269_lifebook_speaker_automute(codec);
12457 alc269_lifebook_mic_autoswitch(codec);
12460 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12461 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12462 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12463 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12464 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12465 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12466 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12467 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12471 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12472 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12473 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12474 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12475 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12476 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12477 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12481 /* toggle speaker-output according to the hp-jack state */
12482 static void alc269_speaker_automute(struct hda_codec *codec)
12484 unsigned int present;
12485 unsigned char bits;
12487 present = snd_hda_codec_read(codec, 0x15, 0,
12488 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12489 bits = present ? AMP_IN_MUTE(0) : 0;
12490 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12491 AMP_IN_MUTE(0), bits);
12492 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12493 AMP_IN_MUTE(0), bits);
12496 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12498 unsigned int present;
12500 present = snd_hda_codec_read(codec, 0x18, 0,
12501 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12502 snd_hda_codec_write(codec, 0x23, 0,
12503 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12506 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12508 unsigned int present;
12510 present = snd_hda_codec_read(codec, 0x18, 0,
12511 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12512 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12513 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12514 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12515 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12518 /* unsolicited event for HP jack sensing */
12519 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12522 if ((res >> 26) == ALC880_HP_EVENT)
12523 alc269_speaker_automute(codec);
12525 if ((res >> 26) == ALC880_MIC_EVENT)
12526 alc269_eeepc_dmic_automute(codec);
12529 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12531 alc269_speaker_automute(codec);
12532 alc269_eeepc_dmic_automute(codec);
12535 /* unsolicited event for HP jack sensing */
12536 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12539 if ((res >> 26) == ALC880_HP_EVENT)
12540 alc269_speaker_automute(codec);
12542 if ((res >> 26) == ALC880_MIC_EVENT)
12543 alc269_eeepc_amic_automute(codec);
12546 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12548 alc269_speaker_automute(codec);
12549 alc269_eeepc_amic_automute(codec);
12553 * generic initialization of ADC, input mixers and output mixers
12555 static struct hda_verb alc269_init_verbs[] = {
12557 * Unmute ADC0 and set the default input to mic-in
12559 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12561 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12562 * analog-loopback mixer widget
12563 * Note: PASD motherboards uses the Line In 2 as the input for
12564 * front panel mic (mic 2)
12566 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12567 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12568 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12569 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12574 * Set up output mixers (0x0c - 0x0e)
12576 /* set vol=0 to output mixers */
12577 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12578 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12580 /* set up input amps for analog loopback */
12581 /* Amp Indices: DAC = 0, mixer = 1 */
12582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12586 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12587 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12589 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12590 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12591 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12592 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12593 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12594 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12595 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12597 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12598 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12599 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12600 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12601 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12602 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12603 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12605 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12606 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12608 /* FIXME: use matrix-type input source selection */
12609 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12610 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12611 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12612 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12614 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12617 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12618 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12622 /* add playback controls from the parsed DAC table */
12623 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12624 const struct auto_pin_cfg *cfg)
12629 spec->multiout.num_dacs = 1; /* only use one dac */
12630 spec->multiout.dac_nids = spec->private_dac_nids;
12631 spec->multiout.dac_nids[0] = 2;
12633 nid = cfg->line_out_pins[0];
12635 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12636 "Front Playback Volume",
12637 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12640 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12641 "Front Playback Switch",
12642 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12647 nid = cfg->speaker_pins[0];
12649 if (!cfg->line_out_pins[0]) {
12650 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12651 "Speaker Playback Volume",
12652 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12658 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12659 "Speaker Playback Switch",
12660 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12665 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12666 "Speaker Playback Switch",
12667 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12673 nid = cfg->hp_pins[0];
12675 /* spec->multiout.hp_nid = 2; */
12676 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12677 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12678 "Headphone Playback Volume",
12679 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12685 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12686 "Headphone Playback Switch",
12687 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12692 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12693 "Headphone Playback Switch",
12694 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12703 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12704 const struct auto_pin_cfg *cfg)
12708 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12711 /* digital-mic input pin is excluded in alc880_auto_create..()
12712 * because it's under 0x18
12714 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12715 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12716 struct hda_input_mux *imux = &spec->private_imux[0];
12717 imux->items[imux->num_items].label = "Int Mic";
12718 imux->items[imux->num_items].index = 0x05;
12724 #ifdef CONFIG_SND_HDA_POWER_SAVE
12725 #define alc269_loopbacks alc880_loopbacks
12728 /* pcm configuration: identiacal with ALC880 */
12729 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12730 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12731 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12732 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12734 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
12738 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12739 /* NID is set in alc_build_pcms */
12741 .open = alc880_playback_pcm_open,
12742 .prepare = alc880_playback_pcm_prepare,
12743 .cleanup = alc880_playback_pcm_cleanup
12747 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
12751 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12752 /* NID is set in alc_build_pcms */
12756 * BIOS auto configuration
12758 static int alc269_parse_auto_config(struct hda_codec *codec)
12760 struct alc_spec *spec = codec->spec;
12762 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12764 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12769 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12772 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12776 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12778 if (spec->autocfg.dig_outs)
12779 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12781 if (spec->kctls.list)
12782 add_mixer(spec, spec->kctls.list);
12784 add_verb(spec, alc269_init_verbs);
12785 spec->num_mux_defs = 1;
12786 spec->input_mux = &spec->private_imux[0];
12787 /* set default input source */
12788 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12789 0, AC_VERB_SET_CONNECT_SEL,
12790 spec->input_mux->items[0].index);
12792 err = alc_auto_add_mic_boost(codec);
12796 if (!spec->cap_mixer && !spec->no_analog)
12797 set_capture_mixer(spec);
12802 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12803 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12804 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12807 /* init callback for auto-configuration model -- overriding the default init */
12808 static void alc269_auto_init(struct hda_codec *codec)
12810 struct alc_spec *spec = codec->spec;
12811 alc269_auto_init_multi_out(codec);
12812 alc269_auto_init_hp_out(codec);
12813 alc269_auto_init_analog_input(codec);
12814 if (spec->unsol_event)
12815 alc_inithook(codec);
12819 * configuration and preset
12821 static const char *alc269_models[ALC269_MODEL_LAST] = {
12822 [ALC269_BASIC] = "basic",
12823 [ALC269_QUANTA_FL1] = "quanta",
12824 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12825 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12826 [ALC269_FUJITSU] = "fujitsu",
12827 [ALC269_LIFEBOOK] = "lifebook"
12830 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12831 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12832 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12833 ALC269_ASUS_EEEPC_P703),
12834 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
12835 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
12836 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
12837 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
12838 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
12839 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
12840 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12841 ALC269_ASUS_EEEPC_P901),
12842 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12843 ALC269_ASUS_EEEPC_P901),
12844 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
12845 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12846 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12850 static struct alc_config_preset alc269_presets[] = {
12852 .mixers = { alc269_base_mixer },
12853 .init_verbs = { alc269_init_verbs },
12854 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12855 .dac_nids = alc269_dac_nids,
12857 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12858 .channel_mode = alc269_modes,
12859 .input_mux = &alc269_capture_source,
12861 [ALC269_QUANTA_FL1] = {
12862 .mixers = { alc269_quanta_fl1_mixer },
12863 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12864 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12865 .dac_nids = alc269_dac_nids,
12867 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12868 .channel_mode = alc269_modes,
12869 .input_mux = &alc269_capture_source,
12870 .unsol_event = alc269_quanta_fl1_unsol_event,
12871 .init_hook = alc269_quanta_fl1_init_hook,
12873 [ALC269_ASUS_EEEPC_P703] = {
12874 .mixers = { alc269_eeepc_mixer },
12875 .cap_mixer = alc269_epc_capture_mixer,
12876 .init_verbs = { alc269_init_verbs,
12877 alc269_eeepc_amic_init_verbs },
12878 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12879 .dac_nids = alc269_dac_nids,
12881 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12882 .channel_mode = alc269_modes,
12883 .input_mux = &alc269_eeepc_amic_capture_source,
12884 .unsol_event = alc269_eeepc_amic_unsol_event,
12885 .init_hook = alc269_eeepc_amic_inithook,
12887 [ALC269_ASUS_EEEPC_P901] = {
12888 .mixers = { alc269_eeepc_mixer },
12889 .cap_mixer = alc269_epc_capture_mixer,
12890 .init_verbs = { alc269_init_verbs,
12891 alc269_eeepc_dmic_init_verbs },
12892 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12893 .dac_nids = alc269_dac_nids,
12895 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12896 .channel_mode = alc269_modes,
12897 .input_mux = &alc269_eeepc_dmic_capture_source,
12898 .unsol_event = alc269_eeepc_dmic_unsol_event,
12899 .init_hook = alc269_eeepc_dmic_inithook,
12901 [ALC269_FUJITSU] = {
12902 .mixers = { alc269_fujitsu_mixer },
12903 .cap_mixer = alc269_epc_capture_mixer,
12904 .init_verbs = { alc269_init_verbs,
12905 alc269_eeepc_dmic_init_verbs },
12906 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12907 .dac_nids = alc269_dac_nids,
12909 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12910 .channel_mode = alc269_modes,
12911 .input_mux = &alc269_eeepc_dmic_capture_source,
12912 .unsol_event = alc269_eeepc_dmic_unsol_event,
12913 .init_hook = alc269_eeepc_dmic_inithook,
12915 [ALC269_LIFEBOOK] = {
12916 .mixers = { alc269_lifebook_mixer },
12917 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12918 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12919 .dac_nids = alc269_dac_nids,
12921 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12922 .channel_mode = alc269_modes,
12923 .input_mux = &alc269_capture_source,
12924 .unsol_event = alc269_lifebook_unsol_event,
12925 .init_hook = alc269_lifebook_init_hook,
12929 static int patch_alc269(struct hda_codec *codec)
12931 struct alc_spec *spec;
12935 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12939 codec->spec = spec;
12941 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12943 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12947 if (board_config < 0) {
12948 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12949 "trying auto-probe from BIOS...\n");
12950 board_config = ALC269_AUTO;
12953 if (board_config == ALC269_AUTO) {
12954 /* automatic parse from the BIOS config */
12955 err = alc269_parse_auto_config(codec);
12961 "hda_codec: Cannot set up configuration "
12962 "from BIOS. Using base mode...\n");
12963 board_config = ALC269_BASIC;
12967 err = snd_hda_attach_beep_device(codec, 0x1);
12973 if (board_config != ALC269_AUTO)
12974 setup_preset(spec, &alc269_presets[board_config]);
12976 spec->stream_name_analog = "ALC269 Analog";
12977 if (codec->subsystem_id == 0x17aa3bf8) {
12978 /* Due to a hardware problem on Lenovo Ideadpad, we need to
12979 * fix the sample rate of analog I/O to 44.1kHz
12981 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
12982 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
12984 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12985 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12987 spec->stream_name_digital = "ALC269 Digital";
12988 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12989 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12991 spec->adc_nids = alc269_adc_nids;
12992 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12993 spec->capsrc_nids = alc269_capsrc_nids;
12994 if (!spec->cap_mixer)
12995 set_capture_mixer(spec);
12996 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12998 codec->patch_ops = alc_patch_ops;
12999 if (board_config == ALC269_AUTO)
13000 spec->init_hook = alc269_auto_init;
13001 #ifdef CONFIG_SND_HDA_POWER_SAVE
13002 if (!spec->loopback.amplist)
13003 spec->loopback.amplist = alc269_loopbacks;
13005 codec->proc_widget_hook = print_realtek_coef;
13011 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13015 * set the path ways for 2 channel output
13016 * need to set the codec line out and mic 1 pin widgets to inputs
13018 static struct hda_verb alc861_threestack_ch2_init[] = {
13019 /* set pin widget 1Ah (line in) for input */
13020 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13021 /* set pin widget 18h (mic1/2) for input, for mic also enable
13024 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13026 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13028 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13029 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13035 * need to set the codec line out and mic 1 pin widgets to outputs
13037 static struct hda_verb alc861_threestack_ch6_init[] = {
13038 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13039 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13040 /* set pin widget 18h (mic1) for output (CLFE)*/
13041 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13043 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13044 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13046 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13048 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13049 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13054 static struct hda_channel_mode alc861_threestack_modes[2] = {
13055 { 2, alc861_threestack_ch2_init },
13056 { 6, alc861_threestack_ch6_init },
13058 /* Set mic1 as input and unmute the mixer */
13059 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13060 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13061 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13064 /* Set mic1 as output and mute mixer */
13065 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13066 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13067 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13071 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13072 { 2, alc861_uniwill_m31_ch2_init },
13073 { 4, alc861_uniwill_m31_ch4_init },
13076 /* Set mic1 and line-in as input and unmute the mixer */
13077 static struct hda_verb alc861_asus_ch2_init[] = {
13078 /* set pin widget 1Ah (line in) for input */
13079 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13080 /* set pin widget 18h (mic1/2) for input, for mic also enable
13083 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13085 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13087 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13088 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13092 /* Set mic1 nad line-in as output and mute mixer */
13093 static struct hda_verb alc861_asus_ch6_init[] = {
13094 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13095 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13096 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13097 /* set pin widget 18h (mic1) for output (CLFE)*/
13098 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13099 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13100 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13101 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13103 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13105 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13106 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13111 static struct hda_channel_mode alc861_asus_modes[2] = {
13112 { 2, alc861_asus_ch2_init },
13113 { 6, alc861_asus_ch6_init },
13118 static struct snd_kcontrol_new alc861_base_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),
13141 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13142 /* output mixer control */
13143 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13144 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13145 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13146 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13147 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13149 /* Input mixer control */
13150 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13151 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13152 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13153 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13154 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13155 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13156 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13157 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13158 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13159 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13162 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13163 .name = "Channel Mode",
13164 .info = alc_ch_mode_info,
13165 .get = alc_ch_mode_get,
13166 .put = alc_ch_mode_put,
13167 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13172 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13173 /* output mixer control */
13174 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13175 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13176 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13181 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13182 /* output mixer control */
13183 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13184 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13185 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13186 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13187 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13189 /* Input mixer control */
13190 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13191 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13192 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13193 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13194 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13195 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13197 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13198 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13199 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13202 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13203 .name = "Channel Mode",
13204 .info = alc_ch_mode_info,
13205 .get = alc_ch_mode_get,
13206 .put = alc_ch_mode_put,
13207 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13212 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13213 /* output mixer control */
13214 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13215 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13216 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13217 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13218 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13220 /* Input mixer control */
13221 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13222 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13223 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13224 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13225 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13226 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13227 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13228 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13229 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13230 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13233 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13234 .name = "Channel Mode",
13235 .info = alc_ch_mode_info,
13236 .get = alc_ch_mode_get,
13237 .put = alc_ch_mode_put,
13238 .private_value = ARRAY_SIZE(alc861_asus_modes),
13243 /* additional mixer */
13244 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13245 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13246 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13251 * generic initialization of ADC, input mixers and output mixers
13253 static struct hda_verb alc861_base_init_verbs[] = {
13255 * Unmute ADC0 and set the default input to mic-in
13257 /* port-A for surround (rear panel) */
13258 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13259 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13260 /* port-B for mic-in (rear panel) with vref */
13261 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13262 /* port-C for line-in (rear panel) */
13263 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13264 /* port-D for Front */
13265 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13266 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13267 /* port-E for HP out (front panel) */
13268 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13269 /* route front PCM to HP */
13270 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13271 /* port-F for mic-in (front panel) with vref */
13272 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13273 /* port-G for CLFE (rear panel) */
13274 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13275 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13276 /* port-H for side (rear panel) */
13277 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13278 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13280 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13281 /* route front mic to ADC1*/
13282 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13283 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13285 /* Unmute DAC0~3 & spdif out*/
13286 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13287 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13288 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13289 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13290 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13292 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13293 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13294 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13295 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13296 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13298 /* Unmute Stereo Mixer 15 */
13299 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13300 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13301 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13302 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13304 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13305 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13306 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13307 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13308 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13309 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13310 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13311 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13312 /* hp used DAC 3 (Front) */
13313 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13314 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13319 static struct hda_verb alc861_threestack_init_verbs[] = {
13321 * Unmute ADC0 and set the default input to mic-in
13323 /* port-A for surround (rear panel) */
13324 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13325 /* port-B for mic-in (rear panel) with vref */
13326 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13327 /* port-C for line-in (rear panel) */
13328 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13329 /* port-D for Front */
13330 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13331 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13332 /* port-E for HP out (front panel) */
13333 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13334 /* route front PCM to HP */
13335 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13336 /* port-F for mic-in (front panel) with vref */
13337 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13338 /* port-G for CLFE (rear panel) */
13339 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13340 /* port-H for side (rear panel) */
13341 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13343 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13344 /* route front mic to ADC1*/
13345 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13346 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13347 /* Unmute DAC0~3 & spdif out*/
13348 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13349 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13350 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13351 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13352 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13354 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13355 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13356 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13357 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13358 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13360 /* Unmute Stereo Mixer 15 */
13361 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13362 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13363 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13364 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13366 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13367 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13368 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13369 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13370 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13371 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13372 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13373 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13374 /* hp used DAC 3 (Front) */
13375 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13376 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13380 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13382 * Unmute ADC0 and set the default input to mic-in
13384 /* port-A for surround (rear panel) */
13385 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13386 /* port-B for mic-in (rear panel) with vref */
13387 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13388 /* port-C for line-in (rear panel) */
13389 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13390 /* port-D for Front */
13391 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13392 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13393 /* port-E for HP out (front panel) */
13394 /* this has to be set to VREF80 */
13395 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13396 /* route front PCM to HP */
13397 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13398 /* port-F for mic-in (front panel) with vref */
13399 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13400 /* port-G for CLFE (rear panel) */
13401 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13402 /* port-H for side (rear panel) */
13403 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13405 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13406 /* route front mic to ADC1*/
13407 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13408 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13409 /* Unmute DAC0~3 & spdif out*/
13410 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13411 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13412 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13413 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13414 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13416 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13417 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13418 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13419 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13420 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13422 /* Unmute Stereo Mixer 15 */
13423 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13424 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13425 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13426 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13428 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13429 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13430 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13431 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13432 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13433 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13434 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13435 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13436 /* hp used DAC 3 (Front) */
13437 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13438 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13442 static struct hda_verb alc861_asus_init_verbs[] = {
13444 * Unmute ADC0 and set the default input to mic-in
13446 /* port-A for surround (rear panel)
13447 * according to codec#0 this is the HP jack
13449 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13450 /* route front PCM to HP */
13451 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13452 /* port-B for mic-in (rear panel) with vref */
13453 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13454 /* port-C for line-in (rear panel) */
13455 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13456 /* port-D for Front */
13457 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13458 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13459 /* port-E for HP out (front panel) */
13460 /* this has to be set to VREF80 */
13461 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13462 /* route front PCM to HP */
13463 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13464 /* port-F for mic-in (front panel) with vref */
13465 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13466 /* port-G for CLFE (rear panel) */
13467 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13468 /* port-H for side (rear panel) */
13469 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13471 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13472 /* route front mic to ADC1*/
13473 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13474 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13475 /* Unmute DAC0~3 & spdif out*/
13476 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13477 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13478 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13479 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13480 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13481 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13482 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13483 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13484 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13485 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13487 /* Unmute Stereo Mixer 15 */
13488 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13489 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13490 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13491 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13493 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13494 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13495 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13496 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13497 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13498 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13499 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13500 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13501 /* hp used DAC 3 (Front) */
13502 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13503 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13507 /* additional init verbs for ASUS laptops */
13508 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13509 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13510 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13515 * generic initialization of ADC, input mixers and output mixers
13517 static struct hda_verb alc861_auto_init_verbs[] = {
13519 * Unmute ADC0 and set the default input to mic-in
13521 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13522 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13524 /* Unmute DAC0~3 & spdif out*/
13525 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13526 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13527 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13528 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13529 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13531 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13532 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13533 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13534 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13535 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13537 /* Unmute Stereo Mixer 15 */
13538 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13539 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13540 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13541 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13543 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13544 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13545 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13546 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13547 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13548 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13549 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13550 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13552 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13553 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13554 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13555 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13556 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13557 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13558 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13559 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13561 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13566 static struct hda_verb alc861_toshiba_init_verbs[] = {
13567 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13572 /* toggle speaker-output according to the hp-jack state */
13573 static void alc861_toshiba_automute(struct hda_codec *codec)
13575 unsigned int present;
13577 present = snd_hda_codec_read(codec, 0x0f, 0,
13578 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13579 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13580 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13581 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13582 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13585 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13588 if ((res >> 26) == ALC880_HP_EVENT)
13589 alc861_toshiba_automute(codec);
13592 /* pcm configuration: identiacal with ALC880 */
13593 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13594 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13595 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13596 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13599 #define ALC861_DIGOUT_NID 0x07
13601 static struct hda_channel_mode alc861_8ch_modes[1] = {
13605 static hda_nid_t alc861_dac_nids[4] = {
13606 /* front, surround, clfe, side */
13607 0x03, 0x06, 0x05, 0x04
13610 static hda_nid_t alc660_dac_nids[3] = {
13611 /* front, clfe, surround */
13615 static hda_nid_t alc861_adc_nids[1] = {
13620 static struct hda_input_mux alc861_capture_source = {
13624 { "Front Mic", 0x3 },
13631 /* fill in the dac_nids table from the parsed pin configuration */
13632 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13633 const struct auto_pin_cfg *cfg)
13638 spec->multiout.dac_nids = spec->private_dac_nids;
13639 for (i = 0; i < cfg->line_outs; i++) {
13640 nid = cfg->line_out_pins[i];
13642 if (i >= ARRAY_SIZE(alc861_dac_nids))
13644 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13647 spec->multiout.num_dacs = cfg->line_outs;
13651 /* add playback controls from the parsed DAC table */
13652 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13653 const struct auto_pin_cfg *cfg)
13656 static const char *chname[4] = {
13657 "Front", "Surround", NULL /*CLFE*/, "Side"
13662 for (i = 0; i < cfg->line_outs; i++) {
13663 nid = spec->multiout.dac_nids[i];
13668 err = add_control(spec, ALC_CTL_BIND_MUTE,
13669 "Center Playback Switch",
13670 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13674 err = add_control(spec, ALC_CTL_BIND_MUTE,
13675 "LFE Playback Switch",
13676 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13681 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13683 if (nid == alc861_dac_nids[idx])
13685 sprintf(name, "%s Playback Switch", chname[idx]);
13686 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13687 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13696 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13704 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13706 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13707 "Headphone Playback Switch",
13708 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13711 spec->multiout.hp_nid = nid;
13716 /* create playback/capture controls for input pins */
13717 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13718 const struct auto_pin_cfg *cfg)
13720 struct hda_input_mux *imux = &spec->private_imux[0];
13721 int i, err, idx, idx1;
13723 for (i = 0; i < AUTO_PIN_LAST; i++) {
13724 switch (cfg->input_pins[i]) {
13727 idx = 2; /* Line In */
13731 idx = 2; /* Line In */
13735 idx = 1; /* Mic In */
13739 idx = 1; /* Mic In */
13749 err = new_analog_input(spec, cfg->input_pins[i],
13750 auto_pin_cfg_labels[i], idx, 0x15);
13754 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13755 imux->items[imux->num_items].index = idx1;
13761 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13763 int pin_type, int dac_idx)
13765 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13767 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13771 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13773 struct alc_spec *spec = codec->spec;
13776 for (i = 0; i < spec->autocfg.line_outs; i++) {
13777 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13778 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13780 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13781 spec->multiout.dac_nids[i]);
13785 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13787 struct alc_spec *spec = codec->spec;
13790 pin = spec->autocfg.hp_pins[0];
13791 if (pin) /* connect to front */
13792 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13793 spec->multiout.dac_nids[0]);
13794 pin = spec->autocfg.speaker_pins[0];
13796 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13799 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13801 struct alc_spec *spec = codec->spec;
13804 for (i = 0; i < AUTO_PIN_LAST; i++) {
13805 hda_nid_t nid = spec->autocfg.input_pins[i];
13806 if (nid >= 0x0c && nid <= 0x11)
13807 alc_set_input_pin(codec, nid, i);
13811 /* parse the BIOS configuration and set up the alc_spec */
13812 /* return 1 if successful, 0 if the proper config is not found,
13813 * or a negative error code
13815 static int alc861_parse_auto_config(struct hda_codec *codec)
13817 struct alc_spec *spec = codec->spec;
13819 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13821 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13825 if (!spec->autocfg.line_outs)
13826 return 0; /* can't find valid BIOS pin config */
13828 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13831 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13834 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13837 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13841 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13843 if (spec->autocfg.dig_outs)
13844 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13846 if (spec->kctls.list)
13847 add_mixer(spec, spec->kctls.list);
13849 add_verb(spec, alc861_auto_init_verbs);
13851 spec->num_mux_defs = 1;
13852 spec->input_mux = &spec->private_imux[0];
13854 spec->adc_nids = alc861_adc_nids;
13855 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13856 set_capture_mixer(spec);
13858 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
13863 /* additional initialization for auto-configuration model */
13864 static void alc861_auto_init(struct hda_codec *codec)
13866 struct alc_spec *spec = codec->spec;
13867 alc861_auto_init_multi_out(codec);
13868 alc861_auto_init_hp_out(codec);
13869 alc861_auto_init_analog_input(codec);
13870 if (spec->unsol_event)
13871 alc_inithook(codec);
13874 #ifdef CONFIG_SND_HDA_POWER_SAVE
13875 static struct hda_amp_list alc861_loopbacks[] = {
13876 { 0x15, HDA_INPUT, 0 },
13877 { 0x15, HDA_INPUT, 1 },
13878 { 0x15, HDA_INPUT, 2 },
13879 { 0x15, HDA_INPUT, 3 },
13886 * configuration and preset
13888 static const char *alc861_models[ALC861_MODEL_LAST] = {
13889 [ALC861_3ST] = "3stack",
13890 [ALC660_3ST] = "3stack-660",
13891 [ALC861_3ST_DIG] = "3stack-dig",
13892 [ALC861_6ST_DIG] = "6stack-dig",
13893 [ALC861_UNIWILL_M31] = "uniwill-m31",
13894 [ALC861_TOSHIBA] = "toshiba",
13895 [ALC861_ASUS] = "asus",
13896 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13897 [ALC861_AUTO] = "auto",
13900 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13901 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13902 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13903 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13904 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13905 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13906 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13907 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13908 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13909 * Any other models that need this preset?
13911 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13912 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13913 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13914 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13915 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13916 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13917 /* FIXME: the below seems conflict */
13918 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13919 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13920 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13924 static struct alc_config_preset alc861_presets[] = {
13926 .mixers = { alc861_3ST_mixer },
13927 .init_verbs = { alc861_threestack_init_verbs },
13928 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13929 .dac_nids = alc861_dac_nids,
13930 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13931 .channel_mode = alc861_threestack_modes,
13933 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13934 .adc_nids = alc861_adc_nids,
13935 .input_mux = &alc861_capture_source,
13937 [ALC861_3ST_DIG] = {
13938 .mixers = { alc861_base_mixer },
13939 .init_verbs = { alc861_threestack_init_verbs },
13940 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13941 .dac_nids = alc861_dac_nids,
13942 .dig_out_nid = ALC861_DIGOUT_NID,
13943 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13944 .channel_mode = alc861_threestack_modes,
13946 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13947 .adc_nids = alc861_adc_nids,
13948 .input_mux = &alc861_capture_source,
13950 [ALC861_6ST_DIG] = {
13951 .mixers = { alc861_base_mixer },
13952 .init_verbs = { alc861_base_init_verbs },
13953 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13954 .dac_nids = alc861_dac_nids,
13955 .dig_out_nid = ALC861_DIGOUT_NID,
13956 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13957 .channel_mode = alc861_8ch_modes,
13958 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13959 .adc_nids = alc861_adc_nids,
13960 .input_mux = &alc861_capture_source,
13963 .mixers = { alc861_3ST_mixer },
13964 .init_verbs = { alc861_threestack_init_verbs },
13965 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13966 .dac_nids = alc660_dac_nids,
13967 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13968 .channel_mode = alc861_threestack_modes,
13970 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13971 .adc_nids = alc861_adc_nids,
13972 .input_mux = &alc861_capture_source,
13974 [ALC861_UNIWILL_M31] = {
13975 .mixers = { alc861_uniwill_m31_mixer },
13976 .init_verbs = { alc861_uniwill_m31_init_verbs },
13977 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13978 .dac_nids = alc861_dac_nids,
13979 .dig_out_nid = ALC861_DIGOUT_NID,
13980 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13981 .channel_mode = alc861_uniwill_m31_modes,
13983 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13984 .adc_nids = alc861_adc_nids,
13985 .input_mux = &alc861_capture_source,
13987 [ALC861_TOSHIBA] = {
13988 .mixers = { alc861_toshiba_mixer },
13989 .init_verbs = { alc861_base_init_verbs,
13990 alc861_toshiba_init_verbs },
13991 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13992 .dac_nids = alc861_dac_nids,
13993 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13994 .channel_mode = alc883_3ST_2ch_modes,
13995 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13996 .adc_nids = alc861_adc_nids,
13997 .input_mux = &alc861_capture_source,
13998 .unsol_event = alc861_toshiba_unsol_event,
13999 .init_hook = alc861_toshiba_automute,
14002 .mixers = { alc861_asus_mixer },
14003 .init_verbs = { alc861_asus_init_verbs },
14004 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14005 .dac_nids = alc861_dac_nids,
14006 .dig_out_nid = ALC861_DIGOUT_NID,
14007 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14008 .channel_mode = alc861_asus_modes,
14011 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14012 .adc_nids = alc861_adc_nids,
14013 .input_mux = &alc861_capture_source,
14015 [ALC861_ASUS_LAPTOP] = {
14016 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14017 .init_verbs = { alc861_asus_init_verbs,
14018 alc861_asus_laptop_init_verbs },
14019 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14020 .dac_nids = alc861_dac_nids,
14021 .dig_out_nid = ALC861_DIGOUT_NID,
14022 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14023 .channel_mode = alc883_3ST_2ch_modes,
14025 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14026 .adc_nids = alc861_adc_nids,
14027 .input_mux = &alc861_capture_source,
14032 static int patch_alc861(struct hda_codec *codec)
14034 struct alc_spec *spec;
14038 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14042 codec->spec = spec;
14044 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14048 if (board_config < 0) {
14049 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
14050 "trying auto-probe from BIOS...\n");
14051 board_config = ALC861_AUTO;
14054 if (board_config == ALC861_AUTO) {
14055 /* automatic parse from the BIOS config */
14056 err = alc861_parse_auto_config(codec);
14062 "hda_codec: Cannot set up configuration "
14063 "from BIOS. Using base mode...\n");
14064 board_config = ALC861_3ST_DIG;
14068 err = snd_hda_attach_beep_device(codec, 0x23);
14074 if (board_config != ALC861_AUTO)
14075 setup_preset(spec, &alc861_presets[board_config]);
14077 spec->stream_name_analog = "ALC861 Analog";
14078 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14079 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14081 spec->stream_name_digital = "ALC861 Digital";
14082 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14083 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14085 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14087 spec->vmaster_nid = 0x03;
14089 codec->patch_ops = alc_patch_ops;
14090 if (board_config == ALC861_AUTO)
14091 spec->init_hook = alc861_auto_init;
14092 #ifdef CONFIG_SND_HDA_POWER_SAVE
14093 if (!spec->loopback.amplist)
14094 spec->loopback.amplist = alc861_loopbacks;
14096 codec->proc_widget_hook = print_realtek_coef;
14102 * ALC861-VD support
14106 * In addition, an independent DAC
14108 #define ALC861VD_DIGOUT_NID 0x06
14110 static hda_nid_t alc861vd_dac_nids[4] = {
14111 /* front, surr, clfe, side surr */
14112 0x02, 0x03, 0x04, 0x05
14115 /* dac_nids for ALC660vd are in a different order - according to
14116 * Realtek's driver.
14117 * This should probably tesult in a different mixer for 6stack models
14118 * of ALC660vd codecs, but for now there is only 3stack mixer
14119 * - and it is the same as in 861vd.
14120 * adc_nids in ALC660vd are (is) the same as in 861vd
14122 static hda_nid_t alc660vd_dac_nids[3] = {
14123 /* front, rear, clfe, rear_surr */
14127 static hda_nid_t alc861vd_adc_nids[1] = {
14132 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14135 /* FIXME: should be a matrix-type input source selection */
14136 static struct hda_input_mux alc861vd_capture_source = {
14140 { "Front Mic", 0x1 },
14146 static struct hda_input_mux alc861vd_dallas_capture_source = {
14149 { "Ext Mic", 0x0 },
14150 { "Int Mic", 0x1 },
14154 static struct hda_input_mux alc861vd_hp_capture_source = {
14157 { "Front Mic", 0x0 },
14158 { "ATAPI Mic", 0x1 },
14165 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14172 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14173 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14174 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14175 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14176 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14183 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14184 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14185 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14186 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14187 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14191 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14192 { 6, alc861vd_6stack_ch6_init },
14193 { 8, alc861vd_6stack_ch8_init },
14196 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14198 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14199 .name = "Channel Mode",
14200 .info = alc_ch_mode_info,
14201 .get = alc_ch_mode_get,
14202 .put = alc_ch_mode_put,
14207 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14208 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14210 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14211 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14212 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14214 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14215 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14217 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14219 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14221 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14222 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14224 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14225 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14229 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14230 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14231 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14233 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14234 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14235 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14237 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14238 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14240 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14241 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14246 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14247 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14248 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14250 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14252 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14256 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14257 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14258 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14260 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14261 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14263 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14264 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14269 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14270 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14271 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14272 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14274 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14276 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14277 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14278 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14280 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14281 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14282 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14284 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14285 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14290 /* Pin assignment: Speaker=0x14, HP = 0x15,
14291 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14293 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14294 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14295 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14296 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14297 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14298 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14299 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14300 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14301 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14302 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14303 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14307 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14308 * Front Mic=0x18, ATAPI Mic = 0x19,
14310 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14311 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14312 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14313 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14314 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14315 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14316 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14317 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14318 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14324 * generic initialization of ADC, input mixers and output mixers
14326 static struct hda_verb alc861vd_volume_init_verbs[] = {
14328 * Unmute ADC0 and set the default input to mic-in
14330 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14331 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14333 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14334 * the analog-loopback mixer widget
14336 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14343 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14345 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14346 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14350 * Set up output mixers (0x02 - 0x05)
14352 /* set vol=0 to output mixers */
14353 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14354 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14355 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14356 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14358 /* set up input amps for analog loopback */
14359 /* Amp Indices: DAC = 0, mixer = 1 */
14360 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14361 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14362 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14363 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14364 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14365 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14366 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14367 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14373 * 3-stack pin configuration:
14374 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14376 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14378 * Set pin mode and muting
14380 /* set front pin widgets 0x14 for output */
14381 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14382 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14383 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14385 /* Mic (rear) pin: input vref at 80% */
14386 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14387 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14388 /* Front Mic pin: input vref at 80% */
14389 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14390 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14391 /* Line In pin: input */
14392 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14393 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14394 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14395 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14396 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14397 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14398 /* CD pin widget for input */
14399 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14405 * 6-stack pin configuration:
14407 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14409 * Set pin mode and muting
14411 /* set front pin widgets 0x14 for output */
14412 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14413 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14414 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14416 /* Rear Pin: output 1 (0x0d) */
14417 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14418 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14419 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14420 /* CLFE Pin: output 2 (0x0e) */
14421 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14422 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14423 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14424 /* Side Pin: output 3 (0x0f) */
14425 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14426 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14427 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14429 /* Mic (rear) pin: input vref at 80% */
14430 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14431 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14432 /* Front Mic pin: input vref at 80% */
14433 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14434 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14435 /* Line In pin: input */
14436 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14437 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14438 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14439 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14440 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14441 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14442 /* CD pin widget for input */
14443 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14448 static struct hda_verb alc861vd_eapd_verbs[] = {
14449 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14453 static struct hda_verb alc660vd_eapd_verbs[] = {
14454 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14455 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14459 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14460 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14461 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14462 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14463 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14464 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14468 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14470 unsigned int present;
14471 unsigned char bits;
14473 present = snd_hda_codec_read(codec, 0x18, 0,
14474 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14475 bits = present ? HDA_AMP_MUTE : 0;
14476 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14477 HDA_AMP_MUTE, bits);
14480 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14482 struct alc_spec *spec = codec->spec;
14484 spec->autocfg.hp_pins[0] = 0x1b;
14485 spec->autocfg.speaker_pins[0] = 0x14;
14486 alc_automute_amp(codec);
14487 alc861vd_lenovo_mic_automute(codec);
14490 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14493 switch (res >> 26) {
14494 case ALC880_MIC_EVENT:
14495 alc861vd_lenovo_mic_automute(codec);
14498 alc_automute_amp_unsol_event(codec, res);
14503 static struct hda_verb alc861vd_dallas_verbs[] = {
14504 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14505 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14506 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14507 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14509 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14510 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14511 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14512 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14513 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14514 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14515 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14516 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14518 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14519 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14520 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14521 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14522 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14523 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14524 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14525 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14527 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14528 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14529 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14530 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14531 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14532 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14533 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14534 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14536 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14537 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14538 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14539 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14541 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14542 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14543 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14548 /* toggle speaker-output according to the hp-jack state */
14549 static void alc861vd_dallas_init_hook(struct hda_codec *codec)
14551 struct alc_spec *spec = codec->spec;
14553 spec->autocfg.hp_pins[0] = 0x15;
14554 spec->autocfg.speaker_pins[0] = 0x14;
14555 alc_automute_amp(codec);
14558 #ifdef CONFIG_SND_HDA_POWER_SAVE
14559 #define alc861vd_loopbacks alc880_loopbacks
14562 /* pcm configuration: identiacal with ALC880 */
14563 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14564 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14565 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14566 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14569 * configuration and preset
14571 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14572 [ALC660VD_3ST] = "3stack-660",
14573 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14574 [ALC660VD_ASUS_V1S] = "asus-v1s",
14575 [ALC861VD_3ST] = "3stack",
14576 [ALC861VD_3ST_DIG] = "3stack-digout",
14577 [ALC861VD_6ST_DIG] = "6stack-digout",
14578 [ALC861VD_LENOVO] = "lenovo",
14579 [ALC861VD_DALLAS] = "dallas",
14580 [ALC861VD_HP] = "hp",
14581 [ALC861VD_AUTO] = "auto",
14584 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14585 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14586 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14587 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14588 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14589 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14590 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14591 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14592 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14593 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14594 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14595 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14596 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14597 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14598 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14599 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14603 static struct alc_config_preset alc861vd_presets[] = {
14605 .mixers = { alc861vd_3st_mixer },
14606 .init_verbs = { alc861vd_volume_init_verbs,
14607 alc861vd_3stack_init_verbs },
14608 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14609 .dac_nids = alc660vd_dac_nids,
14610 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14611 .channel_mode = alc861vd_3stack_2ch_modes,
14612 .input_mux = &alc861vd_capture_source,
14614 [ALC660VD_3ST_DIG] = {
14615 .mixers = { alc861vd_3st_mixer },
14616 .init_verbs = { alc861vd_volume_init_verbs,
14617 alc861vd_3stack_init_verbs },
14618 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14619 .dac_nids = alc660vd_dac_nids,
14620 .dig_out_nid = ALC861VD_DIGOUT_NID,
14621 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14622 .channel_mode = alc861vd_3stack_2ch_modes,
14623 .input_mux = &alc861vd_capture_source,
14626 .mixers = { alc861vd_3st_mixer },
14627 .init_verbs = { alc861vd_volume_init_verbs,
14628 alc861vd_3stack_init_verbs },
14629 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14630 .dac_nids = alc861vd_dac_nids,
14631 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14632 .channel_mode = alc861vd_3stack_2ch_modes,
14633 .input_mux = &alc861vd_capture_source,
14635 [ALC861VD_3ST_DIG] = {
14636 .mixers = { alc861vd_3st_mixer },
14637 .init_verbs = { alc861vd_volume_init_verbs,
14638 alc861vd_3stack_init_verbs },
14639 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14640 .dac_nids = alc861vd_dac_nids,
14641 .dig_out_nid = ALC861VD_DIGOUT_NID,
14642 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14643 .channel_mode = alc861vd_3stack_2ch_modes,
14644 .input_mux = &alc861vd_capture_source,
14646 [ALC861VD_6ST_DIG] = {
14647 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14648 .init_verbs = { alc861vd_volume_init_verbs,
14649 alc861vd_6stack_init_verbs },
14650 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14651 .dac_nids = alc861vd_dac_nids,
14652 .dig_out_nid = ALC861VD_DIGOUT_NID,
14653 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14654 .channel_mode = alc861vd_6stack_modes,
14655 .input_mux = &alc861vd_capture_source,
14657 [ALC861VD_LENOVO] = {
14658 .mixers = { alc861vd_lenovo_mixer },
14659 .init_verbs = { alc861vd_volume_init_verbs,
14660 alc861vd_3stack_init_verbs,
14661 alc861vd_eapd_verbs,
14662 alc861vd_lenovo_unsol_verbs },
14663 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14664 .dac_nids = alc660vd_dac_nids,
14665 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14666 .channel_mode = alc861vd_3stack_2ch_modes,
14667 .input_mux = &alc861vd_capture_source,
14668 .unsol_event = alc861vd_lenovo_unsol_event,
14669 .init_hook = alc861vd_lenovo_init_hook,
14671 [ALC861VD_DALLAS] = {
14672 .mixers = { alc861vd_dallas_mixer },
14673 .init_verbs = { alc861vd_dallas_verbs },
14674 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14675 .dac_nids = alc861vd_dac_nids,
14676 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14677 .channel_mode = alc861vd_3stack_2ch_modes,
14678 .input_mux = &alc861vd_dallas_capture_source,
14679 .unsol_event = alc_automute_amp_unsol_event,
14680 .init_hook = alc861vd_dallas_init_hook,
14683 .mixers = { alc861vd_hp_mixer },
14684 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14685 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14686 .dac_nids = alc861vd_dac_nids,
14687 .dig_out_nid = ALC861VD_DIGOUT_NID,
14688 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14689 .channel_mode = alc861vd_3stack_2ch_modes,
14690 .input_mux = &alc861vd_hp_capture_source,
14691 .unsol_event = alc_automute_amp_unsol_event,
14692 .init_hook = alc861vd_dallas_init_hook,
14694 [ALC660VD_ASUS_V1S] = {
14695 .mixers = { alc861vd_lenovo_mixer },
14696 .init_verbs = { alc861vd_volume_init_verbs,
14697 alc861vd_3stack_init_verbs,
14698 alc861vd_eapd_verbs,
14699 alc861vd_lenovo_unsol_verbs },
14700 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14701 .dac_nids = alc660vd_dac_nids,
14702 .dig_out_nid = ALC861VD_DIGOUT_NID,
14703 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14704 .channel_mode = alc861vd_3stack_2ch_modes,
14705 .input_mux = &alc861vd_capture_source,
14706 .unsol_event = alc861vd_lenovo_unsol_event,
14707 .init_hook = alc861vd_lenovo_init_hook,
14712 * BIOS auto configuration
14714 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14715 hda_nid_t nid, int pin_type, int dac_idx)
14717 alc_set_pin_output(codec, nid, pin_type);
14720 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14722 struct alc_spec *spec = codec->spec;
14725 for (i = 0; i <= HDA_SIDE; i++) {
14726 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14727 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14729 alc861vd_auto_set_output_and_unmute(codec, nid,
14735 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14737 struct alc_spec *spec = codec->spec;
14740 pin = spec->autocfg.hp_pins[0];
14741 if (pin) /* connect to front and use dac 0 */
14742 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14743 pin = spec->autocfg.speaker_pins[0];
14745 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14748 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14749 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14751 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14753 struct alc_spec *spec = codec->spec;
14756 for (i = 0; i < AUTO_PIN_LAST; i++) {
14757 hda_nid_t nid = spec->autocfg.input_pins[i];
14758 if (alc861vd_is_input_pin(nid)) {
14759 alc_set_input_pin(codec, nid, i);
14760 if (nid != ALC861VD_PIN_CD_NID &&
14761 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
14762 snd_hda_codec_write(codec, nid, 0,
14763 AC_VERB_SET_AMP_GAIN_MUTE,
14769 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14771 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14772 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14774 /* add playback controls from the parsed DAC table */
14775 /* Based on ALC880 version. But ALC861VD has separate,
14776 * different NIDs for mute/unmute switch and volume control */
14777 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14778 const struct auto_pin_cfg *cfg)
14781 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14782 hda_nid_t nid_v, nid_s;
14785 for (i = 0; i < cfg->line_outs; i++) {
14786 if (!spec->multiout.dac_nids[i])
14788 nid_v = alc861vd_idx_to_mixer_vol(
14790 spec->multiout.dac_nids[i]));
14791 nid_s = alc861vd_idx_to_mixer_switch(
14793 spec->multiout.dac_nids[i]));
14797 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14798 "Center Playback Volume",
14799 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14803 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14804 "LFE Playback Volume",
14805 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14809 err = add_control(spec, ALC_CTL_BIND_MUTE,
14810 "Center Playback Switch",
14811 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14815 err = add_control(spec, ALC_CTL_BIND_MUTE,
14816 "LFE Playback Switch",
14817 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14822 sprintf(name, "%s Playback Volume", chname[i]);
14823 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14824 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14828 sprintf(name, "%s Playback Switch", chname[i]);
14829 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14830 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14839 /* add playback controls for speaker and HP outputs */
14840 /* Based on ALC880 version. But ALC861VD has separate,
14841 * different NIDs for mute/unmute switch and volume control */
14842 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14843 hda_nid_t pin, const char *pfx)
14845 hda_nid_t nid_v, nid_s;
14852 if (alc880_is_fixed_pin(pin)) {
14853 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14854 /* specify the DAC as the extra output */
14855 if (!spec->multiout.hp_nid)
14856 spec->multiout.hp_nid = nid_v;
14858 spec->multiout.extra_out_nid[0] = nid_v;
14859 /* control HP volume/switch on the output mixer amp */
14860 nid_v = alc861vd_idx_to_mixer_vol(
14861 alc880_fixed_pin_idx(pin));
14862 nid_s = alc861vd_idx_to_mixer_switch(
14863 alc880_fixed_pin_idx(pin));
14865 sprintf(name, "%s Playback Volume", pfx);
14866 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14867 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14870 sprintf(name, "%s Playback Switch", pfx);
14871 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14872 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14875 } else if (alc880_is_multi_pin(pin)) {
14876 /* set manual connection */
14877 /* we have only a switch on HP-out PIN */
14878 sprintf(name, "%s Playback Switch", pfx);
14879 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14880 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14887 /* parse the BIOS configuration and set up the alc_spec
14888 * return 1 if successful, 0 if the proper config is not found,
14889 * or a negative error code
14890 * Based on ALC880 version - had to change it to override
14891 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14892 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14894 struct alc_spec *spec = codec->spec;
14896 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14898 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14902 if (!spec->autocfg.line_outs)
14903 return 0; /* can't find valid BIOS pin config */
14905 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14908 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14911 err = alc861vd_auto_create_extra_out(spec,
14912 spec->autocfg.speaker_pins[0],
14916 err = alc861vd_auto_create_extra_out(spec,
14917 spec->autocfg.hp_pins[0],
14921 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14925 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14927 if (spec->autocfg.dig_outs)
14928 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14930 if (spec->kctls.list)
14931 add_mixer(spec, spec->kctls.list);
14933 add_verb(spec, alc861vd_volume_init_verbs);
14935 spec->num_mux_defs = 1;
14936 spec->input_mux = &spec->private_imux[0];
14938 err = alc_auto_add_mic_boost(codec);
14942 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
14947 /* additional initialization for auto-configuration model */
14948 static void alc861vd_auto_init(struct hda_codec *codec)
14950 struct alc_spec *spec = codec->spec;
14951 alc861vd_auto_init_multi_out(codec);
14952 alc861vd_auto_init_hp_out(codec);
14953 alc861vd_auto_init_analog_input(codec);
14954 alc861vd_auto_init_input_src(codec);
14955 if (spec->unsol_event)
14956 alc_inithook(codec);
14959 static int patch_alc861vd(struct hda_codec *codec)
14961 struct alc_spec *spec;
14962 int err, board_config;
14964 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14968 codec->spec = spec;
14970 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14974 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14975 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14976 "ALC861VD, trying auto-probe from BIOS...\n");
14977 board_config = ALC861VD_AUTO;
14980 if (board_config == ALC861VD_AUTO) {
14981 /* automatic parse from the BIOS config */
14982 err = alc861vd_parse_auto_config(codec);
14988 "hda_codec: Cannot set up configuration "
14989 "from BIOS. Using base mode...\n");
14990 board_config = ALC861VD_3ST;
14994 err = snd_hda_attach_beep_device(codec, 0x23);
15000 if (board_config != ALC861VD_AUTO)
15001 setup_preset(spec, &alc861vd_presets[board_config]);
15003 if (codec->vendor_id == 0x10ec0660) {
15004 spec->stream_name_analog = "ALC660-VD Analog";
15005 spec->stream_name_digital = "ALC660-VD Digital";
15006 /* always turn on EAPD */
15007 add_verb(spec, alc660vd_eapd_verbs);
15009 spec->stream_name_analog = "ALC861VD Analog";
15010 spec->stream_name_digital = "ALC861VD Digital";
15013 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15014 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15016 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15017 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15019 spec->adc_nids = alc861vd_adc_nids;
15020 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15021 spec->capsrc_nids = alc861vd_capsrc_nids;
15022 spec->capture_style = CAPT_MIX;
15024 set_capture_mixer(spec);
15025 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15027 spec->vmaster_nid = 0x02;
15029 codec->patch_ops = alc_patch_ops;
15031 if (board_config == ALC861VD_AUTO)
15032 spec->init_hook = alc861vd_auto_init;
15033 #ifdef CONFIG_SND_HDA_POWER_SAVE
15034 if (!spec->loopback.amplist)
15035 spec->loopback.amplist = alc861vd_loopbacks;
15037 codec->proc_widget_hook = print_realtek_coef;
15045 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15046 * configuration. Each pin widget can choose any input DACs and a mixer.
15047 * Each ADC is connected from a mixer of all inputs. This makes possible
15048 * 6-channel independent captures.
15050 * In addition, an independent DAC for the multi-playback (not used in this
15053 #define ALC662_DIGOUT_NID 0x06
15054 #define ALC662_DIGIN_NID 0x0a
15056 static hda_nid_t alc662_dac_nids[4] = {
15057 /* front, rear, clfe, rear_surr */
15061 static hda_nid_t alc272_dac_nids[2] = {
15065 static hda_nid_t alc662_adc_nids[1] = {
15070 static hda_nid_t alc272_adc_nids[1] = {
15075 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15076 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15080 /* FIXME: should be a matrix-type input source selection */
15081 static struct hda_input_mux alc662_capture_source = {
15085 { "Front Mic", 0x1 },
15091 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15099 static struct hda_input_mux alc662_eeepc_capture_source = {
15107 static struct hda_input_mux alc663_capture_source = {
15111 { "Front Mic", 0x1 },
15116 static struct hda_input_mux alc663_m51va_capture_source = {
15119 { "Ext-Mic", 0x0 },
15124 #if 1 /* set to 0 for testing other input sources below */
15125 static struct hda_input_mux alc272_nc10_capture_source = {
15128 { "Autoselect Mic", 0x0 },
15129 { "Internal Mic", 0x1 },
15133 static struct hda_input_mux alc272_nc10_capture_source = {
15136 { "Autoselect Mic", 0x0 },
15137 { "Internal Mic", 0x1 },
15138 { "In-0x02", 0x2 },
15139 { "In-0x03", 0x3 },
15140 { "In-0x04", 0x4 },
15141 { "In-0x05", 0x5 },
15142 { "In-0x06", 0x6 },
15143 { "In-0x07", 0x7 },
15144 { "In-0x08", 0x8 },
15145 { "In-0x09", 0x9 },
15146 { "In-0x0a", 0x0a },
15147 { "In-0x0b", 0x0b },
15148 { "In-0x0c", 0x0c },
15149 { "In-0x0d", 0x0d },
15150 { "In-0x0e", 0x0e },
15151 { "In-0x0f", 0x0f },
15159 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15166 static struct hda_verb alc662_3ST_ch2_init[] = {
15167 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15168 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15169 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15170 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15177 static struct hda_verb alc662_3ST_ch6_init[] = {
15178 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15179 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15180 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15181 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15182 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15183 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15187 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15188 { 2, alc662_3ST_ch2_init },
15189 { 6, alc662_3ST_ch6_init },
15195 static struct hda_verb alc662_sixstack_ch6_init[] = {
15196 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15197 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15198 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15205 static struct hda_verb alc662_sixstack_ch8_init[] = {
15206 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15207 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15208 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15212 static struct hda_channel_mode alc662_5stack_modes[2] = {
15213 { 2, alc662_sixstack_ch6_init },
15214 { 6, alc662_sixstack_ch8_init },
15217 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15218 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15221 static struct snd_kcontrol_new alc662_base_mixer[] = {
15222 /* output mixer control */
15223 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15224 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15225 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15226 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15227 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15228 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15229 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15230 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15231 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15233 /*Input mixer control */
15234 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15235 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15236 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15237 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15238 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15239 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15240 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15241 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15245 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15246 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15247 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15248 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15249 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15250 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15251 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15252 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15255 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15256 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15260 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15261 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15262 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15263 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15264 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15265 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15266 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15267 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15268 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15269 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15270 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15271 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15272 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15273 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15274 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15275 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15276 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15277 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15281 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15282 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15283 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15284 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15285 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15286 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15287 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15288 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15289 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15290 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15294 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15295 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15296 ALC262_HIPPO_MASTER_SWITCH,
15298 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15299 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15300 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15302 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15303 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15304 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15308 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15309 ALC262_HIPPO_MASTER_SWITCH,
15310 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15311 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15312 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15313 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15314 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15315 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15316 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15317 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15318 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15322 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15323 .ops = &snd_hda_bind_vol,
15325 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15326 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15331 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15332 .ops = &snd_hda_bind_sw,
15334 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15335 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15340 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15341 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15342 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15343 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15344 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15348 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15349 .ops = &snd_hda_bind_sw,
15351 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15352 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15353 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15358 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15359 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15360 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15361 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15362 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15363 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15364 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15369 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15370 .ops = &snd_hda_bind_sw,
15372 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15373 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15374 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15379 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15380 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15381 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15382 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15383 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15384 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15385 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15389 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15390 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15391 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15392 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15393 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15394 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15395 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15396 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15400 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15401 .ops = &snd_hda_bind_vol,
15403 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15404 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15409 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15410 .ops = &snd_hda_bind_sw,
15412 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15413 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15418 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15419 HDA_BIND_VOL("Master Playback Volume",
15420 &alc663_asus_two_bind_master_vol),
15421 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15422 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15423 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15424 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15425 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15429 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15430 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15431 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15432 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15433 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15434 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15435 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15439 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15440 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15441 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15442 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15443 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15444 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15446 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15447 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15448 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15449 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15453 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15454 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15455 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15456 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15458 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15459 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15460 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15461 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15462 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15463 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15467 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15469 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15470 .name = "Channel Mode",
15471 .info = alc_ch_mode_info,
15472 .get = alc_ch_mode_get,
15473 .put = alc_ch_mode_put,
15478 static struct hda_verb alc662_init_verbs[] = {
15479 /* ADC: mute amp left and right */
15480 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15481 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15482 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15484 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15485 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15486 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15487 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15490 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15491 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15492 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15493 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15494 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15495 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15497 /* Front Pin: output 0 (0x0c) */
15498 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15499 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15501 /* Rear Pin: output 1 (0x0d) */
15502 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15503 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15505 /* CLFE Pin: output 2 (0x0e) */
15506 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15507 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15509 /* Mic (rear) pin: input vref at 80% */
15510 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15511 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15512 /* Front Mic pin: input vref at 80% */
15513 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15514 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15515 /* Line In pin: input */
15516 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15517 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15518 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15519 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15520 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15521 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15522 /* CD pin widget for input */
15523 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15525 /* FIXME: use matrix-type input source selection */
15526 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15529 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15531 /* always trun on EAPD */
15532 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15533 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15538 static struct hda_verb alc662_sue_init_verbs[] = {
15539 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15540 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15544 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15545 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15546 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15550 /* Set Unsolicited Event*/
15551 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15552 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15553 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15558 * generic initialization of ADC, input mixers and output mixers
15560 static struct hda_verb alc662_auto_init_verbs[] = {
15562 * Unmute ADC and set the default input to mic-in
15564 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15565 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15567 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15569 * Note: PASD motherboards uses the Line In 2 as the input for front
15570 * panel mic (mic 2)
15572 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15573 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15574 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15575 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15576 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15577 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15580 * Set up output mixers (0x0c - 0x0f)
15582 /* set vol=0 to output mixers */
15583 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15584 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15585 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15587 /* set up input amps for analog loopback */
15588 /* Amp Indices: DAC = 0, mixer = 1 */
15589 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15590 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15591 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15592 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15593 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15594 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15597 /* FIXME: use matrix-type input source selection */
15598 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15601 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15605 /* additional verbs for ALC663 */
15606 static struct hda_verb alc663_auto_init_verbs[] = {
15607 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15608 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15612 static struct hda_verb alc663_m51va_init_verbs[] = {
15613 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15614 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15615 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15616 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15617 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15620 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15621 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15625 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15626 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15627 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15628 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15629 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15630 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15631 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15632 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15636 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15637 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15638 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15639 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15640 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15641 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15642 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15643 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15644 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15648 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15650 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15651 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15652 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15654 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15655 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15659 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15660 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15661 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15662 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15663 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15664 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15665 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15666 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15667 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15668 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15669 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15670 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15671 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15675 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15676 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15677 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15678 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15679 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15680 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15681 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15682 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15683 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15684 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15685 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15686 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15687 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15691 static struct hda_verb alc663_g71v_init_verbs[] = {
15692 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15693 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15694 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15696 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15697 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15698 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15700 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15701 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15702 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15706 static struct hda_verb alc663_g50v_init_verbs[] = {
15707 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15708 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15709 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15711 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15712 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15716 static struct hda_verb alc662_ecs_init_verbs[] = {
15717 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15719 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15720 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15724 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
15725 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15726 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15727 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15728 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15729 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15730 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15731 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15732 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15733 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15734 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15735 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15739 static struct hda_verb alc272_dell_init_verbs[] = {
15740 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15741 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15742 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15743 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15744 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15745 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15746 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15747 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15748 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15749 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15750 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15754 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15755 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15756 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15760 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
15761 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
15762 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
15766 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15768 unsigned int present;
15769 unsigned char bits;
15771 present = snd_hda_codec_read(codec, 0x14, 0,
15772 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15773 bits = present ? HDA_AMP_MUTE : 0;
15774 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15775 HDA_AMP_MUTE, bits);
15778 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15780 unsigned int present;
15781 unsigned char bits;
15783 present = snd_hda_codec_read(codec, 0x1b, 0,
15784 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15785 bits = present ? HDA_AMP_MUTE : 0;
15786 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15787 HDA_AMP_MUTE, bits);
15788 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15789 HDA_AMP_MUTE, bits);
15792 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15795 if ((res >> 26) == ALC880_HP_EVENT)
15796 alc662_lenovo_101e_all_automute(codec);
15797 if ((res >> 26) == ALC880_FRONT_EVENT)
15798 alc662_lenovo_101e_ispeaker_automute(codec);
15801 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15803 unsigned int present;
15805 present = snd_hda_codec_read(codec, 0x18, 0,
15806 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15807 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15808 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15809 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15810 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15811 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15812 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15813 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15814 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15817 /* unsolicited event for HP jack sensing */
15818 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15821 if ((res >> 26) == ALC880_MIC_EVENT)
15822 alc662_eeepc_mic_automute(codec);
15824 alc262_hippo_unsol_event(codec, res);
15827 static void alc662_eeepc_inithook(struct hda_codec *codec)
15829 alc262_hippo1_init_hook(codec);
15830 alc662_eeepc_mic_automute(codec);
15833 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15835 struct alc_spec *spec = codec->spec;
15837 spec->autocfg.hp_pins[0] = 0x14;
15838 spec->autocfg.speaker_pins[0] = 0x1b;
15839 alc262_hippo_master_update(codec);
15842 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15844 unsigned int present;
15845 unsigned char bits;
15847 present = snd_hda_codec_read(codec, 0x21, 0,
15848 AC_VERB_GET_PIN_SENSE, 0)
15849 & AC_PINSENSE_PRESENCE;
15850 bits = present ? HDA_AMP_MUTE : 0;
15851 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15852 AMP_IN_MUTE(0), bits);
15853 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15854 AMP_IN_MUTE(0), bits);
15857 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15859 unsigned int present;
15860 unsigned char bits;
15862 present = snd_hda_codec_read(codec, 0x21, 0,
15863 AC_VERB_GET_PIN_SENSE, 0)
15864 & AC_PINSENSE_PRESENCE;
15865 bits = present ? HDA_AMP_MUTE : 0;
15866 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15867 AMP_IN_MUTE(0), bits);
15868 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15869 AMP_IN_MUTE(0), bits);
15870 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15871 AMP_IN_MUTE(0), bits);
15872 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15873 AMP_IN_MUTE(0), bits);
15876 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15878 unsigned int present;
15879 unsigned char bits;
15881 present = snd_hda_codec_read(codec, 0x15, 0,
15882 AC_VERB_GET_PIN_SENSE, 0)
15883 & AC_PINSENSE_PRESENCE;
15884 bits = present ? HDA_AMP_MUTE : 0;
15885 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15886 AMP_IN_MUTE(0), bits);
15887 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15888 AMP_IN_MUTE(0), bits);
15889 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15890 AMP_IN_MUTE(0), bits);
15891 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15892 AMP_IN_MUTE(0), bits);
15895 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15897 unsigned int present;
15898 unsigned char bits;
15900 present = snd_hda_codec_read(codec, 0x1b, 0,
15901 AC_VERB_GET_PIN_SENSE, 0)
15902 & AC_PINSENSE_PRESENCE;
15903 bits = present ? 0 : PIN_OUT;
15904 snd_hda_codec_write(codec, 0x14, 0,
15905 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15908 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15910 unsigned int present1, present2;
15912 present1 = snd_hda_codec_read(codec, 0x21, 0,
15913 AC_VERB_GET_PIN_SENSE, 0)
15914 & AC_PINSENSE_PRESENCE;
15915 present2 = snd_hda_codec_read(codec, 0x15, 0,
15916 AC_VERB_GET_PIN_SENSE, 0)
15917 & AC_PINSENSE_PRESENCE;
15919 if (present1 || present2) {
15920 snd_hda_codec_write_cache(codec, 0x14, 0,
15921 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15923 snd_hda_codec_write_cache(codec, 0x14, 0,
15924 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15928 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15930 unsigned int present1, present2;
15932 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15933 AC_VERB_GET_PIN_SENSE, 0)
15934 & AC_PINSENSE_PRESENCE;
15935 present2 = snd_hda_codec_read(codec, 0x15, 0,
15936 AC_VERB_GET_PIN_SENSE, 0)
15937 & AC_PINSENSE_PRESENCE;
15939 if (present1 || present2) {
15940 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15941 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15942 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15943 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15945 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15946 AMP_IN_MUTE(0), 0);
15947 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15948 AMP_IN_MUTE(0), 0);
15952 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15954 unsigned int present;
15956 present = snd_hda_codec_read(codec, 0x18, 0,
15957 AC_VERB_GET_PIN_SENSE, 0)
15958 & AC_PINSENSE_PRESENCE;
15959 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15960 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15961 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15962 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15963 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15964 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15965 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15966 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15969 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15972 switch (res >> 26) {
15973 case ALC880_HP_EVENT:
15974 alc663_m51va_speaker_automute(codec);
15976 case ALC880_MIC_EVENT:
15977 alc663_m51va_mic_automute(codec);
15982 static void alc663_m51va_inithook(struct hda_codec *codec)
15984 alc663_m51va_speaker_automute(codec);
15985 alc663_m51va_mic_automute(codec);
15988 /* ***************** Mode1 ******************************/
15989 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15992 switch (res >> 26) {
15993 case ALC880_HP_EVENT:
15994 alc663_m51va_speaker_automute(codec);
15996 case ALC880_MIC_EVENT:
15997 alc662_eeepc_mic_automute(codec);
16002 static void alc663_mode1_inithook(struct hda_codec *codec)
16004 alc663_m51va_speaker_automute(codec);
16005 alc662_eeepc_mic_automute(codec);
16007 /* ***************** Mode2 ******************************/
16008 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16011 switch (res >> 26) {
16012 case ALC880_HP_EVENT:
16013 alc662_f5z_speaker_automute(codec);
16015 case ALC880_MIC_EVENT:
16016 alc662_eeepc_mic_automute(codec);
16021 static void alc662_mode2_inithook(struct hda_codec *codec)
16023 alc662_f5z_speaker_automute(codec);
16024 alc662_eeepc_mic_automute(codec);
16026 /* ***************** Mode3 ******************************/
16027 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16030 switch (res >> 26) {
16031 case ALC880_HP_EVENT:
16032 alc663_two_hp_m1_speaker_automute(codec);
16034 case ALC880_MIC_EVENT:
16035 alc662_eeepc_mic_automute(codec);
16040 static void alc663_mode3_inithook(struct hda_codec *codec)
16042 alc663_two_hp_m1_speaker_automute(codec);
16043 alc662_eeepc_mic_automute(codec);
16045 /* ***************** Mode4 ******************************/
16046 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16049 switch (res >> 26) {
16050 case ALC880_HP_EVENT:
16051 alc663_21jd_two_speaker_automute(codec);
16053 case ALC880_MIC_EVENT:
16054 alc662_eeepc_mic_automute(codec);
16059 static void alc663_mode4_inithook(struct hda_codec *codec)
16061 alc663_21jd_two_speaker_automute(codec);
16062 alc662_eeepc_mic_automute(codec);
16064 /* ***************** Mode5 ******************************/
16065 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16068 switch (res >> 26) {
16069 case ALC880_HP_EVENT:
16070 alc663_15jd_two_speaker_automute(codec);
16072 case ALC880_MIC_EVENT:
16073 alc662_eeepc_mic_automute(codec);
16078 static void alc663_mode5_inithook(struct hda_codec *codec)
16080 alc663_15jd_two_speaker_automute(codec);
16081 alc662_eeepc_mic_automute(codec);
16083 /* ***************** Mode6 ******************************/
16084 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16087 switch (res >> 26) {
16088 case ALC880_HP_EVENT:
16089 alc663_two_hp_m2_speaker_automute(codec);
16091 case ALC880_MIC_EVENT:
16092 alc662_eeepc_mic_automute(codec);
16097 static void alc663_mode6_inithook(struct hda_codec *codec)
16099 alc663_two_hp_m2_speaker_automute(codec);
16100 alc662_eeepc_mic_automute(codec);
16103 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16105 unsigned int present;
16106 unsigned char bits;
16108 present = snd_hda_codec_read(codec, 0x21, 0,
16109 AC_VERB_GET_PIN_SENSE, 0)
16110 & AC_PINSENSE_PRESENCE;
16111 bits = present ? HDA_AMP_MUTE : 0;
16112 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16113 HDA_AMP_MUTE, bits);
16114 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16115 HDA_AMP_MUTE, bits);
16118 static void alc663_g71v_front_automute(struct hda_codec *codec)
16120 unsigned int present;
16121 unsigned char bits;
16123 present = snd_hda_codec_read(codec, 0x15, 0,
16124 AC_VERB_GET_PIN_SENSE, 0)
16125 & AC_PINSENSE_PRESENCE;
16126 bits = present ? HDA_AMP_MUTE : 0;
16127 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16128 HDA_AMP_MUTE, bits);
16131 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16134 switch (res >> 26) {
16135 case ALC880_HP_EVENT:
16136 alc663_g71v_hp_automute(codec);
16138 case ALC880_FRONT_EVENT:
16139 alc663_g71v_front_automute(codec);
16141 case ALC880_MIC_EVENT:
16142 alc662_eeepc_mic_automute(codec);
16147 static void alc663_g71v_inithook(struct hda_codec *codec)
16149 alc663_g71v_front_automute(codec);
16150 alc663_g71v_hp_automute(codec);
16151 alc662_eeepc_mic_automute(codec);
16154 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16157 switch (res >> 26) {
16158 case ALC880_HP_EVENT:
16159 alc663_m51va_speaker_automute(codec);
16161 case ALC880_MIC_EVENT:
16162 alc662_eeepc_mic_automute(codec);
16167 static void alc663_g50v_inithook(struct hda_codec *codec)
16169 alc663_m51va_speaker_automute(codec);
16170 alc662_eeepc_mic_automute(codec);
16173 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16174 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16175 ALC262_HIPPO_MASTER_SWITCH,
16177 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16178 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16179 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16181 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16182 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16183 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16187 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16188 /* Master Playback automatically created from Speaker and Headphone */
16189 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16190 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16191 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16192 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16194 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16195 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16196 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16198 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16199 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16200 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16204 #ifdef CONFIG_SND_HDA_POWER_SAVE
16205 #define alc662_loopbacks alc880_loopbacks
16209 /* pcm configuration: identiacal with ALC880 */
16210 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16211 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16212 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16213 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16216 * configuration and preset
16218 static const char *alc662_models[ALC662_MODEL_LAST] = {
16219 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16220 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16221 [ALC662_3ST_6ch] = "3stack-6ch",
16222 [ALC662_5ST_DIG] = "6stack-dig",
16223 [ALC662_LENOVO_101E] = "lenovo-101e",
16224 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16225 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16226 [ALC662_ECS] = "ecs",
16227 [ALC663_ASUS_M51VA] = "m51va",
16228 [ALC663_ASUS_G71V] = "g71v",
16229 [ALC663_ASUS_H13] = "h13",
16230 [ALC663_ASUS_G50V] = "g50v",
16231 [ALC663_ASUS_MODE1] = "asus-mode1",
16232 [ALC662_ASUS_MODE2] = "asus-mode2",
16233 [ALC663_ASUS_MODE3] = "asus-mode3",
16234 [ALC663_ASUS_MODE4] = "asus-mode4",
16235 [ALC663_ASUS_MODE5] = "asus-mode5",
16236 [ALC663_ASUS_MODE6] = "asus-mode6",
16237 [ALC272_DELL] = "dell",
16238 [ALC272_DELL_ZM1] = "dell-zm1",
16239 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16240 [ALC662_AUTO] = "auto",
16243 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16244 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16245 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16246 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16247 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16248 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16249 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16250 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16251 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16252 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16253 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16254 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16255 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16256 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16257 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16258 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16259 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16260 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16261 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16262 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16263 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16264 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16265 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16266 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16267 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16268 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16269 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16270 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16271 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16272 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16273 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16274 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16275 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16276 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16277 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16278 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16279 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16280 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16281 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16282 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16283 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16284 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16285 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16286 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16287 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16288 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16289 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16290 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16291 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16292 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16293 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16294 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16295 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16296 ALC662_3ST_6ch_DIG),
16297 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16298 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16299 ALC662_3ST_6ch_DIG),
16300 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16301 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16302 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16303 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16304 ALC662_3ST_6ch_DIG),
16305 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16310 static struct alc_config_preset alc662_presets[] = {
16311 [ALC662_3ST_2ch_DIG] = {
16312 .mixers = { alc662_3ST_2ch_mixer },
16313 .init_verbs = { alc662_init_verbs },
16314 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16315 .dac_nids = alc662_dac_nids,
16316 .dig_out_nid = ALC662_DIGOUT_NID,
16317 .dig_in_nid = ALC662_DIGIN_NID,
16318 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16319 .channel_mode = alc662_3ST_2ch_modes,
16320 .input_mux = &alc662_capture_source,
16322 [ALC662_3ST_6ch_DIG] = {
16323 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16324 .init_verbs = { alc662_init_verbs },
16325 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16326 .dac_nids = alc662_dac_nids,
16327 .dig_out_nid = ALC662_DIGOUT_NID,
16328 .dig_in_nid = ALC662_DIGIN_NID,
16329 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16330 .channel_mode = alc662_3ST_6ch_modes,
16332 .input_mux = &alc662_capture_source,
16334 [ALC662_3ST_6ch] = {
16335 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16336 .init_verbs = { alc662_init_verbs },
16337 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16338 .dac_nids = alc662_dac_nids,
16339 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16340 .channel_mode = alc662_3ST_6ch_modes,
16342 .input_mux = &alc662_capture_source,
16344 [ALC662_5ST_DIG] = {
16345 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16346 .init_verbs = { alc662_init_verbs },
16347 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16348 .dac_nids = alc662_dac_nids,
16349 .dig_out_nid = ALC662_DIGOUT_NID,
16350 .dig_in_nid = ALC662_DIGIN_NID,
16351 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16352 .channel_mode = alc662_5stack_modes,
16353 .input_mux = &alc662_capture_source,
16355 [ALC662_LENOVO_101E] = {
16356 .mixers = { alc662_lenovo_101e_mixer },
16357 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16358 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16359 .dac_nids = alc662_dac_nids,
16360 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16361 .channel_mode = alc662_3ST_2ch_modes,
16362 .input_mux = &alc662_lenovo_101e_capture_source,
16363 .unsol_event = alc662_lenovo_101e_unsol_event,
16364 .init_hook = alc662_lenovo_101e_all_automute,
16366 [ALC662_ASUS_EEEPC_P701] = {
16367 .mixers = { alc662_eeepc_p701_mixer },
16368 .init_verbs = { alc662_init_verbs,
16369 alc662_eeepc_sue_init_verbs },
16370 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16371 .dac_nids = alc662_dac_nids,
16372 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16373 .channel_mode = alc662_3ST_2ch_modes,
16374 .input_mux = &alc662_eeepc_capture_source,
16375 .unsol_event = alc662_eeepc_unsol_event,
16376 .init_hook = alc662_eeepc_inithook,
16378 [ALC662_ASUS_EEEPC_EP20] = {
16379 .mixers = { alc662_eeepc_ep20_mixer,
16380 alc662_chmode_mixer },
16381 .init_verbs = { alc662_init_verbs,
16382 alc662_eeepc_ep20_sue_init_verbs },
16383 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16384 .dac_nids = alc662_dac_nids,
16385 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16386 .channel_mode = alc662_3ST_6ch_modes,
16387 .input_mux = &alc662_lenovo_101e_capture_source,
16388 .unsol_event = alc662_eeepc_unsol_event,
16389 .init_hook = alc662_eeepc_ep20_inithook,
16392 .mixers = { alc662_ecs_mixer },
16393 .init_verbs = { alc662_init_verbs,
16394 alc662_ecs_init_verbs },
16395 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16396 .dac_nids = alc662_dac_nids,
16397 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16398 .channel_mode = alc662_3ST_2ch_modes,
16399 .input_mux = &alc662_eeepc_capture_source,
16400 .unsol_event = alc662_eeepc_unsol_event,
16401 .init_hook = alc662_eeepc_inithook,
16403 [ALC663_ASUS_M51VA] = {
16404 .mixers = { alc663_m51va_mixer },
16405 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16406 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16407 .dac_nids = alc662_dac_nids,
16408 .dig_out_nid = ALC662_DIGOUT_NID,
16409 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16410 .channel_mode = alc662_3ST_2ch_modes,
16411 .input_mux = &alc663_m51va_capture_source,
16412 .unsol_event = alc663_m51va_unsol_event,
16413 .init_hook = alc663_m51va_inithook,
16415 [ALC663_ASUS_G71V] = {
16416 .mixers = { alc663_g71v_mixer },
16417 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16418 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16419 .dac_nids = alc662_dac_nids,
16420 .dig_out_nid = ALC662_DIGOUT_NID,
16421 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16422 .channel_mode = alc662_3ST_2ch_modes,
16423 .input_mux = &alc662_eeepc_capture_source,
16424 .unsol_event = alc663_g71v_unsol_event,
16425 .init_hook = alc663_g71v_inithook,
16427 [ALC663_ASUS_H13] = {
16428 .mixers = { alc663_m51va_mixer },
16429 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16430 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16431 .dac_nids = alc662_dac_nids,
16432 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16433 .channel_mode = alc662_3ST_2ch_modes,
16434 .input_mux = &alc663_m51va_capture_source,
16435 .unsol_event = alc663_m51va_unsol_event,
16436 .init_hook = alc663_m51va_inithook,
16438 [ALC663_ASUS_G50V] = {
16439 .mixers = { alc663_g50v_mixer },
16440 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16441 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16442 .dac_nids = alc662_dac_nids,
16443 .dig_out_nid = ALC662_DIGOUT_NID,
16444 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16445 .channel_mode = alc662_3ST_6ch_modes,
16446 .input_mux = &alc663_capture_source,
16447 .unsol_event = alc663_g50v_unsol_event,
16448 .init_hook = alc663_g50v_inithook,
16450 [ALC663_ASUS_MODE1] = {
16451 .mixers = { alc663_m51va_mixer },
16452 .cap_mixer = alc662_auto_capture_mixer,
16453 .init_verbs = { alc662_init_verbs,
16454 alc663_21jd_amic_init_verbs },
16455 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16457 .dac_nids = alc662_dac_nids,
16458 .dig_out_nid = ALC662_DIGOUT_NID,
16459 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16460 .channel_mode = alc662_3ST_2ch_modes,
16461 .input_mux = &alc662_eeepc_capture_source,
16462 .unsol_event = alc663_mode1_unsol_event,
16463 .init_hook = alc663_mode1_inithook,
16465 [ALC662_ASUS_MODE2] = {
16466 .mixers = { alc662_1bjd_mixer },
16467 .cap_mixer = alc662_auto_capture_mixer,
16468 .init_verbs = { alc662_init_verbs,
16469 alc662_1bjd_amic_init_verbs },
16470 .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 = alc662_mode2_unsol_event,
16477 .init_hook = alc662_mode2_inithook,
16479 [ALC663_ASUS_MODE3] = {
16480 .mixers = { alc663_two_hp_m1_mixer },
16481 .cap_mixer = alc662_auto_capture_mixer,
16482 .init_verbs = { alc662_init_verbs,
16483 alc663_two_hp_amic_m1_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_mode3_unsol_event,
16492 .init_hook = alc663_mode3_inithook,
16494 [ALC663_ASUS_MODE4] = {
16495 .mixers = { alc663_asus_21jd_clfe_mixer },
16496 .cap_mixer = alc662_auto_capture_mixer,
16497 .init_verbs = { alc662_init_verbs,
16498 alc663_21jd_amic_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_mode4_unsol_event,
16507 .init_hook = alc663_mode4_inithook,
16509 [ALC663_ASUS_MODE5] = {
16510 .mixers = { alc663_asus_15jd_clfe_mixer },
16511 .cap_mixer = alc662_auto_capture_mixer,
16512 .init_verbs = { alc662_init_verbs,
16513 alc663_15jd_amic_init_verbs },
16514 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16516 .dac_nids = alc662_dac_nids,
16517 .dig_out_nid = ALC662_DIGOUT_NID,
16518 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16519 .channel_mode = alc662_3ST_2ch_modes,
16520 .input_mux = &alc662_eeepc_capture_source,
16521 .unsol_event = alc663_mode5_unsol_event,
16522 .init_hook = alc663_mode5_inithook,
16524 [ALC663_ASUS_MODE6] = {
16525 .mixers = { alc663_two_hp_m2_mixer },
16526 .cap_mixer = alc662_auto_capture_mixer,
16527 .init_verbs = { alc662_init_verbs,
16528 alc663_two_hp_amic_m2_init_verbs },
16529 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16531 .dac_nids = alc662_dac_nids,
16532 .dig_out_nid = ALC662_DIGOUT_NID,
16533 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16534 .channel_mode = alc662_3ST_2ch_modes,
16535 .input_mux = &alc662_eeepc_capture_source,
16536 .unsol_event = alc663_mode6_unsol_event,
16537 .init_hook = alc663_mode6_inithook,
16540 .mixers = { alc663_m51va_mixer },
16541 .cap_mixer = alc272_auto_capture_mixer,
16542 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16543 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16544 .dac_nids = alc662_dac_nids,
16545 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16546 .adc_nids = alc272_adc_nids,
16547 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16548 .capsrc_nids = alc272_capsrc_nids,
16549 .channel_mode = alc662_3ST_2ch_modes,
16550 .input_mux = &alc663_m51va_capture_source,
16551 .unsol_event = alc663_m51va_unsol_event,
16552 .init_hook = alc663_m51va_inithook,
16554 [ALC272_DELL_ZM1] = {
16555 .mixers = { alc663_m51va_mixer },
16556 .cap_mixer = alc662_auto_capture_mixer,
16557 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16558 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16559 .dac_nids = alc662_dac_nids,
16560 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16561 .adc_nids = alc662_adc_nids,
16562 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
16563 .capsrc_nids = alc662_capsrc_nids,
16564 .channel_mode = alc662_3ST_2ch_modes,
16565 .input_mux = &alc663_m51va_capture_source,
16566 .unsol_event = alc663_m51va_unsol_event,
16567 .init_hook = alc663_m51va_inithook,
16569 [ALC272_SAMSUNG_NC10] = {
16570 .mixers = { alc272_nc10_mixer },
16571 .init_verbs = { alc662_init_verbs,
16572 alc663_21jd_amic_init_verbs },
16573 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16574 .dac_nids = alc272_dac_nids,
16575 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16576 .channel_mode = alc662_3ST_2ch_modes,
16577 .input_mux = &alc272_nc10_capture_source,
16578 .unsol_event = alc663_mode4_unsol_event,
16579 .init_hook = alc663_mode4_inithook,
16585 * BIOS auto configuration
16588 /* add playback controls from the parsed DAC table */
16589 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16590 const struct auto_pin_cfg *cfg)
16593 static const char *chname[4] = {
16594 "Front", "Surround", NULL /*CLFE*/, "Side"
16599 for (i = 0; i < cfg->line_outs; i++) {
16600 if (!spec->multiout.dac_nids[i])
16602 nid = alc880_idx_to_dac(i);
16605 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16606 "Center Playback Volume",
16607 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16611 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16612 "LFE Playback Volume",
16613 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16617 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16618 "Center Playback Switch",
16619 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16623 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16624 "LFE Playback Switch",
16625 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16630 sprintf(name, "%s Playback Volume", chname[i]);
16631 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16632 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16636 sprintf(name, "%s Playback Switch", chname[i]);
16637 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16638 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16647 /* add playback controls for speaker and HP outputs */
16648 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16659 /* ALC663 has a mono output pin on 0x17 */
16660 sprintf(name, "%s Playback Switch", pfx);
16661 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16662 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16666 if (alc880_is_fixed_pin(pin)) {
16667 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16668 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16669 /* specify the DAC as the extra output */
16670 if (!spec->multiout.hp_nid)
16671 spec->multiout.hp_nid = nid;
16673 spec->multiout.extra_out_nid[0] = nid;
16674 /* control HP volume/switch on the output mixer amp */
16675 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16676 sprintf(name, "%s Playback Volume", pfx);
16677 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16678 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16681 sprintf(name, "%s Playback Switch", pfx);
16682 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16683 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16686 } else if (alc880_is_multi_pin(pin)) {
16687 /* set manual connection */
16688 /* we have only a switch on HP-out PIN */
16689 sprintf(name, "%s Playback Switch", pfx);
16690 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16691 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16698 /* return the index of the src widget from the connection list of the nid.
16699 * return -1 if not found
16701 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
16704 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
16707 conns = snd_hda_get_connections(codec, nid, conn_list,
16708 ARRAY_SIZE(conn_list));
16711 for (i = 0; i < conns; i++)
16712 if (conn_list[i] == src)
16717 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
16719 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
16720 return (pincap & AC_PINCAP_IN) != 0;
16723 /* create playback/capture controls for input pins */
16724 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
16725 const struct auto_pin_cfg *cfg)
16727 struct alc_spec *spec = codec->spec;
16728 struct hda_input_mux *imux = &spec->private_imux[0];
16731 for (i = 0; i < AUTO_PIN_LAST; i++) {
16732 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
16733 idx = alc662_input_pin_idx(codec, 0x0b,
16734 cfg->input_pins[i]);
16736 err = new_analog_input(spec, cfg->input_pins[i],
16737 auto_pin_cfg_labels[i],
16742 idx = alc662_input_pin_idx(codec, 0x22,
16743 cfg->input_pins[i]);
16745 imux->items[imux->num_items].label =
16746 auto_pin_cfg_labels[i];
16747 imux->items[imux->num_items].index = idx;
16755 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16756 hda_nid_t nid, int pin_type,
16759 alc_set_pin_output(codec, nid, pin_type);
16760 /* need the manual connection? */
16761 if (alc880_is_multi_pin(nid)) {
16762 struct alc_spec *spec = codec->spec;
16763 int idx = alc880_multi_pin_idx(nid);
16764 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16765 AC_VERB_SET_CONNECT_SEL,
16766 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16770 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16772 struct alc_spec *spec = codec->spec;
16775 for (i = 0; i <= HDA_SIDE; i++) {
16776 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16777 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16779 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16784 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16786 struct alc_spec *spec = codec->spec;
16789 pin = spec->autocfg.hp_pins[0];
16790 if (pin) /* connect to front */
16792 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16793 pin = spec->autocfg.speaker_pins[0];
16795 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16798 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16800 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16802 struct alc_spec *spec = codec->spec;
16805 for (i = 0; i < AUTO_PIN_LAST; i++) {
16806 hda_nid_t nid = spec->autocfg.input_pins[i];
16807 if (alc662_is_input_pin(codec, nid)) {
16808 alc_set_input_pin(codec, nid, i);
16809 if (nid != ALC662_PIN_CD_NID &&
16810 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16811 snd_hda_codec_write(codec, nid, 0,
16812 AC_VERB_SET_AMP_GAIN_MUTE,
16818 #define alc662_auto_init_input_src alc882_auto_init_input_src
16820 static int alc662_parse_auto_config(struct hda_codec *codec)
16822 struct alc_spec *spec = codec->spec;
16824 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16826 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16830 if (!spec->autocfg.line_outs)
16831 return 0; /* can't find valid BIOS pin config */
16833 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16836 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16839 err = alc662_auto_create_extra_out(spec,
16840 spec->autocfg.speaker_pins[0],
16844 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16848 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
16852 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16854 if (spec->autocfg.dig_outs)
16855 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16857 if (spec->kctls.list)
16858 add_mixer(spec, spec->kctls.list);
16860 spec->num_mux_defs = 1;
16861 spec->input_mux = &spec->private_imux[0];
16863 add_verb(spec, alc662_auto_init_verbs);
16864 if (codec->vendor_id == 0x10ec0663)
16865 add_verb(spec, alc663_auto_init_verbs);
16867 err = alc_auto_add_mic_boost(codec);
16871 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
16876 /* additional initialization for auto-configuration model */
16877 static void alc662_auto_init(struct hda_codec *codec)
16879 struct alc_spec *spec = codec->spec;
16880 alc662_auto_init_multi_out(codec);
16881 alc662_auto_init_hp_out(codec);
16882 alc662_auto_init_analog_input(codec);
16883 alc662_auto_init_input_src(codec);
16884 if (spec->unsol_event)
16885 alc_inithook(codec);
16888 static int patch_alc662(struct hda_codec *codec)
16890 struct alc_spec *spec;
16891 int err, board_config;
16893 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16897 codec->spec = spec;
16899 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16901 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16904 if (board_config < 0) {
16905 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16906 "trying auto-probe from BIOS...\n");
16907 board_config = ALC662_AUTO;
16910 if (board_config == ALC662_AUTO) {
16911 /* automatic parse from the BIOS config */
16912 err = alc662_parse_auto_config(codec);
16918 "hda_codec: Cannot set up configuration "
16919 "from BIOS. Using base mode...\n");
16920 board_config = ALC662_3ST_2ch_DIG;
16924 err = snd_hda_attach_beep_device(codec, 0x1);
16930 if (board_config != ALC662_AUTO)
16931 setup_preset(spec, &alc662_presets[board_config]);
16933 if (codec->vendor_id == 0x10ec0663) {
16934 spec->stream_name_analog = "ALC663 Analog";
16935 spec->stream_name_digital = "ALC663 Digital";
16936 } else if (codec->vendor_id == 0x10ec0272) {
16937 spec->stream_name_analog = "ALC272 Analog";
16938 spec->stream_name_digital = "ALC272 Digital";
16940 spec->stream_name_analog = "ALC662 Analog";
16941 spec->stream_name_digital = "ALC662 Digital";
16944 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16945 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16947 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16948 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16950 spec->adc_nids = alc662_adc_nids;
16951 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16952 spec->capsrc_nids = alc662_capsrc_nids;
16953 spec->capture_style = CAPT_MIX;
16955 if (!spec->cap_mixer)
16956 set_capture_mixer(spec);
16957 if (codec->vendor_id == 0x10ec0662)
16958 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16960 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
16962 spec->vmaster_nid = 0x02;
16964 codec->patch_ops = alc_patch_ops;
16965 if (board_config == ALC662_AUTO)
16966 spec->init_hook = alc662_auto_init;
16967 #ifdef CONFIG_SND_HDA_POWER_SAVE
16968 if (!spec->loopback.amplist)
16969 spec->loopback.amplist = alc662_loopbacks;
16971 codec->proc_widget_hook = print_realtek_coef;
16979 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16980 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16981 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16982 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16983 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16984 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16985 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16986 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16987 .patch = patch_alc861 },
16988 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16989 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16990 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16991 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16992 .patch = patch_alc883 },
16993 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16994 .patch = patch_alc662 },
16995 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16996 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16997 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16998 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16999 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17000 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17001 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17002 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17003 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17004 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
17005 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17006 .patch = patch_alc883 },
17007 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
17008 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
17009 {} /* terminator */
17012 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17014 MODULE_LICENSE("GPL");
17015 MODULE_DESCRIPTION("Realtek HD-audio codec");
17017 static struct hda_codec_preset_list realtek_list = {
17018 .preset = snd_hda_preset_realtek,
17019 .owner = THIS_MODULE,
17022 static int __init patch_realtek_init(void)
17024 return snd_hda_add_codec_preset(&realtek_list);
17027 static void __exit patch_realtek_exit(void)
17029 snd_hda_delete_codec_preset(&realtek_list);
17032 module_init(patch_realtek_init)
17033 module_exit(patch_realtek_exit)