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,
220 ALC883_TARGA_2ch_DIG,
223 ALC888_ACER_ASPIRE_4930G,
227 ALC883_LENOVO_101E_2ch,
228 ALC883_LENOVO_NB0763,
229 ALC888_LENOVO_MS7195_DIG,
236 ALC883_FUJITSU_PI2515,
237 ALC888_FUJITSU_XA3530,
238 ALC883_3ST_6ch_INTEL,
246 /* styles of capture selection */
248 CAPT_MUX = 0, /* only mux based */
249 CAPT_MIX, /* only mixer based */
250 CAPT_1MUX_MIX, /* first mux and other mixers */
254 #define GPIO_MASK 0x03
256 /* extra amp-initialization sequence types */
266 /* codec parameterization */
267 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
268 unsigned int num_mixers;
269 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
270 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
272 const struct hda_verb *init_verbs[5]; /* initialization verbs
276 unsigned int num_init_verbs;
278 char *stream_name_analog; /* analog PCM stream */
279 struct hda_pcm_stream *stream_analog_playback;
280 struct hda_pcm_stream *stream_analog_capture;
281 struct hda_pcm_stream *stream_analog_alt_playback;
282 struct hda_pcm_stream *stream_analog_alt_capture;
284 char *stream_name_digital; /* digital PCM stream */
285 struct hda_pcm_stream *stream_digital_playback;
286 struct hda_pcm_stream *stream_digital_capture;
289 struct hda_multi_out multiout; /* playback set-up
290 * max_channels, dacs must be set
291 * dig_out_nid and hp_nid are optional
293 hda_nid_t alt_dac_nid;
294 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
298 unsigned int num_adc_nids;
300 hda_nid_t *capsrc_nids;
301 hda_nid_t dig_in_nid; /* digital-in NID; optional */
302 int capture_style; /* capture style (CAPT_*) */
305 unsigned int num_mux_defs;
306 const struct hda_input_mux *input_mux;
307 unsigned int cur_mux[3];
310 const struct hda_channel_mode *channel_mode;
311 int num_channel_mode;
314 /* PCM information */
315 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
317 /* dynamic controls, init_verbs and input_mux */
318 struct auto_pin_cfg autocfg;
319 struct snd_array kctls;
320 struct hda_input_mux private_imux[3];
321 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
324 void (*init_hook)(struct hda_codec *codec);
325 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
327 /* for pin sensing */
328 unsigned int sense_updated: 1;
329 unsigned int jack_present: 1;
330 unsigned int master_sw: 1;
333 unsigned int no_analog :1; /* digital I/O only */
336 /* for virtual master */
337 hda_nid_t vmaster_nid;
338 #ifdef CONFIG_SND_HDA_POWER_SAVE
339 struct hda_loopback_check loopback;
344 unsigned int pll_coef_idx, pll_coef_bit;
348 * configuration template - to be copied to the spec instance
350 struct alc_config_preset {
351 struct snd_kcontrol_new *mixers[5]; /* should be identical size
354 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
355 const struct hda_verb *init_verbs[5];
356 unsigned int num_dacs;
358 hda_nid_t dig_out_nid; /* optional */
359 hda_nid_t hp_nid; /* optional */
360 hda_nid_t *slave_dig_outs;
361 unsigned int num_adc_nids;
363 hda_nid_t *capsrc_nids;
364 hda_nid_t dig_in_nid;
365 unsigned int num_channel_mode;
366 const struct hda_channel_mode *channel_mode;
368 unsigned int num_mux_defs;
369 const struct hda_input_mux *input_mux;
370 void (*unsol_event)(struct hda_codec *, unsigned int);
371 void (*init_hook)(struct hda_codec *);
372 #ifdef CONFIG_SND_HDA_POWER_SAVE
373 struct hda_amp_list *loopbacks;
381 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
382 struct snd_ctl_elem_info *uinfo)
384 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
385 struct alc_spec *spec = codec->spec;
386 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
387 if (mux_idx >= spec->num_mux_defs)
389 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
392 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
393 struct snd_ctl_elem_value *ucontrol)
395 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
396 struct alc_spec *spec = codec->spec;
397 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
399 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
403 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
404 struct snd_ctl_elem_value *ucontrol)
406 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
407 struct alc_spec *spec = codec->spec;
408 const struct hda_input_mux *imux;
409 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
410 unsigned int mux_idx;
411 hda_nid_t nid = spec->capsrc_nids ?
412 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
414 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
415 imux = &spec->input_mux[mux_idx];
417 if (spec->capture_style &&
418 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) {
419 /* Matrix-mixer style (e.g. ALC882) */
420 unsigned int *cur_val = &spec->cur_mux[adc_idx];
423 idx = ucontrol->value.enumerated.item[0];
424 if (idx >= imux->num_items)
425 idx = imux->num_items - 1;
428 for (i = 0; i < imux->num_items; i++) {
429 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
430 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
431 imux->items[i].index,
437 /* MUX style (e.g. ALC880) */
438 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
439 &spec->cur_mux[adc_idx]);
444 * channel mode setting
446 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
447 struct snd_ctl_elem_info *uinfo)
449 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
450 struct alc_spec *spec = codec->spec;
451 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
452 spec->num_channel_mode);
455 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
456 struct snd_ctl_elem_value *ucontrol)
458 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
459 struct alc_spec *spec = codec->spec;
460 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
461 spec->num_channel_mode,
462 spec->multiout.max_channels);
465 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
466 struct snd_ctl_elem_value *ucontrol)
468 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
469 struct alc_spec *spec = codec->spec;
470 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
471 spec->num_channel_mode,
472 &spec->multiout.max_channels);
473 if (err >= 0 && spec->need_dac_fix)
474 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
479 * Control the mode of pin widget settings via the mixer. "pc" is used
480 * instead of "%" to avoid consequences of accidently treating the % as
481 * being part of a format specifier. Maximum allowed length of a value is
482 * 63 characters plus NULL terminator.
484 * Note: some retasking pin complexes seem to ignore requests for input
485 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
486 * are requested. Therefore order this list so that this behaviour will not
487 * cause problems when mixer clients move through the enum sequentially.
488 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
491 static char *alc_pin_mode_names[] = {
492 "Mic 50pc bias", "Mic 80pc bias",
493 "Line in", "Line out", "Headphone out",
495 static unsigned char alc_pin_mode_values[] = {
496 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
498 /* The control can present all 5 options, or it can limit the options based
499 * in the pin being assumed to be exclusively an input or an output pin. In
500 * addition, "input" pins may or may not process the mic bias option
501 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
502 * accept requests for bias as of chip versions up to March 2006) and/or
503 * wiring in the computer.
505 #define ALC_PIN_DIR_IN 0x00
506 #define ALC_PIN_DIR_OUT 0x01
507 #define ALC_PIN_DIR_INOUT 0x02
508 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
509 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
511 /* Info about the pin modes supported by the different pin direction modes.
512 * For each direction the minimum and maximum values are given.
514 static signed char alc_pin_mode_dir_info[5][2] = {
515 { 0, 2 }, /* ALC_PIN_DIR_IN */
516 { 3, 4 }, /* ALC_PIN_DIR_OUT */
517 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
518 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
519 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
521 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
522 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
523 #define alc_pin_mode_n_items(_dir) \
524 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
526 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
527 struct snd_ctl_elem_info *uinfo)
529 unsigned int item_num = uinfo->value.enumerated.item;
530 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
532 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
534 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
536 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
537 item_num = alc_pin_mode_min(dir);
538 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
542 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
543 struct snd_ctl_elem_value *ucontrol)
546 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
547 hda_nid_t nid = kcontrol->private_value & 0xffff;
548 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
549 long *valp = ucontrol->value.integer.value;
550 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
551 AC_VERB_GET_PIN_WIDGET_CONTROL,
554 /* Find enumerated value for current pinctl setting */
555 i = alc_pin_mode_min(dir);
556 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
558 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
562 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
563 struct snd_ctl_elem_value *ucontrol)
566 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
567 hda_nid_t nid = kcontrol->private_value & 0xffff;
568 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
569 long val = *ucontrol->value.integer.value;
570 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
571 AC_VERB_GET_PIN_WIDGET_CONTROL,
574 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
575 val = alc_pin_mode_min(dir);
577 change = pinctl != alc_pin_mode_values[val];
579 /* Set pin mode to that requested */
580 snd_hda_codec_write_cache(codec, nid, 0,
581 AC_VERB_SET_PIN_WIDGET_CONTROL,
582 alc_pin_mode_values[val]);
584 /* Also enable the retasking pin's input/output as required
585 * for the requested pin mode. Enum values of 2 or less are
588 * Dynamically switching the input/output buffers probably
589 * reduces noise slightly (particularly on input) so we'll
590 * do it. However, having both input and output buffers
591 * enabled simultaneously doesn't seem to be problematic if
592 * this turns out to be necessary in the future.
595 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
596 HDA_AMP_MUTE, HDA_AMP_MUTE);
597 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
600 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
601 HDA_AMP_MUTE, HDA_AMP_MUTE);
602 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
609 #define ALC_PIN_MODE(xname, nid, dir) \
610 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
611 .info = alc_pin_mode_info, \
612 .get = alc_pin_mode_get, \
613 .put = alc_pin_mode_put, \
614 .private_value = nid | (dir<<16) }
616 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
617 * together using a mask with more than one bit set. This control is
618 * currently used only by the ALC260 test model. At this stage they are not
619 * needed for any "production" models.
621 #ifdef CONFIG_SND_DEBUG
622 #define alc_gpio_data_info snd_ctl_boolean_mono_info
624 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
625 struct snd_ctl_elem_value *ucontrol)
627 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
628 hda_nid_t nid = kcontrol->private_value & 0xffff;
629 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
630 long *valp = ucontrol->value.integer.value;
631 unsigned int val = snd_hda_codec_read(codec, nid, 0,
632 AC_VERB_GET_GPIO_DATA, 0x00);
634 *valp = (val & mask) != 0;
637 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
638 struct snd_ctl_elem_value *ucontrol)
641 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
642 hda_nid_t nid = kcontrol->private_value & 0xffff;
643 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
644 long val = *ucontrol->value.integer.value;
645 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
646 AC_VERB_GET_GPIO_DATA,
649 /* Set/unset the masked GPIO bit(s) as needed */
650 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
655 snd_hda_codec_write_cache(codec, nid, 0,
656 AC_VERB_SET_GPIO_DATA, gpio_data);
660 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
661 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
662 .info = alc_gpio_data_info, \
663 .get = alc_gpio_data_get, \
664 .put = alc_gpio_data_put, \
665 .private_value = nid | (mask<<16) }
666 #endif /* CONFIG_SND_DEBUG */
668 /* A switch control to allow the enabling of the digital IO pins on the
669 * ALC260. This is incredibly simplistic; the intention of this control is
670 * to provide something in the test model allowing digital outputs to be
671 * identified if present. If models are found which can utilise these
672 * outputs a more complete mixer control can be devised for those models if
675 #ifdef CONFIG_SND_DEBUG
676 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
678 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
679 struct snd_ctl_elem_value *ucontrol)
681 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
682 hda_nid_t nid = kcontrol->private_value & 0xffff;
683 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
684 long *valp = ucontrol->value.integer.value;
685 unsigned int val = snd_hda_codec_read(codec, nid, 0,
686 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
688 *valp = (val & mask) != 0;
691 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
692 struct snd_ctl_elem_value *ucontrol)
695 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
696 hda_nid_t nid = kcontrol->private_value & 0xffff;
697 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
698 long val = *ucontrol->value.integer.value;
699 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
700 AC_VERB_GET_DIGI_CONVERT_1,
703 /* Set/unset the masked control bit(s) as needed */
704 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
709 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
714 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
715 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
716 .info = alc_spdif_ctrl_info, \
717 .get = alc_spdif_ctrl_get, \
718 .put = alc_spdif_ctrl_put, \
719 .private_value = nid | (mask<<16) }
720 #endif /* CONFIG_SND_DEBUG */
722 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
723 * Again, this is only used in the ALC26x test models to help identify when
724 * the EAPD line must be asserted for features to work.
726 #ifdef CONFIG_SND_DEBUG
727 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
729 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
730 struct snd_ctl_elem_value *ucontrol)
732 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
733 hda_nid_t nid = kcontrol->private_value & 0xffff;
734 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
735 long *valp = ucontrol->value.integer.value;
736 unsigned int val = snd_hda_codec_read(codec, nid, 0,
737 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
739 *valp = (val & mask) != 0;
743 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
744 struct snd_ctl_elem_value *ucontrol)
747 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
748 hda_nid_t nid = kcontrol->private_value & 0xffff;
749 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
750 long val = *ucontrol->value.integer.value;
751 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
752 AC_VERB_GET_EAPD_BTLENABLE,
755 /* Set/unset the masked control bit(s) as needed */
756 change = (!val ? 0 : mask) != (ctrl_data & mask);
761 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
767 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
768 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
769 .info = alc_eapd_ctrl_info, \
770 .get = alc_eapd_ctrl_get, \
771 .put = alc_eapd_ctrl_put, \
772 .private_value = nid | (mask<<16) }
773 #endif /* CONFIG_SND_DEBUG */
776 * set up the input pin config (depending on the given auto-pin type)
778 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
781 unsigned int val = PIN_IN;
783 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
785 pincap = snd_hda_query_pin_caps(codec, nid);
786 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
787 if (pincap & AC_PINCAP_VREF_80)
790 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
795 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
797 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
799 spec->mixers[spec->num_mixers++] = mix;
802 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
804 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
806 spec->init_verbs[spec->num_init_verbs++] = verb;
809 #ifdef CONFIG_PROC_FS
813 static void print_realtek_coef(struct snd_info_buffer *buffer,
814 struct hda_codec *codec, hda_nid_t nid)
820 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
821 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
822 coeff = snd_hda_codec_read(codec, nid, 0,
823 AC_VERB_GET_COEF_INDEX, 0);
824 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
827 #define print_realtek_coef NULL
831 * set up from the preset table
833 static void setup_preset(struct alc_spec *spec,
834 const struct alc_config_preset *preset)
838 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
839 add_mixer(spec, preset->mixers[i]);
840 spec->cap_mixer = preset->cap_mixer;
841 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
843 add_verb(spec, preset->init_verbs[i]);
845 spec->channel_mode = preset->channel_mode;
846 spec->num_channel_mode = preset->num_channel_mode;
847 spec->need_dac_fix = preset->need_dac_fix;
849 spec->multiout.max_channels = spec->channel_mode[0].channels;
851 spec->multiout.num_dacs = preset->num_dacs;
852 spec->multiout.dac_nids = preset->dac_nids;
853 spec->multiout.dig_out_nid = preset->dig_out_nid;
854 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
855 spec->multiout.hp_nid = preset->hp_nid;
857 spec->num_mux_defs = preset->num_mux_defs;
858 if (!spec->num_mux_defs)
859 spec->num_mux_defs = 1;
860 spec->input_mux = preset->input_mux;
862 spec->num_adc_nids = preset->num_adc_nids;
863 spec->adc_nids = preset->adc_nids;
864 spec->capsrc_nids = preset->capsrc_nids;
865 spec->dig_in_nid = preset->dig_in_nid;
867 spec->unsol_event = preset->unsol_event;
868 spec->init_hook = preset->init_hook;
869 #ifdef CONFIG_SND_HDA_POWER_SAVE
870 spec->loopback.amplist = preset->loopbacks;
874 /* Enable GPIO mask and set output */
875 static struct hda_verb alc_gpio1_init_verbs[] = {
876 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
877 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
878 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
882 static struct hda_verb alc_gpio2_init_verbs[] = {
883 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
884 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
885 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
889 static struct hda_verb alc_gpio3_init_verbs[] = {
890 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
891 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
892 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
897 * Fix hardware PLL issue
898 * On some codecs, the analog PLL gating control must be off while
899 * the default value is 1.
901 static void alc_fix_pll(struct hda_codec *codec)
903 struct alc_spec *spec = codec->spec;
908 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
910 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
911 AC_VERB_GET_PROC_COEF, 0);
912 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
914 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
915 val & ~(1 << spec->pll_coef_bit));
918 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
919 unsigned int coef_idx, unsigned int coef_bit)
921 struct alc_spec *spec = codec->spec;
923 spec->pll_coef_idx = coef_idx;
924 spec->pll_coef_bit = coef_bit;
928 static void alc_sku_automute(struct hda_codec *codec)
930 struct alc_spec *spec = codec->spec;
931 unsigned int present;
932 unsigned int hp_nid = spec->autocfg.hp_pins[0];
933 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
935 /* need to execute and sync at first */
936 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
937 present = snd_hda_codec_read(codec, hp_nid, 0,
938 AC_VERB_GET_PIN_SENSE, 0);
939 spec->jack_present = (present & 0x80000000) != 0;
940 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
941 spec->jack_present ? 0 : PIN_OUT);
944 #if 0 /* it's broken in some acses -- temporarily disabled */
945 static void alc_mic_automute(struct hda_codec *codec)
947 struct alc_spec *spec = codec->spec;
948 unsigned int present;
949 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
950 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
951 unsigned int mix_nid = spec->capsrc_nids[0];
952 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
954 capsrc_idx_mic = mic_nid - 0x18;
955 capsrc_idx_fmic = fmic_nid - 0x18;
956 present = snd_hda_codec_read(codec, mic_nid, 0,
957 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
958 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
959 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
960 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
961 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
962 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
963 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
966 #define alc_mic_automute(codec) do {} while(0) /* NOP */
967 #endif /* disabled */
969 /* unsolicited event for HP jack sensing */
970 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
972 if (codec->vendor_id == 0x10ec0880)
976 if (res == ALC880_HP_EVENT)
977 alc_sku_automute(codec);
979 if (res == ALC880_MIC_EVENT)
980 alc_mic_automute(codec);
983 static void alc_inithook(struct hda_codec *codec)
985 alc_sku_automute(codec);
986 alc_mic_automute(codec);
989 /* additional initialization for ALC888 variants */
990 static void alc888_coef_init(struct hda_codec *codec)
994 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
995 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
996 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
997 if ((tmp & 0xf0) == 0x20)
999 snd_hda_codec_read(codec, 0x20, 0,
1000 AC_VERB_SET_PROC_COEF, 0x830);
1003 snd_hda_codec_read(codec, 0x20, 0,
1004 AC_VERB_SET_PROC_COEF, 0x3030);
1007 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1012 case ALC_INIT_GPIO1:
1013 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1015 case ALC_INIT_GPIO2:
1016 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1018 case ALC_INIT_GPIO3:
1019 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1021 case ALC_INIT_DEFAULT:
1022 switch (codec->vendor_id) {
1024 snd_hda_codec_write(codec, 0x0f, 0,
1025 AC_VERB_SET_EAPD_BTLENABLE, 2);
1026 snd_hda_codec_write(codec, 0x10, 0,
1027 AC_VERB_SET_EAPD_BTLENABLE, 2);
1039 snd_hda_codec_write(codec, 0x14, 0,
1040 AC_VERB_SET_EAPD_BTLENABLE, 2);
1041 snd_hda_codec_write(codec, 0x15, 0,
1042 AC_VERB_SET_EAPD_BTLENABLE, 2);
1045 switch (codec->vendor_id) {
1047 snd_hda_codec_write(codec, 0x1a, 0,
1048 AC_VERB_SET_COEF_INDEX, 7);
1049 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1050 AC_VERB_GET_PROC_COEF, 0);
1051 snd_hda_codec_write(codec, 0x1a, 0,
1052 AC_VERB_SET_COEF_INDEX, 7);
1053 snd_hda_codec_write(codec, 0x1a, 0,
1054 AC_VERB_SET_PROC_COEF,
1064 snd_hda_codec_write(codec, 0x20, 0,
1065 AC_VERB_SET_COEF_INDEX, 7);
1066 tmp = snd_hda_codec_read(codec, 0x20, 0,
1067 AC_VERB_GET_PROC_COEF, 0);
1068 snd_hda_codec_write(codec, 0x20, 0,
1069 AC_VERB_SET_COEF_INDEX, 7);
1070 snd_hda_codec_write(codec, 0x20, 0,
1071 AC_VERB_SET_PROC_COEF,
1075 alc888_coef_init(codec);
1079 snd_hda_codec_write(codec, 0x20, 0,
1080 AC_VERB_SET_COEF_INDEX, 7);
1081 tmp = snd_hda_codec_read(codec, 0x20, 0,
1082 AC_VERB_GET_PROC_COEF, 0);
1083 snd_hda_codec_write(codec, 0x20, 0,
1084 AC_VERB_SET_COEF_INDEX, 7);
1085 snd_hda_codec_write(codec, 0x20, 0,
1086 AC_VERB_SET_PROC_COEF,
1094 static void alc_init_auto_hp(struct hda_codec *codec)
1096 struct alc_spec *spec = codec->spec;
1098 if (!spec->autocfg.hp_pins[0])
1101 if (!spec->autocfg.speaker_pins[0]) {
1102 if (spec->autocfg.line_out_pins[0] &&
1103 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1104 spec->autocfg.speaker_pins[0] =
1105 spec->autocfg.line_out_pins[0];
1110 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1111 spec->autocfg.hp_pins[0]);
1112 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1113 AC_VERB_SET_UNSOLICITED_ENABLE,
1114 AC_USRSP_EN | ALC880_HP_EVENT);
1115 spec->unsol_event = alc_sku_unsol_event;
1118 /* check subsystem ID and set up device-specific initialization;
1119 * return 1 if initialized, 0 if invalid SSID
1121 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1122 * 31 ~ 16 : Manufacture ID
1124 * 7 ~ 0 : Assembly ID
1125 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1127 static int alc_subsystem_id(struct hda_codec *codec,
1128 hda_nid_t porta, hda_nid_t porte,
1131 unsigned int ass, tmp, i;
1133 struct alc_spec *spec = codec->spec;
1135 ass = codec->subsystem_id & 0xffff;
1136 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1139 /* invalid SSID, check the special NID pin defcfg instead */
1141 * 31~30 : port conetcivity
1144 * 19~16 : Check sum (15:1)
1149 if (codec->vendor_id == 0x10ec0260)
1151 ass = snd_hda_codec_get_pincfg(codec, nid);
1152 snd_printd("realtek: No valid SSID, "
1153 "checking pincfg 0x%08x for NID 0x%x\n",
1155 if (!(ass & 1) && !(ass & 0x100000))
1157 if ((ass >> 30) != 1) /* no physical connection */
1162 for (i = 1; i < 16; i++) {
1166 if (((ass >> 16) & 0xf) != tmp)
1169 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1170 ass & 0xffff, codec->vendor_id);
1174 * 2 : 0 --> Desktop, 1 --> Laptop
1175 * 3~5 : External Amplifier control
1178 tmp = (ass & 0x38) >> 3; /* external Amp control */
1181 spec->init_amp = ALC_INIT_GPIO1;
1184 spec->init_amp = ALC_INIT_GPIO2;
1187 spec->init_amp = ALC_INIT_GPIO3;
1190 spec->init_amp = ALC_INIT_DEFAULT;
1194 /* is laptop or Desktop and enable the function "Mute internal speaker
1195 * when the external headphone out jack is plugged"
1197 if (!(ass & 0x8000))
1200 * 10~8 : Jack location
1201 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1203 * 15 : 1 --> enable the function "Mute internal speaker
1204 * when the external headphone out jack is plugged"
1206 if (!spec->autocfg.hp_pins[0]) {
1207 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1209 spec->autocfg.hp_pins[0] = porta;
1211 spec->autocfg.hp_pins[0] = porte;
1213 spec->autocfg.hp_pins[0] = portd;
1218 alc_init_auto_hp(codec);
1222 static void alc_ssid_check(struct hda_codec *codec,
1223 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1225 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1226 struct alc_spec *spec = codec->spec;
1227 snd_printd("realtek: "
1228 "Enable default setup for auto mode as fallback\n");
1229 spec->init_amp = ALC_INIT_DEFAULT;
1230 alc_init_auto_hp(codec);
1235 * Fix-up pin default configurations
1243 static void alc_fix_pincfg(struct hda_codec *codec,
1244 const struct snd_pci_quirk *quirk,
1245 const struct alc_pincfg **pinfix)
1247 const struct alc_pincfg *cfg;
1249 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1253 cfg = pinfix[quirk->value];
1254 for (; cfg->nid; cfg++)
1255 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1265 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1266 /* Mic-in jack as mic in */
1267 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1268 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1269 /* Line-in jack as Line in */
1270 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1271 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1272 /* Line-Out as Front */
1273 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1280 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1281 /* Mic-in jack as mic in */
1282 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1283 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1284 /* Line-in jack as Surround */
1285 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1286 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1287 /* Line-Out as Front */
1288 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1295 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1296 /* Mic-in jack as CLFE */
1297 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1298 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1299 /* Line-in jack as Surround */
1300 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1301 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1302 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1303 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1310 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1311 /* Mic-in jack as CLFE */
1312 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1313 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1314 /* Line-in jack as Surround */
1315 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1316 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1317 /* Line-Out as Side */
1318 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1322 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1323 { 2, alc888_4ST_ch2_intel_init },
1324 { 4, alc888_4ST_ch4_intel_init },
1325 { 6, alc888_4ST_ch6_intel_init },
1326 { 8, alc888_4ST_ch8_intel_init },
1330 * ALC888 Fujitsu Siemens Amillo xa3530
1333 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1334 /* Front Mic: set to PIN_IN (empty by default) */
1335 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1336 /* Connect Internal HP to Front */
1337 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1338 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1339 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1340 /* Connect Bass HP to Front */
1341 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1342 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1343 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1344 /* Connect Line-Out side jack (SPDIF) to Side */
1345 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1346 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1347 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1348 /* Connect Mic jack to CLFE */
1349 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1350 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1351 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1352 /* Connect Line-in jack to Surround */
1353 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1354 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1355 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1356 /* Connect HP out jack to Front */
1357 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1358 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1359 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1360 /* Enable unsolicited event for HP jack and Line-out jack */
1361 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1362 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1366 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1368 unsigned int present;
1370 /* Line out presence */
1371 present = snd_hda_codec_read(codec, 0x17, 0,
1372 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1373 /* HP out presence */
1374 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1375 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1376 bits = present ? HDA_AMP_MUTE : 0;
1377 /* Toggle internal speakers muting */
1378 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1379 HDA_AMP_MUTE, bits);
1380 /* Toggle internal bass muting */
1381 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1382 HDA_AMP_MUTE, bits);
1385 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1388 if (res >> 26 == ALC880_HP_EVENT)
1389 alc888_fujitsu_xa3530_automute(codec);
1394 * ALC888 Acer Aspire 4930G model
1397 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1398 /* Front Mic: set to PIN_IN (empty by default) */
1399 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1400 /* Unselect Front Mic by default in input mixer 3 */
1401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1402 /* Enable unsolicited event for HP jack */
1403 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1404 /* Connect Internal HP to front */
1405 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1406 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1407 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1408 /* Connect HP out to front */
1409 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1410 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1411 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1415 static struct hda_input_mux alc888_2_capture_sources[2] = {
1416 /* Front mic only available on one ADC */
1423 { "Front Mic", 0xb },
1436 static struct snd_kcontrol_new alc888_base_mixer[] = {
1437 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1438 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1439 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1440 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1441 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1443 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1444 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1445 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1446 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1447 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1448 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1449 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1450 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1451 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1452 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1453 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1454 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1458 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1460 unsigned int present;
1462 present = snd_hda_codec_read(codec, 0x15, 0,
1463 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1464 bits = present ? HDA_AMP_MUTE : 0;
1465 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1466 HDA_AMP_MUTE, bits);
1469 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
1472 if (res >> 26 == ALC880_HP_EVENT)
1473 alc888_acer_aspire_4930g_automute(codec);
1477 * ALC880 3-stack model
1479 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1480 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1481 * F-Mic = 0x1b, HP = 0x19
1484 static hda_nid_t alc880_dac_nids[4] = {
1485 /* front, rear, clfe, rear_surr */
1486 0x02, 0x05, 0x04, 0x03
1489 static hda_nid_t alc880_adc_nids[3] = {
1494 /* The datasheet says the node 0x07 is connected from inputs,
1495 * but it shows zero connection in the real implementation on some devices.
1496 * Note: this is a 915GAV bug, fixed on 915GLV
1498 static hda_nid_t alc880_adc_nids_alt[2] = {
1503 #define ALC880_DIGOUT_NID 0x06
1504 #define ALC880_DIGIN_NID 0x0a
1506 static struct hda_input_mux alc880_capture_source = {
1510 { "Front Mic", 0x3 },
1516 /* channel source setting (2/6 channel selection for 3-stack) */
1518 static struct hda_verb alc880_threestack_ch2_init[] = {
1519 /* set line-in to input, mute it */
1520 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1521 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1522 /* set mic-in to input vref 80%, mute it */
1523 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1524 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1529 static struct hda_verb alc880_threestack_ch6_init[] = {
1530 /* set line-in to output, unmute it */
1531 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1532 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1533 /* set mic-in to output, unmute it */
1534 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1535 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1539 static struct hda_channel_mode alc880_threestack_modes[2] = {
1540 { 2, alc880_threestack_ch2_init },
1541 { 6, alc880_threestack_ch6_init },
1544 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1545 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1546 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1547 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1548 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1549 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1550 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1551 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1552 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1553 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1554 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1555 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1556 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1557 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1558 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1559 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1560 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1561 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1563 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1564 .name = "Channel Mode",
1565 .info = alc_ch_mode_info,
1566 .get = alc_ch_mode_get,
1567 .put = alc_ch_mode_put,
1572 /* capture mixer elements */
1573 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1574 struct snd_ctl_elem_info *uinfo)
1576 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1577 struct alc_spec *spec = codec->spec;
1580 mutex_lock(&codec->control_mutex);
1581 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1583 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1584 mutex_unlock(&codec->control_mutex);
1588 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1589 unsigned int size, unsigned int __user *tlv)
1591 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1592 struct alc_spec *spec = codec->spec;
1595 mutex_lock(&codec->control_mutex);
1596 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1598 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1599 mutex_unlock(&codec->control_mutex);
1603 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1604 struct snd_ctl_elem_value *ucontrol);
1606 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1607 struct snd_ctl_elem_value *ucontrol,
1610 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1611 struct alc_spec *spec = codec->spec;
1612 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1615 mutex_lock(&codec->control_mutex);
1616 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1618 err = func(kcontrol, ucontrol);
1619 mutex_unlock(&codec->control_mutex);
1623 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1624 struct snd_ctl_elem_value *ucontrol)
1626 return alc_cap_getput_caller(kcontrol, ucontrol,
1627 snd_hda_mixer_amp_volume_get);
1630 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1631 struct snd_ctl_elem_value *ucontrol)
1633 return alc_cap_getput_caller(kcontrol, ucontrol,
1634 snd_hda_mixer_amp_volume_put);
1637 /* capture mixer elements */
1638 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1640 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1641 struct snd_ctl_elem_value *ucontrol)
1643 return alc_cap_getput_caller(kcontrol, ucontrol,
1644 snd_hda_mixer_amp_switch_get);
1647 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1648 struct snd_ctl_elem_value *ucontrol)
1650 return alc_cap_getput_caller(kcontrol, ucontrol,
1651 snd_hda_mixer_amp_switch_put);
1654 #define _DEFINE_CAPMIX(num) \
1656 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1657 .name = "Capture Switch", \
1658 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1660 .info = alc_cap_sw_info, \
1661 .get = alc_cap_sw_get, \
1662 .put = alc_cap_sw_put, \
1665 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1666 .name = "Capture Volume", \
1667 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1668 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1669 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1671 .info = alc_cap_vol_info, \
1672 .get = alc_cap_vol_get, \
1673 .put = alc_cap_vol_put, \
1674 .tlv = { .c = alc_cap_vol_tlv }, \
1677 #define _DEFINE_CAPSRC(num) \
1679 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1680 /* .name = "Capture Source", */ \
1681 .name = "Input Source", \
1683 .info = alc_mux_enum_info, \
1684 .get = alc_mux_enum_get, \
1685 .put = alc_mux_enum_put, \
1688 #define DEFINE_CAPMIX(num) \
1689 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1690 _DEFINE_CAPMIX(num), \
1691 _DEFINE_CAPSRC(num), \
1695 #define DEFINE_CAPMIX_NOSRC(num) \
1696 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1697 _DEFINE_CAPMIX(num), \
1701 /* up to three ADCs */
1705 DEFINE_CAPMIX_NOSRC(1);
1706 DEFINE_CAPMIX_NOSRC(2);
1707 DEFINE_CAPMIX_NOSRC(3);
1710 * ALC880 5-stack model
1712 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1714 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1715 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1718 /* additional mixers to alc880_three_stack_mixer */
1719 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1720 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1721 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1725 /* channel source setting (6/8 channel selection for 5-stack) */
1727 static struct hda_verb alc880_fivestack_ch6_init[] = {
1728 /* set line-in to input, mute it */
1729 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1730 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1735 static struct hda_verb alc880_fivestack_ch8_init[] = {
1736 /* set line-in to output, unmute it */
1737 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1738 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1742 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1743 { 6, alc880_fivestack_ch6_init },
1744 { 8, alc880_fivestack_ch8_init },
1749 * ALC880 6-stack model
1751 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1752 * Side = 0x05 (0x0f)
1753 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1754 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1757 static hda_nid_t alc880_6st_dac_nids[4] = {
1758 /* front, rear, clfe, rear_surr */
1759 0x02, 0x03, 0x04, 0x05
1762 static struct hda_input_mux alc880_6stack_capture_source = {
1766 { "Front Mic", 0x1 },
1772 /* fixed 8-channels */
1773 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1777 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1778 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1779 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1780 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1781 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1782 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1783 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1784 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1785 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1786 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1787 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1788 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1789 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1790 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1791 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1792 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1793 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1794 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1795 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1797 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1798 .name = "Channel Mode",
1799 .info = alc_ch_mode_info,
1800 .get = alc_ch_mode_get,
1801 .put = alc_ch_mode_put,
1810 * W810 has rear IO for:
1813 * Center/LFE (DAC 04)
1816 * The system also has a pair of internal speakers, and a headphone jack.
1817 * These are both connected to Line2 on the codec, hence to DAC 02.
1819 * There is a variable resistor to control the speaker or headphone
1820 * volume. This is a hardware-only device without a software API.
1822 * Plugging headphones in will disable the internal speakers. This is
1823 * implemented in hardware, not via the driver using jack sense. In
1824 * a similar fashion, plugging into the rear socket marked "front" will
1825 * disable both the speakers and headphones.
1827 * For input, there's a microphone jack, and an "audio in" jack.
1828 * These may not do anything useful with this driver yet, because I
1829 * haven't setup any initialization verbs for these yet...
1832 static hda_nid_t alc880_w810_dac_nids[3] = {
1833 /* front, rear/surround, clfe */
1837 /* fixed 6 channels */
1838 static struct hda_channel_mode alc880_w810_modes[1] = {
1842 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1843 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1844 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1845 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1846 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1847 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1848 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1849 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1850 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1851 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1852 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1860 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1861 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1865 static hda_nid_t alc880_z71v_dac_nids[1] = {
1868 #define ALC880_Z71V_HP_DAC 0x03
1870 /* fixed 2 channels */
1871 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1875 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1876 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1877 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1878 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1879 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1880 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1881 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1882 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1883 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1889 * ALC880 F1734 model
1891 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1892 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1895 static hda_nid_t alc880_f1734_dac_nids[1] = {
1898 #define ALC880_F1734_HP_DAC 0x02
1900 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1901 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1902 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1903 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1904 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1905 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1906 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1908 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1912 static struct hda_input_mux alc880_f1734_capture_source = {
1924 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1925 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1926 * Mic = 0x18, Line = 0x1a
1929 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1930 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1932 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1933 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1934 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1935 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1936 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1937 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1938 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1939 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1940 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1941 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1942 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1943 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1944 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1945 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1946 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1948 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1949 .name = "Channel Mode",
1950 .info = alc_ch_mode_info,
1951 .get = alc_ch_mode_get,
1952 .put = alc_ch_mode_put,
1958 * ALC880 ASUS W1V model
1960 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1961 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1962 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1965 /* additional mixers to alc880_asus_mixer */
1966 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1967 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1968 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1973 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1974 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1975 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1976 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1977 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1978 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1979 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1980 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1981 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1982 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1987 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1988 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1989 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1990 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1991 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1992 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1993 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1994 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1995 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1996 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1997 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1998 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1999 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2000 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2001 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2002 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2003 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2005 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2006 .name = "Channel Mode",
2007 .info = alc_ch_mode_info,
2008 .get = alc_ch_mode_get,
2009 .put = alc_ch_mode_put,
2014 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2015 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2016 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2017 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2018 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2019 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2020 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2021 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2022 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2023 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2024 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2028 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2029 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2030 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2031 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2032 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2033 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2034 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2039 * virtual master controls
2043 * slave controls for virtual master
2045 static const char *alc_slave_vols[] = {
2046 "Front Playback Volume",
2047 "Surround Playback Volume",
2048 "Center Playback Volume",
2049 "LFE Playback Volume",
2050 "Side Playback Volume",
2051 "Headphone Playback Volume",
2052 "Speaker Playback Volume",
2053 "Mono Playback Volume",
2054 "Line-Out Playback Volume",
2055 "PCM Playback Volume",
2059 static const char *alc_slave_sws[] = {
2060 "Front Playback Switch",
2061 "Surround Playback Switch",
2062 "Center Playback Switch",
2063 "LFE Playback Switch",
2064 "Side Playback Switch",
2065 "Headphone Playback Switch",
2066 "Speaker Playback Switch",
2067 "Mono Playback Switch",
2068 "IEC958 Playback Switch",
2073 * build control elements
2076 static void alc_free_kctls(struct hda_codec *codec);
2078 /* additional beep mixers; the actual parameters are overwritten at build */
2079 static struct snd_kcontrol_new alc_beep_mixer[] = {
2080 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2081 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2085 static int alc_build_controls(struct hda_codec *codec)
2087 struct alc_spec *spec = codec->spec;
2091 for (i = 0; i < spec->num_mixers; i++) {
2092 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2096 if (spec->cap_mixer) {
2097 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2101 if (spec->multiout.dig_out_nid) {
2102 err = snd_hda_create_spdif_out_ctls(codec,
2103 spec->multiout.dig_out_nid);
2106 if (!spec->no_analog) {
2107 err = snd_hda_create_spdif_share_sw(codec,
2111 spec->multiout.share_spdif = 1;
2114 if (spec->dig_in_nid) {
2115 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2120 /* create beep controls if needed */
2121 if (spec->beep_amp) {
2122 struct snd_kcontrol_new *knew;
2123 for (knew = alc_beep_mixer; knew->name; knew++) {
2124 struct snd_kcontrol *kctl;
2125 kctl = snd_ctl_new1(knew, codec);
2128 kctl->private_value = spec->beep_amp;
2129 err = snd_hda_ctl_add(codec, kctl);
2135 /* if we have no master control, let's create it */
2136 if (!spec->no_analog &&
2137 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2138 unsigned int vmaster_tlv[4];
2139 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2140 HDA_OUTPUT, vmaster_tlv);
2141 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2142 vmaster_tlv, alc_slave_vols);
2146 if (!spec->no_analog &&
2147 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2148 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2149 NULL, alc_slave_sws);
2154 alc_free_kctls(codec); /* no longer needed */
2160 * initialize the codec volumes, etc
2164 * generic initialization of ADC, input mixers and output mixers
2166 static struct hda_verb alc880_volume_init_verbs[] = {
2168 * Unmute ADC0-2 and set the default input to mic-in
2170 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2171 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2172 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2173 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2174 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2175 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2177 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2179 * Note: PASD motherboards uses the Line In 2 as the input for front
2182 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2183 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2184 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2187 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2188 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2189 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2192 * Set up output mixers (0x0c - 0x0f)
2194 /* set vol=0 to output mixers */
2195 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2196 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2197 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2198 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2199 /* set up input amps for analog loopback */
2200 /* Amp Indices: DAC = 0, mixer = 1 */
2201 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2202 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2203 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2204 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2205 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2206 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2207 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2208 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2214 * 3-stack pin configuration:
2215 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2217 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2219 * preset connection lists of input pins
2220 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2222 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2223 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2224 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2227 * Set pin mode and muting
2229 /* set front pin widgets 0x14 for output */
2230 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2231 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2232 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2233 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2234 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2235 /* Mic2 (as headphone out) for HP output */
2236 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2237 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2238 /* Line In pin widget for input */
2239 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2240 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2241 /* Line2 (as front mic) pin widget for input and vref at 80% */
2242 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2243 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2244 /* CD pin widget for input */
2245 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2251 * 5-stack pin configuration:
2252 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2253 * line-in/side = 0x1a, f-mic = 0x1b
2255 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2257 * preset connection lists of input pins
2258 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2260 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2261 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2264 * Set pin mode and muting
2266 /* set pin widgets 0x14-0x17 for output */
2267 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2268 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2269 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2270 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2271 /* unmute pins for output (no gain on this amp) */
2272 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2273 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2274 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2275 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2277 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2278 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2279 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2280 /* Mic2 (as headphone out) for HP output */
2281 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2282 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2283 /* Line In pin widget for input */
2284 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2285 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2286 /* Line2 (as front mic) pin widget for input and vref at 80% */
2287 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2288 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2289 /* CD pin widget for input */
2290 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2296 * W810 pin configuration:
2297 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2299 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2300 /* hphone/speaker input selector: front DAC */
2301 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2303 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2304 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2305 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2306 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2307 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2308 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2310 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2311 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2317 * Z71V pin configuration:
2318 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2320 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2321 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2322 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2323 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2324 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2326 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2327 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2328 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2329 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2335 * 6-stack pin configuration:
2336 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2337 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2339 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2340 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2342 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2343 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2344 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2345 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2346 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2347 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2348 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2349 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2351 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2352 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2353 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2354 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2355 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2356 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2357 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2358 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2359 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2365 * Uniwill pin configuration:
2366 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2369 static struct hda_verb alc880_uniwill_init_verbs[] = {
2370 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2372 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2373 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2374 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2375 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2376 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2377 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2378 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2379 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2380 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2381 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2382 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2383 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2384 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2385 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2387 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2388 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2389 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2390 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2391 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2392 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2393 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2394 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2395 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2397 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2398 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2405 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2407 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2408 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2410 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2411 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2412 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2413 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2414 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2415 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2416 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2417 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2418 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2419 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2420 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2421 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2423 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2424 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2425 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2426 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2427 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2428 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2430 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2431 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2436 static struct hda_verb alc880_beep_init_verbs[] = {
2437 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2441 /* toggle speaker-output according to the hp-jack state */
2442 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2444 unsigned int present;
2447 present = snd_hda_codec_read(codec, 0x14, 0,
2448 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2449 bits = present ? HDA_AMP_MUTE : 0;
2450 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2451 HDA_AMP_MUTE, bits);
2452 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2453 HDA_AMP_MUTE, bits);
2456 /* auto-toggle front mic */
2457 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2459 unsigned int present;
2462 present = snd_hda_codec_read(codec, 0x18, 0,
2463 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2464 bits = present ? HDA_AMP_MUTE : 0;
2465 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2468 static void alc880_uniwill_automute(struct hda_codec *codec)
2470 alc880_uniwill_hp_automute(codec);
2471 alc880_uniwill_mic_automute(codec);
2474 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2477 /* Looks like the unsol event is incompatible with the standard
2478 * definition. 4bit tag is placed at 28 bit!
2480 switch (res >> 28) {
2481 case ALC880_HP_EVENT:
2482 alc880_uniwill_hp_automute(codec);
2484 case ALC880_MIC_EVENT:
2485 alc880_uniwill_mic_automute(codec);
2490 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2492 unsigned int present;
2495 present = snd_hda_codec_read(codec, 0x14, 0,
2496 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2497 bits = present ? HDA_AMP_MUTE : 0;
2498 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2501 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2503 unsigned int present;
2505 present = snd_hda_codec_read(codec, 0x21, 0,
2506 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2507 present &= HDA_AMP_VOLMASK;
2508 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2509 HDA_AMP_VOLMASK, present);
2510 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2511 HDA_AMP_VOLMASK, present);
2514 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2517 /* Looks like the unsol event is incompatible with the standard
2518 * definition. 4bit tag is placed at 28 bit!
2520 if ((res >> 28) == ALC880_HP_EVENT)
2521 alc880_uniwill_p53_hp_automute(codec);
2522 if ((res >> 28) == ALC880_DCVOL_EVENT)
2523 alc880_uniwill_p53_dcvol_automute(codec);
2527 * F1734 pin configuration:
2528 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2530 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2531 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2532 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2533 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2534 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2535 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2537 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2538 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2539 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2540 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2542 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2543 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2544 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2545 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2546 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2547 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2548 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2549 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2550 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2552 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2553 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2559 * ASUS pin configuration:
2560 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2562 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2563 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2564 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2565 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2566 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2568 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2569 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2570 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2571 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2572 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2573 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2574 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2575 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2577 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2578 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2579 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2580 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2581 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2582 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2583 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2584 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2585 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2590 /* Enable GPIO mask and set output */
2591 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2592 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2594 /* Clevo m520g init */
2595 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2596 /* headphone output */
2597 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2599 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2600 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2602 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2603 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2605 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2606 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2607 /* Mic1 (rear panel) */
2608 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2609 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2610 /* Mic2 (front panel) */
2611 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2612 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2614 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2615 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2616 /* change to EAPD mode */
2617 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2618 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2623 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2624 /* change to EAPD mode */
2625 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2626 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2628 /* Headphone output */
2629 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2631 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2632 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2634 /* Line In pin widget for input */
2635 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2636 /* CD pin widget for input */
2637 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2638 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2639 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2641 /* change to EAPD mode */
2642 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2643 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2649 * LG m1 express dual
2652 * Rear Line-In/Out (blue): 0x14
2653 * Build-in Mic-In: 0x15
2655 * HP-Out (green): 0x1b
2656 * Mic-In/Out (red): 0x19
2660 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2661 static hda_nid_t alc880_lg_dac_nids[3] = {
2665 /* seems analog CD is not working */
2666 static struct hda_input_mux alc880_lg_capture_source = {
2671 { "Internal Mic", 0x6 },
2675 /* 2,4,6 channel modes */
2676 static struct hda_verb alc880_lg_ch2_init[] = {
2677 /* set line-in and mic-in to input */
2678 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2679 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2683 static struct hda_verb alc880_lg_ch4_init[] = {
2684 /* set line-in to out and mic-in to input */
2685 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2686 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2690 static struct hda_verb alc880_lg_ch6_init[] = {
2691 /* set line-in and mic-in to output */
2692 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2693 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2697 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2698 { 2, alc880_lg_ch2_init },
2699 { 4, alc880_lg_ch4_init },
2700 { 6, alc880_lg_ch6_init },
2703 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2704 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2705 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2706 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2707 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2708 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2709 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2710 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2711 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2712 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2713 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2714 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2715 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2716 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2717 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2719 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2720 .name = "Channel Mode",
2721 .info = alc_ch_mode_info,
2722 .get = alc_ch_mode_get,
2723 .put = alc_ch_mode_put,
2728 static struct hda_verb alc880_lg_init_verbs[] = {
2729 /* set capture source to mic-in */
2730 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2731 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2732 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2733 /* mute all amp mixer inputs */
2734 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2735 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2736 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2737 /* line-in to input */
2738 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2739 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2741 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2742 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2744 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2745 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2746 /* mic-in to input */
2747 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2748 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2749 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2751 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2752 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2753 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2755 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2759 /* toggle speaker-output according to the hp-jack state */
2760 static void alc880_lg_automute(struct hda_codec *codec)
2762 unsigned int present;
2765 present = snd_hda_codec_read(codec, 0x1b, 0,
2766 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2767 bits = present ? HDA_AMP_MUTE : 0;
2768 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2769 HDA_AMP_MUTE, bits);
2772 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2774 /* Looks like the unsol event is incompatible with the standard
2775 * definition. 4bit tag is placed at 28 bit!
2777 if ((res >> 28) == 0x01)
2778 alc880_lg_automute(codec);
2787 * Built-in Mic-In: 0x19
2793 static struct hda_input_mux alc880_lg_lw_capture_source = {
2797 { "Internal Mic", 0x1 },
2802 #define alc880_lg_lw_modes alc880_threestack_modes
2804 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2805 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2806 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2807 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2808 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2809 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2810 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2811 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2812 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2813 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2814 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2815 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2816 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2817 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2818 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2820 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2821 .name = "Channel Mode",
2822 .info = alc_ch_mode_info,
2823 .get = alc_ch_mode_get,
2824 .put = alc_ch_mode_put,
2829 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2830 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2831 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2832 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2834 /* set capture source to mic-in */
2835 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2836 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2837 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2838 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2841 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2843 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2844 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2845 /* mic-in to input */
2846 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2847 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2849 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2850 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2852 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2856 /* toggle speaker-output according to the hp-jack state */
2857 static void alc880_lg_lw_automute(struct hda_codec *codec)
2859 unsigned int present;
2862 present = snd_hda_codec_read(codec, 0x1b, 0,
2863 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2864 bits = present ? HDA_AMP_MUTE : 0;
2865 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2866 HDA_AMP_MUTE, bits);
2869 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2871 /* Looks like the unsol event is incompatible with the standard
2872 * definition. 4bit tag is placed at 28 bit!
2874 if ((res >> 28) == 0x01)
2875 alc880_lg_lw_automute(codec);
2878 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2879 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2880 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2881 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2882 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2883 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2884 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2888 static struct hda_input_mux alc880_medion_rim_capture_source = {
2892 { "Internal Mic", 0x1 },
2896 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2897 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2899 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2900 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2902 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2903 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2904 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2905 /* Mic2 (as headphone out) for HP output */
2906 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2907 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2908 /* Internal Speaker */
2909 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2910 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2912 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2913 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2915 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2919 /* toggle speaker-output according to the hp-jack state */
2920 static void alc880_medion_rim_automute(struct hda_codec *codec)
2922 unsigned int present;
2925 present = snd_hda_codec_read(codec, 0x14, 0,
2926 AC_VERB_GET_PIN_SENSE, 0)
2927 & AC_PINSENSE_PRESENCE;
2928 bits = present ? HDA_AMP_MUTE : 0;
2929 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2930 HDA_AMP_MUTE, bits);
2932 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2934 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2937 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2940 /* Looks like the unsol event is incompatible with the standard
2941 * definition. 4bit tag is placed at 28 bit!
2943 if ((res >> 28) == ALC880_HP_EVENT)
2944 alc880_medion_rim_automute(codec);
2947 #ifdef CONFIG_SND_HDA_POWER_SAVE
2948 static struct hda_amp_list alc880_loopbacks[] = {
2949 { 0x0b, HDA_INPUT, 0 },
2950 { 0x0b, HDA_INPUT, 1 },
2951 { 0x0b, HDA_INPUT, 2 },
2952 { 0x0b, HDA_INPUT, 3 },
2953 { 0x0b, HDA_INPUT, 4 },
2957 static struct hda_amp_list alc880_lg_loopbacks[] = {
2958 { 0x0b, HDA_INPUT, 1 },
2959 { 0x0b, HDA_INPUT, 6 },
2960 { 0x0b, HDA_INPUT, 7 },
2969 static int alc_init(struct hda_codec *codec)
2971 struct alc_spec *spec = codec->spec;
2975 alc_auto_init_amp(codec, spec->init_amp);
2977 for (i = 0; i < spec->num_init_verbs; i++)
2978 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2980 if (spec->init_hook)
2981 spec->init_hook(codec);
2986 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2988 struct alc_spec *spec = codec->spec;
2990 if (spec->unsol_event)
2991 spec->unsol_event(codec, res);
2994 #ifdef CONFIG_SND_HDA_POWER_SAVE
2995 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2997 struct alc_spec *spec = codec->spec;
2998 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3003 * Analog playback callbacks
3005 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3006 struct hda_codec *codec,
3007 struct snd_pcm_substream *substream)
3009 struct alc_spec *spec = codec->spec;
3010 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3014 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3015 struct hda_codec *codec,
3016 unsigned int stream_tag,
3017 unsigned int format,
3018 struct snd_pcm_substream *substream)
3020 struct alc_spec *spec = codec->spec;
3021 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3022 stream_tag, format, substream);
3025 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3026 struct hda_codec *codec,
3027 struct snd_pcm_substream *substream)
3029 struct alc_spec *spec = codec->spec;
3030 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3036 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3037 struct hda_codec *codec,
3038 struct snd_pcm_substream *substream)
3040 struct alc_spec *spec = codec->spec;
3041 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3044 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3045 struct hda_codec *codec,
3046 unsigned int stream_tag,
3047 unsigned int format,
3048 struct snd_pcm_substream *substream)
3050 struct alc_spec *spec = codec->spec;
3051 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3052 stream_tag, format, substream);
3055 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3056 struct hda_codec *codec,
3057 struct snd_pcm_substream *substream)
3059 struct alc_spec *spec = codec->spec;
3060 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3063 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3064 struct hda_codec *codec,
3065 struct snd_pcm_substream *substream)
3067 struct alc_spec *spec = codec->spec;
3068 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3074 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3075 struct hda_codec *codec,
3076 unsigned int stream_tag,
3077 unsigned int format,
3078 struct snd_pcm_substream *substream)
3080 struct alc_spec *spec = codec->spec;
3082 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3083 stream_tag, 0, format);
3087 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3088 struct hda_codec *codec,
3089 struct snd_pcm_substream *substream)
3091 struct alc_spec *spec = codec->spec;
3093 snd_hda_codec_cleanup_stream(codec,
3094 spec->adc_nids[substream->number + 1]);
3101 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3105 /* NID is set in alc_build_pcms */
3107 .open = alc880_playback_pcm_open,
3108 .prepare = alc880_playback_pcm_prepare,
3109 .cleanup = alc880_playback_pcm_cleanup
3113 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3117 /* NID is set in alc_build_pcms */
3120 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3124 /* NID is set in alc_build_pcms */
3127 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3128 .substreams = 2, /* can be overridden */
3131 /* NID is set in alc_build_pcms */
3133 .prepare = alc880_alt_capture_pcm_prepare,
3134 .cleanup = alc880_alt_capture_pcm_cleanup
3138 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3142 /* NID is set in alc_build_pcms */
3144 .open = alc880_dig_playback_pcm_open,
3145 .close = alc880_dig_playback_pcm_close,
3146 .prepare = alc880_dig_playback_pcm_prepare,
3147 .cleanup = alc880_dig_playback_pcm_cleanup
3151 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3155 /* NID is set in alc_build_pcms */
3158 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3159 static struct hda_pcm_stream alc_pcm_null_stream = {
3165 static int alc_build_pcms(struct hda_codec *codec)
3167 struct alc_spec *spec = codec->spec;
3168 struct hda_pcm *info = spec->pcm_rec;
3171 codec->num_pcms = 1;
3172 codec->pcm_info = info;
3174 if (spec->no_analog)
3177 info->name = spec->stream_name_analog;
3178 if (spec->stream_analog_playback) {
3179 if (snd_BUG_ON(!spec->multiout.dac_nids))
3181 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3182 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3184 if (spec->stream_analog_capture) {
3185 if (snd_BUG_ON(!spec->adc_nids))
3187 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3188 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3191 if (spec->channel_mode) {
3192 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3193 for (i = 0; i < spec->num_channel_mode; i++) {
3194 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3195 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3201 /* SPDIF for stream index #1 */
3202 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3203 codec->num_pcms = 2;
3204 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3205 info = spec->pcm_rec + 1;
3206 info->name = spec->stream_name_digital;
3207 if (spec->dig_out_type)
3208 info->pcm_type = spec->dig_out_type;
3210 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3211 if (spec->multiout.dig_out_nid &&
3212 spec->stream_digital_playback) {
3213 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3214 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3216 if (spec->dig_in_nid &&
3217 spec->stream_digital_capture) {
3218 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3219 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3221 /* FIXME: do we need this for all Realtek codec models? */
3222 codec->spdif_status_reset = 1;
3225 if (spec->no_analog)
3228 /* If the use of more than one ADC is requested for the current
3229 * model, configure a second analog capture-only PCM.
3231 /* Additional Analaog capture for index #2 */
3232 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3233 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3234 codec->num_pcms = 3;
3235 info = spec->pcm_rec + 2;
3236 info->name = spec->stream_name_analog;
3237 if (spec->alt_dac_nid) {
3238 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3239 *spec->stream_analog_alt_playback;
3240 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3243 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3244 alc_pcm_null_stream;
3245 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3247 if (spec->num_adc_nids > 1) {
3248 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3249 *spec->stream_analog_alt_capture;
3250 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3252 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3253 spec->num_adc_nids - 1;
3255 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3256 alc_pcm_null_stream;
3257 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3264 static void alc_free_kctls(struct hda_codec *codec)
3266 struct alc_spec *spec = codec->spec;
3268 if (spec->kctls.list) {
3269 struct snd_kcontrol_new *kctl = spec->kctls.list;
3271 for (i = 0; i < spec->kctls.used; i++)
3272 kfree(kctl[i].name);
3274 snd_array_free(&spec->kctls);
3277 static void alc_free(struct hda_codec *codec)
3279 struct alc_spec *spec = codec->spec;
3284 alc_free_kctls(codec);
3286 snd_hda_detach_beep_device(codec);
3289 #ifdef SND_HDA_NEEDS_RESUME
3290 static int alc_resume(struct hda_codec *codec)
3292 codec->patch_ops.init(codec);
3293 snd_hda_codec_resume_amp(codec);
3294 snd_hda_codec_resume_cache(codec);
3301 static struct hda_codec_ops alc_patch_ops = {
3302 .build_controls = alc_build_controls,
3303 .build_pcms = alc_build_pcms,
3306 .unsol_event = alc_unsol_event,
3307 #ifdef SND_HDA_NEEDS_RESUME
3308 .resume = alc_resume,
3310 #ifdef CONFIG_SND_HDA_POWER_SAVE
3311 .check_power_status = alc_check_power_status,
3317 * Test configuration for debugging
3319 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3322 #ifdef CONFIG_SND_DEBUG
3323 static hda_nid_t alc880_test_dac_nids[4] = {
3324 0x02, 0x03, 0x04, 0x05
3327 static struct hda_input_mux alc880_test_capture_source = {
3336 { "Surround", 0x6 },
3340 static struct hda_channel_mode alc880_test_modes[4] = {
3347 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3348 struct snd_ctl_elem_info *uinfo)
3350 static char *texts[] = {
3351 "N/A", "Line Out", "HP Out",
3352 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3354 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3356 uinfo->value.enumerated.items = 8;
3357 if (uinfo->value.enumerated.item >= 8)
3358 uinfo->value.enumerated.item = 7;
3359 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3363 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3364 struct snd_ctl_elem_value *ucontrol)
3366 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3367 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3368 unsigned int pin_ctl, item = 0;
3370 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3371 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3372 if (pin_ctl & AC_PINCTL_OUT_EN) {
3373 if (pin_ctl & AC_PINCTL_HP_EN)
3377 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3378 switch (pin_ctl & AC_PINCTL_VREFEN) {
3379 case AC_PINCTL_VREF_HIZ: item = 3; break;
3380 case AC_PINCTL_VREF_50: item = 4; break;
3381 case AC_PINCTL_VREF_GRD: item = 5; break;
3382 case AC_PINCTL_VREF_80: item = 6; break;
3383 case AC_PINCTL_VREF_100: item = 7; break;
3386 ucontrol->value.enumerated.item[0] = item;
3390 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3391 struct snd_ctl_elem_value *ucontrol)
3393 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3394 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3395 static unsigned int ctls[] = {
3396 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3397 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3398 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3399 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3400 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3401 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3403 unsigned int old_ctl, new_ctl;
3405 old_ctl = snd_hda_codec_read(codec, nid, 0,
3406 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3407 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3408 if (old_ctl != new_ctl) {
3410 snd_hda_codec_write_cache(codec, nid, 0,
3411 AC_VERB_SET_PIN_WIDGET_CONTROL,
3413 val = ucontrol->value.enumerated.item[0] >= 3 ?
3415 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3422 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3423 struct snd_ctl_elem_info *uinfo)
3425 static char *texts[] = {
3426 "Front", "Surround", "CLFE", "Side"
3428 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3430 uinfo->value.enumerated.items = 4;
3431 if (uinfo->value.enumerated.item >= 4)
3432 uinfo->value.enumerated.item = 3;
3433 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3437 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3438 struct snd_ctl_elem_value *ucontrol)
3440 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3441 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3444 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3445 ucontrol->value.enumerated.item[0] = sel & 3;
3449 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3450 struct snd_ctl_elem_value *ucontrol)
3452 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3453 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3456 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3457 if (ucontrol->value.enumerated.item[0] != sel) {
3458 sel = ucontrol->value.enumerated.item[0] & 3;
3459 snd_hda_codec_write_cache(codec, nid, 0,
3460 AC_VERB_SET_CONNECT_SEL, sel);
3466 #define PIN_CTL_TEST(xname,nid) { \
3467 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3469 .info = alc_test_pin_ctl_info, \
3470 .get = alc_test_pin_ctl_get, \
3471 .put = alc_test_pin_ctl_put, \
3472 .private_value = nid \
3475 #define PIN_SRC_TEST(xname,nid) { \
3476 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3478 .info = alc_test_pin_src_info, \
3479 .get = alc_test_pin_src_get, \
3480 .put = alc_test_pin_src_put, \
3481 .private_value = nid \
3484 static struct snd_kcontrol_new alc880_test_mixer[] = {
3485 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3486 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3487 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3488 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3489 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3490 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3491 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3492 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3493 PIN_CTL_TEST("Front Pin Mode", 0x14),
3494 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3495 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3496 PIN_CTL_TEST("Side Pin Mode", 0x17),
3497 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3498 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3499 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3500 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3501 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3502 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3503 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3504 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3505 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3506 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3507 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3508 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3509 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3510 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3511 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3512 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3513 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3514 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3516 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3517 .name = "Channel Mode",
3518 .info = alc_ch_mode_info,
3519 .get = alc_ch_mode_get,
3520 .put = alc_ch_mode_put,
3525 static struct hda_verb alc880_test_init_verbs[] = {
3526 /* Unmute inputs of 0x0c - 0x0f */
3527 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3529 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3530 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3531 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3532 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3533 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3534 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3535 /* Vol output for 0x0c-0x0f */
3536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3537 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3538 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3539 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3540 /* Set output pins 0x14-0x17 */
3541 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3542 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3543 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3544 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3545 /* Unmute output pins 0x14-0x17 */
3546 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3547 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3548 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3549 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3550 /* Set input pins 0x18-0x1c */
3551 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3552 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3553 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3554 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3555 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3556 /* Mute input pins 0x18-0x1b */
3557 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3558 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3559 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3560 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3562 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3563 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3564 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3565 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3566 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3567 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3568 /* Analog input/passthru */
3569 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3572 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3573 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3581 static const char *alc880_models[ALC880_MODEL_LAST] = {
3582 [ALC880_3ST] = "3stack",
3583 [ALC880_TCL_S700] = "tcl",
3584 [ALC880_3ST_DIG] = "3stack-digout",
3585 [ALC880_CLEVO] = "clevo",
3586 [ALC880_5ST] = "5stack",
3587 [ALC880_5ST_DIG] = "5stack-digout",
3588 [ALC880_W810] = "w810",
3589 [ALC880_Z71V] = "z71v",
3590 [ALC880_6ST] = "6stack",
3591 [ALC880_6ST_DIG] = "6stack-digout",
3592 [ALC880_ASUS] = "asus",
3593 [ALC880_ASUS_W1V] = "asus-w1v",
3594 [ALC880_ASUS_DIG] = "asus-dig",
3595 [ALC880_ASUS_DIG2] = "asus-dig2",
3596 [ALC880_UNIWILL_DIG] = "uniwill",
3597 [ALC880_UNIWILL_P53] = "uniwill-p53",
3598 [ALC880_FUJITSU] = "fujitsu",
3599 [ALC880_F1734] = "F1734",
3601 [ALC880_LG_LW] = "lg-lw",
3602 [ALC880_MEDION_RIM] = "medion",
3603 #ifdef CONFIG_SND_DEBUG
3604 [ALC880_TEST] = "test",
3606 [ALC880_AUTO] = "auto",
3609 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3610 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3611 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3612 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3613 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3614 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3615 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3616 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3617 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3618 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3619 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3620 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3621 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3622 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3623 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3624 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3625 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3626 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3627 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3628 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3629 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3630 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3631 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3632 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3633 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3634 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3635 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3636 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3637 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3638 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3639 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3640 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3641 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3642 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3643 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3644 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3645 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3646 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3647 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3648 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3649 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3650 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3651 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3652 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3653 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3654 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3655 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3656 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3657 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3658 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3659 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3660 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3661 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3662 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3663 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3664 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3665 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3666 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3667 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3668 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3669 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3670 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3671 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3672 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3673 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3674 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3675 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3676 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3677 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3679 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3680 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3681 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3686 * ALC880 codec presets
3688 static struct alc_config_preset alc880_presets[] = {
3690 .mixers = { alc880_three_stack_mixer },
3691 .init_verbs = { alc880_volume_init_verbs,
3692 alc880_pin_3stack_init_verbs },
3693 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3694 .dac_nids = alc880_dac_nids,
3695 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3696 .channel_mode = alc880_threestack_modes,
3698 .input_mux = &alc880_capture_source,
3700 [ALC880_3ST_DIG] = {
3701 .mixers = { alc880_three_stack_mixer },
3702 .init_verbs = { alc880_volume_init_verbs,
3703 alc880_pin_3stack_init_verbs },
3704 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3705 .dac_nids = alc880_dac_nids,
3706 .dig_out_nid = ALC880_DIGOUT_NID,
3707 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3708 .channel_mode = alc880_threestack_modes,
3710 .input_mux = &alc880_capture_source,
3712 [ALC880_TCL_S700] = {
3713 .mixers = { alc880_tcl_s700_mixer },
3714 .init_verbs = { alc880_volume_init_verbs,
3715 alc880_pin_tcl_S700_init_verbs,
3716 alc880_gpio2_init_verbs },
3717 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3718 .dac_nids = alc880_dac_nids,
3719 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3720 .num_adc_nids = 1, /* single ADC */
3722 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3723 .channel_mode = alc880_2_jack_modes,
3724 .input_mux = &alc880_capture_source,
3727 .mixers = { alc880_three_stack_mixer,
3728 alc880_five_stack_mixer},
3729 .init_verbs = { alc880_volume_init_verbs,
3730 alc880_pin_5stack_init_verbs },
3731 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3732 .dac_nids = alc880_dac_nids,
3733 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3734 .channel_mode = alc880_fivestack_modes,
3735 .input_mux = &alc880_capture_source,
3737 [ALC880_5ST_DIG] = {
3738 .mixers = { alc880_three_stack_mixer,
3739 alc880_five_stack_mixer },
3740 .init_verbs = { alc880_volume_init_verbs,
3741 alc880_pin_5stack_init_verbs },
3742 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3743 .dac_nids = alc880_dac_nids,
3744 .dig_out_nid = ALC880_DIGOUT_NID,
3745 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3746 .channel_mode = alc880_fivestack_modes,
3747 .input_mux = &alc880_capture_source,
3750 .mixers = { alc880_six_stack_mixer },
3751 .init_verbs = { alc880_volume_init_verbs,
3752 alc880_pin_6stack_init_verbs },
3753 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3754 .dac_nids = alc880_6st_dac_nids,
3755 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3756 .channel_mode = alc880_sixstack_modes,
3757 .input_mux = &alc880_6stack_capture_source,
3759 [ALC880_6ST_DIG] = {
3760 .mixers = { alc880_six_stack_mixer },
3761 .init_verbs = { alc880_volume_init_verbs,
3762 alc880_pin_6stack_init_verbs },
3763 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3764 .dac_nids = alc880_6st_dac_nids,
3765 .dig_out_nid = ALC880_DIGOUT_NID,
3766 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3767 .channel_mode = alc880_sixstack_modes,
3768 .input_mux = &alc880_6stack_capture_source,
3771 .mixers = { alc880_w810_base_mixer },
3772 .init_verbs = { alc880_volume_init_verbs,
3773 alc880_pin_w810_init_verbs,
3774 alc880_gpio2_init_verbs },
3775 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3776 .dac_nids = alc880_w810_dac_nids,
3777 .dig_out_nid = ALC880_DIGOUT_NID,
3778 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3779 .channel_mode = alc880_w810_modes,
3780 .input_mux = &alc880_capture_source,
3783 .mixers = { alc880_z71v_mixer },
3784 .init_verbs = { alc880_volume_init_verbs,
3785 alc880_pin_z71v_init_verbs },
3786 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3787 .dac_nids = alc880_z71v_dac_nids,
3788 .dig_out_nid = ALC880_DIGOUT_NID,
3790 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3791 .channel_mode = alc880_2_jack_modes,
3792 .input_mux = &alc880_capture_source,
3795 .mixers = { alc880_f1734_mixer },
3796 .init_verbs = { alc880_volume_init_verbs,
3797 alc880_pin_f1734_init_verbs },
3798 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3799 .dac_nids = alc880_f1734_dac_nids,
3801 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3802 .channel_mode = alc880_2_jack_modes,
3803 .input_mux = &alc880_f1734_capture_source,
3804 .unsol_event = alc880_uniwill_p53_unsol_event,
3805 .init_hook = alc880_uniwill_p53_hp_automute,
3808 .mixers = { alc880_asus_mixer },
3809 .init_verbs = { alc880_volume_init_verbs,
3810 alc880_pin_asus_init_verbs,
3811 alc880_gpio1_init_verbs },
3812 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3813 .dac_nids = alc880_asus_dac_nids,
3814 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3815 .channel_mode = alc880_asus_modes,
3817 .input_mux = &alc880_capture_source,
3819 [ALC880_ASUS_DIG] = {
3820 .mixers = { alc880_asus_mixer },
3821 .init_verbs = { alc880_volume_init_verbs,
3822 alc880_pin_asus_init_verbs,
3823 alc880_gpio1_init_verbs },
3824 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3825 .dac_nids = alc880_asus_dac_nids,
3826 .dig_out_nid = ALC880_DIGOUT_NID,
3827 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3828 .channel_mode = alc880_asus_modes,
3830 .input_mux = &alc880_capture_source,
3832 [ALC880_ASUS_DIG2] = {
3833 .mixers = { alc880_asus_mixer },
3834 .init_verbs = { alc880_volume_init_verbs,
3835 alc880_pin_asus_init_verbs,
3836 alc880_gpio2_init_verbs }, /* use GPIO2 */
3837 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3838 .dac_nids = alc880_asus_dac_nids,
3839 .dig_out_nid = ALC880_DIGOUT_NID,
3840 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3841 .channel_mode = alc880_asus_modes,
3843 .input_mux = &alc880_capture_source,
3845 [ALC880_ASUS_W1V] = {
3846 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3847 .init_verbs = { alc880_volume_init_verbs,
3848 alc880_pin_asus_init_verbs,
3849 alc880_gpio1_init_verbs },
3850 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3851 .dac_nids = alc880_asus_dac_nids,
3852 .dig_out_nid = ALC880_DIGOUT_NID,
3853 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3854 .channel_mode = alc880_asus_modes,
3856 .input_mux = &alc880_capture_source,
3858 [ALC880_UNIWILL_DIG] = {
3859 .mixers = { alc880_asus_mixer },
3860 .init_verbs = { alc880_volume_init_verbs,
3861 alc880_pin_asus_init_verbs },
3862 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3863 .dac_nids = alc880_asus_dac_nids,
3864 .dig_out_nid = ALC880_DIGOUT_NID,
3865 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3866 .channel_mode = alc880_asus_modes,
3868 .input_mux = &alc880_capture_source,
3870 [ALC880_UNIWILL] = {
3871 .mixers = { alc880_uniwill_mixer },
3872 .init_verbs = { alc880_volume_init_verbs,
3873 alc880_uniwill_init_verbs },
3874 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3875 .dac_nids = alc880_asus_dac_nids,
3876 .dig_out_nid = ALC880_DIGOUT_NID,
3877 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3878 .channel_mode = alc880_threestack_modes,
3880 .input_mux = &alc880_capture_source,
3881 .unsol_event = alc880_uniwill_unsol_event,
3882 .init_hook = alc880_uniwill_automute,
3884 [ALC880_UNIWILL_P53] = {
3885 .mixers = { alc880_uniwill_p53_mixer },
3886 .init_verbs = { alc880_volume_init_verbs,
3887 alc880_uniwill_p53_init_verbs },
3888 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3889 .dac_nids = alc880_asus_dac_nids,
3890 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3891 .channel_mode = alc880_threestack_modes,
3892 .input_mux = &alc880_capture_source,
3893 .unsol_event = alc880_uniwill_p53_unsol_event,
3894 .init_hook = alc880_uniwill_p53_hp_automute,
3896 [ALC880_FUJITSU] = {
3897 .mixers = { alc880_fujitsu_mixer },
3898 .init_verbs = { alc880_volume_init_verbs,
3899 alc880_uniwill_p53_init_verbs,
3900 alc880_beep_init_verbs },
3901 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3902 .dac_nids = alc880_dac_nids,
3903 .dig_out_nid = ALC880_DIGOUT_NID,
3904 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3905 .channel_mode = alc880_2_jack_modes,
3906 .input_mux = &alc880_capture_source,
3907 .unsol_event = alc880_uniwill_p53_unsol_event,
3908 .init_hook = alc880_uniwill_p53_hp_automute,
3911 .mixers = { alc880_three_stack_mixer },
3912 .init_verbs = { alc880_volume_init_verbs,
3913 alc880_pin_clevo_init_verbs },
3914 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3915 .dac_nids = alc880_dac_nids,
3917 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3918 .channel_mode = alc880_threestack_modes,
3920 .input_mux = &alc880_capture_source,
3923 .mixers = { alc880_lg_mixer },
3924 .init_verbs = { alc880_volume_init_verbs,
3925 alc880_lg_init_verbs },
3926 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3927 .dac_nids = alc880_lg_dac_nids,
3928 .dig_out_nid = ALC880_DIGOUT_NID,
3929 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3930 .channel_mode = alc880_lg_ch_modes,
3932 .input_mux = &alc880_lg_capture_source,
3933 .unsol_event = alc880_lg_unsol_event,
3934 .init_hook = alc880_lg_automute,
3935 #ifdef CONFIG_SND_HDA_POWER_SAVE
3936 .loopbacks = alc880_lg_loopbacks,
3940 .mixers = { alc880_lg_lw_mixer },
3941 .init_verbs = { alc880_volume_init_verbs,
3942 alc880_lg_lw_init_verbs },
3943 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3944 .dac_nids = alc880_dac_nids,
3945 .dig_out_nid = ALC880_DIGOUT_NID,
3946 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3947 .channel_mode = alc880_lg_lw_modes,
3948 .input_mux = &alc880_lg_lw_capture_source,
3949 .unsol_event = alc880_lg_lw_unsol_event,
3950 .init_hook = alc880_lg_lw_automute,
3952 [ALC880_MEDION_RIM] = {
3953 .mixers = { alc880_medion_rim_mixer },
3954 .init_verbs = { alc880_volume_init_verbs,
3955 alc880_medion_rim_init_verbs,
3956 alc_gpio2_init_verbs },
3957 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3958 .dac_nids = alc880_dac_nids,
3959 .dig_out_nid = ALC880_DIGOUT_NID,
3960 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3961 .channel_mode = alc880_2_jack_modes,
3962 .input_mux = &alc880_medion_rim_capture_source,
3963 .unsol_event = alc880_medion_rim_unsol_event,
3964 .init_hook = alc880_medion_rim_automute,
3966 #ifdef CONFIG_SND_DEBUG
3968 .mixers = { alc880_test_mixer },
3969 .init_verbs = { alc880_test_init_verbs },
3970 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3971 .dac_nids = alc880_test_dac_nids,
3972 .dig_out_nid = ALC880_DIGOUT_NID,
3973 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3974 .channel_mode = alc880_test_modes,
3975 .input_mux = &alc880_test_capture_source,
3981 * Automatic parse of I/O pins from the BIOS configuration
3986 ALC_CTL_WIDGET_MUTE,
3989 static struct snd_kcontrol_new alc880_control_templates[] = {
3990 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3991 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3992 HDA_BIND_MUTE(NULL, 0, 0, 0),
3995 /* add dynamic controls */
3996 static int add_control(struct alc_spec *spec, int type, const char *name,
3999 struct snd_kcontrol_new *knew;
4001 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4002 knew = snd_array_new(&spec->kctls);
4005 *knew = alc880_control_templates[type];
4006 knew->name = kstrdup(name, GFP_KERNEL);
4009 knew->private_value = val;
4013 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4014 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4015 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4016 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4017 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4018 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4019 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4020 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4021 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4022 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4023 #define ALC880_PIN_CD_NID 0x1c
4025 /* fill in the dac_nids table from the parsed pin configuration */
4026 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4027 const struct auto_pin_cfg *cfg)
4033 memset(assigned, 0, sizeof(assigned));
4034 spec->multiout.dac_nids = spec->private_dac_nids;
4036 /* check the pins hardwired to audio widget */
4037 for (i = 0; i < cfg->line_outs; i++) {
4038 nid = cfg->line_out_pins[i];
4039 if (alc880_is_fixed_pin(nid)) {
4040 int idx = alc880_fixed_pin_idx(nid);
4041 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4045 /* left pins can be connect to any audio widget */
4046 for (i = 0; i < cfg->line_outs; i++) {
4047 nid = cfg->line_out_pins[i];
4048 if (alc880_is_fixed_pin(nid))
4050 /* search for an empty channel */
4051 for (j = 0; j < cfg->line_outs; j++) {
4053 spec->multiout.dac_nids[i] =
4054 alc880_idx_to_dac(j);
4060 spec->multiout.num_dacs = cfg->line_outs;
4064 /* add playback controls from the parsed DAC table */
4065 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4066 const struct auto_pin_cfg *cfg)
4069 static const char *chname[4] = {
4070 "Front", "Surround", NULL /*CLFE*/, "Side"
4075 for (i = 0; i < cfg->line_outs; i++) {
4076 if (!spec->multiout.dac_nids[i])
4078 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4081 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4082 "Center Playback Volume",
4083 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4087 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4088 "LFE Playback Volume",
4089 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4093 err = add_control(spec, ALC_CTL_BIND_MUTE,
4094 "Center Playback Switch",
4095 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4099 err = add_control(spec, ALC_CTL_BIND_MUTE,
4100 "LFE Playback Switch",
4101 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4106 sprintf(name, "%s Playback Volume", chname[i]);
4107 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4108 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4112 sprintf(name, "%s Playback Switch", chname[i]);
4113 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4114 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4123 /* add playback controls for speaker and HP outputs */
4124 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4134 if (alc880_is_fixed_pin(pin)) {
4135 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4136 /* specify the DAC as the extra output */
4137 if (!spec->multiout.hp_nid)
4138 spec->multiout.hp_nid = nid;
4140 spec->multiout.extra_out_nid[0] = nid;
4141 /* control HP volume/switch on the output mixer amp */
4142 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4143 sprintf(name, "%s Playback Volume", pfx);
4144 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4145 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4148 sprintf(name, "%s Playback Switch", pfx);
4149 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4150 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4153 } else if (alc880_is_multi_pin(pin)) {
4154 /* set manual connection */
4155 /* we have only a switch on HP-out PIN */
4156 sprintf(name, "%s Playback Switch", pfx);
4157 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4158 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4165 /* create input playback/capture controls for the given pin */
4166 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4167 const char *ctlname,
4168 int idx, hda_nid_t mix_nid)
4173 sprintf(name, "%s Playback Volume", ctlname);
4174 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4175 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4178 sprintf(name, "%s Playback Switch", ctlname);
4179 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4180 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4186 /* create playback/capture controls for input pins */
4187 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4188 const struct auto_pin_cfg *cfg)
4190 struct hda_input_mux *imux = &spec->private_imux[0];
4193 for (i = 0; i < AUTO_PIN_LAST; i++) {
4194 if (alc880_is_input_pin(cfg->input_pins[i])) {
4195 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4196 err = new_analog_input(spec, cfg->input_pins[i],
4197 auto_pin_cfg_labels[i],
4201 imux->items[imux->num_items].label =
4202 auto_pin_cfg_labels[i];
4203 imux->items[imux->num_items].index =
4204 alc880_input_pin_idx(cfg->input_pins[i]);
4211 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4212 unsigned int pin_type)
4214 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4217 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4221 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4222 hda_nid_t nid, int pin_type,
4225 alc_set_pin_output(codec, nid, pin_type);
4226 /* need the manual connection? */
4227 if (alc880_is_multi_pin(nid)) {
4228 struct alc_spec *spec = codec->spec;
4229 int idx = alc880_multi_pin_idx(nid);
4230 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4231 AC_VERB_SET_CONNECT_SEL,
4232 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4236 static int get_pin_type(int line_out_type)
4238 if (line_out_type == AUTO_PIN_HP_OUT)
4244 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4246 struct alc_spec *spec = codec->spec;
4249 for (i = 0; i < spec->autocfg.line_outs; i++) {
4250 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4251 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4252 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4256 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4258 struct alc_spec *spec = codec->spec;
4261 pin = spec->autocfg.speaker_pins[0];
4262 if (pin) /* connect to front */
4263 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4264 pin = spec->autocfg.hp_pins[0];
4265 if (pin) /* connect to front */
4266 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4269 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4271 struct alc_spec *spec = codec->spec;
4274 for (i = 0; i < AUTO_PIN_LAST; i++) {
4275 hda_nid_t nid = spec->autocfg.input_pins[i];
4276 if (alc880_is_input_pin(nid)) {
4277 alc_set_input_pin(codec, nid, i);
4278 if (nid != ALC880_PIN_CD_NID &&
4279 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4280 snd_hda_codec_write(codec, nid, 0,
4281 AC_VERB_SET_AMP_GAIN_MUTE,
4287 /* parse the BIOS configuration and set up the alc_spec */
4288 /* return 1 if successful, 0 if the proper config is not found,
4289 * or a negative error code
4291 static int alc880_parse_auto_config(struct hda_codec *codec)
4293 struct alc_spec *spec = codec->spec;
4295 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4297 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4301 if (!spec->autocfg.line_outs)
4302 return 0; /* can't find valid BIOS pin config */
4304 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4307 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4310 err = alc880_auto_create_extra_out(spec,
4311 spec->autocfg.speaker_pins[0],
4315 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4319 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4323 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4325 /* check multiple SPDIF-out (for recent codecs) */
4326 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4328 err = snd_hda_get_connections(codec,
4329 spec->autocfg.dig_out_pins[i],
4334 spec->multiout.dig_out_nid = dig_nid;
4336 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4337 spec->slave_dig_outs[i - 1] = dig_nid;
4338 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4342 if (spec->autocfg.dig_in_pin)
4343 spec->dig_in_nid = ALC880_DIGIN_NID;
4345 if (spec->kctls.list)
4346 add_mixer(spec, spec->kctls.list);
4348 add_verb(spec, alc880_volume_init_verbs);
4350 spec->num_mux_defs = 1;
4351 spec->input_mux = &spec->private_imux[0];
4353 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4358 /* additional initialization for auto-configuration model */
4359 static void alc880_auto_init(struct hda_codec *codec)
4361 struct alc_spec *spec = codec->spec;
4362 alc880_auto_init_multi_out(codec);
4363 alc880_auto_init_extra_out(codec);
4364 alc880_auto_init_analog_input(codec);
4365 if (spec->unsol_event)
4366 alc_inithook(codec);
4369 static void set_capture_mixer(struct alc_spec *spec)
4371 static struct snd_kcontrol_new *caps[2][3] = {
4372 { alc_capture_mixer_nosrc1,
4373 alc_capture_mixer_nosrc2,
4374 alc_capture_mixer_nosrc3 },
4375 { alc_capture_mixer1,
4377 alc_capture_mixer3 },
4379 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4381 if (spec->input_mux && spec->input_mux->num_items > 1)
4385 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4389 #define set_beep_amp(spec, nid, idx, dir) \
4390 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4393 * OK, here we have finally the patch for ALC880
4396 static int patch_alc880(struct hda_codec *codec)
4398 struct alc_spec *spec;
4402 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4408 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4411 if (board_config < 0) {
4412 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4413 "trying auto-probe from BIOS...\n");
4414 board_config = ALC880_AUTO;
4417 if (board_config == ALC880_AUTO) {
4418 /* automatic parse from the BIOS config */
4419 err = alc880_parse_auto_config(codec);
4425 "hda_codec: Cannot set up configuration "
4426 "from BIOS. Using 3-stack mode...\n");
4427 board_config = ALC880_3ST;
4431 err = snd_hda_attach_beep_device(codec, 0x1);
4437 if (board_config != ALC880_AUTO)
4438 setup_preset(spec, &alc880_presets[board_config]);
4440 spec->stream_name_analog = "ALC880 Analog";
4441 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4442 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4443 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4445 spec->stream_name_digital = "ALC880 Digital";
4446 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4447 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4449 if (!spec->adc_nids && spec->input_mux) {
4450 /* check whether NID 0x07 is valid */
4451 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4453 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4454 if (wcap != AC_WID_AUD_IN) {
4455 spec->adc_nids = alc880_adc_nids_alt;
4456 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4458 spec->adc_nids = alc880_adc_nids;
4459 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4462 set_capture_mixer(spec);
4463 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4465 spec->vmaster_nid = 0x0c;
4467 codec->patch_ops = alc_patch_ops;
4468 if (board_config == ALC880_AUTO)
4469 spec->init_hook = alc880_auto_init;
4470 #ifdef CONFIG_SND_HDA_POWER_SAVE
4471 if (!spec->loopback.amplist)
4472 spec->loopback.amplist = alc880_loopbacks;
4474 codec->proc_widget_hook = print_realtek_coef;
4484 static hda_nid_t alc260_dac_nids[1] = {
4489 static hda_nid_t alc260_adc_nids[1] = {
4494 static hda_nid_t alc260_adc_nids_alt[1] = {
4499 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4500 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4502 static hda_nid_t alc260_dual_adc_nids[2] = {
4507 #define ALC260_DIGOUT_NID 0x03
4508 #define ALC260_DIGIN_NID 0x06
4510 static struct hda_input_mux alc260_capture_source = {
4514 { "Front Mic", 0x1 },
4520 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4521 * headphone jack and the internal CD lines since these are the only pins at
4522 * which audio can appear. For flexibility, also allow the option of
4523 * recording the mixer output on the second ADC (ADC0 doesn't have a
4524 * connection to the mixer output).
4526 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4530 { "Mic/Line", 0x0 },
4532 { "Headphone", 0x2 },
4538 { "Mic/Line", 0x0 },
4540 { "Headphone", 0x2 },
4547 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4548 * the Fujitsu S702x, but jacks are marked differently.
4550 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4557 { "Headphone", 0x5 },
4566 { "Headphone", 0x6 },
4572 /* Maxdata Favorit 100XS */
4573 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4577 { "Line/Mic", 0x0 },
4584 { "Line/Mic", 0x0 },
4592 * This is just place-holder, so there's something for alc_build_pcms to look
4593 * at when it calculates the maximum number of channels. ALC260 has no mixer
4594 * element which allows changing the channel mode, so the verb list is
4597 static struct hda_channel_mode alc260_modes[1] = {
4602 /* Mixer combinations
4604 * basic: base_output + input + pc_beep + capture
4605 * HP: base_output + input + capture_alt
4606 * HP_3013: hp_3013 + input + capture
4607 * fujitsu: fujitsu + capture
4608 * acer: acer + capture
4611 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4612 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4613 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4614 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4615 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4616 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4617 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4621 static struct snd_kcontrol_new alc260_input_mixer[] = {
4622 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4623 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4624 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4625 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4626 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4627 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4628 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4629 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4633 /* update HP, line and mono out pins according to the master switch */
4634 static void alc260_hp_master_update(struct hda_codec *codec,
4635 hda_nid_t hp, hda_nid_t line,
4638 struct alc_spec *spec = codec->spec;
4639 unsigned int val = spec->master_sw ? PIN_HP : 0;
4640 /* change HP and line-out pins */
4641 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4643 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4645 /* mono (speaker) depending on the HP jack sense */
4646 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4647 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4651 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4652 struct snd_ctl_elem_value *ucontrol)
4654 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4655 struct alc_spec *spec = codec->spec;
4656 *ucontrol->value.integer.value = spec->master_sw;
4660 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4661 struct snd_ctl_elem_value *ucontrol)
4663 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4664 struct alc_spec *spec = codec->spec;
4665 int val = !!*ucontrol->value.integer.value;
4666 hda_nid_t hp, line, mono;
4668 if (val == spec->master_sw)
4670 spec->master_sw = val;
4671 hp = (kcontrol->private_value >> 16) & 0xff;
4672 line = (kcontrol->private_value >> 8) & 0xff;
4673 mono = kcontrol->private_value & 0xff;
4674 alc260_hp_master_update(codec, hp, line, mono);
4678 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4680 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4681 .name = "Master Playback Switch",
4682 .info = snd_ctl_boolean_mono_info,
4683 .get = alc260_hp_master_sw_get,
4684 .put = alc260_hp_master_sw_put,
4685 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4687 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4688 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4689 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4690 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4691 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4693 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4697 static struct hda_verb alc260_hp_unsol_verbs[] = {
4698 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4702 static void alc260_hp_automute(struct hda_codec *codec)
4704 struct alc_spec *spec = codec->spec;
4705 unsigned int present;
4707 present = snd_hda_codec_read(codec, 0x10, 0,
4708 AC_VERB_GET_PIN_SENSE, 0);
4709 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4710 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4713 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4715 if ((res >> 26) == ALC880_HP_EVENT)
4716 alc260_hp_automute(codec);
4719 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4721 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4722 .name = "Master Playback Switch",
4723 .info = snd_ctl_boolean_mono_info,
4724 .get = alc260_hp_master_sw_get,
4725 .put = alc260_hp_master_sw_put,
4726 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4728 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4729 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4730 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4731 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4732 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4733 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4734 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4735 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4739 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4740 .ops = &snd_hda_bind_vol,
4742 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4743 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4744 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4749 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4750 .ops = &snd_hda_bind_sw,
4752 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4753 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4758 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4759 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4760 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4761 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4762 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4766 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4767 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4771 static void alc260_hp_3013_automute(struct hda_codec *codec)
4773 struct alc_spec *spec = codec->spec;
4774 unsigned int present;
4776 present = snd_hda_codec_read(codec, 0x15, 0,
4777 AC_VERB_GET_PIN_SENSE, 0);
4778 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4779 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4782 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4785 if ((res >> 26) == ALC880_HP_EVENT)
4786 alc260_hp_3013_automute(codec);
4789 static void alc260_hp_3012_automute(struct hda_codec *codec)
4791 unsigned int present, bits;
4793 present = snd_hda_codec_read(codec, 0x10, 0,
4794 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4796 bits = present ? 0 : PIN_OUT;
4797 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4799 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4801 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4805 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4808 if ((res >> 26) == ALC880_HP_EVENT)
4809 alc260_hp_3012_automute(codec);
4812 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4813 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4815 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4816 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4817 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4818 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4819 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4820 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4821 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4822 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4823 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4824 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4825 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4829 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4830 * versions of the ALC260 don't act on requests to enable mic bias from NID
4831 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4832 * datasheet doesn't mention this restriction. At this stage it's not clear
4833 * whether this behaviour is intentional or is a hardware bug in chip
4834 * revisions available in early 2006. Therefore for now allow the
4835 * "Headphone Jack Mode" control to span all choices, but if it turns out
4836 * that the lack of mic bias for this NID is intentional we could change the
4837 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4839 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4840 * don't appear to make the mic bias available from the "line" jack, even
4841 * though the NID used for this jack (0x14) can supply it. The theory is
4842 * that perhaps Acer have included blocking capacitors between the ALC260
4843 * and the output jack. If this turns out to be the case for all such
4844 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4845 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4847 * The C20x Tablet series have a mono internal speaker which is controlled
4848 * via the chip's Mono sum widget and pin complex, so include the necessary
4849 * controls for such models. On models without a "mono speaker" the control
4850 * won't do anything.
4852 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4853 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4854 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4855 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4856 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4858 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4860 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4861 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4862 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4863 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4864 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4865 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4866 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4867 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4871 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
4873 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
4874 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4875 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4876 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4877 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4878 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4879 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4883 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4884 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4886 static struct snd_kcontrol_new alc260_will_mixer[] = {
4887 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4888 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4889 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4890 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4891 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4892 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4893 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4894 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4895 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4896 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4900 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4901 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4903 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4904 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4905 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4906 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4907 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4908 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4909 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4910 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4911 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4912 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4913 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4918 * initialization verbs
4920 static struct hda_verb alc260_init_verbs[] = {
4921 /* Line In pin widget for input */
4922 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4923 /* CD pin widget for input */
4924 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4925 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4926 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4927 /* Mic2 (front panel) pin widget for input and vref at 80% */
4928 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4929 /* LINE-2 is used for line-out in rear */
4930 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4931 /* select line-out */
4932 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4934 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4936 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4938 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4939 /* mute capture amp left and right */
4940 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4941 /* set connection select to line in (default select for this ADC) */
4942 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4943 /* mute capture amp left and right */
4944 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4945 /* set connection select to line in (default select for this ADC) */
4946 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4947 /* set vol=0 Line-Out mixer amp left and right */
4948 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4949 /* unmute pin widget amp left and right (no gain on this amp) */
4950 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4951 /* set vol=0 HP mixer amp left and right */
4952 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4953 /* unmute pin widget amp left and right (no gain on this amp) */
4954 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4955 /* set vol=0 Mono mixer amp left and right */
4956 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4957 /* unmute pin widget amp left and right (no gain on this amp) */
4958 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4959 /* unmute LINE-2 out pin */
4960 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4961 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4964 /* mute analog inputs */
4965 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4966 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4967 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4968 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4969 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4970 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4971 /* mute Front out path */
4972 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4973 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4974 /* mute Headphone out path */
4975 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4976 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4977 /* mute Mono out path */
4978 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4979 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4983 #if 0 /* should be identical with alc260_init_verbs? */
4984 static struct hda_verb alc260_hp_init_verbs[] = {
4985 /* Headphone and output */
4986 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4988 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4989 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4990 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4991 /* Mic2 (front panel) pin widget for input and vref at 80% */
4992 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4993 /* Line In pin widget for input */
4994 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4995 /* Line-2 pin widget for output */
4996 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4997 /* CD pin widget for input */
4998 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4999 /* unmute amp left and right */
5000 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5001 /* set connection select to line in (default select for this ADC) */
5002 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5003 /* unmute Line-Out mixer amp left and right (volume = 0) */
5004 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5005 /* mute pin widget amp left and right (no gain on this amp) */
5006 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5007 /* unmute HP mixer amp left and right (volume = 0) */
5008 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5009 /* mute pin widget amp left and right (no gain on this amp) */
5010 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5011 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5014 /* mute analog inputs */
5015 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5016 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5017 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5018 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5019 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5020 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5021 /* Unmute Front out path */
5022 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5023 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5024 /* Unmute Headphone out path */
5025 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5026 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5027 /* Unmute Mono out path */
5028 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5029 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5034 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5035 /* Line out and output */
5036 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5038 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5039 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5040 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5041 /* Mic2 (front panel) pin widget for input and vref at 80% */
5042 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5043 /* Line In pin widget for input */
5044 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5045 /* Headphone pin widget for output */
5046 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5047 /* CD pin widget for input */
5048 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5049 /* unmute amp left and right */
5050 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5051 /* set connection select to line in (default select for this ADC) */
5052 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5053 /* unmute Line-Out mixer amp left and right (volume = 0) */
5054 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5055 /* mute pin widget amp left and right (no gain on this amp) */
5056 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5057 /* unmute HP mixer amp left and right (volume = 0) */
5058 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5059 /* mute pin widget amp left and right (no gain on this amp) */
5060 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5061 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5064 /* mute analog inputs */
5065 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5066 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5067 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5068 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5069 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5070 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5071 /* Unmute Front out path */
5072 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5073 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5074 /* Unmute Headphone out path */
5075 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5076 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5077 /* Unmute Mono out path */
5078 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5079 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5083 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5084 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5085 * audio = 0x16, internal speaker = 0x10.
5087 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5088 /* Disable all GPIOs */
5089 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5090 /* Internal speaker is connected to headphone pin */
5091 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5092 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5093 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5094 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5095 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5096 /* Ensure all other unused pins are disabled and muted. */
5097 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5098 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5099 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5100 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5101 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5102 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5103 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5104 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5106 /* Disable digital (SPDIF) pins */
5107 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5108 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5110 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5111 * when acting as an output.
5113 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5115 /* Start with output sum widgets muted and their output gains at min */
5116 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5117 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5118 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5119 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5120 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5121 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5122 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5123 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5124 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5126 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5127 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5128 /* Unmute Line1 pin widget output buffer since it starts as an output.
5129 * If the pin mode is changed by the user the pin mode control will
5130 * take care of enabling the pin's input/output buffers as needed.
5131 * Therefore there's no need to enable the input buffer at this
5134 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5135 /* Unmute input buffer of pin widget used for Line-in (no equiv
5138 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5140 /* Mute capture amp left and right */
5141 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5142 /* Set ADC connection select to match default mixer setting - line
5145 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5147 /* Do the same for the second ADC: mute capture input amp and
5148 * set ADC connection to line in (on mic1 pin)
5150 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5151 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5153 /* Mute all inputs to mixer widget (even unconnected ones) */
5154 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5155 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5156 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5158 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5159 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5161 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5166 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5167 * similar laptops (adapted from Fujitsu init verbs).
5169 static struct hda_verb alc260_acer_init_verbs[] = {
5170 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5171 * the headphone jack. Turn this on and rely on the standard mute
5172 * methods whenever the user wants to turn these outputs off.
5174 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5175 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5176 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5177 /* Internal speaker/Headphone jack is connected to Line-out pin */
5178 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5179 /* Internal microphone/Mic jack is connected to Mic1 pin */
5180 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5181 /* Line In jack is connected to Line1 pin */
5182 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5183 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5184 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5185 /* Ensure all other unused pins are disabled and muted. */
5186 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5187 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5188 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5189 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5190 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5191 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5192 /* Disable digital (SPDIF) pins */
5193 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5194 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5196 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5197 * bus when acting as outputs.
5199 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5200 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5202 /* Start with output sum widgets muted and their output gains at min */
5203 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5204 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5205 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5206 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5207 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5208 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5209 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5210 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5211 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5213 /* Unmute Line-out pin widget amp left and right
5214 * (no equiv mixer ctrl)
5216 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5217 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5218 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5219 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5220 * inputs. If the pin mode is changed by the user the pin mode control
5221 * will take care of enabling the pin's input/output buffers as needed.
5222 * Therefore there's no need to enable the input buffer at this
5225 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5226 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5228 /* Mute capture amp left and right */
5229 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5230 /* Set ADC connection select to match default mixer setting - mic
5233 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5235 /* Do similar with the second ADC: mute capture input amp and
5236 * set ADC connection to mic to match ALSA's default state.
5238 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5239 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5241 /* Mute all inputs to mixer widget (even unconnected ones) */
5242 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5243 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5244 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5245 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5246 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5247 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5248 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5249 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5254 /* Initialisation sequence for Maxdata Favorit 100XS
5255 * (adapted from Acer init verbs).
5257 static struct hda_verb alc260_favorit100_init_verbs[] = {
5258 /* GPIO 0 enables the output jack.
5259 * Turn this on and rely on the standard mute
5260 * methods whenever the user wants to turn these outputs off.
5262 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5263 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5264 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5265 /* Line/Mic input jack is connected to Mic1 pin */
5266 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5267 /* Ensure all other unused pins are disabled and muted. */
5268 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5269 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5270 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5271 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5272 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5273 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5274 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5275 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5276 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5277 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5278 /* Disable digital (SPDIF) pins */
5279 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5280 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5282 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5283 * bus when acting as outputs.
5285 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5286 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5288 /* Start with output sum widgets muted and their output gains at min */
5289 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5290 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5291 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5292 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5293 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5294 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5295 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5296 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5297 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5299 /* Unmute Line-out pin widget amp left and right
5300 * (no equiv mixer ctrl)
5302 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5303 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5304 * inputs. If the pin mode is changed by the user the pin mode control
5305 * will take care of enabling the pin's input/output buffers as needed.
5306 * Therefore there's no need to enable the input buffer at this
5309 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5311 /* Mute capture amp left and right */
5312 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5313 /* Set ADC connection select to match default mixer setting - mic
5316 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5318 /* Do similar with the second ADC: mute capture input amp and
5319 * set ADC connection to mic to match ALSA's default state.
5321 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5322 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5324 /* Mute all inputs to mixer widget (even unconnected ones) */
5325 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5326 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5327 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5330 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5337 static struct hda_verb alc260_will_verbs[] = {
5338 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5339 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5340 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5341 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5342 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5343 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5347 static struct hda_verb alc260_replacer_672v_verbs[] = {
5348 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5349 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5350 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5352 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5353 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5354 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5356 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5360 /* toggle speaker-output according to the hp-jack state */
5361 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5363 unsigned int present;
5365 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5366 present = snd_hda_codec_read(codec, 0x0f, 0,
5367 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5369 snd_hda_codec_write_cache(codec, 0x01, 0,
5370 AC_VERB_SET_GPIO_DATA, 1);
5371 snd_hda_codec_write_cache(codec, 0x0f, 0,
5372 AC_VERB_SET_PIN_WIDGET_CONTROL,
5375 snd_hda_codec_write_cache(codec, 0x01, 0,
5376 AC_VERB_SET_GPIO_DATA, 0);
5377 snd_hda_codec_write_cache(codec, 0x0f, 0,
5378 AC_VERB_SET_PIN_WIDGET_CONTROL,
5383 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5386 if ((res >> 26) == ALC880_HP_EVENT)
5387 alc260_replacer_672v_automute(codec);
5390 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5391 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5392 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5393 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5394 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5395 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5396 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5397 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5398 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5399 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5400 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5404 /* Test configuration for debugging, modelled after the ALC880 test
5407 #ifdef CONFIG_SND_DEBUG
5408 static hda_nid_t alc260_test_dac_nids[1] = {
5411 static hda_nid_t alc260_test_adc_nids[2] = {
5414 /* For testing the ALC260, each input MUX needs its own definition since
5415 * the signal assignments are different. This assumes that the first ADC
5418 static struct hda_input_mux alc260_test_capture_sources[2] = {
5422 { "MIC1 pin", 0x0 },
5423 { "MIC2 pin", 0x1 },
5424 { "LINE1 pin", 0x2 },
5425 { "LINE2 pin", 0x3 },
5427 { "LINE-OUT pin", 0x5 },
5428 { "HP-OUT pin", 0x6 },
5434 { "MIC1 pin", 0x0 },
5435 { "MIC2 pin", 0x1 },
5436 { "LINE1 pin", 0x2 },
5437 { "LINE2 pin", 0x3 },
5440 { "LINE-OUT pin", 0x6 },
5441 { "HP-OUT pin", 0x7 },
5445 static struct snd_kcontrol_new alc260_test_mixer[] = {
5446 /* Output driver widgets */
5447 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5448 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5449 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5450 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5451 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5452 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5454 /* Modes for retasking pin widgets
5455 * Note: the ALC260 doesn't seem to act on requests to enable mic
5456 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5457 * mention this restriction. At this stage it's not clear whether
5458 * this behaviour is intentional or is a hardware bug in chip
5459 * revisions available at least up until early 2006. Therefore for
5460 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5461 * choices, but if it turns out that the lack of mic bias for these
5462 * NIDs is intentional we could change their modes from
5463 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5465 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5466 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5467 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5468 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5469 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5470 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5472 /* Loopback mixer controls */
5473 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5474 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5475 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5476 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5477 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5478 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5479 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5480 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5481 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5482 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5483 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5484 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5485 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5486 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5488 /* Controls for GPIO pins, assuming they are configured as outputs */
5489 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5490 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5491 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5492 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5494 /* Switches to allow the digital IO pins to be enabled. The datasheet
5495 * is ambigious as to which NID is which; testing on laptops which
5496 * make this output available should provide clarification.
5498 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5499 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5501 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5502 * this output to turn on an external amplifier.
5504 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5505 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5509 static struct hda_verb alc260_test_init_verbs[] = {
5510 /* Enable all GPIOs as outputs with an initial value of 0 */
5511 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5512 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5513 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5515 /* Enable retasking pins as output, initially without power amp */
5516 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5517 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5518 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5519 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5520 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5521 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5523 /* Disable digital (SPDIF) pins initially, but users can enable
5524 * them via a mixer switch. In the case of SPDIF-out, this initverb
5525 * payload also sets the generation to 0, output to be in "consumer"
5526 * PCM format, copyright asserted, no pre-emphasis and no validity
5529 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5530 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5532 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5533 * OUT1 sum bus when acting as an output.
5535 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5536 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5537 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5538 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5540 /* Start with output sum widgets muted and their output gains at min */
5541 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5542 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5543 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5544 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5545 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5546 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5547 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5548 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5549 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5551 /* Unmute retasking pin widget output buffers since the default
5552 * state appears to be output. As the pin mode is changed by the
5553 * user the pin mode control will take care of enabling the pin's
5554 * input/output buffers as needed.
5556 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5557 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5558 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5559 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5560 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5561 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5562 /* Also unmute the mono-out pin widget */
5563 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5565 /* Mute capture amp left and right */
5566 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5567 /* Set ADC connection select to match default mixer setting (mic1
5570 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5572 /* Do the same for the second ADC: mute capture input amp and
5573 * set ADC connection to mic1 pin
5575 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5576 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5578 /* Mute all inputs to mixer widget (even unconnected ones) */
5579 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5582 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5583 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5584 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5585 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5586 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5592 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5593 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5595 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5596 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5599 * for BIOS auto-configuration
5602 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5603 const char *pfx, int *vol_bits)
5606 unsigned long vol_val, sw_val;
5610 if (nid >= 0x0f && nid < 0x11) {
5611 nid_vol = nid - 0x7;
5612 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5613 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5614 } else if (nid == 0x11) {
5615 nid_vol = nid - 0x7;
5616 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5617 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5618 } else if (nid >= 0x12 && nid <= 0x15) {
5620 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5621 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5625 if (!(*vol_bits & (1 << nid_vol))) {
5626 /* first control for the volume widget */
5627 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5628 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5631 *vol_bits |= (1 << nid_vol);
5633 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5634 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5640 /* add playback controls from the parsed DAC table */
5641 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5642 const struct auto_pin_cfg *cfg)
5648 spec->multiout.num_dacs = 1;
5649 spec->multiout.dac_nids = spec->private_dac_nids;
5650 spec->multiout.dac_nids[0] = 0x02;
5652 nid = cfg->line_out_pins[0];
5654 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5659 nid = cfg->speaker_pins[0];
5661 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5666 nid = cfg->hp_pins[0];
5668 err = alc260_add_playback_controls(spec, nid, "Headphone",
5676 /* create playback/capture controls for input pins */
5677 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5678 const struct auto_pin_cfg *cfg)
5680 struct hda_input_mux *imux = &spec->private_imux[0];
5683 for (i = 0; i < AUTO_PIN_LAST; i++) {
5684 if (cfg->input_pins[i] >= 0x12) {
5685 idx = cfg->input_pins[i] - 0x12;
5686 err = new_analog_input(spec, cfg->input_pins[i],
5687 auto_pin_cfg_labels[i], idx,
5691 imux->items[imux->num_items].label =
5692 auto_pin_cfg_labels[i];
5693 imux->items[imux->num_items].index = idx;
5696 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5697 idx = cfg->input_pins[i] - 0x09;
5698 err = new_analog_input(spec, cfg->input_pins[i],
5699 auto_pin_cfg_labels[i], idx,
5703 imux->items[imux->num_items].label =
5704 auto_pin_cfg_labels[i];
5705 imux->items[imux->num_items].index = idx;
5712 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5713 hda_nid_t nid, int pin_type,
5716 alc_set_pin_output(codec, nid, pin_type);
5717 /* need the manual connection? */
5719 int idx = nid - 0x12;
5720 snd_hda_codec_write(codec, idx + 0x0b, 0,
5721 AC_VERB_SET_CONNECT_SEL, sel_idx);
5725 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5727 struct alc_spec *spec = codec->spec;
5730 nid = spec->autocfg.line_out_pins[0];
5732 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5733 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5736 nid = spec->autocfg.speaker_pins[0];
5738 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5740 nid = spec->autocfg.hp_pins[0];
5742 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5745 #define ALC260_PIN_CD_NID 0x16
5746 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5748 struct alc_spec *spec = codec->spec;
5751 for (i = 0; i < AUTO_PIN_LAST; i++) {
5752 hda_nid_t nid = spec->autocfg.input_pins[i];
5754 alc_set_input_pin(codec, nid, i);
5755 if (nid != ALC260_PIN_CD_NID &&
5756 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5757 snd_hda_codec_write(codec, nid, 0,
5758 AC_VERB_SET_AMP_GAIN_MUTE,
5765 * generic initialization of ADC, input mixers and output mixers
5767 static struct hda_verb alc260_volume_init_verbs[] = {
5769 * Unmute ADC0-1 and set the default input to mic-in
5771 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5772 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5773 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5774 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5776 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5778 * Note: PASD motherboards uses the Line In 2 as the input for
5779 * front panel mic (mic 2)
5781 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5782 /* mute analog inputs */
5783 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5784 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5785 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5786 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5787 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5790 * Set up output mixers (0x08 - 0x0a)
5792 /* set vol=0 to output mixers */
5793 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5794 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5795 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5796 /* set up input amps for analog loopback */
5797 /* Amp Indices: DAC = 0, mixer = 1 */
5798 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5799 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5800 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5801 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5802 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5803 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5808 static int alc260_parse_auto_config(struct hda_codec *codec)
5810 struct alc_spec *spec = codec->spec;
5812 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5814 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5818 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5821 if (!spec->kctls.list)
5822 return 0; /* can't find valid BIOS pin config */
5823 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5827 spec->multiout.max_channels = 2;
5829 if (spec->autocfg.dig_outs)
5830 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5831 if (spec->kctls.list)
5832 add_mixer(spec, spec->kctls.list);
5834 add_verb(spec, alc260_volume_init_verbs);
5836 spec->num_mux_defs = 1;
5837 spec->input_mux = &spec->private_imux[0];
5839 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
5844 /* additional initialization for auto-configuration model */
5845 static void alc260_auto_init(struct hda_codec *codec)
5847 struct alc_spec *spec = codec->spec;
5848 alc260_auto_init_multi_out(codec);
5849 alc260_auto_init_analog_input(codec);
5850 if (spec->unsol_event)
5851 alc_inithook(codec);
5854 #ifdef CONFIG_SND_HDA_POWER_SAVE
5855 static struct hda_amp_list alc260_loopbacks[] = {
5856 { 0x07, HDA_INPUT, 0 },
5857 { 0x07, HDA_INPUT, 1 },
5858 { 0x07, HDA_INPUT, 2 },
5859 { 0x07, HDA_INPUT, 3 },
5860 { 0x07, HDA_INPUT, 4 },
5866 * ALC260 configurations
5868 static const char *alc260_models[ALC260_MODEL_LAST] = {
5869 [ALC260_BASIC] = "basic",
5871 [ALC260_HP_3013] = "hp-3013",
5872 [ALC260_HP_DC7600] = "hp-dc7600",
5873 [ALC260_FUJITSU_S702X] = "fujitsu",
5874 [ALC260_ACER] = "acer",
5875 [ALC260_WILL] = "will",
5876 [ALC260_REPLACER_672V] = "replacer",
5877 [ALC260_FAVORIT100] = "favorit100",
5878 #ifdef CONFIG_SND_DEBUG
5879 [ALC260_TEST] = "test",
5881 [ALC260_AUTO] = "auto",
5884 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5885 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5886 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5887 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
5888 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5889 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5890 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5891 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5892 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5893 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5894 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5895 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5896 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5897 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5898 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5899 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5900 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5901 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5902 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5903 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5907 static struct alc_config_preset alc260_presets[] = {
5909 .mixers = { alc260_base_output_mixer,
5910 alc260_input_mixer },
5911 .init_verbs = { alc260_init_verbs },
5912 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5913 .dac_nids = alc260_dac_nids,
5914 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5915 .adc_nids = alc260_adc_nids,
5916 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5917 .channel_mode = alc260_modes,
5918 .input_mux = &alc260_capture_source,
5921 .mixers = { alc260_hp_output_mixer,
5922 alc260_input_mixer },
5923 .init_verbs = { alc260_init_verbs,
5924 alc260_hp_unsol_verbs },
5925 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5926 .dac_nids = alc260_dac_nids,
5927 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5928 .adc_nids = alc260_adc_nids_alt,
5929 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5930 .channel_mode = alc260_modes,
5931 .input_mux = &alc260_capture_source,
5932 .unsol_event = alc260_hp_unsol_event,
5933 .init_hook = alc260_hp_automute,
5935 [ALC260_HP_DC7600] = {
5936 .mixers = { alc260_hp_dc7600_mixer,
5937 alc260_input_mixer },
5938 .init_verbs = { alc260_init_verbs,
5939 alc260_hp_dc7600_verbs },
5940 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5941 .dac_nids = alc260_dac_nids,
5942 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5943 .adc_nids = alc260_adc_nids_alt,
5944 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5945 .channel_mode = alc260_modes,
5946 .input_mux = &alc260_capture_source,
5947 .unsol_event = alc260_hp_3012_unsol_event,
5948 .init_hook = alc260_hp_3012_automute,
5950 [ALC260_HP_3013] = {
5951 .mixers = { alc260_hp_3013_mixer,
5952 alc260_input_mixer },
5953 .init_verbs = { alc260_hp_3013_init_verbs,
5954 alc260_hp_3013_unsol_verbs },
5955 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5956 .dac_nids = alc260_dac_nids,
5957 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5958 .adc_nids = alc260_adc_nids_alt,
5959 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5960 .channel_mode = alc260_modes,
5961 .input_mux = &alc260_capture_source,
5962 .unsol_event = alc260_hp_3013_unsol_event,
5963 .init_hook = alc260_hp_3013_automute,
5965 [ALC260_FUJITSU_S702X] = {
5966 .mixers = { alc260_fujitsu_mixer },
5967 .init_verbs = { alc260_fujitsu_init_verbs },
5968 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5969 .dac_nids = alc260_dac_nids,
5970 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5971 .adc_nids = alc260_dual_adc_nids,
5972 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5973 .channel_mode = alc260_modes,
5974 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5975 .input_mux = alc260_fujitsu_capture_sources,
5978 .mixers = { alc260_acer_mixer },
5979 .init_verbs = { alc260_acer_init_verbs },
5980 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5981 .dac_nids = alc260_dac_nids,
5982 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5983 .adc_nids = alc260_dual_adc_nids,
5984 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5985 .channel_mode = alc260_modes,
5986 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5987 .input_mux = alc260_acer_capture_sources,
5989 [ALC260_FAVORIT100] = {
5990 .mixers = { alc260_favorit100_mixer },
5991 .init_verbs = { alc260_favorit100_init_verbs },
5992 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5993 .dac_nids = alc260_dac_nids,
5994 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5995 .adc_nids = alc260_dual_adc_nids,
5996 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5997 .channel_mode = alc260_modes,
5998 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
5999 .input_mux = alc260_favorit100_capture_sources,
6002 .mixers = { alc260_will_mixer },
6003 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6004 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6005 .dac_nids = alc260_dac_nids,
6006 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6007 .adc_nids = alc260_adc_nids,
6008 .dig_out_nid = ALC260_DIGOUT_NID,
6009 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6010 .channel_mode = alc260_modes,
6011 .input_mux = &alc260_capture_source,
6013 [ALC260_REPLACER_672V] = {
6014 .mixers = { alc260_replacer_672v_mixer },
6015 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6016 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6017 .dac_nids = alc260_dac_nids,
6018 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6019 .adc_nids = alc260_adc_nids,
6020 .dig_out_nid = ALC260_DIGOUT_NID,
6021 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6022 .channel_mode = alc260_modes,
6023 .input_mux = &alc260_capture_source,
6024 .unsol_event = alc260_replacer_672v_unsol_event,
6025 .init_hook = alc260_replacer_672v_automute,
6027 #ifdef CONFIG_SND_DEBUG
6029 .mixers = { alc260_test_mixer },
6030 .init_verbs = { alc260_test_init_verbs },
6031 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6032 .dac_nids = alc260_test_dac_nids,
6033 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6034 .adc_nids = alc260_test_adc_nids,
6035 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6036 .channel_mode = alc260_modes,
6037 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6038 .input_mux = alc260_test_capture_sources,
6043 static int patch_alc260(struct hda_codec *codec)
6045 struct alc_spec *spec;
6046 int err, board_config;
6048 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6054 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6057 if (board_config < 0) {
6058 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
6059 "trying auto-probe from BIOS...\n");
6060 board_config = ALC260_AUTO;
6063 if (board_config == ALC260_AUTO) {
6064 /* automatic parse from the BIOS config */
6065 err = alc260_parse_auto_config(codec);
6071 "hda_codec: Cannot set up configuration "
6072 "from BIOS. Using base mode...\n");
6073 board_config = ALC260_BASIC;
6077 err = snd_hda_attach_beep_device(codec, 0x1);
6083 if (board_config != ALC260_AUTO)
6084 setup_preset(spec, &alc260_presets[board_config]);
6086 spec->stream_name_analog = "ALC260 Analog";
6087 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6088 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6090 spec->stream_name_digital = "ALC260 Digital";
6091 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6092 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6094 if (!spec->adc_nids && spec->input_mux) {
6095 /* check whether NID 0x04 is valid */
6096 unsigned int wcap = get_wcaps(codec, 0x04);
6097 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6099 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6100 spec->adc_nids = alc260_adc_nids_alt;
6101 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6103 spec->adc_nids = alc260_adc_nids;
6104 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6107 set_capture_mixer(spec);
6108 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6110 spec->vmaster_nid = 0x08;
6112 codec->patch_ops = alc_patch_ops;
6113 if (board_config == ALC260_AUTO)
6114 spec->init_hook = alc260_auto_init;
6115 #ifdef CONFIG_SND_HDA_POWER_SAVE
6116 if (!spec->loopback.amplist)
6117 spec->loopback.amplist = alc260_loopbacks;
6119 codec->proc_widget_hook = print_realtek_coef;
6128 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6129 * configuration. Each pin widget can choose any input DACs and a mixer.
6130 * Each ADC is connected from a mixer of all inputs. This makes possible
6131 * 6-channel independent captures.
6133 * In addition, an independent DAC for the multi-playback (not used in this
6136 #define ALC882_DIGOUT_NID 0x06
6137 #define ALC882_DIGIN_NID 0x0a
6139 static struct hda_channel_mode alc882_ch_modes[1] = {
6143 static hda_nid_t alc882_dac_nids[4] = {
6144 /* front, rear, clfe, rear_surr */
6145 0x02, 0x03, 0x04, 0x05
6148 /* identical with ALC880 */
6149 #define alc882_adc_nids alc880_adc_nids
6150 #define alc882_adc_nids_alt alc880_adc_nids_alt
6152 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6153 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6156 /* FIXME: should be a matrix-type input source selection */
6158 static struct hda_input_mux alc882_capture_source = {
6162 { "Front Mic", 0x1 },
6170 static struct hda_verb alc882_3ST_ch2_init[] = {
6171 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6172 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6173 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6174 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6181 static struct hda_verb alc882_3ST_ch6_init[] = {
6182 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6183 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6184 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6185 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6186 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6187 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6191 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6192 { 2, alc882_3ST_ch2_init },
6193 { 6, alc882_3ST_ch6_init },
6199 static struct hda_verb alc882_sixstack_ch6_init[] = {
6200 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6201 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6202 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6203 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6210 static struct hda_verb alc882_sixstack_ch8_init[] = {
6211 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6212 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6213 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6214 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6218 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6219 { 6, alc882_sixstack_ch6_init },
6220 { 8, alc882_sixstack_ch8_init },
6224 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6230 static struct hda_verb alc885_mbp_ch2_init[] = {
6231 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6232 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6233 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6240 static struct hda_verb alc885_mbp_ch6_init[] = {
6241 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6242 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6243 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6244 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6245 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6249 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6250 { 2, alc885_mbp_ch2_init },
6251 { 6, alc885_mbp_ch6_init },
6255 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6256 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6258 static struct snd_kcontrol_new alc882_base_mixer[] = {
6259 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6260 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6261 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6262 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6263 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6264 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6265 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6266 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6267 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6268 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6269 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6270 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6271 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6272 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6273 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6274 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6275 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6276 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6277 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6278 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6279 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6283 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6284 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6285 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6286 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6287 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6288 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6289 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6290 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6291 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6292 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6293 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6296 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6297 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6298 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6299 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6300 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6301 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6302 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6303 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6304 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6305 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6309 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6310 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6311 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6312 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6313 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6314 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6315 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6316 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6317 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6318 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6319 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6320 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6321 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6322 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6326 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6327 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6329 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6330 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6331 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6332 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6333 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6334 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6335 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6336 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6337 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6338 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6339 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6340 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6341 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6342 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6346 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6347 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6348 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6349 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6350 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6351 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6352 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6353 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6354 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6355 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6356 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6360 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6362 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6363 .name = "Channel Mode",
6364 .info = alc_ch_mode_info,
6365 .get = alc_ch_mode_get,
6366 .put = alc_ch_mode_put,
6371 static struct hda_verb alc882_init_verbs[] = {
6372 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6374 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6375 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6377 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6378 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6379 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6381 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6382 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6383 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6385 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6386 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6387 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6389 /* Front Pin: output 0 (0x0c) */
6390 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6391 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6392 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6393 /* Rear Pin: output 1 (0x0d) */
6394 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6395 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6396 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6397 /* CLFE Pin: output 2 (0x0e) */
6398 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6399 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6400 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6401 /* Side Pin: output 3 (0x0f) */
6402 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6403 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6404 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6405 /* Mic (rear) pin: input vref at 80% */
6406 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6407 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6408 /* Front Mic pin: input vref at 80% */
6409 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6410 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6411 /* Line In pin: input */
6412 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6413 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6414 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6415 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6416 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6417 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6418 /* CD pin widget for input */
6419 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6421 /* FIXME: use matrix-type input source selection */
6422 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6423 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6424 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6425 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6426 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6427 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6429 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6430 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6431 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6432 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6434 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6435 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6436 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6437 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6438 /* ADC1: mute amp left and right */
6439 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6440 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6441 /* ADC2: mute amp left and right */
6442 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6443 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6444 /* ADC3: mute amp left and right */
6445 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6446 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6451 static struct hda_verb alc882_eapd_verbs[] = {
6452 /* change to EAPD mode */
6453 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6454 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6459 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6460 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6461 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6462 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6463 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6464 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6465 /* FIXME: this looks suspicious...
6466 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6467 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6472 static struct hda_verb alc882_macpro_init_verbs[] = {
6473 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6476 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6477 /* Front Pin: output 0 (0x0c) */
6478 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6479 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6480 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6481 /* Front Mic pin: input vref at 80% */
6482 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6483 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6484 /* Speaker: output */
6485 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6486 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6487 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6488 /* Headphone output (output 0 - 0x0c) */
6489 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6490 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6491 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6493 /* FIXME: use matrix-type input source selection */
6494 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6495 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6496 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6497 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6498 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6499 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6501 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6502 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6503 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6504 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6506 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6507 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6508 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6509 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6510 /* ADC1: mute amp left and right */
6511 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6512 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6513 /* ADC2: mute amp left and right */
6514 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6515 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6516 /* ADC3: mute amp left and right */
6517 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6518 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6523 /* Macbook Pro rev3 */
6524 static struct hda_verb alc885_mbp3_init_verbs[] = {
6525 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6527 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6530 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6531 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6532 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6533 /* Front Pin: output 0 (0x0c) */
6534 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6535 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6536 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6537 /* HP Pin: output 0 (0x0d) */
6538 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6539 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6540 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6541 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6542 /* Mic (rear) pin: input vref at 80% */
6543 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6544 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6545 /* Front Mic pin: input vref at 80% */
6546 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6547 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6548 /* Line In pin: use output 1 when in LineOut mode */
6549 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6550 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6551 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6553 /* FIXME: use matrix-type input source selection */
6554 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6555 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6556 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6557 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6558 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6559 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6561 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6562 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6563 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6566 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6567 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6568 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6570 /* ADC1: mute amp left and right */
6571 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6572 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6573 /* ADC2: mute amp left and right */
6574 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6575 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6576 /* ADC3: mute amp left and right */
6577 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6578 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6583 /* iMac 24 mixer. */
6584 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6585 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6586 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6590 /* iMac 24 init verbs. */
6591 static struct hda_verb alc885_imac24_init_verbs[] = {
6592 /* Internal speakers: output 0 (0x0c) */
6593 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6594 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6595 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6596 /* Internal speakers: output 0 (0x0c) */
6597 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6598 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6599 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6600 /* Headphone: output 0 (0x0c) */
6601 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6602 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6603 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6604 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6605 /* Front Mic: input vref at 80% */
6606 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6607 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6611 /* Toggle speaker-output according to the hp-jack state */
6612 static void alc885_imac24_automute(struct hda_codec *codec)
6614 unsigned int present;
6616 present = snd_hda_codec_read(codec, 0x14, 0,
6617 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6618 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6619 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6620 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6621 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6624 /* Processes unsolicited events. */
6625 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6628 /* Headphone insertion or removal. */
6629 if ((res >> 26) == ALC880_HP_EVENT)
6630 alc885_imac24_automute(codec);
6633 static void alc885_mbp3_automute(struct hda_codec *codec)
6635 unsigned int present;
6637 present = snd_hda_codec_read(codec, 0x15, 0,
6638 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6639 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6640 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6641 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6642 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6645 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6648 /* Headphone insertion or removal. */
6649 if ((res >> 26) == ALC880_HP_EVENT)
6650 alc885_mbp3_automute(codec);
6654 static struct hda_verb alc882_targa_verbs[] = {
6655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6658 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6659 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6661 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6662 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6663 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6665 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6666 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6667 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6668 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6672 /* toggle speaker-output according to the hp-jack state */
6673 static void alc882_targa_automute(struct hda_codec *codec)
6675 unsigned int present;
6677 present = snd_hda_codec_read(codec, 0x14, 0,
6678 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6679 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6680 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6681 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6685 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6687 /* Looks like the unsol event is incompatible with the standard
6688 * definition. 4bit tag is placed at 26 bit!
6690 if (((res >> 26) == ALC880_HP_EVENT)) {
6691 alc882_targa_automute(codec);
6695 static struct hda_verb alc882_asus_a7j_verbs[] = {
6696 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6697 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6699 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6700 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6701 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6703 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6704 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6705 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6707 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6708 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6709 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6713 static struct hda_verb alc882_asus_a7m_verbs[] = {
6714 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6715 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6717 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6718 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6719 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6721 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6722 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6723 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6725 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6726 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6727 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6731 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6733 unsigned int gpiostate, gpiomask, gpiodir;
6735 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6736 AC_VERB_GET_GPIO_DATA, 0);
6739 gpiostate |= (1 << pin);
6741 gpiostate &= ~(1 << pin);
6743 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6744 AC_VERB_GET_GPIO_MASK, 0);
6745 gpiomask |= (1 << pin);
6747 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6748 AC_VERB_GET_GPIO_DIRECTION, 0);
6749 gpiodir |= (1 << pin);
6752 snd_hda_codec_write(codec, codec->afg, 0,
6753 AC_VERB_SET_GPIO_MASK, gpiomask);
6754 snd_hda_codec_write(codec, codec->afg, 0,
6755 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6759 snd_hda_codec_write(codec, codec->afg, 0,
6760 AC_VERB_SET_GPIO_DATA, gpiostate);
6763 /* set up GPIO at initialization */
6764 static void alc885_macpro_init_hook(struct hda_codec *codec)
6766 alc882_gpio_mute(codec, 0, 0);
6767 alc882_gpio_mute(codec, 1, 0);
6770 /* set up GPIO and update auto-muting at initialization */
6771 static void alc885_imac24_init_hook(struct hda_codec *codec)
6773 alc885_macpro_init_hook(codec);
6774 alc885_imac24_automute(codec);
6778 * generic initialization of ADC, input mixers and output mixers
6780 static struct hda_verb alc882_auto_init_verbs[] = {
6782 * Unmute ADC0-2 and set the default input to mic-in
6784 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6785 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6786 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6787 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6788 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6789 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6791 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6793 * Note: PASD motherboards uses the Line In 2 as the input for
6794 * front panel mic (mic 2)
6796 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6797 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6798 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6799 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6800 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6801 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6804 * Set up output mixers (0x0c - 0x0f)
6806 /* set vol=0 to output mixers */
6807 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6809 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6810 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6811 /* set up input amps for analog loopback */
6812 /* Amp Indices: DAC = 0, mixer = 1 */
6813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6814 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6815 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6816 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6817 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6818 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6819 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6820 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6821 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6822 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6824 /* FIXME: use matrix-type input source selection */
6825 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6826 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6827 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6828 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6829 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6830 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6832 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6833 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6834 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6835 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6837 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6838 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6839 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6840 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6845 #ifdef CONFIG_SND_HDA_POWER_SAVE
6846 #define alc882_loopbacks alc880_loopbacks
6849 /* pcm configuration: identiacal with ALC880 */
6850 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6851 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6852 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6853 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6856 * configuration and preset
6858 static const char *alc882_models[ALC882_MODEL_LAST] = {
6859 [ALC882_3ST_DIG] = "3stack-dig",
6860 [ALC882_6ST_DIG] = "6stack-dig",
6861 [ALC882_ARIMA] = "arima",
6862 [ALC882_W2JC] = "w2jc",
6863 [ALC882_TARGA] = "targa",
6864 [ALC882_ASUS_A7J] = "asus-a7j",
6865 [ALC882_ASUS_A7M] = "asus-a7m",
6866 [ALC885_MACPRO] = "macpro",
6867 [ALC885_MBP3] = "mbp3",
6868 [ALC885_IMAC24] = "imac24",
6869 [ALC882_AUTO] = "auto",
6872 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6873 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6874 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6875 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6876 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6877 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6878 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6879 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6880 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6881 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6882 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6883 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6884 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6888 static struct alc_config_preset alc882_presets[] = {
6889 [ALC882_3ST_DIG] = {
6890 .mixers = { alc882_base_mixer },
6891 .init_verbs = { alc882_init_verbs },
6892 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6893 .dac_nids = alc882_dac_nids,
6894 .dig_out_nid = ALC882_DIGOUT_NID,
6895 .dig_in_nid = ALC882_DIGIN_NID,
6896 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6897 .channel_mode = alc882_ch_modes,
6899 .input_mux = &alc882_capture_source,
6901 [ALC882_6ST_DIG] = {
6902 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6903 .init_verbs = { alc882_init_verbs },
6904 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6905 .dac_nids = alc882_dac_nids,
6906 .dig_out_nid = ALC882_DIGOUT_NID,
6907 .dig_in_nid = ALC882_DIGIN_NID,
6908 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6909 .channel_mode = alc882_sixstack_modes,
6910 .input_mux = &alc882_capture_source,
6913 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6914 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6915 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6916 .dac_nids = alc882_dac_nids,
6917 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6918 .channel_mode = alc882_sixstack_modes,
6919 .input_mux = &alc882_capture_source,
6922 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6923 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6924 alc880_gpio1_init_verbs },
6925 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6926 .dac_nids = alc882_dac_nids,
6927 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6928 .channel_mode = alc880_threestack_modes,
6930 .input_mux = &alc882_capture_source,
6931 .dig_out_nid = ALC882_DIGOUT_NID,
6934 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6935 .init_verbs = { alc885_mbp3_init_verbs,
6936 alc880_gpio1_init_verbs },
6937 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6938 .dac_nids = alc882_dac_nids,
6939 .channel_mode = alc885_mbp_6ch_modes,
6940 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6941 .input_mux = &alc882_capture_source,
6942 .dig_out_nid = ALC882_DIGOUT_NID,
6943 .dig_in_nid = ALC882_DIGIN_NID,
6944 .unsol_event = alc885_mbp3_unsol_event,
6945 .init_hook = alc885_mbp3_automute,
6948 .mixers = { alc882_macpro_mixer },
6949 .init_verbs = { alc882_macpro_init_verbs },
6950 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6951 .dac_nids = alc882_dac_nids,
6952 .dig_out_nid = ALC882_DIGOUT_NID,
6953 .dig_in_nid = ALC882_DIGIN_NID,
6954 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6955 .channel_mode = alc882_ch_modes,
6956 .input_mux = &alc882_capture_source,
6957 .init_hook = alc885_macpro_init_hook,
6960 .mixers = { alc885_imac24_mixer },
6961 .init_verbs = { alc885_imac24_init_verbs },
6962 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6963 .dac_nids = alc882_dac_nids,
6964 .dig_out_nid = ALC882_DIGOUT_NID,
6965 .dig_in_nid = ALC882_DIGIN_NID,
6966 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6967 .channel_mode = alc882_ch_modes,
6968 .input_mux = &alc882_capture_source,
6969 .unsol_event = alc885_imac24_unsol_event,
6970 .init_hook = alc885_imac24_init_hook,
6973 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6974 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6975 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6976 .dac_nids = alc882_dac_nids,
6977 .dig_out_nid = ALC882_DIGOUT_NID,
6978 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6979 .adc_nids = alc882_adc_nids,
6980 .capsrc_nids = alc882_capsrc_nids,
6981 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6982 .channel_mode = alc882_3ST_6ch_modes,
6984 .input_mux = &alc882_capture_source,
6985 .unsol_event = alc882_targa_unsol_event,
6986 .init_hook = alc882_targa_automute,
6988 [ALC882_ASUS_A7J] = {
6989 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6990 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6991 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6992 .dac_nids = alc882_dac_nids,
6993 .dig_out_nid = ALC882_DIGOUT_NID,
6994 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6995 .adc_nids = alc882_adc_nids,
6996 .capsrc_nids = alc882_capsrc_nids,
6997 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6998 .channel_mode = alc882_3ST_6ch_modes,
7000 .input_mux = &alc882_capture_source,
7002 [ALC882_ASUS_A7M] = {
7003 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
7004 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
7005 alc880_gpio1_init_verbs,
7006 alc882_asus_a7m_verbs },
7007 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7008 .dac_nids = alc882_dac_nids,
7009 .dig_out_nid = ALC882_DIGOUT_NID,
7010 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
7011 .channel_mode = alc880_threestack_modes,
7013 .input_mux = &alc882_capture_source,
7022 PINFIX_ABIT_AW9D_MAX
7025 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
7026 { 0x15, 0x01080104 }, /* side */
7027 { 0x16, 0x01011012 }, /* rear */
7028 { 0x17, 0x01016011 }, /* clfe */
7032 static const struct alc_pincfg *alc882_pin_fixes[] = {
7033 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
7036 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
7037 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
7042 * BIOS auto configuration
7044 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
7045 hda_nid_t nid, int pin_type,
7049 struct alc_spec *spec = codec->spec;
7052 alc_set_pin_output(codec, nid, pin_type);
7053 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7056 idx = spec->multiout.dac_nids[dac_idx] - 2;
7057 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7061 static void alc882_auto_init_multi_out(struct hda_codec *codec)
7063 struct alc_spec *spec = codec->spec;
7066 for (i = 0; i <= HDA_SIDE; i++) {
7067 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7068 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7070 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
7075 static void alc882_auto_init_hp_out(struct hda_codec *codec)
7077 struct alc_spec *spec = codec->spec;
7080 pin = spec->autocfg.hp_pins[0];
7081 if (pin) /* connect to front */
7083 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7084 pin = spec->autocfg.speaker_pins[0];
7086 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7089 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7090 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7092 static void alc882_auto_init_analog_input(struct hda_codec *codec)
7094 struct alc_spec *spec = codec->spec;
7097 for (i = 0; i < AUTO_PIN_LAST; i++) {
7098 hda_nid_t nid = spec->autocfg.input_pins[i];
7101 alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/);
7102 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
7103 snd_hda_codec_write(codec, nid, 0,
7104 AC_VERB_SET_AMP_GAIN_MUTE,
7109 static void alc882_auto_init_input_src(struct hda_codec *codec)
7111 struct alc_spec *spec = codec->spec;
7114 for (c = 0; c < spec->num_adc_nids; c++) {
7115 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
7116 hda_nid_t nid = spec->capsrc_nids[c];
7117 unsigned int mux_idx;
7118 const struct hda_input_mux *imux;
7119 int conns, mute, idx, item;
7121 conns = snd_hda_get_connections(codec, nid, conn_list,
7122 ARRAY_SIZE(conn_list));
7125 mux_idx = c >= spec->num_mux_defs ? 0 : c;
7126 imux = &spec->input_mux[mux_idx];
7127 for (idx = 0; idx < conns; idx++) {
7128 /* if the current connection is the selected one,
7129 * unmute it as default - otherwise mute it
7131 mute = AMP_IN_MUTE(idx);
7132 for (item = 0; item < imux->num_items; item++) {
7133 if (imux->items[item].index == idx) {
7134 if (spec->cur_mux[c] == item)
7135 mute = AMP_IN_UNMUTE(idx);
7139 /* check if we have a selector or mixer
7140 * we could check for the widget type instead, but
7141 * just check for Amp-In presence (in case of mixer
7142 * without amp-in there is something wrong, this
7143 * function shouldn't be used or capsrc nid is wrong)
7145 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
7146 snd_hda_codec_write(codec, nid, 0,
7147 AC_VERB_SET_AMP_GAIN_MUTE,
7149 else if (mute != AMP_IN_MUTE(idx))
7150 snd_hda_codec_write(codec, nid, 0,
7151 AC_VERB_SET_CONNECT_SEL,
7157 /* add mic boosts if needed */
7158 static int alc_auto_add_mic_boost(struct hda_codec *codec)
7160 struct alc_spec *spec = codec->spec;
7164 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7165 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7166 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7168 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7172 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7173 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7174 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7176 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7183 /* almost identical with ALC880 parser... */
7184 static int alc882_parse_auto_config(struct hda_codec *codec)
7186 struct alc_spec *spec = codec->spec;
7187 int err = alc880_parse_auto_config(codec);
7192 return 0; /* no config found */
7194 err = alc_auto_add_mic_boost(codec);
7198 /* hack - override the init verbs */
7199 spec->init_verbs[0] = alc882_auto_init_verbs;
7201 return 1; /* config found */
7204 /* additional initialization for auto-configuration model */
7205 static void alc882_auto_init(struct hda_codec *codec)
7207 struct alc_spec *spec = codec->spec;
7208 alc882_auto_init_multi_out(codec);
7209 alc882_auto_init_hp_out(codec);
7210 alc882_auto_init_analog_input(codec);
7211 alc882_auto_init_input_src(codec);
7212 if (spec->unsol_event)
7213 alc_inithook(codec);
7216 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7218 static int patch_alc882(struct hda_codec *codec)
7220 struct alc_spec *spec;
7221 int err, board_config;
7223 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7229 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7233 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7234 /* Pick up systems that don't supply PCI SSID */
7235 switch (codec->subsystem_id) {
7236 case 0x106b0c00: /* Mac Pro */
7237 board_config = ALC885_MACPRO;
7239 case 0x106b1000: /* iMac 24 */
7240 case 0x106b2800: /* AppleTV */
7241 case 0x106b3e00: /* iMac 24 Aluminium */
7242 board_config = ALC885_IMAC24;
7244 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7245 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7246 case 0x106b00a4: /* MacbookPro4,1 */
7247 case 0x106b2c00: /* Macbook Pro rev3 */
7248 case 0x106b3600: /* Macbook 3.1 */
7249 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7250 board_config = ALC885_MBP3;
7253 /* ALC889A is handled better as ALC888-compatible */
7254 if (codec->revision_id == 0x100101 ||
7255 codec->revision_id == 0x100103) {
7257 return patch_alc883(codec);
7259 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7260 "trying auto-probe from BIOS...\n");
7261 board_config = ALC882_AUTO;
7265 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7267 if (board_config == ALC882_AUTO) {
7268 /* automatic parse from the BIOS config */
7269 err = alc882_parse_auto_config(codec);
7275 "hda_codec: Cannot set up configuration "
7276 "from BIOS. Using base mode...\n");
7277 board_config = ALC882_3ST_DIG;
7281 err = snd_hda_attach_beep_device(codec, 0x1);
7287 if (board_config != ALC882_AUTO)
7288 setup_preset(spec, &alc882_presets[board_config]);
7290 if (codec->vendor_id == 0x10ec0885) {
7291 spec->stream_name_analog = "ALC885 Analog";
7292 spec->stream_name_digital = "ALC885 Digital";
7294 spec->stream_name_analog = "ALC882 Analog";
7295 spec->stream_name_digital = "ALC882 Digital";
7298 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7299 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7300 /* FIXME: setup DAC5 */
7301 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7302 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7304 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7305 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7307 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7308 if (!spec->adc_nids && spec->input_mux) {
7309 /* check whether NID 0x07 is valid */
7310 unsigned int wcap = get_wcaps(codec, 0x07);
7312 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7313 if (wcap != AC_WID_AUD_IN) {
7314 spec->adc_nids = alc882_adc_nids_alt;
7315 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7316 spec->capsrc_nids = alc882_capsrc_nids_alt;
7318 spec->adc_nids = alc882_adc_nids;
7319 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7320 spec->capsrc_nids = alc882_capsrc_nids;
7323 set_capture_mixer(spec);
7324 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7326 spec->vmaster_nid = 0x0c;
7328 codec->patch_ops = alc_patch_ops;
7329 if (board_config == ALC882_AUTO)
7330 spec->init_hook = alc882_auto_init;
7331 #ifdef CONFIG_SND_HDA_POWER_SAVE
7332 if (!spec->loopback.amplist)
7333 spec->loopback.amplist = alc882_loopbacks;
7335 codec->proc_widget_hook = print_realtek_coef;
7343 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7344 * configuration. Each pin widget can choose any input DACs and a mixer.
7345 * Each ADC is connected from a mixer of all inputs. This makes possible
7346 * 6-channel independent captures.
7348 * In addition, an independent DAC for the multi-playback (not used in this
7351 #define ALC883_DIGOUT_NID 0x06
7352 #define ALC883_DIGIN_NID 0x0a
7354 #define ALC1200_DIGOUT_NID 0x10
7356 static hda_nid_t alc883_dac_nids[4] = {
7357 /* front, rear, clfe, rear_surr */
7358 0x02, 0x03, 0x04, 0x05
7361 static hda_nid_t alc883_adc_nids[2] = {
7366 static hda_nid_t alc883_adc_nids_alt[1] = {
7371 static hda_nid_t alc883_adc_nids_rev[2] = {
7376 #define alc889_adc_nids alc880_adc_nids
7378 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7380 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7382 #define alc889_capsrc_nids alc882_capsrc_nids
7385 /* FIXME: should be a matrix-type input source selection */
7387 static struct hda_input_mux alc883_capture_source = {
7391 { "Front Mic", 0x1 },
7397 static struct hda_input_mux alc883_3stack_6ch_intel = {
7401 { "Front Mic", 0x0 },
7407 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7415 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7425 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7433 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7437 { "Front Mic", 0x1 },
7442 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7453 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7460 static struct hda_verb alc883_3ST_ch2_init[] = {
7461 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7462 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7463 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7464 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7471 static struct hda_verb alc883_3ST_ch4_init[] = {
7472 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7473 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7474 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7475 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7476 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7483 static struct hda_verb alc883_3ST_ch6_init[] = {
7484 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7485 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7486 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7487 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7488 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7489 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7493 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7494 { 2, alc883_3ST_ch2_init },
7495 { 4, alc883_3ST_ch4_init },
7496 { 6, alc883_3ST_ch6_init },
7502 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7503 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7504 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7505 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7506 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7513 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7514 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7515 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7516 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7517 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7518 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7525 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7526 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7527 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7528 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7529 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7530 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7531 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7535 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7536 { 2, alc883_3ST_ch2_intel_init },
7537 { 4, alc883_3ST_ch4_intel_init },
7538 { 6, alc883_3ST_ch6_intel_init },
7544 static struct hda_verb alc883_sixstack_ch6_init[] = {
7545 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7546 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7547 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7548 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7555 static struct hda_verb alc883_sixstack_ch8_init[] = {
7556 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7557 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7558 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7559 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7563 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7564 { 6, alc883_sixstack_ch6_init },
7565 { 8, alc883_sixstack_ch8_init },
7568 static struct hda_verb alc883_medion_eapd_verbs[] = {
7569 /* eanable EAPD on medion laptop */
7570 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7571 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7575 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7576 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7579 static struct snd_kcontrol_new alc883_base_mixer[] = {
7580 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7581 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7582 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7583 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7584 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7585 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7586 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7587 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7588 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7589 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7590 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7591 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7592 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7593 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7594 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7595 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7596 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7597 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7598 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7599 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7600 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7604 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7605 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7606 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7607 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7608 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7609 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7610 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7611 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7612 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7613 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7614 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7615 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7616 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7617 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7621 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7622 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7623 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7624 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7625 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7626 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7627 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7628 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7629 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7630 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7631 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7635 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7636 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7637 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7638 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7639 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7640 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7641 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7642 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7643 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7644 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7645 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7649 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7650 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7651 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7652 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7653 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7654 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7655 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7656 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7657 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7658 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7659 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7660 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7661 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7662 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7666 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7667 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7668 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7669 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7670 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7671 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7672 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7673 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7674 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7675 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7676 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7677 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7678 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7679 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7680 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7681 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7682 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7683 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7684 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7685 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7689 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7690 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7691 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7692 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7693 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7694 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7696 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7697 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7698 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7699 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7700 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7701 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7702 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7703 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7704 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7705 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7706 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7707 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7708 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7709 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7713 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7714 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7715 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7716 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7717 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7718 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7719 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7720 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7721 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7722 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7723 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7724 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7725 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7726 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7727 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7728 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7729 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7730 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7731 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7732 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7736 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7737 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7738 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7739 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7740 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7741 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7742 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7743 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7744 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7745 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
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, 0x0, HDA_INPUT),
7751 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7752 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7756 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7757 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7758 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7759 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7760 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7761 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7762 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7763 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7764 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7765 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7766 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7767 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7771 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7772 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7773 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7774 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7775 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7776 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7778 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7783 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7784 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7785 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7786 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7787 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7788 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7789 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7790 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7791 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7792 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7796 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7797 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7798 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7799 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7800 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7801 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7802 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7803 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7804 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7805 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7809 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7810 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7811 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7812 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7813 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7814 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7815 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7816 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7817 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7821 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7822 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7823 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7824 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7825 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7826 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7827 0x0d, 1, 0x0, HDA_OUTPUT),
7828 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7829 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7830 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7831 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7832 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7833 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7834 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7835 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7836 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7837 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7838 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7839 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7840 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7841 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7842 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7843 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7844 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7848 static struct hda_bind_ctls alc883_bind_cap_vol = {
7849 .ops = &snd_hda_bind_vol,
7851 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7852 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7857 static struct hda_bind_ctls alc883_bind_cap_switch = {
7858 .ops = &snd_hda_bind_sw,
7860 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7861 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7866 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7867 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7868 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7869 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7870 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7871 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7872 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7873 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7874 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7878 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7879 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7880 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7882 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7883 /* .name = "Capture Source", */
7884 .name = "Input Source",
7886 .info = alc_mux_enum_info,
7887 .get = alc_mux_enum_get,
7888 .put = alc_mux_enum_put,
7893 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7895 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7896 .name = "Channel Mode",
7897 .info = alc_ch_mode_info,
7898 .get = alc_ch_mode_get,
7899 .put = alc_ch_mode_put,
7904 static struct hda_verb alc883_init_verbs[] = {
7905 /* ADC1: mute amp left and right */
7906 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7907 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7908 /* ADC2: mute amp left and right */
7909 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7910 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7911 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7912 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7913 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7914 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7916 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7917 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7918 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7920 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7921 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7922 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7924 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7925 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7926 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7928 /* mute analog input loopbacks */
7929 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7930 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7932 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7935 /* Front Pin: output 0 (0x0c) */
7936 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7937 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7938 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7939 /* Rear Pin: output 1 (0x0d) */
7940 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7941 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7942 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7943 /* CLFE Pin: output 2 (0x0e) */
7944 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7945 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7946 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7947 /* Side Pin: output 3 (0x0f) */
7948 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7949 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7950 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7951 /* Mic (rear) pin: input vref at 80% */
7952 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7953 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7954 /* Front Mic pin: input vref at 80% */
7955 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7956 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7957 /* Line In pin: input */
7958 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7959 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7960 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7961 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7962 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7963 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7964 /* CD pin widget for input */
7965 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7967 /* FIXME: use matrix-type input source selection */
7968 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7970 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7971 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7972 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7973 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7975 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7976 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7977 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7978 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7982 /* toggle speaker-output according to the hp-jack state */
7983 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7985 unsigned int present;
7987 present = snd_hda_codec_read(codec, 0x15, 0,
7988 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7989 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7990 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7991 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7992 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7995 /* auto-toggle front mic */
7997 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7999 unsigned int present;
8002 present = snd_hda_codec_read(codec, 0x18, 0,
8003 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8004 bits = present ? HDA_AMP_MUTE : 0;
8005 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8009 static void alc883_mitac_automute(struct hda_codec *codec)
8011 alc883_mitac_hp_automute(codec);
8012 /* alc883_mitac_mic_automute(codec); */
8015 static void alc883_mitac_unsol_event(struct hda_codec *codec,
8018 switch (res >> 26) {
8019 case ALC880_HP_EVENT:
8020 alc883_mitac_hp_automute(codec);
8022 case ALC880_MIC_EVENT:
8023 /* alc883_mitac_mic_automute(codec); */
8028 static struct hda_verb alc883_mitac_verbs[] = {
8030 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8031 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8033 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8034 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8036 /* enable unsolicited event */
8037 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8038 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8043 static struct hda_verb alc883_clevo_m720_verbs[] = {
8045 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8046 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8048 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8049 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8051 /* enable unsolicited event */
8052 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8053 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8058 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8060 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8061 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8063 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8064 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8066 /* enable unsolicited event */
8067 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8072 static struct hda_verb alc883_tagra_verbs[] = {
8073 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8074 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8076 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8077 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8079 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8080 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8081 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8083 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8084 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
8085 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
8086 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
8091 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8092 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8093 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8094 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8098 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8099 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8100 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8101 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8102 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8106 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8107 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8108 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8109 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8110 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8111 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8115 static struct hda_verb alc883_haier_w66_verbs[] = {
8116 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8117 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8119 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8121 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8122 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8123 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8124 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8128 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8129 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8130 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8131 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8132 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8133 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8134 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8135 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8136 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8140 static struct hda_verb alc888_6st_dell_verbs[] = {
8141 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8145 static void alc888_3st_hp_front_automute(struct hda_codec *codec)
8147 unsigned int present, bits;
8149 present = snd_hda_codec_read(codec, 0x1b, 0,
8150 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8151 bits = present ? HDA_AMP_MUTE : 0;
8152 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8153 HDA_AMP_MUTE, bits);
8154 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8155 HDA_AMP_MUTE, bits);
8156 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
8157 HDA_AMP_MUTE, bits);
8160 static void alc888_3st_hp_unsol_event(struct hda_codec *codec,
8163 switch (res >> 26) {
8164 case ALC880_HP_EVENT:
8165 alc888_3st_hp_front_automute(codec);
8170 static struct hda_verb alc888_3st_hp_verbs[] = {
8171 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8172 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8173 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8174 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8181 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8182 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8183 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8184 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8185 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8192 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8193 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8194 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8195 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8196 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8197 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8204 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8205 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8206 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8207 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8208 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8209 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8210 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8214 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8215 { 2, alc888_3st_hp_2ch_init },
8216 { 4, alc888_3st_hp_4ch_init },
8217 { 6, alc888_3st_hp_6ch_init },
8220 /* toggle front-jack and RCA according to the hp-jack state */
8221 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8223 unsigned int present;
8225 present = snd_hda_codec_read(codec, 0x1b, 0,
8226 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8227 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8228 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8229 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8230 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8233 /* toggle RCA according to the front-jack state */
8234 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8236 unsigned int present;
8238 present = snd_hda_codec_read(codec, 0x14, 0,
8239 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8240 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8241 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8244 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8247 if ((res >> 26) == ALC880_HP_EVENT)
8248 alc888_lenovo_ms7195_front_automute(codec);
8249 if ((res >> 26) == ALC880_FRONT_EVENT)
8250 alc888_lenovo_ms7195_rca_automute(codec);
8253 static struct hda_verb alc883_medion_md2_verbs[] = {
8254 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8255 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8257 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8259 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8263 /* toggle speaker-output according to the hp-jack state */
8264 static void alc883_medion_md2_automute(struct hda_codec *codec)
8266 unsigned int present;
8268 present = snd_hda_codec_read(codec, 0x14, 0,
8269 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8270 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8271 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8274 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8277 if ((res >> 26) == ALC880_HP_EVENT)
8278 alc883_medion_md2_automute(codec);
8281 /* toggle speaker-output according to the hp-jack state */
8282 static void alc883_tagra_automute(struct hda_codec *codec)
8284 unsigned int present;
8287 present = snd_hda_codec_read(codec, 0x14, 0,
8288 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8289 bits = present ? HDA_AMP_MUTE : 0;
8290 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8291 HDA_AMP_MUTE, bits);
8292 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8296 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8298 if ((res >> 26) == ALC880_HP_EVENT)
8299 alc883_tagra_automute(codec);
8302 /* toggle speaker-output according to the hp-jack state */
8303 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8305 unsigned int present;
8308 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8309 & AC_PINSENSE_PRESENCE;
8310 bits = present ? HDA_AMP_MUTE : 0;
8311 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8312 HDA_AMP_MUTE, bits);
8315 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8317 unsigned int present;
8319 present = snd_hda_codec_read(codec, 0x18, 0,
8320 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8321 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8322 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8325 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8327 alc883_clevo_m720_hp_automute(codec);
8328 alc883_clevo_m720_mic_automute(codec);
8331 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8334 switch (res >> 26) {
8335 case ALC880_HP_EVENT:
8336 alc883_clevo_m720_hp_automute(codec);
8338 case ALC880_MIC_EVENT:
8339 alc883_clevo_m720_mic_automute(codec);
8344 /* toggle speaker-output according to the hp-jack state */
8345 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8347 unsigned int present;
8350 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8351 & AC_PINSENSE_PRESENCE;
8352 bits = present ? HDA_AMP_MUTE : 0;
8353 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8354 HDA_AMP_MUTE, bits);
8357 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8360 if ((res >> 26) == ALC880_HP_EVENT)
8361 alc883_2ch_fujitsu_pi2515_automute(codec);
8364 static void alc883_haier_w66_automute(struct hda_codec *codec)
8366 unsigned int present;
8369 present = snd_hda_codec_read(codec, 0x1b, 0,
8370 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8371 bits = present ? 0x80 : 0;
8372 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8376 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8379 if ((res >> 26) == ALC880_HP_EVENT)
8380 alc883_haier_w66_automute(codec);
8383 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8385 unsigned int present;
8388 present = snd_hda_codec_read(codec, 0x14, 0,
8389 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8390 bits = present ? HDA_AMP_MUTE : 0;
8391 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8392 HDA_AMP_MUTE, bits);
8395 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8397 unsigned int present;
8400 present = snd_hda_codec_read(codec, 0x1b, 0,
8401 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8402 bits = present ? HDA_AMP_MUTE : 0;
8403 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8404 HDA_AMP_MUTE, bits);
8405 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8406 HDA_AMP_MUTE, bits);
8409 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8412 if ((res >> 26) == ALC880_HP_EVENT)
8413 alc883_lenovo_101e_all_automute(codec);
8414 if ((res >> 26) == ALC880_FRONT_EVENT)
8415 alc883_lenovo_101e_ispeaker_automute(codec);
8418 /* toggle speaker-output according to the hp-jack state */
8419 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8421 unsigned int present;
8423 present = snd_hda_codec_read(codec, 0x14, 0,
8424 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8425 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8426 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8427 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8428 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8431 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8434 if ((res >> 26) == ALC880_HP_EVENT)
8435 alc883_acer_aspire_automute(codec);
8438 static struct hda_verb alc883_acer_eapd_verbs[] = {
8439 /* HP Pin: output 0 (0x0c) */
8440 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8441 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8442 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8443 /* Front Pin: output 0 (0x0c) */
8444 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8445 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8446 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8447 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8448 /* eanable EAPD on medion laptop */
8449 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8450 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8451 /* enable unsolicited event */
8452 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8456 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8458 unsigned int present;
8460 present = snd_hda_codec_read(codec, 0x1b, 0,
8461 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8462 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8463 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8464 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8465 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8466 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8467 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8468 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8469 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8472 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8475 switch (res >> 26) {
8476 case ALC880_HP_EVENT:
8477 /* printk(KERN_DEBUG "hp_event\n"); */
8478 alc888_6st_dell_front_automute(codec);
8483 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8486 unsigned int present;
8488 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8489 present = snd_hda_codec_read(codec, 0x1b, 0,
8490 AC_VERB_GET_PIN_SENSE, 0);
8491 present = (present & 0x80000000) != 0;
8493 /* mute internal speaker */
8494 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8495 HDA_AMP_MUTE, HDA_AMP_MUTE);
8496 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8497 HDA_AMP_MUTE, HDA_AMP_MUTE);
8498 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8499 HDA_AMP_MUTE, HDA_AMP_MUTE);
8500 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8501 HDA_AMP_MUTE, HDA_AMP_MUTE);
8502 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8503 HDA_AMP_MUTE, HDA_AMP_MUTE);
8505 /* unmute internal speaker if necessary */
8506 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8507 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8508 HDA_AMP_MUTE, mute);
8509 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8510 HDA_AMP_MUTE, mute);
8511 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8512 HDA_AMP_MUTE, mute);
8513 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8514 HDA_AMP_MUTE, mute);
8515 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8516 HDA_AMP_MUTE, mute);
8520 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8523 if ((res >> 26) == ALC880_HP_EVENT)
8524 alc888_lenovo_sky_front_automute(codec);
8528 * generic initialization of ADC, input mixers and output mixers
8530 static struct hda_verb alc883_auto_init_verbs[] = {
8532 * Unmute ADC0-2 and set the default input to mic-in
8534 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8535 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8536 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8537 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8539 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8541 * Note: PASD motherboards uses the Line In 2 as the input for
8542 * front panel mic (mic 2)
8544 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8552 * Set up output mixers (0x0c - 0x0f)
8554 /* set vol=0 to output mixers */
8555 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8556 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8557 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8558 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8559 /* set up input amps for analog loopback */
8560 /* Amp Indices: DAC = 0, mixer = 1 */
8561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8563 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8564 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8565 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8567 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8568 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8569 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8570 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8572 /* FIXME: use matrix-type input source selection */
8573 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8575 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8576 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8577 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8578 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8579 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8581 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8582 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8583 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8584 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8585 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8590 static struct hda_verb alc888_asus_m90v_verbs[] = {
8591 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8592 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8593 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8594 /* enable unsolicited event */
8595 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8596 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8600 static void alc883_nb_mic_automute(struct hda_codec *codec)
8602 unsigned int present;
8604 present = snd_hda_codec_read(codec, 0x18, 0,
8605 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8606 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8607 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8608 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8609 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8612 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8614 unsigned int present;
8617 present = snd_hda_codec_read(codec, 0x1b, 0,
8618 AC_VERB_GET_PIN_SENSE, 0)
8619 & AC_PINSENSE_PRESENCE;
8620 bits = present ? 0 : PIN_OUT;
8621 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8623 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8625 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8629 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8632 switch (res >> 26) {
8633 case ALC880_HP_EVENT:
8634 alc883_M90V_speaker_automute(codec);
8636 case ALC880_MIC_EVENT:
8637 alc883_nb_mic_automute(codec);
8642 static void alc883_mode2_inithook(struct hda_codec *codec)
8644 alc883_M90V_speaker_automute(codec);
8645 alc883_nb_mic_automute(codec);
8648 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8649 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8650 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8651 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8653 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8654 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8655 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8656 /* enable unsolicited event */
8657 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8661 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8663 unsigned int present;
8666 present = snd_hda_codec_read(codec, 0x14, 0,
8667 AC_VERB_GET_PIN_SENSE, 0)
8668 & AC_PINSENSE_PRESENCE;
8669 bits = present ? 0 : PIN_OUT;
8670 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8674 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8677 switch (res >> 26) {
8678 case ALC880_HP_EVENT:
8679 alc883_eee1601_speaker_automute(codec);
8684 static void alc883_eee1601_inithook(struct hda_codec *codec)
8686 alc883_eee1601_speaker_automute(codec);
8689 #ifdef CONFIG_SND_HDA_POWER_SAVE
8690 #define alc883_loopbacks alc880_loopbacks
8693 /* pcm configuration: identiacal with ALC880 */
8694 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8695 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8696 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8697 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8698 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8701 * configuration and preset
8703 static const char *alc883_models[ALC883_MODEL_LAST] = {
8704 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8705 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8706 [ALC883_3ST_6ch] = "3stack-6ch",
8707 [ALC883_6ST_DIG] = "6stack-dig",
8708 [ALC883_TARGA_DIG] = "targa-dig",
8709 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8710 [ALC883_ACER] = "acer",
8711 [ALC883_ACER_ASPIRE] = "acer-aspire",
8712 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8713 [ALC883_MEDION] = "medion",
8714 [ALC883_MEDION_MD2] = "medion-md2",
8715 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8716 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8717 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8718 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8719 [ALC888_LENOVO_SKY] = "lenovo-sky",
8720 [ALC883_HAIER_W66] = "haier-w66",
8721 [ALC888_3ST_HP] = "3stack-hp",
8722 [ALC888_6ST_DELL] = "6stack-dell",
8723 [ALC883_MITAC] = "mitac",
8724 [ALC883_CLEVO_M720] = "clevo-m720",
8725 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8726 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8727 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8728 [ALC1200_ASUS_P5Q] = "asus-p5q",
8729 [ALC883_AUTO] = "auto",
8732 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8733 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8734 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8735 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8736 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8737 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8738 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8739 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8740 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8741 ALC888_ACER_ASPIRE_4930G),
8742 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8743 ALC888_ACER_ASPIRE_4930G),
8744 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
8745 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
8746 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8747 ALC888_ACER_ASPIRE_4930G),
8748 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8749 ALC888_ACER_ASPIRE_4930G),
8751 SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER),
8752 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8753 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8754 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8755 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8756 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8757 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8758 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8759 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8760 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8761 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8762 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8763 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8764 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8765 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8766 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8767 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8768 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8769 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8770 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8771 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8772 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8773 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8774 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8775 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8776 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8777 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8778 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8779 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8780 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8781 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8782 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8783 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8784 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8785 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8786 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8787 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8788 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8789 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8790 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8791 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8792 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8793 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8794 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8795 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8796 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8797 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8798 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8799 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8800 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8801 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8802 ALC883_FUJITSU_PI2515),
8803 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8804 ALC888_FUJITSU_XA3530),
8805 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8806 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8807 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8808 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8809 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8810 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8811 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8812 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8813 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8814 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8815 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8816 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8817 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8818 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8822 static hda_nid_t alc883_slave_dig_outs[] = {
8823 ALC1200_DIGOUT_NID, 0,
8826 static hda_nid_t alc1200_slave_dig_outs[] = {
8827 ALC883_DIGOUT_NID, 0,
8830 static struct alc_config_preset alc883_presets[] = {
8831 [ALC883_3ST_2ch_DIG] = {
8832 .mixers = { alc883_3ST_2ch_mixer },
8833 .init_verbs = { alc883_init_verbs },
8834 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8835 .dac_nids = alc883_dac_nids,
8836 .dig_out_nid = ALC883_DIGOUT_NID,
8837 .dig_in_nid = ALC883_DIGIN_NID,
8838 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8839 .channel_mode = alc883_3ST_2ch_modes,
8840 .input_mux = &alc883_capture_source,
8842 [ALC883_3ST_6ch_DIG] = {
8843 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8844 .init_verbs = { alc883_init_verbs },
8845 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8846 .dac_nids = alc883_dac_nids,
8847 .dig_out_nid = ALC883_DIGOUT_NID,
8848 .dig_in_nid = ALC883_DIGIN_NID,
8849 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8850 .channel_mode = alc883_3ST_6ch_modes,
8852 .input_mux = &alc883_capture_source,
8854 [ALC883_3ST_6ch] = {
8855 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8856 .init_verbs = { alc883_init_verbs },
8857 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8858 .dac_nids = alc883_dac_nids,
8859 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8860 .channel_mode = alc883_3ST_6ch_modes,
8862 .input_mux = &alc883_capture_source,
8864 [ALC883_3ST_6ch_INTEL] = {
8865 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8866 .init_verbs = { alc883_init_verbs },
8867 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8868 .dac_nids = alc883_dac_nids,
8869 .dig_out_nid = ALC883_DIGOUT_NID,
8870 .dig_in_nid = ALC883_DIGIN_NID,
8871 .slave_dig_outs = alc883_slave_dig_outs,
8872 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8873 .channel_mode = alc883_3ST_6ch_intel_modes,
8875 .input_mux = &alc883_3stack_6ch_intel,
8877 [ALC883_6ST_DIG] = {
8878 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8879 .init_verbs = { alc883_init_verbs },
8880 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8881 .dac_nids = alc883_dac_nids,
8882 .dig_out_nid = ALC883_DIGOUT_NID,
8883 .dig_in_nid = ALC883_DIGIN_NID,
8884 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8885 .channel_mode = alc883_sixstack_modes,
8886 .input_mux = &alc883_capture_source,
8888 [ALC883_TARGA_DIG] = {
8889 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8890 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8891 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8892 .dac_nids = alc883_dac_nids,
8893 .dig_out_nid = ALC883_DIGOUT_NID,
8894 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8895 .channel_mode = alc883_3ST_6ch_modes,
8897 .input_mux = &alc883_capture_source,
8898 .unsol_event = alc883_tagra_unsol_event,
8899 .init_hook = alc883_tagra_automute,
8901 [ALC883_TARGA_2ch_DIG] = {
8902 .mixers = { alc883_tagra_2ch_mixer},
8903 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8904 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8905 .dac_nids = alc883_dac_nids,
8906 .adc_nids = alc883_adc_nids_alt,
8907 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8908 .dig_out_nid = ALC883_DIGOUT_NID,
8909 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8910 .channel_mode = alc883_3ST_2ch_modes,
8911 .input_mux = &alc883_capture_source,
8912 .unsol_event = alc883_tagra_unsol_event,
8913 .init_hook = alc883_tagra_automute,
8916 .mixers = { alc883_base_mixer },
8917 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8918 * and the headphone jack. Turn this on and rely on the
8919 * standard mute methods whenever the user wants to turn
8920 * these outputs off.
8922 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8923 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8924 .dac_nids = alc883_dac_nids,
8925 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8926 .channel_mode = alc883_3ST_2ch_modes,
8927 .input_mux = &alc883_capture_source,
8929 [ALC883_ACER_ASPIRE] = {
8930 .mixers = { alc883_acer_aspire_mixer },
8931 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8932 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8933 .dac_nids = alc883_dac_nids,
8934 .dig_out_nid = ALC883_DIGOUT_NID,
8935 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8936 .channel_mode = alc883_3ST_2ch_modes,
8937 .input_mux = &alc883_capture_source,
8938 .unsol_event = alc883_acer_aspire_unsol_event,
8939 .init_hook = alc883_acer_aspire_automute,
8941 [ALC888_ACER_ASPIRE_4930G] = {
8942 .mixers = { alc888_base_mixer,
8943 alc883_chmode_mixer },
8944 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8945 alc888_acer_aspire_4930g_verbs },
8946 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8947 .dac_nids = alc883_dac_nids,
8948 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8949 .adc_nids = alc883_adc_nids_rev,
8950 .capsrc_nids = alc883_capsrc_nids_rev,
8951 .dig_out_nid = ALC883_DIGOUT_NID,
8952 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8953 .channel_mode = alc883_3ST_6ch_modes,
8956 ARRAY_SIZE(alc888_2_capture_sources),
8957 .input_mux = alc888_2_capture_sources,
8958 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8959 .init_hook = alc888_acer_aspire_4930g_automute,
8962 .mixers = { alc883_fivestack_mixer,
8963 alc883_chmode_mixer },
8964 .init_verbs = { alc883_init_verbs,
8965 alc883_medion_eapd_verbs },
8966 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8967 .dac_nids = alc883_dac_nids,
8968 .adc_nids = alc883_adc_nids_alt,
8969 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8970 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8971 .channel_mode = alc883_sixstack_modes,
8972 .input_mux = &alc883_capture_source,
8974 [ALC883_MEDION_MD2] = {
8975 .mixers = { alc883_medion_md2_mixer},
8976 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8977 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8978 .dac_nids = alc883_dac_nids,
8979 .dig_out_nid = ALC883_DIGOUT_NID,
8980 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8981 .channel_mode = alc883_3ST_2ch_modes,
8982 .input_mux = &alc883_capture_source,
8983 .unsol_event = alc883_medion_md2_unsol_event,
8984 .init_hook = alc883_medion_md2_automute,
8986 [ALC883_LAPTOP_EAPD] = {
8987 .mixers = { alc883_base_mixer },
8988 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8989 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8990 .dac_nids = alc883_dac_nids,
8991 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8992 .channel_mode = alc883_3ST_2ch_modes,
8993 .input_mux = &alc883_capture_source,
8995 [ALC883_CLEVO_M720] = {
8996 .mixers = { alc883_clevo_m720_mixer },
8997 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8998 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8999 .dac_nids = alc883_dac_nids,
9000 .dig_out_nid = ALC883_DIGOUT_NID,
9001 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9002 .channel_mode = alc883_3ST_2ch_modes,
9003 .input_mux = &alc883_capture_source,
9004 .unsol_event = alc883_clevo_m720_unsol_event,
9005 .init_hook = alc883_clevo_m720_automute,
9007 [ALC883_LENOVO_101E_2ch] = {
9008 .mixers = { alc883_lenovo_101e_2ch_mixer},
9009 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9010 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9011 .dac_nids = alc883_dac_nids,
9012 .adc_nids = alc883_adc_nids_alt,
9013 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9014 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9015 .channel_mode = alc883_3ST_2ch_modes,
9016 .input_mux = &alc883_lenovo_101e_capture_source,
9017 .unsol_event = alc883_lenovo_101e_unsol_event,
9018 .init_hook = alc883_lenovo_101e_all_automute,
9020 [ALC883_LENOVO_NB0763] = {
9021 .mixers = { alc883_lenovo_nb0763_mixer },
9022 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9023 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9024 .dac_nids = alc883_dac_nids,
9025 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9026 .channel_mode = alc883_3ST_2ch_modes,
9028 .input_mux = &alc883_lenovo_nb0763_capture_source,
9029 .unsol_event = alc883_medion_md2_unsol_event,
9030 .init_hook = alc883_medion_md2_automute,
9032 [ALC888_LENOVO_MS7195_DIG] = {
9033 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9034 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9035 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9036 .dac_nids = alc883_dac_nids,
9037 .dig_out_nid = ALC883_DIGOUT_NID,
9038 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9039 .channel_mode = alc883_3ST_6ch_modes,
9041 .input_mux = &alc883_capture_source,
9042 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9043 .init_hook = alc888_lenovo_ms7195_front_automute,
9045 [ALC883_HAIER_W66] = {
9046 .mixers = { alc883_tagra_2ch_mixer},
9047 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9048 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9049 .dac_nids = alc883_dac_nids,
9050 .dig_out_nid = ALC883_DIGOUT_NID,
9051 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9052 .channel_mode = alc883_3ST_2ch_modes,
9053 .input_mux = &alc883_capture_source,
9054 .unsol_event = alc883_haier_w66_unsol_event,
9055 .init_hook = alc883_haier_w66_automute,
9058 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9059 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9060 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9061 .dac_nids = alc883_dac_nids,
9062 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9063 .channel_mode = alc888_3st_hp_modes,
9065 .input_mux = &alc883_capture_source,
9066 .unsol_event = alc888_3st_hp_unsol_event,
9067 .init_hook = alc888_3st_hp_front_automute,
9069 [ALC888_6ST_DELL] = {
9070 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9071 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9072 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9073 .dac_nids = alc883_dac_nids,
9074 .dig_out_nid = ALC883_DIGOUT_NID,
9075 .dig_in_nid = ALC883_DIGIN_NID,
9076 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9077 .channel_mode = alc883_sixstack_modes,
9078 .input_mux = &alc883_capture_source,
9079 .unsol_event = alc888_6st_dell_unsol_event,
9080 .init_hook = alc888_6st_dell_front_automute,
9083 .mixers = { alc883_mitac_mixer },
9084 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9085 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9086 .dac_nids = alc883_dac_nids,
9087 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9088 .channel_mode = alc883_3ST_2ch_modes,
9089 .input_mux = &alc883_capture_source,
9090 .unsol_event = alc883_mitac_unsol_event,
9091 .init_hook = alc883_mitac_automute,
9093 [ALC883_FUJITSU_PI2515] = {
9094 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9095 .init_verbs = { alc883_init_verbs,
9096 alc883_2ch_fujitsu_pi2515_verbs},
9097 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9098 .dac_nids = alc883_dac_nids,
9099 .dig_out_nid = ALC883_DIGOUT_NID,
9100 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9101 .channel_mode = alc883_3ST_2ch_modes,
9102 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9103 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
9104 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
9106 [ALC888_FUJITSU_XA3530] = {
9107 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9108 .init_verbs = { alc883_init_verbs,
9109 alc888_fujitsu_xa3530_verbs },
9110 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9111 .dac_nids = alc883_dac_nids,
9112 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9113 .adc_nids = alc883_adc_nids_rev,
9114 .capsrc_nids = alc883_capsrc_nids_rev,
9115 .dig_out_nid = ALC883_DIGOUT_NID,
9116 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9117 .channel_mode = alc888_4ST_8ch_intel_modes,
9119 ARRAY_SIZE(alc888_2_capture_sources),
9120 .input_mux = alc888_2_capture_sources,
9121 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
9122 .init_hook = alc888_fujitsu_xa3530_automute,
9124 [ALC888_LENOVO_SKY] = {
9125 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9126 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9127 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9128 .dac_nids = alc883_dac_nids,
9129 .dig_out_nid = ALC883_DIGOUT_NID,
9130 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9131 .channel_mode = alc883_sixstack_modes,
9133 .input_mux = &alc883_lenovo_sky_capture_source,
9134 .unsol_event = alc883_lenovo_sky_unsol_event,
9135 .init_hook = alc888_lenovo_sky_front_automute,
9137 [ALC888_ASUS_M90V] = {
9138 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9139 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9140 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9141 .dac_nids = alc883_dac_nids,
9142 .dig_out_nid = ALC883_DIGOUT_NID,
9143 .dig_in_nid = ALC883_DIGIN_NID,
9144 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9145 .channel_mode = alc883_3ST_6ch_modes,
9147 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9148 .unsol_event = alc883_mode2_unsol_event,
9149 .init_hook = alc883_mode2_inithook,
9151 [ALC888_ASUS_EEE1601] = {
9152 .mixers = { alc883_asus_eee1601_mixer },
9153 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9154 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9155 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9156 .dac_nids = alc883_dac_nids,
9157 .dig_out_nid = ALC883_DIGOUT_NID,
9158 .dig_in_nid = ALC883_DIGIN_NID,
9159 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9160 .channel_mode = alc883_3ST_2ch_modes,
9162 .input_mux = &alc883_asus_eee1601_capture_source,
9163 .unsol_event = alc883_eee1601_unsol_event,
9164 .init_hook = alc883_eee1601_inithook,
9166 [ALC1200_ASUS_P5Q] = {
9167 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9168 .init_verbs = { alc883_init_verbs },
9169 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9170 .dac_nids = alc883_dac_nids,
9171 .dig_out_nid = ALC1200_DIGOUT_NID,
9172 .dig_in_nid = ALC883_DIGIN_NID,
9173 .slave_dig_outs = alc1200_slave_dig_outs,
9174 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9175 .channel_mode = alc883_sixstack_modes,
9176 .input_mux = &alc883_capture_source,
9182 * BIOS auto configuration
9184 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
9185 hda_nid_t nid, int pin_type,
9189 struct alc_spec *spec = codec->spec;
9192 alc_set_pin_output(codec, nid, pin_type);
9193 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9196 idx = spec->multiout.dac_nids[dac_idx] - 2;
9197 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9201 static void alc883_auto_init_multi_out(struct hda_codec *codec)
9203 struct alc_spec *spec = codec->spec;
9206 for (i = 0; i <= HDA_SIDE; i++) {
9207 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9208 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9210 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
9215 static void alc883_auto_init_hp_out(struct hda_codec *codec)
9217 struct alc_spec *spec = codec->spec;
9220 pin = spec->autocfg.hp_pins[0];
9221 if (pin) /* connect to front */
9223 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9224 pin = spec->autocfg.speaker_pins[0];
9226 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9229 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9230 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9232 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9234 struct alc_spec *spec = codec->spec;
9237 for (i = 0; i < AUTO_PIN_LAST; i++) {
9238 hda_nid_t nid = spec->autocfg.input_pins[i];
9239 if (alc883_is_input_pin(nid)) {
9240 alc_set_input_pin(codec, nid, i);
9241 if (nid != ALC883_PIN_CD_NID &&
9242 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
9243 snd_hda_codec_write(codec, nid, 0,
9244 AC_VERB_SET_AMP_GAIN_MUTE,
9250 #define alc883_auto_init_input_src alc882_auto_init_input_src
9252 /* almost identical with ALC880 parser... */
9253 static int alc883_parse_auto_config(struct hda_codec *codec)
9255 struct alc_spec *spec = codec->spec;
9256 int err = alc880_parse_auto_config(codec);
9257 struct auto_pin_cfg *cfg = &spec->autocfg;
9263 return 0; /* no config found */
9265 err = alc_auto_add_mic_boost(codec);
9269 /* hack - override the init verbs */
9270 spec->init_verbs[0] = alc883_auto_init_verbs;
9272 /* setup input_mux for ALC889 */
9273 if (codec->vendor_id == 0x10ec0889) {
9274 /* digital-mic input pin is excluded in alc880_auto_create..()
9275 * because it's under 0x18
9277 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9278 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9279 struct hda_input_mux *imux = &spec->private_imux[0];
9280 for (i = 1; i < 3; i++)
9281 memcpy(&spec->private_imux[i],
9282 &spec->private_imux[0],
9283 sizeof(spec->private_imux[0]));
9284 imux->items[imux->num_items].label = "Int DMic";
9285 imux->items[imux->num_items].index = 0x0b;
9287 spec->num_mux_defs = 3;
9288 spec->input_mux = spec->private_imux;
9292 return 1; /* config found */
9295 /* additional initialization for auto-configuration model */
9296 static void alc883_auto_init(struct hda_codec *codec)
9298 struct alc_spec *spec = codec->spec;
9299 alc883_auto_init_multi_out(codec);
9300 alc883_auto_init_hp_out(codec);
9301 alc883_auto_init_analog_input(codec);
9302 alc883_auto_init_input_src(codec);
9303 if (spec->unsol_event)
9304 alc_inithook(codec);
9307 static int patch_alc883(struct hda_codec *codec)
9309 struct alc_spec *spec;
9310 int err, board_config;
9312 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9318 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9320 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9323 if (board_config < 0) {
9324 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9325 "trying auto-probe from BIOS...\n");
9326 board_config = ALC883_AUTO;
9329 if (board_config == ALC883_AUTO) {
9330 /* automatic parse from the BIOS config */
9331 err = alc883_parse_auto_config(codec);
9337 "hda_codec: Cannot set up configuration "
9338 "from BIOS. Using base mode...\n");
9339 board_config = ALC883_3ST_2ch_DIG;
9343 err = snd_hda_attach_beep_device(codec, 0x1);
9349 if (board_config != ALC883_AUTO)
9350 setup_preset(spec, &alc883_presets[board_config]);
9352 switch (codec->vendor_id) {
9354 if (codec->revision_id == 0x100101) {
9355 spec->stream_name_analog = "ALC1200 Analog";
9356 spec->stream_name_digital = "ALC1200 Digital";
9358 spec->stream_name_analog = "ALC888 Analog";
9359 spec->stream_name_digital = "ALC888 Digital";
9361 if (!spec->num_adc_nids) {
9362 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9363 spec->adc_nids = alc883_adc_nids;
9365 if (!spec->capsrc_nids)
9366 spec->capsrc_nids = alc883_capsrc_nids;
9367 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9368 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9371 spec->stream_name_analog = "ALC889 Analog";
9372 spec->stream_name_digital = "ALC889 Digital";
9373 if (!spec->num_adc_nids) {
9374 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9375 spec->adc_nids = alc889_adc_nids;
9377 if (!spec->capsrc_nids)
9378 spec->capsrc_nids = alc889_capsrc_nids;
9379 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9383 spec->stream_name_analog = "ALC883 Analog";
9384 spec->stream_name_digital = "ALC883 Digital";
9385 if (!spec->num_adc_nids) {
9386 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9387 spec->adc_nids = alc883_adc_nids;
9389 if (!spec->capsrc_nids)
9390 spec->capsrc_nids = alc883_capsrc_nids;
9391 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9395 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9396 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9397 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9399 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9400 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9402 if (!spec->cap_mixer)
9403 set_capture_mixer(spec);
9404 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9406 spec->vmaster_nid = 0x0c;
9408 codec->patch_ops = alc_patch_ops;
9409 if (board_config == ALC883_AUTO)
9410 spec->init_hook = alc883_auto_init;
9412 #ifdef CONFIG_SND_HDA_POWER_SAVE
9413 if (!spec->loopback.amplist)
9414 spec->loopback.amplist = alc883_loopbacks;
9416 codec->proc_widget_hook = print_realtek_coef;
9425 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9426 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9428 #define alc262_dac_nids alc260_dac_nids
9429 #define alc262_adc_nids alc882_adc_nids
9430 #define alc262_adc_nids_alt alc882_adc_nids_alt
9431 #define alc262_capsrc_nids alc882_capsrc_nids
9432 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9434 #define alc262_modes alc260_modes
9435 #define alc262_capture_source alc882_capture_source
9437 static hda_nid_t alc262_dmic_adc_nids[1] = {
9442 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9444 static struct snd_kcontrol_new alc262_base_mixer[] = {
9445 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9446 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9447 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9448 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9449 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9450 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9451 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9452 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9453 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9454 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9455 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9456 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9457 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9458 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9459 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9460 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9464 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9465 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9466 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9467 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9468 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9469 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9470 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9471 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9472 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9473 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9474 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9475 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9476 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9477 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9478 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9482 /* update HP, line and mono-out pins according to the master switch */
9483 static void alc262_hp_master_update(struct hda_codec *codec)
9485 struct alc_spec *spec = codec->spec;
9486 int val = spec->master_sw;
9489 snd_hda_codec_write_cache(codec, 0x1b, 0,
9490 AC_VERB_SET_PIN_WIDGET_CONTROL,
9492 snd_hda_codec_write_cache(codec, 0x15, 0,
9493 AC_VERB_SET_PIN_WIDGET_CONTROL,
9495 /* mono (speaker) depending on the HP jack sense */
9496 val = val && !spec->jack_present;
9497 snd_hda_codec_write_cache(codec, 0x16, 0,
9498 AC_VERB_SET_PIN_WIDGET_CONTROL,
9502 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9504 struct alc_spec *spec = codec->spec;
9505 unsigned int presence;
9506 presence = snd_hda_codec_read(codec, 0x1b, 0,
9507 AC_VERB_GET_PIN_SENSE, 0);
9508 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9509 alc262_hp_master_update(codec);
9512 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9514 if ((res >> 26) != ALC880_HP_EVENT)
9516 alc262_hp_bpc_automute(codec);
9519 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9521 struct alc_spec *spec = codec->spec;
9522 unsigned int presence;
9523 presence = snd_hda_codec_read(codec, 0x15, 0,
9524 AC_VERB_GET_PIN_SENSE, 0);
9525 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9526 alc262_hp_master_update(codec);
9529 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9532 if ((res >> 26) != ALC880_HP_EVENT)
9534 alc262_hp_wildwest_automute(codec);
9537 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9538 struct snd_ctl_elem_value *ucontrol)
9540 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9541 struct alc_spec *spec = codec->spec;
9542 *ucontrol->value.integer.value = spec->master_sw;
9546 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9547 struct snd_ctl_elem_value *ucontrol)
9549 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9550 struct alc_spec *spec = codec->spec;
9551 int val = !!*ucontrol->value.integer.value;
9553 if (val == spec->master_sw)
9555 spec->master_sw = val;
9556 alc262_hp_master_update(codec);
9560 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9562 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9563 .name = "Master Playback Switch",
9564 .info = snd_ctl_boolean_mono_info,
9565 .get = alc262_hp_master_sw_get,
9566 .put = alc262_hp_master_sw_put,
9568 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9569 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9570 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9571 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9573 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9576 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9577 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9578 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9579 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9580 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9581 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9582 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9583 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9584 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9585 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9586 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9590 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9592 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9593 .name = "Master Playback Switch",
9594 .info = snd_ctl_boolean_mono_info,
9595 .get = alc262_hp_master_sw_get,
9596 .put = alc262_hp_master_sw_put,
9598 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9599 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9600 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9601 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9602 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9604 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9606 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9607 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9608 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9609 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9610 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9611 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9612 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9616 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9617 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9618 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9619 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9623 /* mute/unmute internal speaker according to the hp jack and mute state */
9624 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9626 struct alc_spec *spec = codec->spec;
9628 if (force || !spec->sense_updated) {
9629 unsigned int present;
9630 present = snd_hda_codec_read(codec, 0x15, 0,
9631 AC_VERB_GET_PIN_SENSE, 0);
9632 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9633 spec->sense_updated = 1;
9635 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9636 spec->jack_present ? HDA_AMP_MUTE : 0);
9639 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9642 if ((res >> 26) != ALC880_HP_EVENT)
9644 alc262_hp_t5735_automute(codec, 1);
9647 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9649 alc262_hp_t5735_automute(codec, 1);
9652 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9653 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9654 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9655 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9656 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9657 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9658 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9659 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9663 static struct hda_verb alc262_hp_t5735_verbs[] = {
9664 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9665 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9667 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9671 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9672 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9673 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9674 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9675 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9676 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9677 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9681 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9682 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9683 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9684 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9685 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9686 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9687 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9688 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9689 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9690 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9691 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9695 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9702 /* bind hp and internal speaker mute (with plug check) */
9703 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9704 struct snd_ctl_elem_value *ucontrol)
9706 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9707 long *valp = ucontrol->value.integer.value;
9710 /* change hp mute */
9711 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9713 valp[0] ? 0 : HDA_AMP_MUTE);
9714 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9716 valp[1] ? 0 : HDA_AMP_MUTE);
9718 /* change speaker according to HP jack state */
9719 struct alc_spec *spec = codec->spec;
9721 if (spec->jack_present)
9722 mute = HDA_AMP_MUTE;
9724 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9726 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9727 HDA_AMP_MUTE, mute);
9732 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9733 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9735 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9736 .name = "Master Playback Switch",
9737 .info = snd_hda_mixer_amp_switch_info,
9738 .get = snd_hda_mixer_amp_switch_get,
9739 .put = alc262_sony_master_sw_put,
9740 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9742 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9743 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9744 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9745 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9749 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9750 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9751 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9752 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9753 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9754 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9755 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9756 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9760 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9761 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9762 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9763 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9764 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9765 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9766 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9767 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9768 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9769 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9770 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9771 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9772 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9776 static struct hda_verb alc262_tyan_verbs[] = {
9777 /* Headphone automute */
9778 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9779 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9780 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9782 /* P11 AUX_IN, white 4-pin connector */
9783 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9784 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9785 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9786 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9791 /* unsolicited event for HP jack sensing */
9792 static void alc262_tyan_automute(struct hda_codec *codec)
9795 unsigned int present;
9797 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9798 present = snd_hda_codec_read(codec, 0x1b, 0,
9799 AC_VERB_GET_PIN_SENSE, 0);
9800 present = (present & 0x80000000) != 0;
9802 /* mute line output on ATX panel */
9803 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9804 HDA_AMP_MUTE, HDA_AMP_MUTE);
9806 /* unmute line output if necessary */
9807 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9808 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9809 HDA_AMP_MUTE, mute);
9813 static void alc262_tyan_unsol_event(struct hda_codec *codec,
9816 if ((res >> 26) != ALC880_HP_EVENT)
9818 alc262_tyan_automute(codec);
9821 #define alc262_capture_mixer alc882_capture_mixer
9822 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9825 * generic initialization of ADC, input mixers and output mixers
9827 static struct hda_verb alc262_init_verbs[] = {
9829 * Unmute ADC0-2 and set the default input to mic-in
9831 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9832 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9833 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9834 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9835 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9836 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9838 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9840 * Note: PASD motherboards uses the Line In 2 as the input for
9841 * front panel mic (mic 2)
9843 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9844 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9845 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9846 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9847 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9848 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9851 * Set up output mixers (0x0c - 0x0e)
9853 /* set vol=0 to output mixers */
9854 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9855 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9856 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9857 /* set up input amps for analog loopback */
9858 /* Amp Indices: DAC = 0, mixer = 1 */
9859 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9860 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9861 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9862 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9863 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9864 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9866 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9867 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9868 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9869 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9870 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9871 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9873 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9874 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9875 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9876 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9877 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9879 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9880 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9882 /* FIXME: use matrix-type input source selection */
9883 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9884 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9885 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9886 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9887 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9888 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9890 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9891 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9892 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9893 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9895 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9896 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9897 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9898 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9903 static struct hda_verb alc262_eapd_verbs[] = {
9904 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9905 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9909 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9910 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9911 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9915 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9916 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9917 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9918 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9920 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9921 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9925 static struct hda_verb alc262_sony_unsol_verbs[] = {
9926 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9927 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9928 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9930 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9931 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9935 static struct hda_input_mux alc262_dmic_capture_source = {
9938 { "Int DMic", 0x9 },
9943 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9944 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9945 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9946 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9948 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9952 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9953 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9954 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9955 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9956 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9957 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9958 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9959 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9960 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9964 static void alc262_dmic_automute(struct hda_codec *codec)
9966 unsigned int present;
9968 present = snd_hda_codec_read(codec, 0x18, 0,
9969 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9970 snd_hda_codec_write(codec, 0x22, 0,
9971 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9974 /* toggle speaker-output according to the hp-jack state */
9975 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9977 unsigned int present;
9980 present = snd_hda_codec_read(codec, 0x15, 0,
9981 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9982 bits = present ? 0 : PIN_OUT;
9983 snd_hda_codec_write(codec, 0x14, 0,
9984 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9989 /* unsolicited event for HP jack sensing */
9990 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9993 if ((res >> 26) == ALC880_HP_EVENT)
9994 alc262_toshiba_s06_speaker_automute(codec);
9995 if ((res >> 26) == ALC880_MIC_EVENT)
9996 alc262_dmic_automute(codec);
10000 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
10002 alc262_toshiba_s06_speaker_automute(codec);
10003 alc262_dmic_automute(codec);
10006 /* mute/unmute internal speaker according to the hp jack and mute state */
10007 static void alc262_hippo_automute(struct hda_codec *codec)
10009 struct alc_spec *spec = codec->spec;
10011 unsigned int present;
10013 /* need to execute and sync at first */
10014 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10015 present = snd_hda_codec_read(codec, 0x15, 0,
10016 AC_VERB_GET_PIN_SENSE, 0);
10017 spec->jack_present = (present & 0x80000000) != 0;
10018 if (spec->jack_present) {
10019 /* mute internal speaker */
10020 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10021 HDA_AMP_MUTE, HDA_AMP_MUTE);
10023 /* unmute internal speaker if necessary */
10024 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
10025 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10026 HDA_AMP_MUTE, mute);
10030 /* unsolicited event for HP jack sensing */
10031 static void alc262_hippo_unsol_event(struct hda_codec *codec,
10034 if ((res >> 26) != ALC880_HP_EVENT)
10036 alc262_hippo_automute(codec);
10039 static void alc262_hippo1_automute(struct hda_codec *codec)
10042 unsigned int present;
10044 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10045 present = snd_hda_codec_read(codec, 0x1b, 0,
10046 AC_VERB_GET_PIN_SENSE, 0);
10047 present = (present & 0x80000000) != 0;
10049 /* mute internal speaker */
10050 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10051 HDA_AMP_MUTE, HDA_AMP_MUTE);
10053 /* unmute internal speaker if necessary */
10054 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10055 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10056 HDA_AMP_MUTE, mute);
10060 /* unsolicited event for HP jack sensing */
10061 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
10064 if ((res >> 26) != ALC880_HP_EVENT)
10066 alc262_hippo1_automute(codec);
10072 * 0x16 = internal speaker
10073 * 0x18 = external mic
10076 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10077 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10078 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10080 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10081 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10082 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10084 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10085 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10089 static struct hda_verb alc262_nec_verbs[] = {
10090 /* Unmute Speaker */
10091 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10094 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10095 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10097 /* External mic to headphone */
10098 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10099 /* External mic to speaker */
10100 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10106 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10107 * 0x1b = port replicator headphone out
10110 #define ALC_HP_EVENT 0x37
10112 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10113 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10114 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10115 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10116 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10120 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10121 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10122 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10126 static struct hda_input_mux alc262_fujitsu_capture_source = {
10130 { "Int Mic", 0x1 },
10135 static struct hda_input_mux alc262_HP_capture_source = {
10139 { "Front Mic", 0x1 },
10146 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10150 { "Front Mic", 0x2 },
10156 /* mute/unmute internal speaker according to the hp jacks and mute state */
10157 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10159 struct alc_spec *spec = codec->spec;
10162 if (force || !spec->sense_updated) {
10163 unsigned int present;
10164 /* need to execute and sync at first */
10165 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10166 /* check laptop HP jack */
10167 present = snd_hda_codec_read(codec, 0x14, 0,
10168 AC_VERB_GET_PIN_SENSE, 0);
10169 /* need to execute and sync at first */
10170 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10171 /* check docking HP jack */
10172 present |= snd_hda_codec_read(codec, 0x1b, 0,
10173 AC_VERB_GET_PIN_SENSE, 0);
10174 if (present & AC_PINSENSE_PRESENCE)
10175 spec->jack_present = 1;
10177 spec->jack_present = 0;
10178 spec->sense_updated = 1;
10180 /* unmute internal speaker only if both HPs are unplugged and
10181 * master switch is on
10183 if (spec->jack_present)
10184 mute = HDA_AMP_MUTE;
10186 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10187 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10188 HDA_AMP_MUTE, mute);
10191 /* unsolicited event for HP jack sensing */
10192 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10195 if ((res >> 26) != ALC_HP_EVENT)
10197 alc262_fujitsu_automute(codec, 1);
10200 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10202 alc262_fujitsu_automute(codec, 1);
10205 /* bind volumes of both NID 0x0c and 0x0d */
10206 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10207 .ops = &snd_hda_bind_vol,
10209 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10210 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10215 /* mute/unmute internal speaker according to the hp jack and mute state */
10216 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10218 struct alc_spec *spec = codec->spec;
10221 if (force || !spec->sense_updated) {
10222 unsigned int present_int_hp;
10223 /* need to execute and sync at first */
10224 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10225 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10226 AC_VERB_GET_PIN_SENSE, 0);
10227 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10228 spec->sense_updated = 1;
10230 if (spec->jack_present) {
10231 /* mute internal speaker */
10232 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10233 HDA_AMP_MUTE, HDA_AMP_MUTE);
10234 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10235 HDA_AMP_MUTE, HDA_AMP_MUTE);
10237 /* unmute internal speaker if necessary */
10238 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10239 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10240 HDA_AMP_MUTE, mute);
10241 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10242 HDA_AMP_MUTE, mute);
10246 /* unsolicited event for HP jack sensing */
10247 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10250 if ((res >> 26) != ALC_HP_EVENT)
10252 alc262_lenovo_3000_automute(codec, 1);
10255 /* bind hp and internal speaker mute (with plug check) */
10256 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10257 struct snd_ctl_elem_value *ucontrol)
10259 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10260 long *valp = ucontrol->value.integer.value;
10263 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10265 valp ? 0 : HDA_AMP_MUTE);
10266 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10268 valp ? 0 : HDA_AMP_MUTE);
10271 alc262_fujitsu_automute(codec, 0);
10275 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10276 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10278 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10279 .name = "Master Playback Switch",
10280 .info = snd_hda_mixer_amp_switch_info,
10281 .get = snd_hda_mixer_amp_switch_get,
10282 .put = alc262_fujitsu_master_sw_put,
10283 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10285 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10286 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10287 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10288 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10290 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10291 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10292 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10296 /* bind hp and internal speaker mute (with plug check) */
10297 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10298 struct snd_ctl_elem_value *ucontrol)
10300 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10301 long *valp = ucontrol->value.integer.value;
10304 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10306 valp ? 0 : HDA_AMP_MUTE);
10309 alc262_lenovo_3000_automute(codec, 0);
10313 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10314 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10316 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10317 .name = "Master Playback Switch",
10318 .info = snd_hda_mixer_amp_switch_info,
10319 .get = snd_hda_mixer_amp_switch_get,
10320 .put = alc262_lenovo_3000_master_sw_put,
10321 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10323 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10324 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10325 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10327 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10328 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10329 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10330 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10334 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10335 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10337 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10338 .name = "Master Playback Switch",
10339 .info = snd_hda_mixer_amp_switch_info,
10340 .get = snd_hda_mixer_amp_switch_get,
10341 .put = alc262_sony_master_sw_put,
10342 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
10344 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10345 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10346 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10347 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10348 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10349 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10353 /* additional init verbs for Benq laptops */
10354 static struct hda_verb alc262_EAPD_verbs[] = {
10355 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10356 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10360 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10361 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10362 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10364 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10365 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10369 /* Samsung Q1 Ultra Vista model setup */
10370 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10371 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10372 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10373 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10374 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10375 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10376 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10380 static struct hda_verb alc262_ultra_verbs[] = {
10382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10384 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10386 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10387 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10388 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10389 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10391 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10392 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10393 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10394 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10395 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10397 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10398 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10399 /* ADC, choose mic */
10400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10401 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10402 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10403 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10404 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10405 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10406 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10407 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10408 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10409 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10413 /* mute/unmute internal speaker according to the hp jack and mute state */
10414 static void alc262_ultra_automute(struct hda_codec *codec)
10416 struct alc_spec *spec = codec->spec;
10420 /* auto-mute only when HP is used as HP */
10421 if (!spec->cur_mux[0]) {
10422 unsigned int present;
10423 /* need to execute and sync at first */
10424 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10425 present = snd_hda_codec_read(codec, 0x15, 0,
10426 AC_VERB_GET_PIN_SENSE, 0);
10427 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10428 if (spec->jack_present)
10429 mute = HDA_AMP_MUTE;
10431 /* mute/unmute internal speaker */
10432 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10433 HDA_AMP_MUTE, mute);
10434 /* mute/unmute HP */
10435 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10436 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10439 /* unsolicited event for HP jack sensing */
10440 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10443 if ((res >> 26) != ALC880_HP_EVENT)
10445 alc262_ultra_automute(codec);
10448 static struct hda_input_mux alc262_ultra_capture_source = {
10452 { "Headphone", 0x7 },
10456 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10457 struct snd_ctl_elem_value *ucontrol)
10459 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10460 struct alc_spec *spec = codec->spec;
10463 ret = alc_mux_enum_put(kcontrol, ucontrol);
10466 /* reprogram the HP pin as mic or HP according to the input source */
10467 snd_hda_codec_write_cache(codec, 0x15, 0,
10468 AC_VERB_SET_PIN_WIDGET_CONTROL,
10469 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10470 alc262_ultra_automute(codec); /* mute/unmute HP */
10474 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10475 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10476 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10478 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10479 .name = "Capture Source",
10480 .info = alc_mux_enum_info,
10481 .get = alc_mux_enum_get,
10482 .put = alc262_ultra_mux_enum_put,
10487 /* add playback controls from the parsed DAC table */
10488 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10489 const struct auto_pin_cfg *cfg)
10494 spec->multiout.num_dacs = 1; /* only use one dac */
10495 spec->multiout.dac_nids = spec->private_dac_nids;
10496 spec->multiout.dac_nids[0] = 2;
10498 nid = cfg->line_out_pins[0];
10500 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10501 "Front Playback Volume",
10502 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10505 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10506 "Front Playback Switch",
10507 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10512 nid = cfg->speaker_pins[0];
10515 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10516 "Speaker Playback Volume",
10517 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10521 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10522 "Speaker Playback Switch",
10523 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10528 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10529 "Speaker Playback Switch",
10530 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10536 nid = cfg->hp_pins[0];
10538 /* spec->multiout.hp_nid = 2; */
10540 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10541 "Headphone Playback Volume",
10542 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10546 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10547 "Headphone Playback Switch",
10548 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10553 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10554 "Headphone Playback Switch",
10555 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10564 /* identical with ALC880 */
10565 #define alc262_auto_create_analog_input_ctls \
10566 alc880_auto_create_analog_input_ctls
10569 * generic initialization of ADC, input mixers and output mixers
10571 static struct hda_verb alc262_volume_init_verbs[] = {
10573 * Unmute ADC0-2 and set the default input to mic-in
10575 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10576 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10577 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10578 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10579 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10580 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10582 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10584 * Note: PASD motherboards uses the Line In 2 as the input for
10585 * front panel mic (mic 2)
10587 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10588 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10589 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10590 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10591 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10592 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10595 * Set up output mixers (0x0c - 0x0f)
10597 /* set vol=0 to output mixers */
10598 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10599 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10600 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10602 /* set up input amps for analog loopback */
10603 /* Amp Indices: DAC = 0, mixer = 1 */
10604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10605 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10606 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10607 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10608 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10609 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10611 /* FIXME: use matrix-type input source selection */
10612 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10613 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10614 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10615 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10616 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10617 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10619 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10620 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10621 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10622 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10626 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10627 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10632 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10634 * Unmute ADC0-2 and set the default input to mic-in
10636 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10638 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10639 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10640 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10641 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10643 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10645 * Note: PASD motherboards uses the Line In 2 as the input for
10646 * front panel mic (mic 2)
10648 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10649 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10650 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10651 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10652 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10653 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10654 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10655 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10658 * Set up output mixers (0x0c - 0x0e)
10660 /* set vol=0 to output mixers */
10661 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10662 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10663 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10665 /* set up input amps for analog loopback */
10666 /* Amp Indices: DAC = 0, mixer = 1 */
10667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10668 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10669 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10670 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10671 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10672 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10674 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10675 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10676 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10678 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10679 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10681 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10682 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10684 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10685 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10686 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10687 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10688 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10690 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10691 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10692 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10693 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10694 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10695 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10698 /* FIXME: use matrix-type input source selection */
10699 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10700 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10701 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10702 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10703 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10704 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10706 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10707 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10708 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10709 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10711 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10712 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10713 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10714 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10716 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10721 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10723 * Unmute ADC0-2 and set the default input to mic-in
10725 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10726 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10727 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10728 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10729 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10730 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10732 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10734 * Note: PASD motherboards uses the Line In 2 as the input for front
10735 * panel mic (mic 2)
10737 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10738 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10739 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10740 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10741 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10742 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10743 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10744 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10745 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10747 * Set up output mixers (0x0c - 0x0e)
10749 /* set vol=0 to output mixers */
10750 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10751 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10752 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10754 /* set up input amps for analog loopback */
10755 /* Amp Indices: DAC = 0, mixer = 1 */
10756 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10757 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10758 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10759 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10760 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10761 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10764 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10765 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10766 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10767 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10768 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10769 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10770 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10772 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10773 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10775 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10776 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10778 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10779 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10780 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10781 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10782 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10783 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10785 /* FIXME: use matrix-type input source selection */
10786 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10787 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10788 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10789 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10790 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10791 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10792 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10793 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10794 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10796 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10797 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10798 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10799 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10800 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10801 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10802 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10804 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10805 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10806 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10807 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10808 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10809 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10810 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10812 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10817 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10819 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10820 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10821 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10823 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10824 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10825 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10826 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10828 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10829 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10830 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10835 #ifdef CONFIG_SND_HDA_POWER_SAVE
10836 #define alc262_loopbacks alc880_loopbacks
10839 /* pcm configuration: identiacal with ALC880 */
10840 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10841 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10842 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10843 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10846 * BIOS auto configuration
10848 static int alc262_parse_auto_config(struct hda_codec *codec)
10850 struct alc_spec *spec = codec->spec;
10852 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10854 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10858 if (!spec->autocfg.line_outs) {
10859 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10860 spec->multiout.max_channels = 2;
10861 spec->no_analog = 1;
10864 return 0; /* can't find valid BIOS pin config */
10866 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10869 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10873 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10876 if (spec->autocfg.dig_outs) {
10877 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10878 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10880 if (spec->autocfg.dig_in_pin)
10881 spec->dig_in_nid = ALC262_DIGIN_NID;
10883 if (spec->kctls.list)
10884 add_mixer(spec, spec->kctls.list);
10886 add_verb(spec, alc262_volume_init_verbs);
10887 spec->num_mux_defs = 1;
10888 spec->input_mux = &spec->private_imux[0];
10890 err = alc_auto_add_mic_boost(codec);
10894 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
10899 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10900 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10901 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10902 #define alc262_auto_init_input_src alc882_auto_init_input_src
10905 /* init callback for auto-configuration model -- overriding the default init */
10906 static void alc262_auto_init(struct hda_codec *codec)
10908 struct alc_spec *spec = codec->spec;
10909 alc262_auto_init_multi_out(codec);
10910 alc262_auto_init_hp_out(codec);
10911 alc262_auto_init_analog_input(codec);
10912 alc262_auto_init_input_src(codec);
10913 if (spec->unsol_event)
10914 alc_inithook(codec);
10918 * configuration and preset
10920 static const char *alc262_models[ALC262_MODEL_LAST] = {
10921 [ALC262_BASIC] = "basic",
10922 [ALC262_HIPPO] = "hippo",
10923 [ALC262_HIPPO_1] = "hippo_1",
10924 [ALC262_FUJITSU] = "fujitsu",
10925 [ALC262_HP_BPC] = "hp-bpc",
10926 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10927 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10928 [ALC262_HP_RP5700] = "hp-rp5700",
10929 [ALC262_BENQ_ED8] = "benq",
10930 [ALC262_BENQ_T31] = "benq-t31",
10931 [ALC262_SONY_ASSAMD] = "sony-assamd",
10932 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10933 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10934 [ALC262_ULTRA] = "ultra",
10935 [ALC262_LENOVO_3000] = "lenovo-3000",
10936 [ALC262_NEC] = "nec",
10937 [ALC262_TYAN] = "tyan",
10938 [ALC262_AUTO] = "auto",
10941 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10942 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10943 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10944 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
10946 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
10948 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
10950 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10951 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10952 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10953 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10954 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10955 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10956 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10957 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10958 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10959 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10960 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10961 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10962 ALC262_HP_TC_T5735),
10963 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10964 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10965 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10966 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10967 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
10968 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
10969 ALC262_SONY_ASSAMD),
10970 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10971 ALC262_TOSHIBA_RX1),
10972 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10973 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10974 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10975 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10976 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
10978 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10979 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10980 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10981 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10982 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10986 static struct alc_config_preset alc262_presets[] = {
10988 .mixers = { alc262_base_mixer },
10989 .init_verbs = { alc262_init_verbs },
10990 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10991 .dac_nids = alc262_dac_nids,
10993 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10994 .channel_mode = alc262_modes,
10995 .input_mux = &alc262_capture_source,
10998 .mixers = { alc262_base_mixer },
10999 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
11000 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11001 .dac_nids = alc262_dac_nids,
11003 .dig_out_nid = ALC262_DIGOUT_NID,
11004 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11005 .channel_mode = alc262_modes,
11006 .input_mux = &alc262_capture_source,
11007 .unsol_event = alc262_hippo_unsol_event,
11008 .init_hook = alc262_hippo_automute,
11010 [ALC262_HIPPO_1] = {
11011 .mixers = { alc262_hippo1_mixer },
11012 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11013 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11014 .dac_nids = alc262_dac_nids,
11016 .dig_out_nid = ALC262_DIGOUT_NID,
11017 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11018 .channel_mode = alc262_modes,
11019 .input_mux = &alc262_capture_source,
11020 .unsol_event = alc262_hippo1_unsol_event,
11021 .init_hook = alc262_hippo1_automute,
11023 [ALC262_FUJITSU] = {
11024 .mixers = { alc262_fujitsu_mixer },
11025 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11026 alc262_fujitsu_unsol_verbs },
11027 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11028 .dac_nids = alc262_dac_nids,
11030 .dig_out_nid = ALC262_DIGOUT_NID,
11031 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11032 .channel_mode = alc262_modes,
11033 .input_mux = &alc262_fujitsu_capture_source,
11034 .unsol_event = alc262_fujitsu_unsol_event,
11035 .init_hook = alc262_fujitsu_init_hook,
11037 [ALC262_HP_BPC] = {
11038 .mixers = { alc262_HP_BPC_mixer },
11039 .init_verbs = { alc262_HP_BPC_init_verbs },
11040 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11041 .dac_nids = alc262_dac_nids,
11043 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11044 .channel_mode = alc262_modes,
11045 .input_mux = &alc262_HP_capture_source,
11046 .unsol_event = alc262_hp_bpc_unsol_event,
11047 .init_hook = alc262_hp_bpc_automute,
11049 [ALC262_HP_BPC_D7000_WF] = {
11050 .mixers = { alc262_HP_BPC_WildWest_mixer },
11051 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11052 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11053 .dac_nids = alc262_dac_nids,
11055 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11056 .channel_mode = alc262_modes,
11057 .input_mux = &alc262_HP_D7000_capture_source,
11058 .unsol_event = alc262_hp_wildwest_unsol_event,
11059 .init_hook = alc262_hp_wildwest_automute,
11061 [ALC262_HP_BPC_D7000_WL] = {
11062 .mixers = { alc262_HP_BPC_WildWest_mixer,
11063 alc262_HP_BPC_WildWest_option_mixer },
11064 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11065 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11066 .dac_nids = alc262_dac_nids,
11068 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11069 .channel_mode = alc262_modes,
11070 .input_mux = &alc262_HP_D7000_capture_source,
11071 .unsol_event = alc262_hp_wildwest_unsol_event,
11072 .init_hook = alc262_hp_wildwest_automute,
11074 [ALC262_HP_TC_T5735] = {
11075 .mixers = { alc262_hp_t5735_mixer },
11076 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11077 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11078 .dac_nids = alc262_dac_nids,
11080 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11081 .channel_mode = alc262_modes,
11082 .input_mux = &alc262_capture_source,
11083 .unsol_event = alc262_hp_t5735_unsol_event,
11084 .init_hook = alc262_hp_t5735_init_hook,
11086 [ALC262_HP_RP5700] = {
11087 .mixers = { alc262_hp_rp5700_mixer },
11088 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11089 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11090 .dac_nids = alc262_dac_nids,
11091 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11092 .channel_mode = alc262_modes,
11093 .input_mux = &alc262_hp_rp5700_capture_source,
11095 [ALC262_BENQ_ED8] = {
11096 .mixers = { alc262_base_mixer },
11097 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11098 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11099 .dac_nids = alc262_dac_nids,
11101 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11102 .channel_mode = alc262_modes,
11103 .input_mux = &alc262_capture_source,
11105 [ALC262_SONY_ASSAMD] = {
11106 .mixers = { alc262_sony_mixer },
11107 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11108 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11109 .dac_nids = alc262_dac_nids,
11111 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11112 .channel_mode = alc262_modes,
11113 .input_mux = &alc262_capture_source,
11114 .unsol_event = alc262_hippo_unsol_event,
11115 .init_hook = alc262_hippo_automute,
11117 [ALC262_BENQ_T31] = {
11118 .mixers = { alc262_benq_t31_mixer },
11119 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
11120 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11121 .dac_nids = alc262_dac_nids,
11123 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11124 .channel_mode = alc262_modes,
11125 .input_mux = &alc262_capture_source,
11126 .unsol_event = alc262_hippo_unsol_event,
11127 .init_hook = alc262_hippo_automute,
11130 .mixers = { alc262_ultra_mixer },
11131 .cap_mixer = alc262_ultra_capture_mixer,
11132 .init_verbs = { alc262_ultra_verbs },
11133 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11134 .dac_nids = alc262_dac_nids,
11135 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11136 .channel_mode = alc262_modes,
11137 .input_mux = &alc262_ultra_capture_source,
11138 .adc_nids = alc262_adc_nids, /* ADC0 */
11139 .capsrc_nids = alc262_capsrc_nids,
11140 .num_adc_nids = 1, /* single ADC */
11141 .unsol_event = alc262_ultra_unsol_event,
11142 .init_hook = alc262_ultra_automute,
11144 [ALC262_LENOVO_3000] = {
11145 .mixers = { alc262_lenovo_3000_mixer },
11146 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11147 alc262_lenovo_3000_unsol_verbs },
11148 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11149 .dac_nids = alc262_dac_nids,
11151 .dig_out_nid = ALC262_DIGOUT_NID,
11152 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11153 .channel_mode = alc262_modes,
11154 .input_mux = &alc262_fujitsu_capture_source,
11155 .unsol_event = alc262_lenovo_3000_unsol_event,
11158 .mixers = { alc262_nec_mixer },
11159 .init_verbs = { alc262_nec_verbs },
11160 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11161 .dac_nids = alc262_dac_nids,
11163 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11164 .channel_mode = alc262_modes,
11165 .input_mux = &alc262_capture_source,
11167 [ALC262_TOSHIBA_S06] = {
11168 .mixers = { alc262_toshiba_s06_mixer },
11169 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11170 alc262_eapd_verbs },
11171 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11172 .capsrc_nids = alc262_dmic_capsrc_nids,
11173 .dac_nids = alc262_dac_nids,
11174 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11175 .dig_out_nid = ALC262_DIGOUT_NID,
11176 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11177 .channel_mode = alc262_modes,
11178 .input_mux = &alc262_dmic_capture_source,
11179 .unsol_event = alc262_toshiba_s06_unsol_event,
11180 .init_hook = alc262_toshiba_s06_init_hook,
11182 [ALC262_TOSHIBA_RX1] = {
11183 .mixers = { alc262_toshiba_rx1_mixer },
11184 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11185 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11186 .dac_nids = alc262_dac_nids,
11188 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11189 .channel_mode = alc262_modes,
11190 .input_mux = &alc262_capture_source,
11191 .unsol_event = alc262_hippo_unsol_event,
11192 .init_hook = alc262_hippo_automute,
11195 .mixers = { alc262_tyan_mixer },
11196 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11197 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11198 .dac_nids = alc262_dac_nids,
11200 .dig_out_nid = ALC262_DIGOUT_NID,
11201 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11202 .channel_mode = alc262_modes,
11203 .input_mux = &alc262_capture_source,
11204 .unsol_event = alc262_tyan_unsol_event,
11205 .init_hook = alc262_tyan_automute,
11209 static int patch_alc262(struct hda_codec *codec)
11211 struct alc_spec *spec;
11215 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11219 codec->spec = spec;
11221 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11226 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11227 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11228 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11229 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11233 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11235 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11239 if (board_config < 0) {
11240 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
11241 "trying auto-probe from BIOS...\n");
11242 board_config = ALC262_AUTO;
11245 if (board_config == ALC262_AUTO) {
11246 /* automatic parse from the BIOS config */
11247 err = alc262_parse_auto_config(codec);
11253 "hda_codec: Cannot set up configuration "
11254 "from BIOS. Using base mode...\n");
11255 board_config = ALC262_BASIC;
11259 if (!spec->no_analog) {
11260 err = snd_hda_attach_beep_device(codec, 0x1);
11267 if (board_config != ALC262_AUTO)
11268 setup_preset(spec, &alc262_presets[board_config]);
11270 spec->stream_name_analog = "ALC262 Analog";
11271 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11272 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11274 spec->stream_name_digital = "ALC262 Digital";
11275 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11276 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11278 spec->capture_style = CAPT_MIX;
11279 if (!spec->adc_nids && spec->input_mux) {
11280 /* check whether NID 0x07 is valid */
11281 unsigned int wcap = get_wcaps(codec, 0x07);
11284 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11285 if (wcap != AC_WID_AUD_IN) {
11286 spec->adc_nids = alc262_adc_nids_alt;
11287 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11288 spec->capsrc_nids = alc262_capsrc_nids_alt;
11290 spec->adc_nids = alc262_adc_nids;
11291 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11292 spec->capsrc_nids = alc262_capsrc_nids;
11295 if (!spec->cap_mixer && !spec->no_analog)
11296 set_capture_mixer(spec);
11297 if (!spec->no_analog)
11298 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11300 spec->vmaster_nid = 0x0c;
11302 codec->patch_ops = alc_patch_ops;
11303 if (board_config == ALC262_AUTO)
11304 spec->init_hook = alc262_auto_init;
11305 #ifdef CONFIG_SND_HDA_POWER_SAVE
11306 if (!spec->loopback.amplist)
11307 spec->loopback.amplist = alc262_loopbacks;
11309 codec->proc_widget_hook = print_realtek_coef;
11315 * ALC268 channel source setting (2 channel)
11317 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11318 #define alc268_modes alc260_modes
11320 static hda_nid_t alc268_dac_nids[2] = {
11325 static hda_nid_t alc268_adc_nids[2] = {
11330 static hda_nid_t alc268_adc_nids_alt[1] = {
11335 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11337 static struct snd_kcontrol_new alc268_base_mixer[] = {
11338 /* output mixer control */
11339 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11340 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11341 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11342 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11343 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11344 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11345 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11349 /* bind Beep switches of both NID 0x0f and 0x10 */
11350 static struct hda_bind_ctls alc268_bind_beep_sw = {
11351 .ops = &snd_hda_bind_sw,
11353 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11354 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11359 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11360 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11361 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11365 static struct hda_verb alc268_eapd_verbs[] = {
11366 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11367 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11371 /* Toshiba specific */
11372 #define alc268_toshiba_automute alc262_hippo_automute
11374 static struct hda_verb alc268_toshiba_verbs[] = {
11375 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11379 static struct hda_input_mux alc268_acer_lc_capture_source = {
11387 /* Acer specific */
11388 /* bind volumes of both NID 0x02 and 0x03 */
11389 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11390 .ops = &snd_hda_bind_vol,
11392 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11393 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11398 /* mute/unmute internal speaker according to the hp jack and mute state */
11399 static void alc268_acer_automute(struct hda_codec *codec, int force)
11401 struct alc_spec *spec = codec->spec;
11404 if (force || !spec->sense_updated) {
11405 unsigned int present;
11406 present = snd_hda_codec_read(codec, 0x14, 0,
11407 AC_VERB_GET_PIN_SENSE, 0);
11408 spec->jack_present = (present & 0x80000000) != 0;
11409 spec->sense_updated = 1;
11411 if (spec->jack_present)
11412 mute = HDA_AMP_MUTE; /* mute internal speaker */
11413 else /* unmute internal speaker if necessary */
11414 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11415 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11416 HDA_AMP_MUTE, mute);
11420 /* bind hp and internal speaker mute (with plug check) */
11421 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11422 struct snd_ctl_elem_value *ucontrol)
11424 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11425 long *valp = ucontrol->value.integer.value;
11428 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11430 valp[0] ? 0 : HDA_AMP_MUTE);
11431 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11433 valp[1] ? 0 : HDA_AMP_MUTE);
11435 alc268_acer_automute(codec, 0);
11439 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11440 /* output mixer control */
11441 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11444 .name = "Master Playback Switch",
11445 .info = snd_hda_mixer_amp_switch_info,
11446 .get = snd_hda_mixer_amp_switch_get,
11447 .put = alc268_acer_master_sw_put,
11448 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11450 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11454 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11455 /* output mixer control */
11456 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11458 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11459 .name = "Master Playback Switch",
11460 .info = snd_hda_mixer_amp_switch_info,
11461 .get = snd_hda_mixer_amp_switch_get,
11462 .put = alc268_acer_master_sw_put,
11463 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11465 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11466 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11467 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11471 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11472 /* output mixer control */
11473 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11475 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11476 .name = "Master Playback Switch",
11477 .info = snd_hda_mixer_amp_switch_info,
11478 .get = snd_hda_mixer_amp_switch_get,
11479 .put = alc268_acer_master_sw_put,
11480 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11482 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11483 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11487 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11488 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11489 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11490 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11491 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11492 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11493 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11497 static struct hda_verb alc268_acer_verbs[] = {
11498 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11499 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11500 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11501 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11502 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11503 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11504 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11508 /* unsolicited event for HP jack sensing */
11509 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11512 if ((res >> 26) != ALC880_HP_EVENT)
11514 alc268_toshiba_automute(codec);
11517 static void alc268_acer_unsol_event(struct hda_codec *codec,
11520 if ((res >> 26) != ALC880_HP_EVENT)
11522 alc268_acer_automute(codec, 1);
11525 static void alc268_acer_init_hook(struct hda_codec *codec)
11527 alc268_acer_automute(codec, 1);
11530 /* toggle speaker-output according to the hp-jack state */
11531 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11533 unsigned int present;
11534 unsigned char bits;
11536 present = snd_hda_codec_read(codec, 0x15, 0,
11537 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11538 bits = present ? AMP_IN_MUTE(0) : 0;
11539 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11540 AMP_IN_MUTE(0), bits);
11541 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11542 AMP_IN_MUTE(0), bits);
11546 static void alc268_acer_mic_automute(struct hda_codec *codec)
11548 unsigned int present;
11550 present = snd_hda_codec_read(codec, 0x18, 0,
11551 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11552 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11553 present ? 0x0 : 0x6);
11556 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11559 if ((res >> 26) == ALC880_HP_EVENT)
11560 alc268_aspire_one_speaker_automute(codec);
11561 if ((res >> 26) == ALC880_MIC_EVENT)
11562 alc268_acer_mic_automute(codec);
11565 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11567 alc268_aspire_one_speaker_automute(codec);
11568 alc268_acer_mic_automute(codec);
11571 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11572 /* output mixer control */
11573 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11574 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11575 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11576 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11577 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11578 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11582 static struct hda_verb alc268_dell_verbs[] = {
11583 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11584 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11585 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11589 /* mute/unmute internal speaker according to the hp jack and mute state */
11590 static void alc268_dell_automute(struct hda_codec *codec)
11592 unsigned int present;
11595 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11596 if (present & 0x80000000)
11597 mute = HDA_AMP_MUTE;
11599 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11600 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11601 HDA_AMP_MUTE, mute);
11604 static void alc268_dell_unsol_event(struct hda_codec *codec,
11607 if ((res >> 26) != ALC880_HP_EVENT)
11609 alc268_dell_automute(codec);
11612 #define alc268_dell_init_hook alc268_dell_automute
11614 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11615 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11616 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11617 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11618 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11619 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11620 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11621 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11622 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11626 static struct hda_verb alc267_quanta_il1_verbs[] = {
11627 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11628 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11632 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11634 unsigned int present;
11636 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11637 & AC_PINSENSE_PRESENCE;
11638 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11639 present ? 0 : PIN_OUT);
11642 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11644 unsigned int present;
11646 present = snd_hda_codec_read(codec, 0x18, 0,
11647 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11648 snd_hda_codec_write(codec, 0x23, 0,
11649 AC_VERB_SET_CONNECT_SEL,
11650 present ? 0x00 : 0x01);
11653 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11655 alc267_quanta_il1_hp_automute(codec);
11656 alc267_quanta_il1_mic_automute(codec);
11659 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11662 switch (res >> 26) {
11663 case ALC880_HP_EVENT:
11664 alc267_quanta_il1_hp_automute(codec);
11666 case ALC880_MIC_EVENT:
11667 alc267_quanta_il1_mic_automute(codec);
11673 * generic initialization of ADC, input mixers and output mixers
11675 static struct hda_verb alc268_base_init_verbs[] = {
11676 /* Unmute DAC0-1 and set vol = 0 */
11677 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11678 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11681 * Set up output mixers (0x0c - 0x0e)
11683 /* set vol=0 to output mixers */
11684 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11685 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11687 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11688 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11690 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11691 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11692 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11693 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11694 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11695 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11696 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11697 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11699 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11700 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11701 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11702 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11703 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11705 /* set PCBEEP vol = 0, mute connections */
11706 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11707 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11708 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11710 /* Unmute Selector 23h,24h and set the default input to mic-in */
11712 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11713 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11714 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11715 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11721 * generic initialization of ADC, input mixers and output mixers
11723 static struct hda_verb alc268_volume_init_verbs[] = {
11724 /* set output DAC */
11725 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11726 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11728 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11729 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11730 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11731 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11732 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11734 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11735 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11736 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11738 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11739 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11741 /* set PCBEEP vol = 0, mute connections */
11742 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11743 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11744 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11749 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11750 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11751 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11753 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11754 /* The multiple "Capture Source" controls confuse alsamixer
11755 * So call somewhat different..
11757 /* .name = "Capture Source", */
11758 .name = "Input Source",
11760 .info = alc_mux_enum_info,
11761 .get = alc_mux_enum_get,
11762 .put = alc_mux_enum_put,
11767 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11768 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11769 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11770 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11771 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11773 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11774 /* The multiple "Capture Source" controls confuse alsamixer
11775 * So call somewhat different..
11777 /* .name = "Capture Source", */
11778 .name = "Input Source",
11780 .info = alc_mux_enum_info,
11781 .get = alc_mux_enum_get,
11782 .put = alc_mux_enum_put,
11787 static struct hda_input_mux alc268_capture_source = {
11791 { "Front Mic", 0x1 },
11797 static struct hda_input_mux alc268_acer_capture_source = {
11801 { "Internal Mic", 0x1 },
11806 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11810 { "Internal Mic", 0x6 },
11815 #ifdef CONFIG_SND_DEBUG
11816 static struct snd_kcontrol_new alc268_test_mixer[] = {
11817 /* Volume widgets */
11818 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11819 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11820 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11821 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11822 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11823 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11824 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11825 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11826 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11827 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11828 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11829 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11830 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11831 /* The below appears problematic on some hardwares */
11832 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11833 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11834 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11835 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11836 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11838 /* Modes for retasking pin widgets */
11839 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11840 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11841 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11842 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11844 /* Controls for GPIO pins, assuming they are configured as outputs */
11845 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11846 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11847 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11848 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11850 /* Switches to allow the digital SPDIF output pin to be enabled.
11851 * The ALC268 does not have an SPDIF input.
11853 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11855 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11856 * this output to turn on an external amplifier.
11858 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11859 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11865 /* create input playback/capture controls for the given pin */
11866 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11867 const char *ctlname, int idx)
11872 sprintf(name, "%s Playback Volume", ctlname);
11874 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11875 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11879 } else if (nid == 0x15) {
11880 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11881 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11887 sprintf(name, "%s Playback Switch", ctlname);
11888 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11889 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11895 /* add playback controls from the parsed DAC table */
11896 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11897 const struct auto_pin_cfg *cfg)
11902 spec->multiout.num_dacs = 2; /* only use one dac */
11903 spec->multiout.dac_nids = spec->private_dac_nids;
11904 spec->multiout.dac_nids[0] = 2;
11905 spec->multiout.dac_nids[1] = 3;
11907 nid = cfg->line_out_pins[0];
11909 alc268_new_analog_output(spec, nid, "Front", 0);
11911 nid = cfg->speaker_pins[0];
11913 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11914 "Speaker Playback Volume",
11915 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11919 nid = cfg->hp_pins[0];
11921 alc268_new_analog_output(spec, nid, "Headphone", 0);
11923 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11925 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11926 "Mono Playback Switch",
11927 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11934 /* create playback/capture controls for input pins */
11935 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11936 const struct auto_pin_cfg *cfg)
11938 struct hda_input_mux *imux = &spec->private_imux[0];
11941 for (i = 0; i < AUTO_PIN_LAST; i++) {
11942 switch(cfg->input_pins[i]) {
11944 idx1 = 0; /* Mic 1 */
11947 idx1 = 1; /* Mic 2 */
11950 idx1 = 2; /* Line In */
11957 idx1 = 6; /* digital mics */
11962 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11963 imux->items[imux->num_items].index = idx1;
11969 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11971 struct alc_spec *spec = codec->spec;
11972 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11973 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11974 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11975 unsigned int dac_vol1, dac_vol2;
11978 snd_hda_codec_write(codec, speaker_nid, 0,
11979 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11980 snd_hda_codec_write(codec, 0x0f, 0,
11981 AC_VERB_SET_AMP_GAIN_MUTE,
11983 snd_hda_codec_write(codec, 0x10, 0,
11984 AC_VERB_SET_AMP_GAIN_MUTE,
11987 snd_hda_codec_write(codec, 0x0f, 0,
11988 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11989 snd_hda_codec_write(codec, 0x10, 0,
11990 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11993 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11994 if (line_nid == 0x14)
11995 dac_vol2 = AMP_OUT_ZERO;
11996 else if (line_nid == 0x15)
11997 dac_vol1 = AMP_OUT_ZERO;
11998 if (hp_nid == 0x14)
11999 dac_vol2 = AMP_OUT_ZERO;
12000 else if (hp_nid == 0x15)
12001 dac_vol1 = AMP_OUT_ZERO;
12002 if (line_nid != 0x16 || hp_nid != 0x16 ||
12003 spec->autocfg.line_out_pins[1] != 0x16 ||
12004 spec->autocfg.line_out_pins[2] != 0x16)
12005 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12007 snd_hda_codec_write(codec, 0x02, 0,
12008 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12009 snd_hda_codec_write(codec, 0x03, 0,
12010 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12013 /* pcm configuration: identiacal with ALC880 */
12014 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12015 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12016 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12017 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12020 * BIOS auto configuration
12022 static int alc268_parse_auto_config(struct hda_codec *codec)
12024 struct alc_spec *spec = codec->spec;
12026 static hda_nid_t alc268_ignore[] = { 0 };
12028 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12032 if (!spec->autocfg.line_outs) {
12033 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12034 spec->multiout.max_channels = 2;
12035 spec->no_analog = 1;
12038 return 0; /* can't find valid BIOS pin config */
12040 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12043 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
12047 spec->multiout.max_channels = 2;
12050 /* digital only support output */
12051 if (spec->autocfg.dig_outs) {
12052 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12053 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12055 if (spec->kctls.list)
12056 add_mixer(spec, spec->kctls.list);
12058 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12059 add_mixer(spec, alc268_beep_mixer);
12061 add_verb(spec, alc268_volume_init_verbs);
12062 spec->num_mux_defs = 1;
12063 spec->input_mux = &spec->private_imux[0];
12065 err = alc_auto_add_mic_boost(codec);
12072 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12073 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12074 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12076 /* init callback for auto-configuration model -- overriding the default init */
12077 static void alc268_auto_init(struct hda_codec *codec)
12079 struct alc_spec *spec = codec->spec;
12080 alc268_auto_init_multi_out(codec);
12081 alc268_auto_init_hp_out(codec);
12082 alc268_auto_init_mono_speaker_out(codec);
12083 alc268_auto_init_analog_input(codec);
12084 if (spec->unsol_event)
12085 alc_inithook(codec);
12089 * configuration and preset
12091 static const char *alc268_models[ALC268_MODEL_LAST] = {
12092 [ALC267_QUANTA_IL1] = "quanta-il1",
12093 [ALC268_3ST] = "3stack",
12094 [ALC268_TOSHIBA] = "toshiba",
12095 [ALC268_ACER] = "acer",
12096 [ALC268_ACER_DMIC] = "acer-dmic",
12097 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12098 [ALC268_DELL] = "dell",
12099 [ALC268_ZEPTO] = "zepto",
12100 #ifdef CONFIG_SND_DEBUG
12101 [ALC268_TEST] = "test",
12103 [ALC268_AUTO] = "auto",
12106 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12107 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12108 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12109 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12110 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12111 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12112 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12113 ALC268_ACER_ASPIRE_ONE),
12114 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12115 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12116 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
12117 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12118 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
12119 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
12120 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
12121 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12122 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12123 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12124 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12128 static struct alc_config_preset alc268_presets[] = {
12129 [ALC267_QUANTA_IL1] = {
12130 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12131 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12132 alc267_quanta_il1_verbs },
12133 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12134 .dac_nids = alc268_dac_nids,
12135 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12136 .adc_nids = alc268_adc_nids_alt,
12138 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12139 .channel_mode = alc268_modes,
12140 .input_mux = &alc268_capture_source,
12141 .unsol_event = alc267_quanta_il1_unsol_event,
12142 .init_hook = alc267_quanta_il1_automute,
12145 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12146 alc268_beep_mixer },
12147 .init_verbs = { alc268_base_init_verbs },
12148 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12149 .dac_nids = alc268_dac_nids,
12150 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12151 .adc_nids = alc268_adc_nids_alt,
12152 .capsrc_nids = alc268_capsrc_nids,
12154 .dig_out_nid = ALC268_DIGOUT_NID,
12155 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12156 .channel_mode = alc268_modes,
12157 .input_mux = &alc268_capture_source,
12159 [ALC268_TOSHIBA] = {
12160 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12161 alc268_beep_mixer },
12162 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12163 alc268_toshiba_verbs },
12164 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12165 .dac_nids = alc268_dac_nids,
12166 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12167 .adc_nids = alc268_adc_nids_alt,
12168 .capsrc_nids = alc268_capsrc_nids,
12170 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12171 .channel_mode = alc268_modes,
12172 .input_mux = &alc268_capture_source,
12173 .unsol_event = alc268_toshiba_unsol_event,
12174 .init_hook = alc268_toshiba_automute,
12177 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12178 alc268_beep_mixer },
12179 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12180 alc268_acer_verbs },
12181 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12182 .dac_nids = alc268_dac_nids,
12183 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12184 .adc_nids = alc268_adc_nids_alt,
12185 .capsrc_nids = alc268_capsrc_nids,
12187 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12188 .channel_mode = alc268_modes,
12189 .input_mux = &alc268_acer_capture_source,
12190 .unsol_event = alc268_acer_unsol_event,
12191 .init_hook = alc268_acer_init_hook,
12193 [ALC268_ACER_DMIC] = {
12194 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12195 alc268_beep_mixer },
12196 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12197 alc268_acer_verbs },
12198 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12199 .dac_nids = alc268_dac_nids,
12200 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12201 .adc_nids = alc268_adc_nids_alt,
12202 .capsrc_nids = alc268_capsrc_nids,
12204 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12205 .channel_mode = alc268_modes,
12206 .input_mux = &alc268_acer_dmic_capture_source,
12207 .unsol_event = alc268_acer_unsol_event,
12208 .init_hook = alc268_acer_init_hook,
12210 [ALC268_ACER_ASPIRE_ONE] = {
12211 .mixers = { alc268_acer_aspire_one_mixer,
12213 alc268_capture_alt_mixer },
12214 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12215 alc268_acer_aspire_one_verbs },
12216 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12217 .dac_nids = alc268_dac_nids,
12218 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12219 .adc_nids = alc268_adc_nids_alt,
12220 .capsrc_nids = alc268_capsrc_nids,
12222 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12223 .channel_mode = alc268_modes,
12224 .input_mux = &alc268_acer_lc_capture_source,
12225 .unsol_event = alc268_acer_lc_unsol_event,
12226 .init_hook = alc268_acer_lc_init_hook,
12229 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12230 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12231 alc268_dell_verbs },
12232 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12233 .dac_nids = alc268_dac_nids,
12235 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12236 .channel_mode = alc268_modes,
12237 .unsol_event = alc268_dell_unsol_event,
12238 .init_hook = alc268_dell_init_hook,
12239 .input_mux = &alc268_capture_source,
12242 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12243 alc268_beep_mixer },
12244 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12245 alc268_toshiba_verbs },
12246 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12247 .dac_nids = alc268_dac_nids,
12248 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12249 .adc_nids = alc268_adc_nids_alt,
12250 .capsrc_nids = alc268_capsrc_nids,
12252 .dig_out_nid = ALC268_DIGOUT_NID,
12253 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12254 .channel_mode = alc268_modes,
12255 .input_mux = &alc268_capture_source,
12256 .unsol_event = alc268_toshiba_unsol_event,
12257 .init_hook = alc268_toshiba_automute
12259 #ifdef CONFIG_SND_DEBUG
12261 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12262 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12263 alc268_volume_init_verbs },
12264 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12265 .dac_nids = alc268_dac_nids,
12266 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12267 .adc_nids = alc268_adc_nids_alt,
12268 .capsrc_nids = alc268_capsrc_nids,
12270 .dig_out_nid = ALC268_DIGOUT_NID,
12271 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12272 .channel_mode = alc268_modes,
12273 .input_mux = &alc268_capture_source,
12278 static int patch_alc268(struct hda_codec *codec)
12280 struct alc_spec *spec;
12282 int i, has_beep, err;
12284 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12288 codec->spec = spec;
12290 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12294 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12295 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
12296 "trying auto-probe from BIOS...\n");
12297 board_config = ALC268_AUTO;
12300 if (board_config == ALC268_AUTO) {
12301 /* automatic parse from the BIOS config */
12302 err = alc268_parse_auto_config(codec);
12308 "hda_codec: Cannot set up configuration "
12309 "from BIOS. Using base mode...\n");
12310 board_config = ALC268_3ST;
12314 if (board_config != ALC268_AUTO)
12315 setup_preset(spec, &alc268_presets[board_config]);
12317 if (codec->vendor_id == 0x10ec0267) {
12318 spec->stream_name_analog = "ALC267 Analog";
12319 spec->stream_name_digital = "ALC267 Digital";
12321 spec->stream_name_analog = "ALC268 Analog";
12322 spec->stream_name_digital = "ALC268 Digital";
12325 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12326 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12327 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12329 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12332 for (i = 0; i < spec->num_mixers; i++) {
12333 if (spec->mixers[i] == alc268_beep_mixer) {
12340 err = snd_hda_attach_beep_device(codec, 0x1);
12345 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12346 /* override the amp caps for beep generator */
12347 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12348 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12349 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12350 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12351 (0 << AC_AMPCAP_MUTE_SHIFT));
12354 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12355 /* check whether NID 0x07 is valid */
12356 unsigned int wcap = get_wcaps(codec, 0x07);
12360 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12361 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12362 spec->adc_nids = alc268_adc_nids_alt;
12363 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12364 add_mixer(spec, alc268_capture_alt_mixer);
12366 spec->adc_nids = alc268_adc_nids;
12367 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12368 add_mixer(spec, alc268_capture_mixer);
12370 spec->capsrc_nids = alc268_capsrc_nids;
12371 /* set default input source */
12372 for (i = 0; i < spec->num_adc_nids; i++)
12373 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12374 0, AC_VERB_SET_CONNECT_SEL,
12375 spec->input_mux->items[0].index);
12378 spec->vmaster_nid = 0x02;
12380 codec->patch_ops = alc_patch_ops;
12381 if (board_config == ALC268_AUTO)
12382 spec->init_hook = alc268_auto_init;
12384 codec->proc_widget_hook = print_realtek_coef;
12390 * ALC269 channel source setting (2 channel)
12392 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12394 #define alc269_dac_nids alc260_dac_nids
12396 static hda_nid_t alc269_adc_nids[1] = {
12401 static hda_nid_t alc269_capsrc_nids[1] = {
12405 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12409 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12417 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12425 #define alc269_modes alc260_modes
12426 #define alc269_capture_source alc880_lg_lw_capture_source
12428 static struct snd_kcontrol_new alc269_base_mixer[] = {
12429 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12430 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12431 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12432 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12435 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12436 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12437 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12438 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12439 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12440 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12444 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12445 /* output mixer control */
12446 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12448 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12449 .name = "Master Playback Switch",
12450 .info = snd_hda_mixer_amp_switch_info,
12451 .get = snd_hda_mixer_amp_switch_get,
12452 .put = alc268_acer_master_sw_put,
12453 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12455 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12456 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12457 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12458 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12459 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12460 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12464 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12465 /* output mixer control */
12466 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12468 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12469 .name = "Master Playback Switch",
12470 .info = snd_hda_mixer_amp_switch_info,
12471 .get = snd_hda_mixer_amp_switch_get,
12472 .put = alc268_acer_master_sw_put,
12473 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12475 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12476 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12477 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12478 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12479 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12480 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12481 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12482 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12483 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12487 /* bind volumes of both NID 0x0c and 0x0d */
12488 static struct hda_bind_ctls alc269_epc_bind_vol = {
12489 .ops = &snd_hda_bind_vol,
12491 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12492 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12497 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12498 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12499 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12500 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12504 /* capture mixer elements */
12505 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12506 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12507 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12508 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12513 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12514 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12515 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12516 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12520 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12521 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12522 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12523 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12524 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12525 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12526 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12530 static struct hda_verb alc269_lifebook_verbs[] = {
12531 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12532 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12533 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12534 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12535 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12536 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12537 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12538 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12539 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12540 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12544 /* toggle speaker-output according to the hp-jack state */
12545 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12547 unsigned int present;
12548 unsigned char bits;
12550 present = snd_hda_codec_read(codec, 0x15, 0,
12551 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12552 bits = present ? AMP_IN_MUTE(0) : 0;
12553 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12554 AMP_IN_MUTE(0), bits);
12555 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12556 AMP_IN_MUTE(0), bits);
12558 snd_hda_codec_write(codec, 0x20, 0,
12559 AC_VERB_SET_COEF_INDEX, 0x0c);
12560 snd_hda_codec_write(codec, 0x20, 0,
12561 AC_VERB_SET_PROC_COEF, 0x680);
12563 snd_hda_codec_write(codec, 0x20, 0,
12564 AC_VERB_SET_COEF_INDEX, 0x0c);
12565 snd_hda_codec_write(codec, 0x20, 0,
12566 AC_VERB_SET_PROC_COEF, 0x480);
12569 /* toggle speaker-output according to the hp-jacks state */
12570 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12572 unsigned int present;
12573 unsigned char bits;
12575 /* Check laptop headphone socket */
12576 present = snd_hda_codec_read(codec, 0x15, 0,
12577 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12579 /* Check port replicator headphone socket */
12580 present |= snd_hda_codec_read(codec, 0x1a, 0,
12581 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12583 bits = present ? AMP_IN_MUTE(0) : 0;
12584 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12585 AMP_IN_MUTE(0), bits);
12586 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12587 AMP_IN_MUTE(0), bits);
12589 snd_hda_codec_write(codec, 0x20, 0,
12590 AC_VERB_SET_COEF_INDEX, 0x0c);
12591 snd_hda_codec_write(codec, 0x20, 0,
12592 AC_VERB_SET_PROC_COEF, 0x680);
12594 snd_hda_codec_write(codec, 0x20, 0,
12595 AC_VERB_SET_COEF_INDEX, 0x0c);
12596 snd_hda_codec_write(codec, 0x20, 0,
12597 AC_VERB_SET_PROC_COEF, 0x480);
12600 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12602 unsigned int present;
12604 present = snd_hda_codec_read(codec, 0x18, 0,
12605 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12606 snd_hda_codec_write(codec, 0x23, 0,
12607 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12610 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12612 unsigned int present_laptop;
12613 unsigned int present_dock;
12615 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12616 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12618 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12619 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12621 /* Laptop mic port overrides dock mic port, design decision */
12623 snd_hda_codec_write(codec, 0x23, 0,
12624 AC_VERB_SET_CONNECT_SEL, 0x3);
12625 if (present_laptop)
12626 snd_hda_codec_write(codec, 0x23, 0,
12627 AC_VERB_SET_CONNECT_SEL, 0x0);
12628 if (!present_dock && !present_laptop)
12629 snd_hda_codec_write(codec, 0x23, 0,
12630 AC_VERB_SET_CONNECT_SEL, 0x1);
12633 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12636 if ((res >> 26) == ALC880_HP_EVENT)
12637 alc269_quanta_fl1_speaker_automute(codec);
12638 if ((res >> 26) == ALC880_MIC_EVENT)
12639 alc269_quanta_fl1_mic_automute(codec);
12642 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12645 if ((res >> 26) == ALC880_HP_EVENT)
12646 alc269_lifebook_speaker_automute(codec);
12647 if ((res >> 26) == ALC880_MIC_EVENT)
12648 alc269_lifebook_mic_autoswitch(codec);
12651 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12653 alc269_quanta_fl1_speaker_automute(codec);
12654 alc269_quanta_fl1_mic_automute(codec);
12657 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12659 alc269_lifebook_speaker_automute(codec);
12660 alc269_lifebook_mic_autoswitch(codec);
12663 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12664 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12665 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12666 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12667 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12668 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12669 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12670 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12674 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12675 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12676 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12677 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12678 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12679 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12680 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12684 /* toggle speaker-output according to the hp-jack state */
12685 static void alc269_speaker_automute(struct hda_codec *codec)
12687 unsigned int present;
12688 unsigned char bits;
12690 present = snd_hda_codec_read(codec, 0x15, 0,
12691 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12692 bits = present ? AMP_IN_MUTE(0) : 0;
12693 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12694 AMP_IN_MUTE(0), bits);
12695 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12696 AMP_IN_MUTE(0), bits);
12699 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12701 unsigned int present;
12703 present = snd_hda_codec_read(codec, 0x18, 0,
12704 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12705 snd_hda_codec_write(codec, 0x23, 0,
12706 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12709 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12711 unsigned int present;
12713 present = snd_hda_codec_read(codec, 0x18, 0,
12714 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12715 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12716 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12717 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12718 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12721 /* unsolicited event for HP jack sensing */
12722 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12725 if ((res >> 26) == ALC880_HP_EVENT)
12726 alc269_speaker_automute(codec);
12728 if ((res >> 26) == ALC880_MIC_EVENT)
12729 alc269_eeepc_dmic_automute(codec);
12732 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12734 alc269_speaker_automute(codec);
12735 alc269_eeepc_dmic_automute(codec);
12738 /* unsolicited event for HP jack sensing */
12739 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12742 if ((res >> 26) == ALC880_HP_EVENT)
12743 alc269_speaker_automute(codec);
12745 if ((res >> 26) == ALC880_MIC_EVENT)
12746 alc269_eeepc_amic_automute(codec);
12749 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12751 alc269_speaker_automute(codec);
12752 alc269_eeepc_amic_automute(codec);
12756 * generic initialization of ADC, input mixers and output mixers
12758 static struct hda_verb alc269_init_verbs[] = {
12760 * Unmute ADC0 and set the default input to mic-in
12762 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12764 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12765 * analog-loopback mixer widget
12766 * Note: PASD motherboards uses the Line In 2 as the input for
12767 * front panel mic (mic 2)
12769 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12770 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12771 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12772 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12773 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12774 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12777 * Set up output mixers (0x0c - 0x0e)
12779 /* set vol=0 to output mixers */
12780 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12781 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12783 /* set up input amps for analog loopback */
12784 /* Amp Indices: DAC = 0, mixer = 1 */
12785 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12786 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12787 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12788 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12789 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12790 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12792 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12793 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12794 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12795 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12796 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12797 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12798 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12800 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12802 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12803 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12804 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12805 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12806 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12808 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12809 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12811 /* FIXME: use matrix-type input source selection */
12812 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12813 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12814 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12815 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12816 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12817 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12820 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12821 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12825 /* add playback controls from the parsed DAC table */
12826 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12827 const struct auto_pin_cfg *cfg)
12832 spec->multiout.num_dacs = 1; /* only use one dac */
12833 spec->multiout.dac_nids = spec->private_dac_nids;
12834 spec->multiout.dac_nids[0] = 2;
12836 nid = cfg->line_out_pins[0];
12838 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12839 "Front Playback Volume",
12840 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12843 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12844 "Front Playback Switch",
12845 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12850 nid = cfg->speaker_pins[0];
12852 if (!cfg->line_out_pins[0]) {
12853 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12854 "Speaker Playback Volume",
12855 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12861 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12862 "Speaker Playback Switch",
12863 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12868 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12869 "Speaker Playback Switch",
12870 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12876 nid = cfg->hp_pins[0];
12878 /* spec->multiout.hp_nid = 2; */
12879 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12880 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12881 "Headphone Playback Volume",
12882 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12888 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12889 "Headphone Playback Switch",
12890 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12895 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12896 "Headphone Playback Switch",
12897 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12906 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12907 const struct auto_pin_cfg *cfg)
12911 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12914 /* digital-mic input pin is excluded in alc880_auto_create..()
12915 * because it's under 0x18
12917 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12918 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12919 struct hda_input_mux *imux = &spec->private_imux[0];
12920 imux->items[imux->num_items].label = "Int Mic";
12921 imux->items[imux->num_items].index = 0x05;
12927 #ifdef CONFIG_SND_HDA_POWER_SAVE
12928 #define alc269_loopbacks alc880_loopbacks
12931 /* pcm configuration: identiacal with ALC880 */
12932 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12933 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12934 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12935 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12937 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
12941 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12942 /* NID is set in alc_build_pcms */
12944 .open = alc880_playback_pcm_open,
12945 .prepare = alc880_playback_pcm_prepare,
12946 .cleanup = alc880_playback_pcm_cleanup
12950 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
12954 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12955 /* NID is set in alc_build_pcms */
12959 * BIOS auto configuration
12961 static int alc269_parse_auto_config(struct hda_codec *codec)
12963 struct alc_spec *spec = codec->spec;
12965 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12967 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12972 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12975 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12979 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12981 if (spec->autocfg.dig_outs)
12982 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12984 if (spec->kctls.list)
12985 add_mixer(spec, spec->kctls.list);
12987 add_verb(spec, alc269_init_verbs);
12988 spec->num_mux_defs = 1;
12989 spec->input_mux = &spec->private_imux[0];
12990 /* set default input source */
12991 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12992 0, AC_VERB_SET_CONNECT_SEL,
12993 spec->input_mux->items[0].index);
12995 err = alc_auto_add_mic_boost(codec);
12999 if (!spec->cap_mixer && !spec->no_analog)
13000 set_capture_mixer(spec);
13005 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13006 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13007 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13010 /* init callback for auto-configuration model -- overriding the default init */
13011 static void alc269_auto_init(struct hda_codec *codec)
13013 struct alc_spec *spec = codec->spec;
13014 alc269_auto_init_multi_out(codec);
13015 alc269_auto_init_hp_out(codec);
13016 alc269_auto_init_analog_input(codec);
13017 if (spec->unsol_event)
13018 alc_inithook(codec);
13022 * configuration and preset
13024 static const char *alc269_models[ALC269_MODEL_LAST] = {
13025 [ALC269_BASIC] = "basic",
13026 [ALC269_QUANTA_FL1] = "quanta",
13027 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13028 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13029 [ALC269_FUJITSU] = "fujitsu",
13030 [ALC269_LIFEBOOK] = "lifebook"
13033 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13034 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13035 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13036 ALC269_ASUS_EEEPC_P703),
13037 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13038 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13039 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13040 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13041 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13042 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13043 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13044 ALC269_ASUS_EEEPC_P901),
13045 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13046 ALC269_ASUS_EEEPC_P901),
13047 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13048 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13049 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13053 static struct alc_config_preset alc269_presets[] = {
13055 .mixers = { alc269_base_mixer },
13056 .init_verbs = { alc269_init_verbs },
13057 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13058 .dac_nids = alc269_dac_nids,
13060 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13061 .channel_mode = alc269_modes,
13062 .input_mux = &alc269_capture_source,
13064 [ALC269_QUANTA_FL1] = {
13065 .mixers = { alc269_quanta_fl1_mixer },
13066 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13067 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13068 .dac_nids = alc269_dac_nids,
13070 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13071 .channel_mode = alc269_modes,
13072 .input_mux = &alc269_capture_source,
13073 .unsol_event = alc269_quanta_fl1_unsol_event,
13074 .init_hook = alc269_quanta_fl1_init_hook,
13076 [ALC269_ASUS_EEEPC_P703] = {
13077 .mixers = { alc269_eeepc_mixer },
13078 .cap_mixer = alc269_epc_capture_mixer,
13079 .init_verbs = { alc269_init_verbs,
13080 alc269_eeepc_amic_init_verbs },
13081 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13082 .dac_nids = alc269_dac_nids,
13084 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13085 .channel_mode = alc269_modes,
13086 .input_mux = &alc269_eeepc_amic_capture_source,
13087 .unsol_event = alc269_eeepc_amic_unsol_event,
13088 .init_hook = alc269_eeepc_amic_inithook,
13090 [ALC269_ASUS_EEEPC_P901] = {
13091 .mixers = { alc269_eeepc_mixer },
13092 .cap_mixer = alc269_epc_capture_mixer,
13093 .init_verbs = { alc269_init_verbs,
13094 alc269_eeepc_dmic_init_verbs },
13095 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13096 .dac_nids = alc269_dac_nids,
13098 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13099 .channel_mode = alc269_modes,
13100 .input_mux = &alc269_eeepc_dmic_capture_source,
13101 .unsol_event = alc269_eeepc_dmic_unsol_event,
13102 .init_hook = alc269_eeepc_dmic_inithook,
13104 [ALC269_FUJITSU] = {
13105 .mixers = { alc269_fujitsu_mixer },
13106 .cap_mixer = alc269_epc_capture_mixer,
13107 .init_verbs = { alc269_init_verbs,
13108 alc269_eeepc_dmic_init_verbs },
13109 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13110 .dac_nids = alc269_dac_nids,
13112 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13113 .channel_mode = alc269_modes,
13114 .input_mux = &alc269_eeepc_dmic_capture_source,
13115 .unsol_event = alc269_eeepc_dmic_unsol_event,
13116 .init_hook = alc269_eeepc_dmic_inithook,
13118 [ALC269_LIFEBOOK] = {
13119 .mixers = { alc269_lifebook_mixer },
13120 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13121 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13122 .dac_nids = alc269_dac_nids,
13124 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13125 .channel_mode = alc269_modes,
13126 .input_mux = &alc269_capture_source,
13127 .unsol_event = alc269_lifebook_unsol_event,
13128 .init_hook = alc269_lifebook_init_hook,
13132 static int patch_alc269(struct hda_codec *codec)
13134 struct alc_spec *spec;
13138 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13142 codec->spec = spec;
13144 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13146 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13150 if (board_config < 0) {
13151 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
13152 "trying auto-probe from BIOS...\n");
13153 board_config = ALC269_AUTO;
13156 if (board_config == ALC269_AUTO) {
13157 /* automatic parse from the BIOS config */
13158 err = alc269_parse_auto_config(codec);
13164 "hda_codec: Cannot set up configuration "
13165 "from BIOS. Using base mode...\n");
13166 board_config = ALC269_BASIC;
13170 err = snd_hda_attach_beep_device(codec, 0x1);
13176 if (board_config != ALC269_AUTO)
13177 setup_preset(spec, &alc269_presets[board_config]);
13179 spec->stream_name_analog = "ALC269 Analog";
13180 if (codec->subsystem_id == 0x17aa3bf8) {
13181 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13182 * fix the sample rate of analog I/O to 44.1kHz
13184 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13185 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13187 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13188 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13190 spec->stream_name_digital = "ALC269 Digital";
13191 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13192 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13194 spec->adc_nids = alc269_adc_nids;
13195 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13196 spec->capsrc_nids = alc269_capsrc_nids;
13197 if (!spec->cap_mixer)
13198 set_capture_mixer(spec);
13199 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13201 codec->patch_ops = alc_patch_ops;
13202 if (board_config == ALC269_AUTO)
13203 spec->init_hook = alc269_auto_init;
13204 #ifdef CONFIG_SND_HDA_POWER_SAVE
13205 if (!spec->loopback.amplist)
13206 spec->loopback.amplist = alc269_loopbacks;
13208 codec->proc_widget_hook = print_realtek_coef;
13214 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13218 * set the path ways for 2 channel output
13219 * need to set the codec line out and mic 1 pin widgets to inputs
13221 static struct hda_verb alc861_threestack_ch2_init[] = {
13222 /* set pin widget 1Ah (line in) for input */
13223 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13224 /* set pin widget 18h (mic1/2) for input, for mic also enable
13227 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13229 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13231 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13232 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13238 * need to set the codec line out and mic 1 pin widgets to outputs
13240 static struct hda_verb alc861_threestack_ch6_init[] = {
13241 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13242 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13243 /* set pin widget 18h (mic1) for output (CLFE)*/
13244 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13246 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13247 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13249 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13251 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13252 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13257 static struct hda_channel_mode alc861_threestack_modes[2] = {
13258 { 2, alc861_threestack_ch2_init },
13259 { 6, alc861_threestack_ch6_init },
13261 /* Set mic1 as input and unmute the mixer */
13262 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13263 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13264 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13267 /* Set mic1 as output and mute mixer */
13268 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13269 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13270 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13274 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13275 { 2, alc861_uniwill_m31_ch2_init },
13276 { 4, alc861_uniwill_m31_ch4_init },
13279 /* Set mic1 and line-in as input and unmute the mixer */
13280 static struct hda_verb alc861_asus_ch2_init[] = {
13281 /* set pin widget 1Ah (line in) for input */
13282 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13283 /* set pin widget 18h (mic1/2) for input, for mic also enable
13286 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13288 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13290 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13291 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13295 /* Set mic1 nad line-in as output and mute mixer */
13296 static struct hda_verb alc861_asus_ch6_init[] = {
13297 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13298 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13299 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13300 /* set pin widget 18h (mic1) for output (CLFE)*/
13301 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13302 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13303 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13304 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13306 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13308 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13309 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13314 static struct hda_channel_mode alc861_asus_modes[2] = {
13315 { 2, alc861_asus_ch2_init },
13316 { 6, alc861_asus_ch6_init },
13321 static struct snd_kcontrol_new alc861_base_mixer[] = {
13322 /* output mixer control */
13323 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13324 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13325 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13326 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13327 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13329 /*Input mixer control */
13330 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13331 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13332 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13333 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13334 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13335 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13336 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13337 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13338 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13339 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13344 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13345 /* output mixer control */
13346 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13347 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13348 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13349 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13350 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13352 /* Input mixer control */
13353 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13354 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13355 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13356 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13357 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13358 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13359 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13360 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13361 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13362 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13365 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13366 .name = "Channel Mode",
13367 .info = alc_ch_mode_info,
13368 .get = alc_ch_mode_get,
13369 .put = alc_ch_mode_put,
13370 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13375 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13376 /* output mixer control */
13377 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13378 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13379 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13384 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13385 /* output mixer control */
13386 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13387 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13388 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13389 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13390 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13392 /* Input mixer control */
13393 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13394 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13395 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13396 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13397 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13398 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13399 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13400 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13401 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13402 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13405 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13406 .name = "Channel Mode",
13407 .info = alc_ch_mode_info,
13408 .get = alc_ch_mode_get,
13409 .put = alc_ch_mode_put,
13410 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13415 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13416 /* output mixer control */
13417 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13418 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13419 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13420 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13421 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13423 /* Input mixer control */
13424 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13425 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13426 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13427 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13428 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13429 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13430 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13431 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13432 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13433 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13436 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13437 .name = "Channel Mode",
13438 .info = alc_ch_mode_info,
13439 .get = alc_ch_mode_get,
13440 .put = alc_ch_mode_put,
13441 .private_value = ARRAY_SIZE(alc861_asus_modes),
13446 /* additional mixer */
13447 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13448 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13449 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13454 * generic initialization of ADC, input mixers and output mixers
13456 static struct hda_verb alc861_base_init_verbs[] = {
13458 * Unmute ADC0 and set the default input to mic-in
13460 /* port-A for surround (rear panel) */
13461 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13462 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13463 /* port-B for mic-in (rear panel) with vref */
13464 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13465 /* port-C for line-in (rear panel) */
13466 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13467 /* port-D for Front */
13468 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13469 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13470 /* port-E for HP out (front panel) */
13471 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13472 /* route front PCM to HP */
13473 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13474 /* port-F for mic-in (front panel) with vref */
13475 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13476 /* port-G for CLFE (rear panel) */
13477 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13478 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13479 /* port-H for side (rear panel) */
13480 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13481 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13483 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13484 /* route front mic to ADC1*/
13485 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13486 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13488 /* Unmute DAC0~3 & spdif out*/
13489 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13490 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13491 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13492 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13493 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13495 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13496 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13497 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13498 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13499 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13501 /* Unmute Stereo Mixer 15 */
13502 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13503 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13504 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13505 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13507 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13508 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13509 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13510 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13511 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13512 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13513 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13514 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13515 /* hp used DAC 3 (Front) */
13516 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13517 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13522 static struct hda_verb alc861_threestack_init_verbs[] = {
13524 * Unmute ADC0 and set the default input to mic-in
13526 /* port-A for surround (rear panel) */
13527 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13528 /* port-B for mic-in (rear panel) with vref */
13529 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13530 /* port-C for line-in (rear panel) */
13531 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13532 /* port-D for Front */
13533 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13534 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13535 /* port-E for HP out (front panel) */
13536 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13537 /* route front PCM to HP */
13538 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13539 /* port-F for mic-in (front panel) with vref */
13540 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13541 /* port-G for CLFE (rear panel) */
13542 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13543 /* port-H for side (rear panel) */
13544 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13546 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13547 /* route front mic to ADC1*/
13548 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13549 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13550 /* Unmute DAC0~3 & spdif out*/
13551 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13552 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13553 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13554 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13555 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13557 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13558 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13559 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13560 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13561 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13563 /* Unmute Stereo Mixer 15 */
13564 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13565 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13566 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13567 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13569 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13570 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13571 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13572 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13573 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13574 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13575 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13576 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13577 /* hp used DAC 3 (Front) */
13578 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13579 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13583 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13585 * Unmute ADC0 and set the default input to mic-in
13587 /* port-A for surround (rear panel) */
13588 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13589 /* port-B for mic-in (rear panel) with vref */
13590 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13591 /* port-C for line-in (rear panel) */
13592 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13593 /* port-D for Front */
13594 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13595 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13596 /* port-E for HP out (front panel) */
13597 /* this has to be set to VREF80 */
13598 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13599 /* route front PCM to HP */
13600 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13601 /* port-F for mic-in (front panel) with vref */
13602 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13603 /* port-G for CLFE (rear panel) */
13604 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13605 /* port-H for side (rear panel) */
13606 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13608 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13609 /* route front mic to ADC1*/
13610 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13611 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13612 /* Unmute DAC0~3 & spdif out*/
13613 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13614 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13615 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13616 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13619 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13620 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13621 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13622 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13623 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13625 /* Unmute Stereo Mixer 15 */
13626 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13627 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13628 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13629 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13631 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13632 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13633 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13634 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13635 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13636 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13637 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13638 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13639 /* hp used DAC 3 (Front) */
13640 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13641 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13645 static struct hda_verb alc861_asus_init_verbs[] = {
13647 * Unmute ADC0 and set the default input to mic-in
13649 /* port-A for surround (rear panel)
13650 * according to codec#0 this is the HP jack
13652 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13653 /* route front PCM to HP */
13654 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13655 /* port-B for mic-in (rear panel) with vref */
13656 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13657 /* port-C for line-in (rear panel) */
13658 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13659 /* port-D for Front */
13660 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13661 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13662 /* port-E for HP out (front panel) */
13663 /* this has to be set to VREF80 */
13664 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13665 /* route front PCM to HP */
13666 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13667 /* port-F for mic-in (front panel) with vref */
13668 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13669 /* port-G for CLFE (rear panel) */
13670 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13671 /* port-H for side (rear panel) */
13672 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13674 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13675 /* route front mic to ADC1*/
13676 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13677 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13678 /* Unmute DAC0~3 & spdif out*/
13679 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13680 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13681 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13682 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13683 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13684 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13685 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13686 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13687 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13688 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13690 /* Unmute Stereo Mixer 15 */
13691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13692 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13693 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13694 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13696 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13697 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13698 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13699 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13700 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13701 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13702 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13703 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13704 /* hp used DAC 3 (Front) */
13705 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13706 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13710 /* additional init verbs for ASUS laptops */
13711 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13712 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13713 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13718 * generic initialization of ADC, input mixers and output mixers
13720 static struct hda_verb alc861_auto_init_verbs[] = {
13722 * Unmute ADC0 and set the default input to mic-in
13724 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13725 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13727 /* Unmute DAC0~3 & spdif out*/
13728 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13729 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13730 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13731 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13732 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13734 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13735 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13736 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13737 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13738 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13740 /* Unmute Stereo Mixer 15 */
13741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13742 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13744 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13746 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13747 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13748 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13749 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13750 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13751 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13752 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13753 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13755 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13756 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13757 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13758 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13759 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13760 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13761 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13762 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13764 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13769 static struct hda_verb alc861_toshiba_init_verbs[] = {
13770 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13775 /* toggle speaker-output according to the hp-jack state */
13776 static void alc861_toshiba_automute(struct hda_codec *codec)
13778 unsigned int present;
13780 present = snd_hda_codec_read(codec, 0x0f, 0,
13781 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13782 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13783 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13784 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13785 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13788 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13791 if ((res >> 26) == ALC880_HP_EVENT)
13792 alc861_toshiba_automute(codec);
13795 /* pcm configuration: identiacal with ALC880 */
13796 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13797 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13798 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13799 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13802 #define ALC861_DIGOUT_NID 0x07
13804 static struct hda_channel_mode alc861_8ch_modes[1] = {
13808 static hda_nid_t alc861_dac_nids[4] = {
13809 /* front, surround, clfe, side */
13810 0x03, 0x06, 0x05, 0x04
13813 static hda_nid_t alc660_dac_nids[3] = {
13814 /* front, clfe, surround */
13818 static hda_nid_t alc861_adc_nids[1] = {
13823 static struct hda_input_mux alc861_capture_source = {
13827 { "Front Mic", 0x3 },
13834 /* fill in the dac_nids table from the parsed pin configuration */
13835 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13836 const struct auto_pin_cfg *cfg)
13841 spec->multiout.dac_nids = spec->private_dac_nids;
13842 for (i = 0; i < cfg->line_outs; i++) {
13843 nid = cfg->line_out_pins[i];
13845 if (i >= ARRAY_SIZE(alc861_dac_nids))
13847 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13850 spec->multiout.num_dacs = cfg->line_outs;
13854 /* add playback controls from the parsed DAC table */
13855 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13856 const struct auto_pin_cfg *cfg)
13859 static const char *chname[4] = {
13860 "Front", "Surround", NULL /*CLFE*/, "Side"
13865 for (i = 0; i < cfg->line_outs; i++) {
13866 nid = spec->multiout.dac_nids[i];
13871 err = add_control(spec, ALC_CTL_BIND_MUTE,
13872 "Center Playback Switch",
13873 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13877 err = add_control(spec, ALC_CTL_BIND_MUTE,
13878 "LFE Playback Switch",
13879 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13884 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13886 if (nid == alc861_dac_nids[idx])
13888 sprintf(name, "%s Playback Switch", chname[idx]);
13889 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13890 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13899 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13907 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13909 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13910 "Headphone Playback Switch",
13911 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13914 spec->multiout.hp_nid = nid;
13919 /* create playback/capture controls for input pins */
13920 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13921 const struct auto_pin_cfg *cfg)
13923 struct hda_input_mux *imux = &spec->private_imux[0];
13924 int i, err, idx, idx1;
13926 for (i = 0; i < AUTO_PIN_LAST; i++) {
13927 switch (cfg->input_pins[i]) {
13930 idx = 2; /* Line In */
13934 idx = 2; /* Line In */
13938 idx = 1; /* Mic In */
13942 idx = 1; /* Mic In */
13952 err = new_analog_input(spec, cfg->input_pins[i],
13953 auto_pin_cfg_labels[i], idx, 0x15);
13957 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13958 imux->items[imux->num_items].index = idx1;
13964 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13966 int pin_type, int dac_idx)
13968 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13970 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13974 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13976 struct alc_spec *spec = codec->spec;
13979 for (i = 0; i < spec->autocfg.line_outs; i++) {
13980 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13981 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13983 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13984 spec->multiout.dac_nids[i]);
13988 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13990 struct alc_spec *spec = codec->spec;
13993 pin = spec->autocfg.hp_pins[0];
13994 if (pin) /* connect to front */
13995 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13996 spec->multiout.dac_nids[0]);
13997 pin = spec->autocfg.speaker_pins[0];
13999 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14002 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14004 struct alc_spec *spec = codec->spec;
14007 for (i = 0; i < AUTO_PIN_LAST; i++) {
14008 hda_nid_t nid = spec->autocfg.input_pins[i];
14009 if (nid >= 0x0c && nid <= 0x11)
14010 alc_set_input_pin(codec, nid, i);
14014 /* parse the BIOS configuration and set up the alc_spec */
14015 /* return 1 if successful, 0 if the proper config is not found,
14016 * or a negative error code
14018 static int alc861_parse_auto_config(struct hda_codec *codec)
14020 struct alc_spec *spec = codec->spec;
14022 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14024 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14028 if (!spec->autocfg.line_outs)
14029 return 0; /* can't find valid BIOS pin config */
14031 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
14034 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
14037 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
14040 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
14044 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14046 if (spec->autocfg.dig_outs)
14047 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14049 if (spec->kctls.list)
14050 add_mixer(spec, spec->kctls.list);
14052 add_verb(spec, alc861_auto_init_verbs);
14054 spec->num_mux_defs = 1;
14055 spec->input_mux = &spec->private_imux[0];
14057 spec->adc_nids = alc861_adc_nids;
14058 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14059 set_capture_mixer(spec);
14061 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14066 /* additional initialization for auto-configuration model */
14067 static void alc861_auto_init(struct hda_codec *codec)
14069 struct alc_spec *spec = codec->spec;
14070 alc861_auto_init_multi_out(codec);
14071 alc861_auto_init_hp_out(codec);
14072 alc861_auto_init_analog_input(codec);
14073 if (spec->unsol_event)
14074 alc_inithook(codec);
14077 #ifdef CONFIG_SND_HDA_POWER_SAVE
14078 static struct hda_amp_list alc861_loopbacks[] = {
14079 { 0x15, HDA_INPUT, 0 },
14080 { 0x15, HDA_INPUT, 1 },
14081 { 0x15, HDA_INPUT, 2 },
14082 { 0x15, HDA_INPUT, 3 },
14089 * configuration and preset
14091 static const char *alc861_models[ALC861_MODEL_LAST] = {
14092 [ALC861_3ST] = "3stack",
14093 [ALC660_3ST] = "3stack-660",
14094 [ALC861_3ST_DIG] = "3stack-dig",
14095 [ALC861_6ST_DIG] = "6stack-dig",
14096 [ALC861_UNIWILL_M31] = "uniwill-m31",
14097 [ALC861_TOSHIBA] = "toshiba",
14098 [ALC861_ASUS] = "asus",
14099 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14100 [ALC861_AUTO] = "auto",
14103 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14104 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14105 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14106 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14107 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14108 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14109 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14110 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14111 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14112 * Any other models that need this preset?
14114 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14115 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14116 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14117 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14118 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14119 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14120 /* FIXME: the below seems conflict */
14121 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14122 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14123 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14127 static struct alc_config_preset alc861_presets[] = {
14129 .mixers = { alc861_3ST_mixer },
14130 .init_verbs = { alc861_threestack_init_verbs },
14131 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14132 .dac_nids = alc861_dac_nids,
14133 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14134 .channel_mode = alc861_threestack_modes,
14136 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14137 .adc_nids = alc861_adc_nids,
14138 .input_mux = &alc861_capture_source,
14140 [ALC861_3ST_DIG] = {
14141 .mixers = { alc861_base_mixer },
14142 .init_verbs = { alc861_threestack_init_verbs },
14143 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14144 .dac_nids = alc861_dac_nids,
14145 .dig_out_nid = ALC861_DIGOUT_NID,
14146 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14147 .channel_mode = alc861_threestack_modes,
14149 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14150 .adc_nids = alc861_adc_nids,
14151 .input_mux = &alc861_capture_source,
14153 [ALC861_6ST_DIG] = {
14154 .mixers = { alc861_base_mixer },
14155 .init_verbs = { alc861_base_init_verbs },
14156 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14157 .dac_nids = alc861_dac_nids,
14158 .dig_out_nid = ALC861_DIGOUT_NID,
14159 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14160 .channel_mode = alc861_8ch_modes,
14161 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14162 .adc_nids = alc861_adc_nids,
14163 .input_mux = &alc861_capture_source,
14166 .mixers = { alc861_3ST_mixer },
14167 .init_verbs = { alc861_threestack_init_verbs },
14168 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14169 .dac_nids = alc660_dac_nids,
14170 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14171 .channel_mode = alc861_threestack_modes,
14173 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14174 .adc_nids = alc861_adc_nids,
14175 .input_mux = &alc861_capture_source,
14177 [ALC861_UNIWILL_M31] = {
14178 .mixers = { alc861_uniwill_m31_mixer },
14179 .init_verbs = { alc861_uniwill_m31_init_verbs },
14180 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14181 .dac_nids = alc861_dac_nids,
14182 .dig_out_nid = ALC861_DIGOUT_NID,
14183 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14184 .channel_mode = alc861_uniwill_m31_modes,
14186 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14187 .adc_nids = alc861_adc_nids,
14188 .input_mux = &alc861_capture_source,
14190 [ALC861_TOSHIBA] = {
14191 .mixers = { alc861_toshiba_mixer },
14192 .init_verbs = { alc861_base_init_verbs,
14193 alc861_toshiba_init_verbs },
14194 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14195 .dac_nids = alc861_dac_nids,
14196 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14197 .channel_mode = alc883_3ST_2ch_modes,
14198 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14199 .adc_nids = alc861_adc_nids,
14200 .input_mux = &alc861_capture_source,
14201 .unsol_event = alc861_toshiba_unsol_event,
14202 .init_hook = alc861_toshiba_automute,
14205 .mixers = { alc861_asus_mixer },
14206 .init_verbs = { alc861_asus_init_verbs },
14207 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14208 .dac_nids = alc861_dac_nids,
14209 .dig_out_nid = ALC861_DIGOUT_NID,
14210 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14211 .channel_mode = alc861_asus_modes,
14214 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14215 .adc_nids = alc861_adc_nids,
14216 .input_mux = &alc861_capture_source,
14218 [ALC861_ASUS_LAPTOP] = {
14219 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14220 .init_verbs = { alc861_asus_init_verbs,
14221 alc861_asus_laptop_init_verbs },
14222 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14223 .dac_nids = alc861_dac_nids,
14224 .dig_out_nid = ALC861_DIGOUT_NID,
14225 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14226 .channel_mode = alc883_3ST_2ch_modes,
14228 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14229 .adc_nids = alc861_adc_nids,
14230 .input_mux = &alc861_capture_source,
14235 static int patch_alc861(struct hda_codec *codec)
14237 struct alc_spec *spec;
14241 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14245 codec->spec = spec;
14247 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14251 if (board_config < 0) {
14252 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
14253 "trying auto-probe from BIOS...\n");
14254 board_config = ALC861_AUTO;
14257 if (board_config == ALC861_AUTO) {
14258 /* automatic parse from the BIOS config */
14259 err = alc861_parse_auto_config(codec);
14265 "hda_codec: Cannot set up configuration "
14266 "from BIOS. Using base mode...\n");
14267 board_config = ALC861_3ST_DIG;
14271 err = snd_hda_attach_beep_device(codec, 0x23);
14277 if (board_config != ALC861_AUTO)
14278 setup_preset(spec, &alc861_presets[board_config]);
14280 spec->stream_name_analog = "ALC861 Analog";
14281 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14282 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14284 spec->stream_name_digital = "ALC861 Digital";
14285 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14286 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14288 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14290 spec->vmaster_nid = 0x03;
14292 codec->patch_ops = alc_patch_ops;
14293 if (board_config == ALC861_AUTO)
14294 spec->init_hook = alc861_auto_init;
14295 #ifdef CONFIG_SND_HDA_POWER_SAVE
14296 if (!spec->loopback.amplist)
14297 spec->loopback.amplist = alc861_loopbacks;
14299 codec->proc_widget_hook = print_realtek_coef;
14305 * ALC861-VD support
14309 * In addition, an independent DAC
14311 #define ALC861VD_DIGOUT_NID 0x06
14313 static hda_nid_t alc861vd_dac_nids[4] = {
14314 /* front, surr, clfe, side surr */
14315 0x02, 0x03, 0x04, 0x05
14318 /* dac_nids for ALC660vd are in a different order - according to
14319 * Realtek's driver.
14320 * This should probably tesult in a different mixer for 6stack models
14321 * of ALC660vd codecs, but for now there is only 3stack mixer
14322 * - and it is the same as in 861vd.
14323 * adc_nids in ALC660vd are (is) the same as in 861vd
14325 static hda_nid_t alc660vd_dac_nids[3] = {
14326 /* front, rear, clfe, rear_surr */
14330 static hda_nid_t alc861vd_adc_nids[1] = {
14335 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14338 /* FIXME: should be a matrix-type input source selection */
14339 static struct hda_input_mux alc861vd_capture_source = {
14343 { "Front Mic", 0x1 },
14349 static struct hda_input_mux alc861vd_dallas_capture_source = {
14352 { "Ext Mic", 0x0 },
14353 { "Int Mic", 0x1 },
14357 static struct hda_input_mux alc861vd_hp_capture_source = {
14360 { "Front Mic", 0x0 },
14361 { "ATAPI Mic", 0x1 },
14368 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14375 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14376 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14377 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14378 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14379 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14386 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14387 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14388 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14389 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14390 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14394 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14395 { 6, alc861vd_6stack_ch6_init },
14396 { 8, alc861vd_6stack_ch8_init },
14399 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14401 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14402 .name = "Channel Mode",
14403 .info = alc_ch_mode_info,
14404 .get = alc_ch_mode_get,
14405 .put = alc_ch_mode_put,
14410 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14411 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14413 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14414 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14415 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14417 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14418 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14420 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14422 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14424 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14425 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14427 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14428 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14430 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14432 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14436 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14437 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14438 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14440 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14441 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14443 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14444 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14449 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14450 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14451 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14453 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14455 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14456 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14457 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14459 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14460 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14461 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14463 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14464 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14466 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14467 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14472 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14473 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14474 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14475 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14477 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14479 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14480 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14481 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14483 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14484 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14485 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14487 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14488 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14493 /* Pin assignment: Speaker=0x14, HP = 0x15,
14494 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14496 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14497 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14498 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14499 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14500 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14501 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14502 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14503 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14504 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14505 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14506 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14510 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14511 * Front Mic=0x18, ATAPI Mic = 0x19,
14513 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14514 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14515 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14516 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14517 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14518 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14519 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14520 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14521 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14527 * generic initialization of ADC, input mixers and output mixers
14529 static struct hda_verb alc861vd_volume_init_verbs[] = {
14531 * Unmute ADC0 and set the default input to mic-in
14533 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14534 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14536 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14537 * the analog-loopback mixer widget
14539 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14540 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14541 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14542 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14543 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14544 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14546 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14547 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14548 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14549 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14550 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14553 * Set up output mixers (0x02 - 0x05)
14555 /* set vol=0 to output mixers */
14556 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14557 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14558 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14559 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14561 /* set up input amps for analog loopback */
14562 /* Amp Indices: DAC = 0, mixer = 1 */
14563 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14564 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14565 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14566 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14567 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14568 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14569 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14570 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14576 * 3-stack pin configuration:
14577 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14579 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14581 * Set pin mode and muting
14583 /* set front pin widgets 0x14 for output */
14584 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14585 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14586 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14588 /* Mic (rear) pin: input vref at 80% */
14589 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14590 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14591 /* Front Mic pin: input vref at 80% */
14592 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14593 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14594 /* Line In pin: input */
14595 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14596 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14597 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14598 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14599 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14600 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14601 /* CD pin widget for input */
14602 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14608 * 6-stack pin configuration:
14610 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14612 * Set pin mode and muting
14614 /* set front pin widgets 0x14 for output */
14615 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14616 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14617 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14619 /* Rear Pin: output 1 (0x0d) */
14620 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14621 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14622 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14623 /* CLFE Pin: output 2 (0x0e) */
14624 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14625 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14626 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14627 /* Side Pin: output 3 (0x0f) */
14628 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14629 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14630 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14632 /* Mic (rear) pin: input vref at 80% */
14633 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14634 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14635 /* Front Mic pin: input vref at 80% */
14636 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14637 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14638 /* Line In pin: input */
14639 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14640 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14641 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14642 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14643 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14644 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14645 /* CD pin widget for input */
14646 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14651 static struct hda_verb alc861vd_eapd_verbs[] = {
14652 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14656 static struct hda_verb alc660vd_eapd_verbs[] = {
14657 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14658 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14662 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14664 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14665 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14666 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14667 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14671 /* toggle speaker-output according to the hp-jack state */
14672 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14674 unsigned int present;
14675 unsigned char bits;
14677 present = snd_hda_codec_read(codec, 0x1b, 0,
14678 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14679 bits = present ? HDA_AMP_MUTE : 0;
14680 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14681 HDA_AMP_MUTE, bits);
14684 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14686 unsigned int present;
14687 unsigned char bits;
14689 present = snd_hda_codec_read(codec, 0x18, 0,
14690 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14691 bits = present ? HDA_AMP_MUTE : 0;
14692 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14693 HDA_AMP_MUTE, bits);
14696 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14698 alc861vd_lenovo_hp_automute(codec);
14699 alc861vd_lenovo_mic_automute(codec);
14702 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14705 switch (res >> 26) {
14706 case ALC880_HP_EVENT:
14707 alc861vd_lenovo_hp_automute(codec);
14709 case ALC880_MIC_EVENT:
14710 alc861vd_lenovo_mic_automute(codec);
14715 static struct hda_verb alc861vd_dallas_verbs[] = {
14716 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14717 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14718 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14719 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14721 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14722 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14723 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14724 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14725 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14726 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14727 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14728 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14730 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14731 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14732 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14733 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14734 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14735 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14736 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14737 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14739 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14740 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14741 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14742 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14743 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14744 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14745 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14746 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14748 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14749 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14750 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14751 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14753 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14754 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14755 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14760 /* toggle speaker-output according to the hp-jack state */
14761 static void alc861vd_dallas_automute(struct hda_codec *codec)
14763 unsigned int present;
14765 present = snd_hda_codec_read(codec, 0x15, 0,
14766 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14767 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14768 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14771 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14773 if ((res >> 26) == ALC880_HP_EVENT)
14774 alc861vd_dallas_automute(codec);
14777 #ifdef CONFIG_SND_HDA_POWER_SAVE
14778 #define alc861vd_loopbacks alc880_loopbacks
14781 /* pcm configuration: identiacal with ALC880 */
14782 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14783 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14784 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14785 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14788 * configuration and preset
14790 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14791 [ALC660VD_3ST] = "3stack-660",
14792 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14793 [ALC660VD_ASUS_V1S] = "asus-v1s",
14794 [ALC861VD_3ST] = "3stack",
14795 [ALC861VD_3ST_DIG] = "3stack-digout",
14796 [ALC861VD_6ST_DIG] = "6stack-digout",
14797 [ALC861VD_LENOVO] = "lenovo",
14798 [ALC861VD_DALLAS] = "dallas",
14799 [ALC861VD_HP] = "hp",
14800 [ALC861VD_AUTO] = "auto",
14803 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14804 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14805 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14806 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14807 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14808 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14809 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14810 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14811 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14812 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14813 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14814 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14815 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14816 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14817 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14818 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14822 static struct alc_config_preset alc861vd_presets[] = {
14824 .mixers = { alc861vd_3st_mixer },
14825 .init_verbs = { alc861vd_volume_init_verbs,
14826 alc861vd_3stack_init_verbs },
14827 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14828 .dac_nids = alc660vd_dac_nids,
14829 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14830 .channel_mode = alc861vd_3stack_2ch_modes,
14831 .input_mux = &alc861vd_capture_source,
14833 [ALC660VD_3ST_DIG] = {
14834 .mixers = { alc861vd_3st_mixer },
14835 .init_verbs = { alc861vd_volume_init_verbs,
14836 alc861vd_3stack_init_verbs },
14837 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14838 .dac_nids = alc660vd_dac_nids,
14839 .dig_out_nid = ALC861VD_DIGOUT_NID,
14840 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14841 .channel_mode = alc861vd_3stack_2ch_modes,
14842 .input_mux = &alc861vd_capture_source,
14845 .mixers = { alc861vd_3st_mixer },
14846 .init_verbs = { alc861vd_volume_init_verbs,
14847 alc861vd_3stack_init_verbs },
14848 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14849 .dac_nids = alc861vd_dac_nids,
14850 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14851 .channel_mode = alc861vd_3stack_2ch_modes,
14852 .input_mux = &alc861vd_capture_source,
14854 [ALC861VD_3ST_DIG] = {
14855 .mixers = { alc861vd_3st_mixer },
14856 .init_verbs = { alc861vd_volume_init_verbs,
14857 alc861vd_3stack_init_verbs },
14858 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14859 .dac_nids = alc861vd_dac_nids,
14860 .dig_out_nid = ALC861VD_DIGOUT_NID,
14861 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14862 .channel_mode = alc861vd_3stack_2ch_modes,
14863 .input_mux = &alc861vd_capture_source,
14865 [ALC861VD_6ST_DIG] = {
14866 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14867 .init_verbs = { alc861vd_volume_init_verbs,
14868 alc861vd_6stack_init_verbs },
14869 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14870 .dac_nids = alc861vd_dac_nids,
14871 .dig_out_nid = ALC861VD_DIGOUT_NID,
14872 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14873 .channel_mode = alc861vd_6stack_modes,
14874 .input_mux = &alc861vd_capture_source,
14876 [ALC861VD_LENOVO] = {
14877 .mixers = { alc861vd_lenovo_mixer },
14878 .init_verbs = { alc861vd_volume_init_verbs,
14879 alc861vd_3stack_init_verbs,
14880 alc861vd_eapd_verbs,
14881 alc861vd_lenovo_unsol_verbs },
14882 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14883 .dac_nids = alc660vd_dac_nids,
14884 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14885 .channel_mode = alc861vd_3stack_2ch_modes,
14886 .input_mux = &alc861vd_capture_source,
14887 .unsol_event = alc861vd_lenovo_unsol_event,
14888 .init_hook = alc861vd_lenovo_automute,
14890 [ALC861VD_DALLAS] = {
14891 .mixers = { alc861vd_dallas_mixer },
14892 .init_verbs = { alc861vd_dallas_verbs },
14893 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14894 .dac_nids = alc861vd_dac_nids,
14895 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14896 .channel_mode = alc861vd_3stack_2ch_modes,
14897 .input_mux = &alc861vd_dallas_capture_source,
14898 .unsol_event = alc861vd_dallas_unsol_event,
14899 .init_hook = alc861vd_dallas_automute,
14902 .mixers = { alc861vd_hp_mixer },
14903 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14904 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14905 .dac_nids = alc861vd_dac_nids,
14906 .dig_out_nid = ALC861VD_DIGOUT_NID,
14907 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14908 .channel_mode = alc861vd_3stack_2ch_modes,
14909 .input_mux = &alc861vd_hp_capture_source,
14910 .unsol_event = alc861vd_dallas_unsol_event,
14911 .init_hook = alc861vd_dallas_automute,
14913 [ALC660VD_ASUS_V1S] = {
14914 .mixers = { alc861vd_lenovo_mixer },
14915 .init_verbs = { alc861vd_volume_init_verbs,
14916 alc861vd_3stack_init_verbs,
14917 alc861vd_eapd_verbs,
14918 alc861vd_lenovo_unsol_verbs },
14919 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14920 .dac_nids = alc660vd_dac_nids,
14921 .dig_out_nid = ALC861VD_DIGOUT_NID,
14922 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14923 .channel_mode = alc861vd_3stack_2ch_modes,
14924 .input_mux = &alc861vd_capture_source,
14925 .unsol_event = alc861vd_lenovo_unsol_event,
14926 .init_hook = alc861vd_lenovo_automute,
14931 * BIOS auto configuration
14933 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14934 hda_nid_t nid, int pin_type, int dac_idx)
14936 alc_set_pin_output(codec, nid, pin_type);
14939 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14941 struct alc_spec *spec = codec->spec;
14944 for (i = 0; i <= HDA_SIDE; i++) {
14945 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14946 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14948 alc861vd_auto_set_output_and_unmute(codec, nid,
14954 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14956 struct alc_spec *spec = codec->spec;
14959 pin = spec->autocfg.hp_pins[0];
14960 if (pin) /* connect to front and use dac 0 */
14961 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14962 pin = spec->autocfg.speaker_pins[0];
14964 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14967 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14968 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14970 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14972 struct alc_spec *spec = codec->spec;
14975 for (i = 0; i < AUTO_PIN_LAST; i++) {
14976 hda_nid_t nid = spec->autocfg.input_pins[i];
14977 if (alc861vd_is_input_pin(nid)) {
14978 alc_set_input_pin(codec, nid, i);
14979 if (nid != ALC861VD_PIN_CD_NID &&
14980 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
14981 snd_hda_codec_write(codec, nid, 0,
14982 AC_VERB_SET_AMP_GAIN_MUTE,
14988 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14990 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14991 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14993 /* add playback controls from the parsed DAC table */
14994 /* Based on ALC880 version. But ALC861VD has separate,
14995 * different NIDs for mute/unmute switch and volume control */
14996 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14997 const struct auto_pin_cfg *cfg)
15000 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15001 hda_nid_t nid_v, nid_s;
15004 for (i = 0; i < cfg->line_outs; i++) {
15005 if (!spec->multiout.dac_nids[i])
15007 nid_v = alc861vd_idx_to_mixer_vol(
15009 spec->multiout.dac_nids[i]));
15010 nid_s = alc861vd_idx_to_mixer_switch(
15012 spec->multiout.dac_nids[i]));
15016 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15017 "Center Playback Volume",
15018 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15022 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15023 "LFE Playback Volume",
15024 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15028 err = add_control(spec, ALC_CTL_BIND_MUTE,
15029 "Center Playback Switch",
15030 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15034 err = add_control(spec, ALC_CTL_BIND_MUTE,
15035 "LFE Playback Switch",
15036 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15041 sprintf(name, "%s Playback Volume", chname[i]);
15042 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15043 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15047 sprintf(name, "%s Playback Switch", chname[i]);
15048 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15049 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15058 /* add playback controls for speaker and HP outputs */
15059 /* Based on ALC880 version. But ALC861VD has separate,
15060 * different NIDs for mute/unmute switch and volume control */
15061 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15062 hda_nid_t pin, const char *pfx)
15064 hda_nid_t nid_v, nid_s;
15071 if (alc880_is_fixed_pin(pin)) {
15072 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15073 /* specify the DAC as the extra output */
15074 if (!spec->multiout.hp_nid)
15075 spec->multiout.hp_nid = nid_v;
15077 spec->multiout.extra_out_nid[0] = nid_v;
15078 /* control HP volume/switch on the output mixer amp */
15079 nid_v = alc861vd_idx_to_mixer_vol(
15080 alc880_fixed_pin_idx(pin));
15081 nid_s = alc861vd_idx_to_mixer_switch(
15082 alc880_fixed_pin_idx(pin));
15084 sprintf(name, "%s Playback Volume", pfx);
15085 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15086 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15089 sprintf(name, "%s Playback Switch", pfx);
15090 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15091 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15094 } else if (alc880_is_multi_pin(pin)) {
15095 /* set manual connection */
15096 /* we have only a switch on HP-out PIN */
15097 sprintf(name, "%s Playback Switch", pfx);
15098 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15099 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15106 /* parse the BIOS configuration and set up the alc_spec
15107 * return 1 if successful, 0 if the proper config is not found,
15108 * or a negative error code
15109 * Based on ALC880 version - had to change it to override
15110 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15111 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15113 struct alc_spec *spec = codec->spec;
15115 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15117 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15121 if (!spec->autocfg.line_outs)
15122 return 0; /* can't find valid BIOS pin config */
15124 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15127 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15130 err = alc861vd_auto_create_extra_out(spec,
15131 spec->autocfg.speaker_pins[0],
15135 err = alc861vd_auto_create_extra_out(spec,
15136 spec->autocfg.hp_pins[0],
15140 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15144 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15146 if (spec->autocfg.dig_outs)
15147 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15149 if (spec->kctls.list)
15150 add_mixer(spec, spec->kctls.list);
15152 add_verb(spec, alc861vd_volume_init_verbs);
15154 spec->num_mux_defs = 1;
15155 spec->input_mux = &spec->private_imux[0];
15157 err = alc_auto_add_mic_boost(codec);
15161 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15166 /* additional initialization for auto-configuration model */
15167 static void alc861vd_auto_init(struct hda_codec *codec)
15169 struct alc_spec *spec = codec->spec;
15170 alc861vd_auto_init_multi_out(codec);
15171 alc861vd_auto_init_hp_out(codec);
15172 alc861vd_auto_init_analog_input(codec);
15173 alc861vd_auto_init_input_src(codec);
15174 if (spec->unsol_event)
15175 alc_inithook(codec);
15178 static int patch_alc861vd(struct hda_codec *codec)
15180 struct alc_spec *spec;
15181 int err, board_config;
15183 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15187 codec->spec = spec;
15189 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15193 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15194 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
15195 "ALC861VD, trying auto-probe from BIOS...\n");
15196 board_config = ALC861VD_AUTO;
15199 if (board_config == ALC861VD_AUTO) {
15200 /* automatic parse from the BIOS config */
15201 err = alc861vd_parse_auto_config(codec);
15207 "hda_codec: Cannot set up configuration "
15208 "from BIOS. Using base mode...\n");
15209 board_config = ALC861VD_3ST;
15213 err = snd_hda_attach_beep_device(codec, 0x23);
15219 if (board_config != ALC861VD_AUTO)
15220 setup_preset(spec, &alc861vd_presets[board_config]);
15222 if (codec->vendor_id == 0x10ec0660) {
15223 spec->stream_name_analog = "ALC660-VD Analog";
15224 spec->stream_name_digital = "ALC660-VD Digital";
15225 /* always turn on EAPD */
15226 add_verb(spec, alc660vd_eapd_verbs);
15228 spec->stream_name_analog = "ALC861VD Analog";
15229 spec->stream_name_digital = "ALC861VD Digital";
15232 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15233 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15235 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15236 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15238 spec->adc_nids = alc861vd_adc_nids;
15239 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15240 spec->capsrc_nids = alc861vd_capsrc_nids;
15241 spec->capture_style = CAPT_MIX;
15243 set_capture_mixer(spec);
15244 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15246 spec->vmaster_nid = 0x02;
15248 codec->patch_ops = alc_patch_ops;
15250 if (board_config == ALC861VD_AUTO)
15251 spec->init_hook = alc861vd_auto_init;
15252 #ifdef CONFIG_SND_HDA_POWER_SAVE
15253 if (!spec->loopback.amplist)
15254 spec->loopback.amplist = alc861vd_loopbacks;
15256 codec->proc_widget_hook = print_realtek_coef;
15264 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15265 * configuration. Each pin widget can choose any input DACs and a mixer.
15266 * Each ADC is connected from a mixer of all inputs. This makes possible
15267 * 6-channel independent captures.
15269 * In addition, an independent DAC for the multi-playback (not used in this
15272 #define ALC662_DIGOUT_NID 0x06
15273 #define ALC662_DIGIN_NID 0x0a
15275 static hda_nid_t alc662_dac_nids[4] = {
15276 /* front, rear, clfe, rear_surr */
15280 static hda_nid_t alc272_dac_nids[2] = {
15284 static hda_nid_t alc662_adc_nids[1] = {
15289 static hda_nid_t alc272_adc_nids[1] = {
15294 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15295 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15299 /* FIXME: should be a matrix-type input source selection */
15300 static struct hda_input_mux alc662_capture_source = {
15304 { "Front Mic", 0x1 },
15310 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15318 static struct hda_input_mux alc662_eeepc_capture_source = {
15326 static struct hda_input_mux alc663_capture_source = {
15330 { "Front Mic", 0x1 },
15335 static struct hda_input_mux alc663_m51va_capture_source = {
15338 { "Ext-Mic", 0x0 },
15346 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15353 static struct hda_verb alc662_3ST_ch2_init[] = {
15354 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15355 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15356 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15357 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15364 static struct hda_verb alc662_3ST_ch6_init[] = {
15365 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15366 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15367 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15368 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15369 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15370 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15374 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15375 { 2, alc662_3ST_ch2_init },
15376 { 6, alc662_3ST_ch6_init },
15382 static struct hda_verb alc662_sixstack_ch6_init[] = {
15383 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15384 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15385 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15392 static struct hda_verb alc662_sixstack_ch8_init[] = {
15393 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15394 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15395 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15399 static struct hda_channel_mode alc662_5stack_modes[2] = {
15400 { 2, alc662_sixstack_ch6_init },
15401 { 6, alc662_sixstack_ch8_init },
15404 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15405 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15408 static struct snd_kcontrol_new alc662_base_mixer[] = {
15409 /* output mixer control */
15410 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15411 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15412 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15413 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15414 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15415 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15416 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15417 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15418 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15420 /*Input mixer control */
15421 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15422 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15423 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15424 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15425 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15426 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15427 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15428 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15432 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15433 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15434 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15435 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15436 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15437 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15438 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15439 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15440 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15441 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15442 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15443 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15447 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15448 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15449 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15450 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15451 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15452 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15453 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15454 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15455 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15456 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15457 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15458 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15459 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15460 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15461 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15462 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15463 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15464 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15468 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15469 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15470 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15471 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15472 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15473 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15474 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15475 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15476 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15477 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15481 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15482 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15484 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15485 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15487 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15488 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15489 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15491 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15492 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15493 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15497 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15498 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15499 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15500 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15501 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15502 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15503 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15504 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15505 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15506 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15507 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15508 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15509 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15510 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15511 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15515 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15516 .ops = &snd_hda_bind_vol,
15518 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15519 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15524 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15525 .ops = &snd_hda_bind_sw,
15527 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15528 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15533 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15534 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15535 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15537 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15541 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15542 .ops = &snd_hda_bind_sw,
15544 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15545 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15546 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15551 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15552 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15553 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15554 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15555 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15556 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15557 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15562 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15563 .ops = &snd_hda_bind_sw,
15565 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15566 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15567 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15572 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15573 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15574 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15576 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15577 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15578 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15582 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15583 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15584 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15585 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15586 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15587 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15588 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15589 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15593 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15594 .ops = &snd_hda_bind_vol,
15596 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15597 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15602 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15603 .ops = &snd_hda_bind_sw,
15605 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15606 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15611 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15612 HDA_BIND_VOL("Master Playback Volume",
15613 &alc663_asus_two_bind_master_vol),
15614 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15615 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15616 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15617 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15618 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15622 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15623 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15624 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15625 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15626 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15627 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15628 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15632 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15633 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15634 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15635 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15636 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15637 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15639 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15640 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15641 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15642 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15646 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15647 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15648 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15649 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15651 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15652 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15653 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15654 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15655 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15656 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15660 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15662 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15663 .name = "Channel Mode",
15664 .info = alc_ch_mode_info,
15665 .get = alc_ch_mode_get,
15666 .put = alc_ch_mode_put,
15671 static struct hda_verb alc662_init_verbs[] = {
15672 /* ADC: mute amp left and right */
15673 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15674 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15675 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15677 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15678 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15679 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15680 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15681 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15683 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15684 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15685 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15686 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15687 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15688 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15690 /* Front Pin: output 0 (0x0c) */
15691 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15692 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15694 /* Rear Pin: output 1 (0x0d) */
15695 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15696 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15698 /* CLFE Pin: output 2 (0x0e) */
15699 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15700 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15702 /* Mic (rear) pin: input vref at 80% */
15703 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15704 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15705 /* Front Mic pin: input vref at 80% */
15706 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15707 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15708 /* Line In pin: input */
15709 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15710 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15711 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15712 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15713 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15714 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15715 /* CD pin widget for input */
15716 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15718 /* FIXME: use matrix-type input source selection */
15719 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15721 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15722 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15724 /* always trun on EAPD */
15725 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15726 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15731 static struct hda_verb alc662_sue_init_verbs[] = {
15732 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15733 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15737 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15738 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15739 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15743 /* Set Unsolicited Event*/
15744 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15745 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15746 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15751 * generic initialization of ADC, input mixers and output mixers
15753 static struct hda_verb alc662_auto_init_verbs[] = {
15755 * Unmute ADC and set the default input to mic-in
15757 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15758 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15760 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15762 * Note: PASD motherboards uses the Line In 2 as the input for front
15763 * panel mic (mic 2)
15765 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15766 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15767 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15768 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15769 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15770 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15773 * Set up output mixers (0x0c - 0x0f)
15775 /* set vol=0 to output mixers */
15776 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15777 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15778 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15780 /* set up input amps for analog loopback */
15781 /* Amp Indices: DAC = 0, mixer = 1 */
15782 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15783 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15784 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15785 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15786 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15787 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15790 /* FIXME: use matrix-type input source selection */
15791 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15793 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15794 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15798 /* additional verbs for ALC663 */
15799 static struct hda_verb alc663_auto_init_verbs[] = {
15800 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15801 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15805 static struct hda_verb alc663_m51va_init_verbs[] = {
15806 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15807 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15808 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15809 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15810 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15811 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15812 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15813 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15814 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15818 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15819 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15820 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15821 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15822 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15823 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15824 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15825 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15829 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15830 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15831 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15832 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15833 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15834 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15835 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15836 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15837 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15841 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15842 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15843 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15844 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15845 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15846 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15847 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15848 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15852 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15853 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15854 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15855 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15856 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15857 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15858 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15859 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15860 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15861 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15862 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15863 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15864 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15868 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15869 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15870 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15871 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15872 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15873 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15874 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15875 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15876 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15877 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15878 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15879 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15880 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15884 static struct hda_verb alc663_g71v_init_verbs[] = {
15885 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15886 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15887 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15889 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15890 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15891 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15893 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15894 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15895 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15899 static struct hda_verb alc663_g50v_init_verbs[] = {
15900 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15901 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15902 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15904 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15905 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15909 static struct hda_verb alc662_ecs_init_verbs[] = {
15910 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15911 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15912 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15913 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15917 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
15918 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15919 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15920 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15921 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15922 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15923 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15924 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15925 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15926 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15927 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15928 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15932 static struct hda_verb alc272_dell_init_verbs[] = {
15933 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15934 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15935 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15936 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15937 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15938 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15939 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15940 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15941 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15942 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15943 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15947 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15948 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15949 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15953 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
15954 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
15955 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
15959 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15961 unsigned int present;
15962 unsigned char bits;
15964 present = snd_hda_codec_read(codec, 0x14, 0,
15965 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15966 bits = present ? HDA_AMP_MUTE : 0;
15967 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15968 HDA_AMP_MUTE, bits);
15971 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15973 unsigned int present;
15974 unsigned char bits;
15976 present = snd_hda_codec_read(codec, 0x1b, 0,
15977 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15978 bits = present ? HDA_AMP_MUTE : 0;
15979 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15980 HDA_AMP_MUTE, bits);
15981 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15982 HDA_AMP_MUTE, bits);
15985 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15988 if ((res >> 26) == ALC880_HP_EVENT)
15989 alc662_lenovo_101e_all_automute(codec);
15990 if ((res >> 26) == ALC880_FRONT_EVENT)
15991 alc662_lenovo_101e_ispeaker_automute(codec);
15994 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15996 unsigned int present;
15998 present = snd_hda_codec_read(codec, 0x18, 0,
15999 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16000 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16001 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16002 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16003 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16004 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16005 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16006 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16007 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16010 /* unsolicited event for HP jack sensing */
16011 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16014 if ((res >> 26) == ALC880_HP_EVENT)
16015 alc262_hippo1_automute( codec );
16017 if ((res >> 26) == ALC880_MIC_EVENT)
16018 alc662_eeepc_mic_automute(codec);
16021 static void alc662_eeepc_inithook(struct hda_codec *codec)
16023 alc262_hippo1_automute( codec );
16024 alc662_eeepc_mic_automute(codec);
16027 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
16030 unsigned int present;
16032 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
16033 present = snd_hda_codec_read(codec, 0x14, 0,
16034 AC_VERB_GET_PIN_SENSE, 0);
16035 present = (present & 0x80000000) != 0;
16037 /* mute internal speaker */
16038 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
16039 HDA_AMP_MUTE, HDA_AMP_MUTE);
16041 /* unmute internal speaker if necessary */
16042 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
16043 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
16044 HDA_AMP_MUTE, mute);
16048 /* unsolicited event for HP jack sensing */
16049 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
16052 if ((res >> 26) == ALC880_HP_EVENT)
16053 alc662_eeepc_ep20_automute(codec);
16056 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
16058 alc662_eeepc_ep20_automute(codec);
16061 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16063 unsigned int present;
16064 unsigned char bits;
16066 present = snd_hda_codec_read(codec, 0x21, 0,
16067 AC_VERB_GET_PIN_SENSE, 0)
16068 & AC_PINSENSE_PRESENCE;
16069 bits = present ? HDA_AMP_MUTE : 0;
16070 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16071 AMP_IN_MUTE(0), bits);
16072 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16073 AMP_IN_MUTE(0), bits);
16076 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16078 unsigned int present;
16079 unsigned char bits;
16081 present = snd_hda_codec_read(codec, 0x21, 0,
16082 AC_VERB_GET_PIN_SENSE, 0)
16083 & AC_PINSENSE_PRESENCE;
16084 bits = present ? HDA_AMP_MUTE : 0;
16085 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16086 AMP_IN_MUTE(0), bits);
16087 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16088 AMP_IN_MUTE(0), bits);
16089 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16090 AMP_IN_MUTE(0), bits);
16091 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16092 AMP_IN_MUTE(0), bits);
16095 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16097 unsigned int present;
16098 unsigned char bits;
16100 present = snd_hda_codec_read(codec, 0x15, 0,
16101 AC_VERB_GET_PIN_SENSE, 0)
16102 & AC_PINSENSE_PRESENCE;
16103 bits = present ? HDA_AMP_MUTE : 0;
16104 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16105 AMP_IN_MUTE(0), bits);
16106 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16107 AMP_IN_MUTE(0), bits);
16108 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16109 AMP_IN_MUTE(0), bits);
16110 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16111 AMP_IN_MUTE(0), bits);
16114 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16116 unsigned int present;
16117 unsigned char bits;
16119 present = snd_hda_codec_read(codec, 0x1b, 0,
16120 AC_VERB_GET_PIN_SENSE, 0)
16121 & AC_PINSENSE_PRESENCE;
16122 bits = present ? 0 : PIN_OUT;
16123 snd_hda_codec_write(codec, 0x14, 0,
16124 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16127 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16129 unsigned int present1, present2;
16131 present1 = snd_hda_codec_read(codec, 0x21, 0,
16132 AC_VERB_GET_PIN_SENSE, 0)
16133 & AC_PINSENSE_PRESENCE;
16134 present2 = snd_hda_codec_read(codec, 0x15, 0,
16135 AC_VERB_GET_PIN_SENSE, 0)
16136 & AC_PINSENSE_PRESENCE;
16138 if (present1 || present2) {
16139 snd_hda_codec_write_cache(codec, 0x14, 0,
16140 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16142 snd_hda_codec_write_cache(codec, 0x14, 0,
16143 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16147 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16149 unsigned int present1, present2;
16151 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16152 AC_VERB_GET_PIN_SENSE, 0)
16153 & AC_PINSENSE_PRESENCE;
16154 present2 = snd_hda_codec_read(codec, 0x15, 0,
16155 AC_VERB_GET_PIN_SENSE, 0)
16156 & AC_PINSENSE_PRESENCE;
16158 if (present1 || present2) {
16159 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16160 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16161 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16162 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16164 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16165 AMP_IN_MUTE(0), 0);
16166 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16167 AMP_IN_MUTE(0), 0);
16171 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16173 unsigned int present;
16175 present = snd_hda_codec_read(codec, 0x18, 0,
16176 AC_VERB_GET_PIN_SENSE, 0)
16177 & AC_PINSENSE_PRESENCE;
16178 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16179 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16180 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16181 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16182 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16183 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16184 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16185 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16188 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16191 switch (res >> 26) {
16192 case ALC880_HP_EVENT:
16193 alc663_m51va_speaker_automute(codec);
16195 case ALC880_MIC_EVENT:
16196 alc663_m51va_mic_automute(codec);
16201 static void alc663_m51va_inithook(struct hda_codec *codec)
16203 alc663_m51va_speaker_automute(codec);
16204 alc663_m51va_mic_automute(codec);
16207 /* ***************** Mode1 ******************************/
16208 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16211 switch (res >> 26) {
16212 case ALC880_HP_EVENT:
16213 alc663_m51va_speaker_automute(codec);
16215 case ALC880_MIC_EVENT:
16216 alc662_eeepc_mic_automute(codec);
16221 static void alc663_mode1_inithook(struct hda_codec *codec)
16223 alc663_m51va_speaker_automute(codec);
16224 alc662_eeepc_mic_automute(codec);
16226 /* ***************** Mode2 ******************************/
16227 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16230 switch (res >> 26) {
16231 case ALC880_HP_EVENT:
16232 alc662_f5z_speaker_automute(codec);
16234 case ALC880_MIC_EVENT:
16235 alc662_eeepc_mic_automute(codec);
16240 static void alc662_mode2_inithook(struct hda_codec *codec)
16242 alc662_f5z_speaker_automute(codec);
16243 alc662_eeepc_mic_automute(codec);
16245 /* ***************** Mode3 ******************************/
16246 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16249 switch (res >> 26) {
16250 case ALC880_HP_EVENT:
16251 alc663_two_hp_m1_speaker_automute(codec);
16253 case ALC880_MIC_EVENT:
16254 alc662_eeepc_mic_automute(codec);
16259 static void alc663_mode3_inithook(struct hda_codec *codec)
16261 alc663_two_hp_m1_speaker_automute(codec);
16262 alc662_eeepc_mic_automute(codec);
16264 /* ***************** Mode4 ******************************/
16265 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16268 switch (res >> 26) {
16269 case ALC880_HP_EVENT:
16270 alc663_21jd_two_speaker_automute(codec);
16272 case ALC880_MIC_EVENT:
16273 alc662_eeepc_mic_automute(codec);
16278 static void alc663_mode4_inithook(struct hda_codec *codec)
16280 alc663_21jd_two_speaker_automute(codec);
16281 alc662_eeepc_mic_automute(codec);
16283 /* ***************** Mode5 ******************************/
16284 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16287 switch (res >> 26) {
16288 case ALC880_HP_EVENT:
16289 alc663_15jd_two_speaker_automute(codec);
16291 case ALC880_MIC_EVENT:
16292 alc662_eeepc_mic_automute(codec);
16297 static void alc663_mode5_inithook(struct hda_codec *codec)
16299 alc663_15jd_two_speaker_automute(codec);
16300 alc662_eeepc_mic_automute(codec);
16302 /* ***************** Mode6 ******************************/
16303 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16306 switch (res >> 26) {
16307 case ALC880_HP_EVENT:
16308 alc663_two_hp_m2_speaker_automute(codec);
16310 case ALC880_MIC_EVENT:
16311 alc662_eeepc_mic_automute(codec);
16316 static void alc663_mode6_inithook(struct hda_codec *codec)
16318 alc663_two_hp_m2_speaker_automute(codec);
16319 alc662_eeepc_mic_automute(codec);
16322 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16324 unsigned int present;
16325 unsigned char bits;
16327 present = snd_hda_codec_read(codec, 0x21, 0,
16328 AC_VERB_GET_PIN_SENSE, 0)
16329 & AC_PINSENSE_PRESENCE;
16330 bits = present ? HDA_AMP_MUTE : 0;
16331 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16332 HDA_AMP_MUTE, bits);
16333 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16334 HDA_AMP_MUTE, bits);
16337 static void alc663_g71v_front_automute(struct hda_codec *codec)
16339 unsigned int present;
16340 unsigned char bits;
16342 present = snd_hda_codec_read(codec, 0x15, 0,
16343 AC_VERB_GET_PIN_SENSE, 0)
16344 & AC_PINSENSE_PRESENCE;
16345 bits = present ? HDA_AMP_MUTE : 0;
16346 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16347 HDA_AMP_MUTE, bits);
16350 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16353 switch (res >> 26) {
16354 case ALC880_HP_EVENT:
16355 alc663_g71v_hp_automute(codec);
16357 case ALC880_FRONT_EVENT:
16358 alc663_g71v_front_automute(codec);
16360 case ALC880_MIC_EVENT:
16361 alc662_eeepc_mic_automute(codec);
16366 static void alc663_g71v_inithook(struct hda_codec *codec)
16368 alc663_g71v_front_automute(codec);
16369 alc663_g71v_hp_automute(codec);
16370 alc662_eeepc_mic_automute(codec);
16373 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16376 switch (res >> 26) {
16377 case ALC880_HP_EVENT:
16378 alc663_m51va_speaker_automute(codec);
16380 case ALC880_MIC_EVENT:
16381 alc662_eeepc_mic_automute(codec);
16386 static void alc663_g50v_inithook(struct hda_codec *codec)
16388 alc663_m51va_speaker_automute(codec);
16389 alc662_eeepc_mic_automute(codec);
16392 /* bind hp and internal speaker mute (with plug check) */
16393 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
16394 struct snd_ctl_elem_value *ucontrol)
16396 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
16397 long *valp = ucontrol->value.integer.value;
16400 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
16402 valp[0] ? 0 : HDA_AMP_MUTE);
16403 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
16405 valp[1] ? 0 : HDA_AMP_MUTE);
16407 alc262_hippo1_automute(codec);
16411 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16412 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16414 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16415 .name = "Master Playback Switch",
16416 .info = snd_hda_mixer_amp_switch_info,
16417 .get = snd_hda_mixer_amp_switch_get,
16418 .put = alc662_ecs_master_sw_put,
16419 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16422 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16423 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16424 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16426 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16427 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16428 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16432 #ifdef CONFIG_SND_HDA_POWER_SAVE
16433 #define alc662_loopbacks alc880_loopbacks
16437 /* pcm configuration: identiacal with ALC880 */
16438 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16439 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16440 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16441 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16444 * configuration and preset
16446 static const char *alc662_models[ALC662_MODEL_LAST] = {
16447 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16448 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16449 [ALC662_3ST_6ch] = "3stack-6ch",
16450 [ALC662_5ST_DIG] = "6stack-dig",
16451 [ALC662_LENOVO_101E] = "lenovo-101e",
16452 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16453 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16454 [ALC662_ECS] = "ecs",
16455 [ALC663_ASUS_M51VA] = "m51va",
16456 [ALC663_ASUS_G71V] = "g71v",
16457 [ALC663_ASUS_H13] = "h13",
16458 [ALC663_ASUS_G50V] = "g50v",
16459 [ALC663_ASUS_MODE1] = "asus-mode1",
16460 [ALC662_ASUS_MODE2] = "asus-mode2",
16461 [ALC663_ASUS_MODE3] = "asus-mode3",
16462 [ALC663_ASUS_MODE4] = "asus-mode4",
16463 [ALC663_ASUS_MODE5] = "asus-mode5",
16464 [ALC663_ASUS_MODE6] = "asus-mode6",
16465 [ALC662_AUTO] = "auto",
16468 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16469 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16470 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16471 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16472 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16473 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16474 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16475 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16476 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16477 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16478 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16479 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16480 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16481 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16482 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16483 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16484 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16485 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16486 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16487 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16488 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16489 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16490 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16491 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16492 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16493 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16494 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16495 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16496 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16497 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16498 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16499 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16500 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16501 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16502 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16503 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16504 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16505 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16506 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16507 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16508 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16509 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16510 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16511 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16512 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16513 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16514 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16515 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16516 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16517 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16518 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16519 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16520 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16521 ALC662_3ST_6ch_DIG),
16522 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16523 ALC662_3ST_6ch_DIG),
16524 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16525 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16526 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16527 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16528 ALC662_3ST_6ch_DIG),
16529 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16534 static struct alc_config_preset alc662_presets[] = {
16535 [ALC662_3ST_2ch_DIG] = {
16536 .mixers = { alc662_3ST_2ch_mixer },
16537 .init_verbs = { alc662_init_verbs },
16538 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16539 .dac_nids = alc662_dac_nids,
16540 .dig_out_nid = ALC662_DIGOUT_NID,
16541 .dig_in_nid = ALC662_DIGIN_NID,
16542 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16543 .channel_mode = alc662_3ST_2ch_modes,
16544 .input_mux = &alc662_capture_source,
16546 [ALC662_3ST_6ch_DIG] = {
16547 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16548 .init_verbs = { alc662_init_verbs },
16549 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16550 .dac_nids = alc662_dac_nids,
16551 .dig_out_nid = ALC662_DIGOUT_NID,
16552 .dig_in_nid = ALC662_DIGIN_NID,
16553 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16554 .channel_mode = alc662_3ST_6ch_modes,
16556 .input_mux = &alc662_capture_source,
16558 [ALC662_3ST_6ch] = {
16559 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16560 .init_verbs = { alc662_init_verbs },
16561 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16562 .dac_nids = alc662_dac_nids,
16563 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16564 .channel_mode = alc662_3ST_6ch_modes,
16566 .input_mux = &alc662_capture_source,
16568 [ALC662_5ST_DIG] = {
16569 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16570 .init_verbs = { alc662_init_verbs },
16571 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16572 .dac_nids = alc662_dac_nids,
16573 .dig_out_nid = ALC662_DIGOUT_NID,
16574 .dig_in_nid = ALC662_DIGIN_NID,
16575 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16576 .channel_mode = alc662_5stack_modes,
16577 .input_mux = &alc662_capture_source,
16579 [ALC662_LENOVO_101E] = {
16580 .mixers = { alc662_lenovo_101e_mixer },
16581 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16582 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16583 .dac_nids = alc662_dac_nids,
16584 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16585 .channel_mode = alc662_3ST_2ch_modes,
16586 .input_mux = &alc662_lenovo_101e_capture_source,
16587 .unsol_event = alc662_lenovo_101e_unsol_event,
16588 .init_hook = alc662_lenovo_101e_all_automute,
16590 [ALC662_ASUS_EEEPC_P701] = {
16591 .mixers = { alc662_eeepc_p701_mixer },
16592 .init_verbs = { alc662_init_verbs,
16593 alc662_eeepc_sue_init_verbs },
16594 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16595 .dac_nids = alc662_dac_nids,
16596 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16597 .channel_mode = alc662_3ST_2ch_modes,
16598 .input_mux = &alc662_eeepc_capture_source,
16599 .unsol_event = alc662_eeepc_unsol_event,
16600 .init_hook = alc662_eeepc_inithook,
16602 [ALC662_ASUS_EEEPC_EP20] = {
16603 .mixers = { alc662_eeepc_ep20_mixer,
16604 alc662_chmode_mixer },
16605 .init_verbs = { alc662_init_verbs,
16606 alc662_eeepc_ep20_sue_init_verbs },
16607 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16608 .dac_nids = alc662_dac_nids,
16609 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16610 .channel_mode = alc662_3ST_6ch_modes,
16611 .input_mux = &alc662_lenovo_101e_capture_source,
16612 .unsol_event = alc662_eeepc_ep20_unsol_event,
16613 .init_hook = alc662_eeepc_ep20_inithook,
16616 .mixers = { alc662_ecs_mixer },
16617 .init_verbs = { alc662_init_verbs,
16618 alc662_ecs_init_verbs },
16619 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16620 .dac_nids = alc662_dac_nids,
16621 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16622 .channel_mode = alc662_3ST_2ch_modes,
16623 .input_mux = &alc662_eeepc_capture_source,
16624 .unsol_event = alc662_eeepc_unsol_event,
16625 .init_hook = alc662_eeepc_inithook,
16627 [ALC663_ASUS_M51VA] = {
16628 .mixers = { alc663_m51va_mixer },
16629 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16630 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16631 .dac_nids = alc662_dac_nids,
16632 .dig_out_nid = ALC662_DIGOUT_NID,
16633 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16634 .channel_mode = alc662_3ST_2ch_modes,
16635 .input_mux = &alc663_m51va_capture_source,
16636 .unsol_event = alc663_m51va_unsol_event,
16637 .init_hook = alc663_m51va_inithook,
16639 [ALC663_ASUS_G71V] = {
16640 .mixers = { alc663_g71v_mixer },
16641 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16642 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16643 .dac_nids = alc662_dac_nids,
16644 .dig_out_nid = ALC662_DIGOUT_NID,
16645 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16646 .channel_mode = alc662_3ST_2ch_modes,
16647 .input_mux = &alc662_eeepc_capture_source,
16648 .unsol_event = alc663_g71v_unsol_event,
16649 .init_hook = alc663_g71v_inithook,
16651 [ALC663_ASUS_H13] = {
16652 .mixers = { alc663_m51va_mixer },
16653 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16654 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16655 .dac_nids = alc662_dac_nids,
16656 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16657 .channel_mode = alc662_3ST_2ch_modes,
16658 .input_mux = &alc663_m51va_capture_source,
16659 .unsol_event = alc663_m51va_unsol_event,
16660 .init_hook = alc663_m51va_inithook,
16662 [ALC663_ASUS_G50V] = {
16663 .mixers = { alc663_g50v_mixer },
16664 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16665 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16666 .dac_nids = alc662_dac_nids,
16667 .dig_out_nid = ALC662_DIGOUT_NID,
16668 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16669 .channel_mode = alc662_3ST_6ch_modes,
16670 .input_mux = &alc663_capture_source,
16671 .unsol_event = alc663_g50v_unsol_event,
16672 .init_hook = alc663_g50v_inithook,
16674 [ALC663_ASUS_MODE1] = {
16675 .mixers = { alc663_m51va_mixer },
16676 .cap_mixer = alc662_auto_capture_mixer,
16677 .init_verbs = { alc662_init_verbs,
16678 alc663_21jd_amic_init_verbs },
16679 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16681 .dac_nids = alc662_dac_nids,
16682 .dig_out_nid = ALC662_DIGOUT_NID,
16683 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16684 .channel_mode = alc662_3ST_2ch_modes,
16685 .input_mux = &alc662_eeepc_capture_source,
16686 .unsol_event = alc663_mode1_unsol_event,
16687 .init_hook = alc663_mode1_inithook,
16689 [ALC662_ASUS_MODE2] = {
16690 .mixers = { alc662_1bjd_mixer },
16691 .cap_mixer = alc662_auto_capture_mixer,
16692 .init_verbs = { alc662_init_verbs,
16693 alc662_1bjd_amic_init_verbs },
16694 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16695 .dac_nids = alc662_dac_nids,
16696 .dig_out_nid = ALC662_DIGOUT_NID,
16697 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16698 .channel_mode = alc662_3ST_2ch_modes,
16699 .input_mux = &alc662_eeepc_capture_source,
16700 .unsol_event = alc662_mode2_unsol_event,
16701 .init_hook = alc662_mode2_inithook,
16703 [ALC663_ASUS_MODE3] = {
16704 .mixers = { alc663_two_hp_m1_mixer },
16705 .cap_mixer = alc662_auto_capture_mixer,
16706 .init_verbs = { alc662_init_verbs,
16707 alc663_two_hp_amic_m1_init_verbs },
16708 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16710 .dac_nids = alc662_dac_nids,
16711 .dig_out_nid = ALC662_DIGOUT_NID,
16712 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16713 .channel_mode = alc662_3ST_2ch_modes,
16714 .input_mux = &alc662_eeepc_capture_source,
16715 .unsol_event = alc663_mode3_unsol_event,
16716 .init_hook = alc663_mode3_inithook,
16718 [ALC663_ASUS_MODE4] = {
16719 .mixers = { alc663_asus_21jd_clfe_mixer },
16720 .cap_mixer = alc662_auto_capture_mixer,
16721 .init_verbs = { alc662_init_verbs,
16722 alc663_21jd_amic_init_verbs},
16723 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16725 .dac_nids = alc662_dac_nids,
16726 .dig_out_nid = ALC662_DIGOUT_NID,
16727 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16728 .channel_mode = alc662_3ST_2ch_modes,
16729 .input_mux = &alc662_eeepc_capture_source,
16730 .unsol_event = alc663_mode4_unsol_event,
16731 .init_hook = alc663_mode4_inithook,
16733 [ALC663_ASUS_MODE5] = {
16734 .mixers = { alc663_asus_15jd_clfe_mixer },
16735 .cap_mixer = alc662_auto_capture_mixer,
16736 .init_verbs = { alc662_init_verbs,
16737 alc663_15jd_amic_init_verbs },
16738 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16740 .dac_nids = alc662_dac_nids,
16741 .dig_out_nid = ALC662_DIGOUT_NID,
16742 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16743 .channel_mode = alc662_3ST_2ch_modes,
16744 .input_mux = &alc662_eeepc_capture_source,
16745 .unsol_event = alc663_mode5_unsol_event,
16746 .init_hook = alc663_mode5_inithook,
16748 [ALC663_ASUS_MODE6] = {
16749 .mixers = { alc663_two_hp_m2_mixer },
16750 .cap_mixer = alc662_auto_capture_mixer,
16751 .init_verbs = { alc662_init_verbs,
16752 alc663_two_hp_amic_m2_init_verbs },
16753 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16755 .dac_nids = alc662_dac_nids,
16756 .dig_out_nid = ALC662_DIGOUT_NID,
16757 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16758 .channel_mode = alc662_3ST_2ch_modes,
16759 .input_mux = &alc662_eeepc_capture_source,
16760 .unsol_event = alc663_mode6_unsol_event,
16761 .init_hook = alc663_mode6_inithook,
16764 .mixers = { alc663_m51va_mixer },
16765 .cap_mixer = alc272_auto_capture_mixer,
16766 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16767 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16768 .dac_nids = alc662_dac_nids,
16769 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16770 .adc_nids = alc272_adc_nids,
16771 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16772 .capsrc_nids = alc272_capsrc_nids,
16773 .channel_mode = alc662_3ST_2ch_modes,
16774 .input_mux = &alc663_m51va_capture_source,
16775 .unsol_event = alc663_m51va_unsol_event,
16776 .init_hook = alc663_m51va_inithook,
16778 [ALC272_DELL_ZM1] = {
16779 .mixers = { alc663_m51va_mixer },
16780 .cap_mixer = alc662_auto_capture_mixer,
16781 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16782 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16783 .dac_nids = alc662_dac_nids,
16784 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16785 .adc_nids = alc662_adc_nids,
16786 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
16787 .capsrc_nids = alc662_capsrc_nids,
16788 .channel_mode = alc662_3ST_2ch_modes,
16789 .input_mux = &alc663_m51va_capture_source,
16790 .unsol_event = alc663_m51va_unsol_event,
16791 .init_hook = alc663_m51va_inithook,
16797 * BIOS auto configuration
16800 /* add playback controls from the parsed DAC table */
16801 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16802 const struct auto_pin_cfg *cfg)
16805 static const char *chname[4] = {
16806 "Front", "Surround", NULL /*CLFE*/, "Side"
16811 for (i = 0; i < cfg->line_outs; i++) {
16812 if (!spec->multiout.dac_nids[i])
16814 nid = alc880_idx_to_dac(i);
16817 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16818 "Center Playback Volume",
16819 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16823 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16824 "LFE Playback Volume",
16825 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16829 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16830 "Center Playback Switch",
16831 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16835 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16836 "LFE Playback Switch",
16837 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16842 sprintf(name, "%s Playback Volume", chname[i]);
16843 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16844 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16848 sprintf(name, "%s Playback Switch", chname[i]);
16849 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16850 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16859 /* add playback controls for speaker and HP outputs */
16860 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16871 /* ALC663 has a mono output pin on 0x17 */
16872 sprintf(name, "%s Playback Switch", pfx);
16873 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16874 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16878 if (alc880_is_fixed_pin(pin)) {
16879 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16880 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16881 /* specify the DAC as the extra output */
16882 if (!spec->multiout.hp_nid)
16883 spec->multiout.hp_nid = nid;
16885 spec->multiout.extra_out_nid[0] = nid;
16886 /* control HP volume/switch on the output mixer amp */
16887 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16888 sprintf(name, "%s Playback Volume", pfx);
16889 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16890 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16893 sprintf(name, "%s Playback Switch", pfx);
16894 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16895 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16898 } else if (alc880_is_multi_pin(pin)) {
16899 /* set manual connection */
16900 /* we have only a switch on HP-out PIN */
16901 sprintf(name, "%s Playback Switch", pfx);
16902 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16903 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16910 /* return the index of the src widget from the connection list of the nid.
16911 * return -1 if not found
16913 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
16916 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
16919 conns = snd_hda_get_connections(codec, nid, conn_list,
16920 ARRAY_SIZE(conn_list));
16923 for (i = 0; i < conns; i++)
16924 if (conn_list[i] == src)
16929 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
16931 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
16932 return (pincap & AC_PINCAP_IN) != 0;
16935 /* create playback/capture controls for input pins */
16936 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
16937 const struct auto_pin_cfg *cfg)
16939 struct alc_spec *spec = codec->spec;
16940 struct hda_input_mux *imux = &spec->private_imux[0];
16943 for (i = 0; i < AUTO_PIN_LAST; i++) {
16944 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
16945 idx = alc662_input_pin_idx(codec, 0x0b,
16946 cfg->input_pins[i]);
16948 err = new_analog_input(spec, cfg->input_pins[i],
16949 auto_pin_cfg_labels[i],
16954 idx = alc662_input_pin_idx(codec, 0x22,
16955 cfg->input_pins[i]);
16957 imux->items[imux->num_items].label =
16958 auto_pin_cfg_labels[i];
16959 imux->items[imux->num_items].index = idx;
16967 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16968 hda_nid_t nid, int pin_type,
16971 alc_set_pin_output(codec, nid, pin_type);
16972 /* need the manual connection? */
16973 if (alc880_is_multi_pin(nid)) {
16974 struct alc_spec *spec = codec->spec;
16975 int idx = alc880_multi_pin_idx(nid);
16976 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16977 AC_VERB_SET_CONNECT_SEL,
16978 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16982 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16984 struct alc_spec *spec = codec->spec;
16987 for (i = 0; i <= HDA_SIDE; i++) {
16988 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16989 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16991 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16996 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16998 struct alc_spec *spec = codec->spec;
17001 pin = spec->autocfg.hp_pins[0];
17002 if (pin) /* connect to front */
17004 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17005 pin = spec->autocfg.speaker_pins[0];
17007 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17010 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17012 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17014 struct alc_spec *spec = codec->spec;
17017 for (i = 0; i < AUTO_PIN_LAST; i++) {
17018 hda_nid_t nid = spec->autocfg.input_pins[i];
17019 if (alc662_is_input_pin(codec, nid)) {
17020 alc_set_input_pin(codec, nid, i);
17021 if (nid != ALC662_PIN_CD_NID &&
17022 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17023 snd_hda_codec_write(codec, nid, 0,
17024 AC_VERB_SET_AMP_GAIN_MUTE,
17030 #define alc662_auto_init_input_src alc882_auto_init_input_src
17032 static int alc662_parse_auto_config(struct hda_codec *codec)
17034 struct alc_spec *spec = codec->spec;
17036 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17038 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17042 if (!spec->autocfg.line_outs)
17043 return 0; /* can't find valid BIOS pin config */
17045 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17048 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17051 err = alc662_auto_create_extra_out(spec,
17052 spec->autocfg.speaker_pins[0],
17056 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17060 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
17064 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17066 if (spec->autocfg.dig_outs)
17067 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17069 if (spec->kctls.list)
17070 add_mixer(spec, spec->kctls.list);
17072 spec->num_mux_defs = 1;
17073 spec->input_mux = &spec->private_imux[0];
17075 add_verb(spec, alc662_auto_init_verbs);
17076 if (codec->vendor_id == 0x10ec0663)
17077 add_verb(spec, alc663_auto_init_verbs);
17079 err = alc_auto_add_mic_boost(codec);
17083 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17088 /* additional initialization for auto-configuration model */
17089 static void alc662_auto_init(struct hda_codec *codec)
17091 struct alc_spec *spec = codec->spec;
17092 alc662_auto_init_multi_out(codec);
17093 alc662_auto_init_hp_out(codec);
17094 alc662_auto_init_analog_input(codec);
17095 alc662_auto_init_input_src(codec);
17096 if (spec->unsol_event)
17097 alc_inithook(codec);
17100 static int patch_alc662(struct hda_codec *codec)
17102 struct alc_spec *spec;
17103 int err, board_config;
17105 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17109 codec->spec = spec;
17111 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17113 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17116 if (board_config < 0) {
17117 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
17118 "trying auto-probe from BIOS...\n");
17119 board_config = ALC662_AUTO;
17122 if (board_config == ALC662_AUTO) {
17123 /* automatic parse from the BIOS config */
17124 err = alc662_parse_auto_config(codec);
17130 "hda_codec: Cannot set up configuration "
17131 "from BIOS. Using base mode...\n");
17132 board_config = ALC662_3ST_2ch_DIG;
17136 err = snd_hda_attach_beep_device(codec, 0x1);
17142 if (board_config != ALC662_AUTO)
17143 setup_preset(spec, &alc662_presets[board_config]);
17145 if (codec->vendor_id == 0x10ec0663) {
17146 spec->stream_name_analog = "ALC663 Analog";
17147 spec->stream_name_digital = "ALC663 Digital";
17148 } else if (codec->vendor_id == 0x10ec0272) {
17149 spec->stream_name_analog = "ALC272 Analog";
17150 spec->stream_name_digital = "ALC272 Digital";
17152 spec->stream_name_analog = "ALC662 Analog";
17153 spec->stream_name_digital = "ALC662 Digital";
17156 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17157 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17159 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17160 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17162 spec->adc_nids = alc662_adc_nids;
17163 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17164 spec->capsrc_nids = alc662_capsrc_nids;
17165 spec->capture_style = CAPT_MIX;
17167 if (!spec->cap_mixer)
17168 set_capture_mixer(spec);
17169 if (codec->vendor_id == 0x10ec0662)
17170 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17172 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17174 spec->vmaster_nid = 0x02;
17176 codec->patch_ops = alc_patch_ops;
17177 if (board_config == ALC662_AUTO)
17178 spec->init_hook = alc662_auto_init;
17179 #ifdef CONFIG_SND_HDA_POWER_SAVE
17180 if (!spec->loopback.amplist)
17181 spec->loopback.amplist = alc662_loopbacks;
17183 codec->proc_widget_hook = print_realtek_coef;
17191 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17192 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17193 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17194 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17195 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17196 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17197 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17198 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17199 .patch = patch_alc861 },
17200 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17201 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17202 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17203 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17204 .patch = patch_alc883 },
17205 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17206 .patch = patch_alc662 },
17207 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17208 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17209 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17210 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
17211 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17212 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17213 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17214 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17215 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17216 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
17217 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17218 .patch = patch_alc883 },
17219 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
17220 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
17221 {} /* terminator */
17224 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17226 MODULE_LICENSE("GPL");
17227 MODULE_DESCRIPTION("Realtek HD-audio codec");
17229 static struct hda_codec_preset_list realtek_list = {
17230 .preset = snd_hda_preset_realtek,
17231 .owner = THIS_MODULE,
17234 static int __init patch_realtek_init(void)
17236 return snd_hda_add_codec_preset(&realtek_list);
17239 static void __exit patch_realtek_exit(void)
17241 snd_hda_delete_codec_preset(&realtek_list);
17244 module_init(patch_realtek_init)
17245 module_exit(patch_realtek_exit)