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,
221 ALC883_TARGA_2ch_DIG,
224 ALC888_ACER_ASPIRE_4930G,
228 ALC883_LENOVO_101E_2ch,
229 ALC883_LENOVO_NB0763,
230 ALC888_LENOVO_MS7195_DIG,
237 ALC883_FUJITSU_PI2515,
238 ALC888_FUJITSU_XA3530,
239 ALC883_3ST_6ch_INTEL,
247 /* styles of capture selection */
249 CAPT_MUX = 0, /* only mux based */
250 CAPT_MIX, /* only mixer based */
251 CAPT_1MUX_MIX, /* first mux and other mixers */
255 #define GPIO_MASK 0x03
257 /* extra amp-initialization sequence types */
267 /* codec parameterization */
268 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
269 unsigned int num_mixers;
270 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
271 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
273 const struct hda_verb *init_verbs[5]; /* initialization verbs
277 unsigned int num_init_verbs;
279 char *stream_name_analog; /* analog PCM stream */
280 struct hda_pcm_stream *stream_analog_playback;
281 struct hda_pcm_stream *stream_analog_capture;
282 struct hda_pcm_stream *stream_analog_alt_playback;
283 struct hda_pcm_stream *stream_analog_alt_capture;
285 char *stream_name_digital; /* digital PCM stream */
286 struct hda_pcm_stream *stream_digital_playback;
287 struct hda_pcm_stream *stream_digital_capture;
290 struct hda_multi_out multiout; /* playback set-up
291 * max_channels, dacs must be set
292 * dig_out_nid and hp_nid are optional
294 hda_nid_t alt_dac_nid;
295 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
299 unsigned int num_adc_nids;
301 hda_nid_t *capsrc_nids;
302 hda_nid_t dig_in_nid; /* digital-in NID; optional */
303 int capture_style; /* capture style (CAPT_*) */
306 unsigned int num_mux_defs;
307 const struct hda_input_mux *input_mux;
308 unsigned int cur_mux[3];
311 const struct hda_channel_mode *channel_mode;
312 int num_channel_mode;
315 /* PCM information */
316 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
318 /* dynamic controls, init_verbs and input_mux */
319 struct auto_pin_cfg autocfg;
320 struct snd_array kctls;
321 struct hda_input_mux private_imux[3];
322 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
325 void (*init_hook)(struct hda_codec *codec);
326 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
328 /* for pin sensing */
329 unsigned int sense_updated: 1;
330 unsigned int jack_present: 1;
331 unsigned int master_sw: 1;
334 unsigned int no_analog :1; /* digital I/O only */
337 /* for virtual master */
338 hda_nid_t vmaster_nid;
339 #ifdef CONFIG_SND_HDA_POWER_SAVE
340 struct hda_loopback_check loopback;
345 unsigned int pll_coef_idx, pll_coef_bit;
349 * configuration template - to be copied to the spec instance
351 struct alc_config_preset {
352 struct snd_kcontrol_new *mixers[5]; /* should be identical size
355 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
356 const struct hda_verb *init_verbs[5];
357 unsigned int num_dacs;
359 hda_nid_t dig_out_nid; /* optional */
360 hda_nid_t hp_nid; /* optional */
361 hda_nid_t *slave_dig_outs;
362 unsigned int num_adc_nids;
364 hda_nid_t *capsrc_nids;
365 hda_nid_t dig_in_nid;
366 unsigned int num_channel_mode;
367 const struct hda_channel_mode *channel_mode;
369 unsigned int num_mux_defs;
370 const struct hda_input_mux *input_mux;
371 void (*unsol_event)(struct hda_codec *, unsigned int);
372 void (*init_hook)(struct hda_codec *);
373 #ifdef CONFIG_SND_HDA_POWER_SAVE
374 struct hda_amp_list *loopbacks;
382 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
383 struct snd_ctl_elem_info *uinfo)
385 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
386 struct alc_spec *spec = codec->spec;
387 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
388 if (mux_idx >= spec->num_mux_defs)
390 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
393 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
394 struct snd_ctl_elem_value *ucontrol)
396 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
397 struct alc_spec *spec = codec->spec;
398 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
400 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
404 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
405 struct snd_ctl_elem_value *ucontrol)
407 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
408 struct alc_spec *spec = codec->spec;
409 const struct hda_input_mux *imux;
410 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
411 unsigned int mux_idx;
412 hda_nid_t nid = spec->capsrc_nids ?
413 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
415 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
416 imux = &spec->input_mux[mux_idx];
418 if (spec->capture_style &&
419 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) {
420 /* Matrix-mixer style (e.g. ALC882) */
421 unsigned int *cur_val = &spec->cur_mux[adc_idx];
424 idx = ucontrol->value.enumerated.item[0];
425 if (idx >= imux->num_items)
426 idx = imux->num_items - 1;
429 for (i = 0; i < imux->num_items; i++) {
430 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
431 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
432 imux->items[i].index,
438 /* MUX style (e.g. ALC880) */
439 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
440 &spec->cur_mux[adc_idx]);
445 * channel mode setting
447 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
448 struct snd_ctl_elem_info *uinfo)
450 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
451 struct alc_spec *spec = codec->spec;
452 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
453 spec->num_channel_mode);
456 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
457 struct snd_ctl_elem_value *ucontrol)
459 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
460 struct alc_spec *spec = codec->spec;
461 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
462 spec->num_channel_mode,
463 spec->multiout.max_channels);
466 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
467 struct snd_ctl_elem_value *ucontrol)
469 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
470 struct alc_spec *spec = codec->spec;
471 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
472 spec->num_channel_mode,
473 &spec->multiout.max_channels);
474 if (err >= 0 && spec->need_dac_fix)
475 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
480 * Control the mode of pin widget settings via the mixer. "pc" is used
481 * instead of "%" to avoid consequences of accidently treating the % as
482 * being part of a format specifier. Maximum allowed length of a value is
483 * 63 characters plus NULL terminator.
485 * Note: some retasking pin complexes seem to ignore requests for input
486 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
487 * are requested. Therefore order this list so that this behaviour will not
488 * cause problems when mixer clients move through the enum sequentially.
489 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
492 static char *alc_pin_mode_names[] = {
493 "Mic 50pc bias", "Mic 80pc bias",
494 "Line in", "Line out", "Headphone out",
496 static unsigned char alc_pin_mode_values[] = {
497 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
499 /* The control can present all 5 options, or it can limit the options based
500 * in the pin being assumed to be exclusively an input or an output pin. In
501 * addition, "input" pins may or may not process the mic bias option
502 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
503 * accept requests for bias as of chip versions up to March 2006) and/or
504 * wiring in the computer.
506 #define ALC_PIN_DIR_IN 0x00
507 #define ALC_PIN_DIR_OUT 0x01
508 #define ALC_PIN_DIR_INOUT 0x02
509 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
510 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
512 /* Info about the pin modes supported by the different pin direction modes.
513 * For each direction the minimum and maximum values are given.
515 static signed char alc_pin_mode_dir_info[5][2] = {
516 { 0, 2 }, /* ALC_PIN_DIR_IN */
517 { 3, 4 }, /* ALC_PIN_DIR_OUT */
518 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
519 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
520 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
522 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
523 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
524 #define alc_pin_mode_n_items(_dir) \
525 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
527 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
528 struct snd_ctl_elem_info *uinfo)
530 unsigned int item_num = uinfo->value.enumerated.item;
531 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
533 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
535 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
537 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
538 item_num = alc_pin_mode_min(dir);
539 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
543 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
544 struct snd_ctl_elem_value *ucontrol)
547 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
548 hda_nid_t nid = kcontrol->private_value & 0xffff;
549 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
550 long *valp = ucontrol->value.integer.value;
551 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
552 AC_VERB_GET_PIN_WIDGET_CONTROL,
555 /* Find enumerated value for current pinctl setting */
556 i = alc_pin_mode_min(dir);
557 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
559 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
563 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
564 struct snd_ctl_elem_value *ucontrol)
567 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
568 hda_nid_t nid = kcontrol->private_value & 0xffff;
569 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
570 long val = *ucontrol->value.integer.value;
571 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
572 AC_VERB_GET_PIN_WIDGET_CONTROL,
575 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
576 val = alc_pin_mode_min(dir);
578 change = pinctl != alc_pin_mode_values[val];
580 /* Set pin mode to that requested */
581 snd_hda_codec_write_cache(codec, nid, 0,
582 AC_VERB_SET_PIN_WIDGET_CONTROL,
583 alc_pin_mode_values[val]);
585 /* Also enable the retasking pin's input/output as required
586 * for the requested pin mode. Enum values of 2 or less are
589 * Dynamically switching the input/output buffers probably
590 * reduces noise slightly (particularly on input) so we'll
591 * do it. However, having both input and output buffers
592 * enabled simultaneously doesn't seem to be problematic if
593 * this turns out to be necessary in the future.
596 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
597 HDA_AMP_MUTE, HDA_AMP_MUTE);
598 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
601 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
602 HDA_AMP_MUTE, HDA_AMP_MUTE);
603 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
610 #define ALC_PIN_MODE(xname, nid, dir) \
611 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
612 .info = alc_pin_mode_info, \
613 .get = alc_pin_mode_get, \
614 .put = alc_pin_mode_put, \
615 .private_value = nid | (dir<<16) }
617 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
618 * together using a mask with more than one bit set. This control is
619 * currently used only by the ALC260 test model. At this stage they are not
620 * needed for any "production" models.
622 #ifdef CONFIG_SND_DEBUG
623 #define alc_gpio_data_info snd_ctl_boolean_mono_info
625 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
626 struct snd_ctl_elem_value *ucontrol)
628 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
629 hda_nid_t nid = kcontrol->private_value & 0xffff;
630 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
631 long *valp = ucontrol->value.integer.value;
632 unsigned int val = snd_hda_codec_read(codec, nid, 0,
633 AC_VERB_GET_GPIO_DATA, 0x00);
635 *valp = (val & mask) != 0;
638 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
639 struct snd_ctl_elem_value *ucontrol)
642 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
643 hda_nid_t nid = kcontrol->private_value & 0xffff;
644 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
645 long val = *ucontrol->value.integer.value;
646 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
647 AC_VERB_GET_GPIO_DATA,
650 /* Set/unset the masked GPIO bit(s) as needed */
651 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
656 snd_hda_codec_write_cache(codec, nid, 0,
657 AC_VERB_SET_GPIO_DATA, gpio_data);
661 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
662 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
663 .info = alc_gpio_data_info, \
664 .get = alc_gpio_data_get, \
665 .put = alc_gpio_data_put, \
666 .private_value = nid | (mask<<16) }
667 #endif /* CONFIG_SND_DEBUG */
669 /* A switch control to allow the enabling of the digital IO pins on the
670 * ALC260. This is incredibly simplistic; the intention of this control is
671 * to provide something in the test model allowing digital outputs to be
672 * identified if present. If models are found which can utilise these
673 * outputs a more complete mixer control can be devised for those models if
676 #ifdef CONFIG_SND_DEBUG
677 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
679 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
680 struct snd_ctl_elem_value *ucontrol)
682 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
683 hda_nid_t nid = kcontrol->private_value & 0xffff;
684 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
685 long *valp = ucontrol->value.integer.value;
686 unsigned int val = snd_hda_codec_read(codec, nid, 0,
687 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
689 *valp = (val & mask) != 0;
692 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
693 struct snd_ctl_elem_value *ucontrol)
696 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
697 hda_nid_t nid = kcontrol->private_value & 0xffff;
698 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
699 long val = *ucontrol->value.integer.value;
700 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
701 AC_VERB_GET_DIGI_CONVERT_1,
704 /* Set/unset the masked control bit(s) as needed */
705 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
710 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
715 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
716 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
717 .info = alc_spdif_ctrl_info, \
718 .get = alc_spdif_ctrl_get, \
719 .put = alc_spdif_ctrl_put, \
720 .private_value = nid | (mask<<16) }
721 #endif /* CONFIG_SND_DEBUG */
723 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
724 * Again, this is only used in the ALC26x test models to help identify when
725 * the EAPD line must be asserted for features to work.
727 #ifdef CONFIG_SND_DEBUG
728 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
730 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
731 struct snd_ctl_elem_value *ucontrol)
733 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
734 hda_nid_t nid = kcontrol->private_value & 0xffff;
735 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
736 long *valp = ucontrol->value.integer.value;
737 unsigned int val = snd_hda_codec_read(codec, nid, 0,
738 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
740 *valp = (val & mask) != 0;
744 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
745 struct snd_ctl_elem_value *ucontrol)
748 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
749 hda_nid_t nid = kcontrol->private_value & 0xffff;
750 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
751 long val = *ucontrol->value.integer.value;
752 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
753 AC_VERB_GET_EAPD_BTLENABLE,
756 /* Set/unset the masked control bit(s) as needed */
757 change = (!val ? 0 : mask) != (ctrl_data & mask);
762 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
768 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
769 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
770 .info = alc_eapd_ctrl_info, \
771 .get = alc_eapd_ctrl_get, \
772 .put = alc_eapd_ctrl_put, \
773 .private_value = nid | (mask<<16) }
774 #endif /* CONFIG_SND_DEBUG */
777 * set up the input pin config (depending on the given auto-pin type)
779 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
782 unsigned int val = PIN_IN;
784 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
786 pincap = snd_hda_query_pin_caps(codec, nid);
787 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
788 if (pincap & AC_PINCAP_VREF_80)
791 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
796 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
798 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
800 spec->mixers[spec->num_mixers++] = mix;
803 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
805 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
807 spec->init_verbs[spec->num_init_verbs++] = verb;
810 #ifdef CONFIG_PROC_FS
814 static void print_realtek_coef(struct snd_info_buffer *buffer,
815 struct hda_codec *codec, hda_nid_t nid)
821 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
822 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
823 coeff = snd_hda_codec_read(codec, nid, 0,
824 AC_VERB_GET_COEF_INDEX, 0);
825 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
828 #define print_realtek_coef NULL
832 * set up from the preset table
834 static void setup_preset(struct alc_spec *spec,
835 const struct alc_config_preset *preset)
839 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
840 add_mixer(spec, preset->mixers[i]);
841 spec->cap_mixer = preset->cap_mixer;
842 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
844 add_verb(spec, preset->init_verbs[i]);
846 spec->channel_mode = preset->channel_mode;
847 spec->num_channel_mode = preset->num_channel_mode;
848 spec->need_dac_fix = preset->need_dac_fix;
850 spec->multiout.max_channels = spec->channel_mode[0].channels;
852 spec->multiout.num_dacs = preset->num_dacs;
853 spec->multiout.dac_nids = preset->dac_nids;
854 spec->multiout.dig_out_nid = preset->dig_out_nid;
855 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
856 spec->multiout.hp_nid = preset->hp_nid;
858 spec->num_mux_defs = preset->num_mux_defs;
859 if (!spec->num_mux_defs)
860 spec->num_mux_defs = 1;
861 spec->input_mux = preset->input_mux;
863 spec->num_adc_nids = preset->num_adc_nids;
864 spec->adc_nids = preset->adc_nids;
865 spec->capsrc_nids = preset->capsrc_nids;
866 spec->dig_in_nid = preset->dig_in_nid;
868 spec->unsol_event = preset->unsol_event;
869 spec->init_hook = preset->init_hook;
870 #ifdef CONFIG_SND_HDA_POWER_SAVE
871 spec->loopback.amplist = preset->loopbacks;
875 /* Enable GPIO mask and set output */
876 static struct hda_verb alc_gpio1_init_verbs[] = {
877 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
878 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
879 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
883 static struct hda_verb alc_gpio2_init_verbs[] = {
884 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
885 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
886 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
890 static struct hda_verb alc_gpio3_init_verbs[] = {
891 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
892 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
893 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
898 * Fix hardware PLL issue
899 * On some codecs, the analog PLL gating control must be off while
900 * the default value is 1.
902 static void alc_fix_pll(struct hda_codec *codec)
904 struct alc_spec *spec = codec->spec;
909 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
911 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
912 AC_VERB_GET_PROC_COEF, 0);
913 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
915 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
916 val & ~(1 << spec->pll_coef_bit));
919 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
920 unsigned int coef_idx, unsigned int coef_bit)
922 struct alc_spec *spec = codec->spec;
924 spec->pll_coef_idx = coef_idx;
925 spec->pll_coef_bit = coef_bit;
929 static void alc_sku_automute(struct hda_codec *codec)
931 struct alc_spec *spec = codec->spec;
932 unsigned int present;
933 unsigned int hp_nid = spec->autocfg.hp_pins[0];
934 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
936 /* need to execute and sync at first */
937 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
938 present = snd_hda_codec_read(codec, hp_nid, 0,
939 AC_VERB_GET_PIN_SENSE, 0);
940 spec->jack_present = (present & 0x80000000) != 0;
941 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
942 spec->jack_present ? 0 : PIN_OUT);
945 #if 0 /* it's broken in some acses -- temporarily disabled */
946 static void alc_mic_automute(struct hda_codec *codec)
948 struct alc_spec *spec = codec->spec;
949 unsigned int present;
950 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
951 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
952 unsigned int mix_nid = spec->capsrc_nids[0];
953 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
955 capsrc_idx_mic = mic_nid - 0x18;
956 capsrc_idx_fmic = fmic_nid - 0x18;
957 present = snd_hda_codec_read(codec, mic_nid, 0,
958 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
959 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
960 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
961 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
962 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
963 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
964 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
967 #define alc_mic_automute(codec) do {} while(0) /* NOP */
968 #endif /* disabled */
970 /* unsolicited event for HP jack sensing */
971 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
973 if (codec->vendor_id == 0x10ec0880)
977 if (res == ALC880_HP_EVENT)
978 alc_sku_automute(codec);
980 if (res == ALC880_MIC_EVENT)
981 alc_mic_automute(codec);
984 static void alc_inithook(struct hda_codec *codec)
986 alc_sku_automute(codec);
987 alc_mic_automute(codec);
990 /* additional initialization for ALC888 variants */
991 static void alc888_coef_init(struct hda_codec *codec)
995 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
996 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
997 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
998 if ((tmp & 0xf0) == 0x20)
1000 snd_hda_codec_read(codec, 0x20, 0,
1001 AC_VERB_SET_PROC_COEF, 0x830);
1004 snd_hda_codec_read(codec, 0x20, 0,
1005 AC_VERB_SET_PROC_COEF, 0x3030);
1008 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1013 case ALC_INIT_GPIO1:
1014 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1016 case ALC_INIT_GPIO2:
1017 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1019 case ALC_INIT_GPIO3:
1020 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1022 case ALC_INIT_DEFAULT:
1023 switch (codec->vendor_id) {
1025 snd_hda_codec_write(codec, 0x0f, 0,
1026 AC_VERB_SET_EAPD_BTLENABLE, 2);
1027 snd_hda_codec_write(codec, 0x10, 0,
1028 AC_VERB_SET_EAPD_BTLENABLE, 2);
1040 snd_hda_codec_write(codec, 0x14, 0,
1041 AC_VERB_SET_EAPD_BTLENABLE, 2);
1042 snd_hda_codec_write(codec, 0x15, 0,
1043 AC_VERB_SET_EAPD_BTLENABLE, 2);
1046 switch (codec->vendor_id) {
1048 snd_hda_codec_write(codec, 0x1a, 0,
1049 AC_VERB_SET_COEF_INDEX, 7);
1050 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1051 AC_VERB_GET_PROC_COEF, 0);
1052 snd_hda_codec_write(codec, 0x1a, 0,
1053 AC_VERB_SET_COEF_INDEX, 7);
1054 snd_hda_codec_write(codec, 0x1a, 0,
1055 AC_VERB_SET_PROC_COEF,
1065 snd_hda_codec_write(codec, 0x20, 0,
1066 AC_VERB_SET_COEF_INDEX, 7);
1067 tmp = snd_hda_codec_read(codec, 0x20, 0,
1068 AC_VERB_GET_PROC_COEF, 0);
1069 snd_hda_codec_write(codec, 0x20, 0,
1070 AC_VERB_SET_COEF_INDEX, 7);
1071 snd_hda_codec_write(codec, 0x20, 0,
1072 AC_VERB_SET_PROC_COEF,
1076 alc888_coef_init(codec);
1080 snd_hda_codec_write(codec, 0x20, 0,
1081 AC_VERB_SET_COEF_INDEX, 7);
1082 tmp = snd_hda_codec_read(codec, 0x20, 0,
1083 AC_VERB_GET_PROC_COEF, 0);
1084 snd_hda_codec_write(codec, 0x20, 0,
1085 AC_VERB_SET_COEF_INDEX, 7);
1086 snd_hda_codec_write(codec, 0x20, 0,
1087 AC_VERB_SET_PROC_COEF,
1095 static void alc_init_auto_hp(struct hda_codec *codec)
1097 struct alc_spec *spec = codec->spec;
1099 if (!spec->autocfg.hp_pins[0])
1102 if (!spec->autocfg.speaker_pins[0]) {
1103 if (spec->autocfg.line_out_pins[0] &&
1104 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1105 spec->autocfg.speaker_pins[0] =
1106 spec->autocfg.line_out_pins[0];
1111 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1112 spec->autocfg.hp_pins[0]);
1113 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1114 AC_VERB_SET_UNSOLICITED_ENABLE,
1115 AC_USRSP_EN | ALC880_HP_EVENT);
1116 spec->unsol_event = alc_sku_unsol_event;
1119 /* check subsystem ID and set up device-specific initialization;
1120 * return 1 if initialized, 0 if invalid SSID
1122 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1123 * 31 ~ 16 : Manufacture ID
1125 * 7 ~ 0 : Assembly ID
1126 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1128 static int alc_subsystem_id(struct hda_codec *codec,
1129 hda_nid_t porta, hda_nid_t porte,
1132 unsigned int ass, tmp, i;
1134 struct alc_spec *spec = codec->spec;
1136 ass = codec->subsystem_id & 0xffff;
1137 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1140 /* invalid SSID, check the special NID pin defcfg instead */
1142 * 31~30 : port conetcivity
1145 * 19~16 : Check sum (15:1)
1150 if (codec->vendor_id == 0x10ec0260)
1152 ass = snd_hda_codec_get_pincfg(codec, nid);
1153 snd_printd("realtek: No valid SSID, "
1154 "checking pincfg 0x%08x for NID 0x%x\n",
1156 if (!(ass & 1) && !(ass & 0x100000))
1158 if ((ass >> 30) != 1) /* no physical connection */
1163 for (i = 1; i < 16; i++) {
1167 if (((ass >> 16) & 0xf) != tmp)
1170 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1171 ass & 0xffff, codec->vendor_id);
1175 * 2 : 0 --> Desktop, 1 --> Laptop
1176 * 3~5 : External Amplifier control
1179 tmp = (ass & 0x38) >> 3; /* external Amp control */
1182 spec->init_amp = ALC_INIT_GPIO1;
1185 spec->init_amp = ALC_INIT_GPIO2;
1188 spec->init_amp = ALC_INIT_GPIO3;
1191 spec->init_amp = ALC_INIT_DEFAULT;
1195 /* is laptop or Desktop and enable the function "Mute internal speaker
1196 * when the external headphone out jack is plugged"
1198 if (!(ass & 0x8000))
1201 * 10~8 : Jack location
1202 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1204 * 15 : 1 --> enable the function "Mute internal speaker
1205 * when the external headphone out jack is plugged"
1207 if (!spec->autocfg.hp_pins[0]) {
1208 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1210 spec->autocfg.hp_pins[0] = porta;
1212 spec->autocfg.hp_pins[0] = porte;
1214 spec->autocfg.hp_pins[0] = portd;
1219 alc_init_auto_hp(codec);
1223 static void alc_ssid_check(struct hda_codec *codec,
1224 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1226 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1227 struct alc_spec *spec = codec->spec;
1228 snd_printd("realtek: "
1229 "Enable default setup for auto mode as fallback\n");
1230 spec->init_amp = ALC_INIT_DEFAULT;
1231 alc_init_auto_hp(codec);
1236 * Fix-up pin default configurations
1244 static void alc_fix_pincfg(struct hda_codec *codec,
1245 const struct snd_pci_quirk *quirk,
1246 const struct alc_pincfg **pinfix)
1248 const struct alc_pincfg *cfg;
1250 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1254 cfg = pinfix[quirk->value];
1255 for (; cfg->nid; cfg++)
1256 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1266 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1267 /* Mic-in jack as mic in */
1268 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1269 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1270 /* Line-in jack as Line in */
1271 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1272 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1273 /* Line-Out as Front */
1274 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1281 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1282 /* Mic-in jack as mic in */
1283 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1284 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1285 /* Line-in jack as Surround */
1286 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1287 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1288 /* Line-Out as Front */
1289 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1296 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1297 /* Mic-in jack as CLFE */
1298 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1299 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1300 /* Line-in jack as Surround */
1301 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1302 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1303 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1304 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1311 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1312 /* Mic-in jack as CLFE */
1313 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1314 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1315 /* Line-in jack as Surround */
1316 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1317 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1318 /* Line-Out as Side */
1319 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1323 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1324 { 2, alc888_4ST_ch2_intel_init },
1325 { 4, alc888_4ST_ch4_intel_init },
1326 { 6, alc888_4ST_ch6_intel_init },
1327 { 8, alc888_4ST_ch8_intel_init },
1331 * ALC888 Fujitsu Siemens Amillo xa3530
1334 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1335 /* Front Mic: set to PIN_IN (empty by default) */
1336 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1337 /* Connect Internal HP to Front */
1338 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1339 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1340 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1341 /* Connect Bass HP to Front */
1342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1343 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1344 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1345 /* Connect Line-Out side jack (SPDIF) to Side */
1346 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1347 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1348 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1349 /* Connect Mic jack to CLFE */
1350 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1351 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1352 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1353 /* Connect Line-in jack to Surround */
1354 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1355 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1356 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1357 /* Connect HP out jack to Front */
1358 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1359 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1360 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1361 /* Enable unsolicited event for HP jack and Line-out jack */
1362 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1363 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1367 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1369 unsigned int present;
1371 /* Line out presence */
1372 present = snd_hda_codec_read(codec, 0x17, 0,
1373 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1374 /* HP out presence */
1375 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1376 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1377 bits = present ? HDA_AMP_MUTE : 0;
1378 /* Toggle internal speakers muting */
1379 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1380 HDA_AMP_MUTE, bits);
1381 /* Toggle internal bass muting */
1382 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1383 HDA_AMP_MUTE, bits);
1386 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1389 if (res >> 26 == ALC880_HP_EVENT)
1390 alc888_fujitsu_xa3530_automute(codec);
1395 * ALC888 Acer Aspire 4930G model
1398 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1399 /* Front Mic: set to PIN_IN (empty by default) */
1400 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1401 /* Unselect Front Mic by default in input mixer 3 */
1402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1403 /* Enable unsolicited event for HP jack */
1404 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1405 /* Connect Internal HP to front */
1406 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1407 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1408 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1409 /* Connect HP out to front */
1410 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1411 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1412 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1416 static struct hda_input_mux alc888_2_capture_sources[2] = {
1417 /* Front mic only available on one ADC */
1424 { "Front Mic", 0xb },
1437 static struct snd_kcontrol_new alc888_base_mixer[] = {
1438 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1439 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1440 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1441 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1442 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1444 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1445 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1446 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1447 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1448 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1449 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1450 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1451 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1452 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1453 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1454 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1455 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1459 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1461 unsigned int present;
1463 present = snd_hda_codec_read(codec, 0x15, 0,
1464 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1465 bits = present ? HDA_AMP_MUTE : 0;
1466 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1467 HDA_AMP_MUTE, bits);
1470 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
1473 if (res >> 26 == ALC880_HP_EVENT)
1474 alc888_acer_aspire_4930g_automute(codec);
1478 * ALC880 3-stack model
1480 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1481 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1482 * F-Mic = 0x1b, HP = 0x19
1485 static hda_nid_t alc880_dac_nids[4] = {
1486 /* front, rear, clfe, rear_surr */
1487 0x02, 0x05, 0x04, 0x03
1490 static hda_nid_t alc880_adc_nids[3] = {
1495 /* The datasheet says the node 0x07 is connected from inputs,
1496 * but it shows zero connection in the real implementation on some devices.
1497 * Note: this is a 915GAV bug, fixed on 915GLV
1499 static hda_nid_t alc880_adc_nids_alt[2] = {
1504 #define ALC880_DIGOUT_NID 0x06
1505 #define ALC880_DIGIN_NID 0x0a
1507 static struct hda_input_mux alc880_capture_source = {
1511 { "Front Mic", 0x3 },
1517 /* channel source setting (2/6 channel selection for 3-stack) */
1519 static struct hda_verb alc880_threestack_ch2_init[] = {
1520 /* set line-in to input, mute it */
1521 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1522 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1523 /* set mic-in to input vref 80%, mute it */
1524 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1525 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1530 static struct hda_verb alc880_threestack_ch6_init[] = {
1531 /* set line-in to output, unmute it */
1532 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1533 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1534 /* set mic-in to output, unmute it */
1535 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1536 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1540 static struct hda_channel_mode alc880_threestack_modes[2] = {
1541 { 2, alc880_threestack_ch2_init },
1542 { 6, alc880_threestack_ch6_init },
1545 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1546 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1547 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1548 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1549 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1550 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1551 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1552 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1553 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1554 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1555 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1556 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1557 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1558 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1559 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1560 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1561 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1562 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1564 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1565 .name = "Channel Mode",
1566 .info = alc_ch_mode_info,
1567 .get = alc_ch_mode_get,
1568 .put = alc_ch_mode_put,
1573 /* capture mixer elements */
1574 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1575 struct snd_ctl_elem_info *uinfo)
1577 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1578 struct alc_spec *spec = codec->spec;
1581 mutex_lock(&codec->control_mutex);
1582 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1584 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1585 mutex_unlock(&codec->control_mutex);
1589 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1590 unsigned int size, unsigned int __user *tlv)
1592 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1593 struct alc_spec *spec = codec->spec;
1596 mutex_lock(&codec->control_mutex);
1597 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1599 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1600 mutex_unlock(&codec->control_mutex);
1604 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1605 struct snd_ctl_elem_value *ucontrol);
1607 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1608 struct snd_ctl_elem_value *ucontrol,
1611 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1612 struct alc_spec *spec = codec->spec;
1613 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1616 mutex_lock(&codec->control_mutex);
1617 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1619 err = func(kcontrol, ucontrol);
1620 mutex_unlock(&codec->control_mutex);
1624 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1625 struct snd_ctl_elem_value *ucontrol)
1627 return alc_cap_getput_caller(kcontrol, ucontrol,
1628 snd_hda_mixer_amp_volume_get);
1631 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1632 struct snd_ctl_elem_value *ucontrol)
1634 return alc_cap_getput_caller(kcontrol, ucontrol,
1635 snd_hda_mixer_amp_volume_put);
1638 /* capture mixer elements */
1639 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1641 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1642 struct snd_ctl_elem_value *ucontrol)
1644 return alc_cap_getput_caller(kcontrol, ucontrol,
1645 snd_hda_mixer_amp_switch_get);
1648 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1649 struct snd_ctl_elem_value *ucontrol)
1651 return alc_cap_getput_caller(kcontrol, ucontrol,
1652 snd_hda_mixer_amp_switch_put);
1655 #define _DEFINE_CAPMIX(num) \
1657 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1658 .name = "Capture Switch", \
1659 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1661 .info = alc_cap_sw_info, \
1662 .get = alc_cap_sw_get, \
1663 .put = alc_cap_sw_put, \
1666 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1667 .name = "Capture Volume", \
1668 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1669 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1670 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1672 .info = alc_cap_vol_info, \
1673 .get = alc_cap_vol_get, \
1674 .put = alc_cap_vol_put, \
1675 .tlv = { .c = alc_cap_vol_tlv }, \
1678 #define _DEFINE_CAPSRC(num) \
1680 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1681 /* .name = "Capture Source", */ \
1682 .name = "Input Source", \
1684 .info = alc_mux_enum_info, \
1685 .get = alc_mux_enum_get, \
1686 .put = alc_mux_enum_put, \
1689 #define DEFINE_CAPMIX(num) \
1690 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1691 _DEFINE_CAPMIX(num), \
1692 _DEFINE_CAPSRC(num), \
1696 #define DEFINE_CAPMIX_NOSRC(num) \
1697 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1698 _DEFINE_CAPMIX(num), \
1702 /* up to three ADCs */
1706 DEFINE_CAPMIX_NOSRC(1);
1707 DEFINE_CAPMIX_NOSRC(2);
1708 DEFINE_CAPMIX_NOSRC(3);
1711 * ALC880 5-stack model
1713 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1715 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1716 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1719 /* additional mixers to alc880_three_stack_mixer */
1720 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1721 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1722 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1726 /* channel source setting (6/8 channel selection for 5-stack) */
1728 static struct hda_verb alc880_fivestack_ch6_init[] = {
1729 /* set line-in to input, mute it */
1730 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1731 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1736 static struct hda_verb alc880_fivestack_ch8_init[] = {
1737 /* set line-in to output, unmute it */
1738 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1739 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1743 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1744 { 6, alc880_fivestack_ch6_init },
1745 { 8, alc880_fivestack_ch8_init },
1750 * ALC880 6-stack model
1752 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1753 * Side = 0x05 (0x0f)
1754 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1755 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1758 static hda_nid_t alc880_6st_dac_nids[4] = {
1759 /* front, rear, clfe, rear_surr */
1760 0x02, 0x03, 0x04, 0x05
1763 static struct hda_input_mux alc880_6stack_capture_source = {
1767 { "Front Mic", 0x1 },
1773 /* fixed 8-channels */
1774 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1778 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1779 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1780 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1781 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1782 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1783 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1784 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1785 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1786 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1787 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1788 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1789 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1790 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1791 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1792 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1793 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1794 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1795 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1796 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1798 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1799 .name = "Channel Mode",
1800 .info = alc_ch_mode_info,
1801 .get = alc_ch_mode_get,
1802 .put = alc_ch_mode_put,
1811 * W810 has rear IO for:
1814 * Center/LFE (DAC 04)
1817 * The system also has a pair of internal speakers, and a headphone jack.
1818 * These are both connected to Line2 on the codec, hence to DAC 02.
1820 * There is a variable resistor to control the speaker or headphone
1821 * volume. This is a hardware-only device without a software API.
1823 * Plugging headphones in will disable the internal speakers. This is
1824 * implemented in hardware, not via the driver using jack sense. In
1825 * a similar fashion, plugging into the rear socket marked "front" will
1826 * disable both the speakers and headphones.
1828 * For input, there's a microphone jack, and an "audio in" jack.
1829 * These may not do anything useful with this driver yet, because I
1830 * haven't setup any initialization verbs for these yet...
1833 static hda_nid_t alc880_w810_dac_nids[3] = {
1834 /* front, rear/surround, clfe */
1838 /* fixed 6 channels */
1839 static struct hda_channel_mode alc880_w810_modes[1] = {
1843 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1844 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1845 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1846 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1847 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1848 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1849 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1850 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1851 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1852 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1853 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1861 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1862 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1866 static hda_nid_t alc880_z71v_dac_nids[1] = {
1869 #define ALC880_Z71V_HP_DAC 0x03
1871 /* fixed 2 channels */
1872 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1876 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1877 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1878 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1879 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1880 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1881 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1882 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1883 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1884 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1890 * ALC880 F1734 model
1892 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1893 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1896 static hda_nid_t alc880_f1734_dac_nids[1] = {
1899 #define ALC880_F1734_HP_DAC 0x02
1901 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1902 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1903 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1904 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1905 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1906 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1907 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1908 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1909 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1913 static struct hda_input_mux alc880_f1734_capture_source = {
1925 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1926 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1927 * Mic = 0x18, Line = 0x1a
1930 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1931 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1933 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1934 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1935 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1936 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1937 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1938 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1939 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1940 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1941 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1942 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1943 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1944 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1945 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1946 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1947 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1949 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1950 .name = "Channel Mode",
1951 .info = alc_ch_mode_info,
1952 .get = alc_ch_mode_get,
1953 .put = alc_ch_mode_put,
1959 * ALC880 ASUS W1V model
1961 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1962 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1963 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1966 /* additional mixers to alc880_asus_mixer */
1967 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1968 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1969 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1974 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1975 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1976 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1977 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1978 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1979 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1980 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1981 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1982 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1983 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1988 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1989 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1990 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1991 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1992 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1993 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1994 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1995 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1996 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1997 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1998 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1999 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2000 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2001 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2002 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2003 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2004 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2006 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2007 .name = "Channel Mode",
2008 .info = alc_ch_mode_info,
2009 .get = alc_ch_mode_get,
2010 .put = alc_ch_mode_put,
2015 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2016 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2017 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2018 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2019 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2020 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2021 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2022 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2023 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2024 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2025 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2029 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2030 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2031 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2032 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2033 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2034 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2035 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2040 * virtual master controls
2044 * slave controls for virtual master
2046 static const char *alc_slave_vols[] = {
2047 "Front Playback Volume",
2048 "Surround Playback Volume",
2049 "Center Playback Volume",
2050 "LFE Playback Volume",
2051 "Side Playback Volume",
2052 "Headphone Playback Volume",
2053 "Speaker Playback Volume",
2054 "Mono Playback Volume",
2055 "Line-Out Playback Volume",
2056 "PCM Playback Volume",
2060 static const char *alc_slave_sws[] = {
2061 "Front Playback Switch",
2062 "Surround Playback Switch",
2063 "Center Playback Switch",
2064 "LFE Playback Switch",
2065 "Side Playback Switch",
2066 "Headphone Playback Switch",
2067 "Speaker Playback Switch",
2068 "Mono Playback Switch",
2069 "IEC958 Playback Switch",
2074 * build control elements
2077 static void alc_free_kctls(struct hda_codec *codec);
2079 /* additional beep mixers; the actual parameters are overwritten at build */
2080 static struct snd_kcontrol_new alc_beep_mixer[] = {
2081 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2082 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2086 static int alc_build_controls(struct hda_codec *codec)
2088 struct alc_spec *spec = codec->spec;
2092 for (i = 0; i < spec->num_mixers; i++) {
2093 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2097 if (spec->cap_mixer) {
2098 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2102 if (spec->multiout.dig_out_nid) {
2103 err = snd_hda_create_spdif_out_ctls(codec,
2104 spec->multiout.dig_out_nid);
2107 if (!spec->no_analog) {
2108 err = snd_hda_create_spdif_share_sw(codec,
2112 spec->multiout.share_spdif = 1;
2115 if (spec->dig_in_nid) {
2116 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2121 /* create beep controls if needed */
2122 if (spec->beep_amp) {
2123 struct snd_kcontrol_new *knew;
2124 for (knew = alc_beep_mixer; knew->name; knew++) {
2125 struct snd_kcontrol *kctl;
2126 kctl = snd_ctl_new1(knew, codec);
2129 kctl->private_value = spec->beep_amp;
2130 err = snd_hda_ctl_add(codec, kctl);
2136 /* if we have no master control, let's create it */
2137 if (!spec->no_analog &&
2138 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2139 unsigned int vmaster_tlv[4];
2140 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2141 HDA_OUTPUT, vmaster_tlv);
2142 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2143 vmaster_tlv, alc_slave_vols);
2147 if (!spec->no_analog &&
2148 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2149 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2150 NULL, alc_slave_sws);
2155 alc_free_kctls(codec); /* no longer needed */
2161 * initialize the codec volumes, etc
2165 * generic initialization of ADC, input mixers and output mixers
2167 static struct hda_verb alc880_volume_init_verbs[] = {
2169 * Unmute ADC0-2 and set the default input to mic-in
2171 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2172 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2173 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2174 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2175 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2176 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2178 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2180 * Note: PASD motherboards uses the Line In 2 as the input for front
2183 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2184 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2187 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2188 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2189 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2190 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2193 * Set up output mixers (0x0c - 0x0f)
2195 /* set vol=0 to output mixers */
2196 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2197 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2198 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2199 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2200 /* set up input amps for analog loopback */
2201 /* Amp Indices: DAC = 0, mixer = 1 */
2202 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2203 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2204 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2205 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2206 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2207 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2208 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2209 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2215 * 3-stack pin configuration:
2216 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2218 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2220 * preset connection lists of input pins
2221 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2223 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2224 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2225 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2228 * Set pin mode and muting
2230 /* set front pin widgets 0x14 for output */
2231 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2232 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2233 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2234 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2235 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2236 /* Mic2 (as headphone out) for HP output */
2237 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2238 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2239 /* Line In pin widget for input */
2240 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2241 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2242 /* Line2 (as front mic) pin widget for input and vref at 80% */
2243 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2244 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2245 /* CD pin widget for input */
2246 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2252 * 5-stack pin configuration:
2253 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2254 * line-in/side = 0x1a, f-mic = 0x1b
2256 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2258 * preset connection lists of input pins
2259 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2261 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2262 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2265 * Set pin mode and muting
2267 /* set pin widgets 0x14-0x17 for output */
2268 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2269 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2270 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2271 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2272 /* unmute pins for output (no gain on this amp) */
2273 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2274 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2275 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2276 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2278 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2279 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2280 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2281 /* Mic2 (as headphone out) for HP output */
2282 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2283 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2284 /* Line In pin widget for input */
2285 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2286 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2287 /* Line2 (as front mic) pin widget for input and vref at 80% */
2288 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2289 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2290 /* CD pin widget for input */
2291 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2297 * W810 pin configuration:
2298 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2300 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2301 /* hphone/speaker input selector: front DAC */
2302 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2304 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2305 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2306 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2307 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2308 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2309 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2311 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2312 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2318 * Z71V pin configuration:
2319 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2321 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2322 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2323 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2324 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2325 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2327 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2328 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2329 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2330 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2336 * 6-stack pin configuration:
2337 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2338 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2340 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2341 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2343 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2344 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2345 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2346 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2347 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2348 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2349 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2350 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2352 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2353 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2354 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2355 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2356 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2357 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2358 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2359 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2360 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2366 * Uniwill pin configuration:
2367 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2370 static struct hda_verb alc880_uniwill_init_verbs[] = {
2371 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2373 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2374 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2375 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2376 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2377 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2378 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2379 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2380 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2381 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2383 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2384 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2385 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2386 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2388 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2389 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2390 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2391 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2392 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2393 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2394 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2395 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2396 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2398 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2399 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2406 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2408 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2409 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2411 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2412 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2413 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2414 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2415 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2416 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2417 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2418 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2419 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2420 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2421 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2422 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2424 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2425 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2426 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2427 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2428 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2429 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2431 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2432 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2437 static struct hda_verb alc880_beep_init_verbs[] = {
2438 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2442 /* toggle speaker-output according to the hp-jack state */
2443 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2445 unsigned int present;
2448 present = snd_hda_codec_read(codec, 0x14, 0,
2449 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2450 bits = present ? HDA_AMP_MUTE : 0;
2451 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2452 HDA_AMP_MUTE, bits);
2453 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2454 HDA_AMP_MUTE, bits);
2457 /* auto-toggle front mic */
2458 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2460 unsigned int present;
2463 present = snd_hda_codec_read(codec, 0x18, 0,
2464 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2465 bits = present ? HDA_AMP_MUTE : 0;
2466 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2469 static void alc880_uniwill_automute(struct hda_codec *codec)
2471 alc880_uniwill_hp_automute(codec);
2472 alc880_uniwill_mic_automute(codec);
2475 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2478 /* Looks like the unsol event is incompatible with the standard
2479 * definition. 4bit tag is placed at 28 bit!
2481 switch (res >> 28) {
2482 case ALC880_HP_EVENT:
2483 alc880_uniwill_hp_automute(codec);
2485 case ALC880_MIC_EVENT:
2486 alc880_uniwill_mic_automute(codec);
2491 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2493 unsigned int present;
2496 present = snd_hda_codec_read(codec, 0x14, 0,
2497 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2498 bits = present ? HDA_AMP_MUTE : 0;
2499 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2502 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2504 unsigned int present;
2506 present = snd_hda_codec_read(codec, 0x21, 0,
2507 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2508 present &= HDA_AMP_VOLMASK;
2509 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2510 HDA_AMP_VOLMASK, present);
2511 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2512 HDA_AMP_VOLMASK, present);
2515 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2518 /* Looks like the unsol event is incompatible with the standard
2519 * definition. 4bit tag is placed at 28 bit!
2521 if ((res >> 28) == ALC880_HP_EVENT)
2522 alc880_uniwill_p53_hp_automute(codec);
2523 if ((res >> 28) == ALC880_DCVOL_EVENT)
2524 alc880_uniwill_p53_dcvol_automute(codec);
2528 * F1734 pin configuration:
2529 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2531 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2532 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2533 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2534 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2535 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2536 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2538 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2539 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2540 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2541 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2543 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2544 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2545 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2546 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2547 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2548 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2549 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2550 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2551 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2553 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2554 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2560 * ASUS pin configuration:
2561 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2563 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2564 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2565 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2566 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2567 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2569 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2570 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2571 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2572 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2573 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2574 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2575 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2576 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2578 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2579 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2580 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2581 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2582 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2583 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2584 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2585 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2586 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2591 /* Enable GPIO mask and set output */
2592 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2593 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2595 /* Clevo m520g init */
2596 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2597 /* headphone output */
2598 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2601 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2603 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2604 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2606 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2607 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2608 /* Mic1 (rear panel) */
2609 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2610 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2611 /* Mic2 (front panel) */
2612 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2613 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2615 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2616 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2617 /* change to EAPD mode */
2618 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2619 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2624 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2625 /* change to EAPD mode */
2626 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2627 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2629 /* Headphone output */
2630 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2632 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2633 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2635 /* Line In pin widget for input */
2636 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2637 /* CD pin widget for input */
2638 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2639 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2640 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2642 /* change to EAPD mode */
2643 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2644 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2650 * LG m1 express dual
2653 * Rear Line-In/Out (blue): 0x14
2654 * Build-in Mic-In: 0x15
2656 * HP-Out (green): 0x1b
2657 * Mic-In/Out (red): 0x19
2661 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2662 static hda_nid_t alc880_lg_dac_nids[3] = {
2666 /* seems analog CD is not working */
2667 static struct hda_input_mux alc880_lg_capture_source = {
2672 { "Internal Mic", 0x6 },
2676 /* 2,4,6 channel modes */
2677 static struct hda_verb alc880_lg_ch2_init[] = {
2678 /* set line-in and mic-in to input */
2679 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2680 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2684 static struct hda_verb alc880_lg_ch4_init[] = {
2685 /* set line-in to out and mic-in to input */
2686 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2687 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2691 static struct hda_verb alc880_lg_ch6_init[] = {
2692 /* set line-in and mic-in to output */
2693 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2694 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2698 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2699 { 2, alc880_lg_ch2_init },
2700 { 4, alc880_lg_ch4_init },
2701 { 6, alc880_lg_ch6_init },
2704 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2705 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2706 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2707 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2708 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2709 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2710 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2711 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2712 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2713 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2714 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2715 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2716 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2717 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2718 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2720 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2721 .name = "Channel Mode",
2722 .info = alc_ch_mode_info,
2723 .get = alc_ch_mode_get,
2724 .put = alc_ch_mode_put,
2729 static struct hda_verb alc880_lg_init_verbs[] = {
2730 /* set capture source to mic-in */
2731 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2732 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2733 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2734 /* mute all amp mixer inputs */
2735 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2736 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2737 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2738 /* line-in to input */
2739 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2740 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2742 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2745 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2746 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2747 /* mic-in to input */
2748 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2749 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2752 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2753 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2754 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2756 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2760 /* toggle speaker-output according to the hp-jack state */
2761 static void alc880_lg_automute(struct hda_codec *codec)
2763 unsigned int present;
2766 present = snd_hda_codec_read(codec, 0x1b, 0,
2767 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2768 bits = present ? HDA_AMP_MUTE : 0;
2769 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2770 HDA_AMP_MUTE, bits);
2773 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2775 /* Looks like the unsol event is incompatible with the standard
2776 * definition. 4bit tag is placed at 28 bit!
2778 if ((res >> 28) == 0x01)
2779 alc880_lg_automute(codec);
2788 * Built-in Mic-In: 0x19
2794 static struct hda_input_mux alc880_lg_lw_capture_source = {
2798 { "Internal Mic", 0x1 },
2803 #define alc880_lg_lw_modes alc880_threestack_modes
2805 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2806 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2807 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2808 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2809 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2810 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2811 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2812 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2813 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2814 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2815 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2816 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2817 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2818 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2819 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2821 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2822 .name = "Channel Mode",
2823 .info = alc_ch_mode_info,
2824 .get = alc_ch_mode_get,
2825 .put = alc_ch_mode_put,
2830 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2831 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2832 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2833 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2835 /* set capture source to mic-in */
2836 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2837 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2838 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2839 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2841 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2842 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2844 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2845 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2846 /* mic-in to input */
2847 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2848 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2850 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2851 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2853 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2857 /* toggle speaker-output according to the hp-jack state */
2858 static void alc880_lg_lw_automute(struct hda_codec *codec)
2860 unsigned int present;
2863 present = snd_hda_codec_read(codec, 0x1b, 0,
2864 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2865 bits = present ? HDA_AMP_MUTE : 0;
2866 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2867 HDA_AMP_MUTE, bits);
2870 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2872 /* Looks like the unsol event is incompatible with the standard
2873 * definition. 4bit tag is placed at 28 bit!
2875 if ((res >> 28) == 0x01)
2876 alc880_lg_lw_automute(codec);
2879 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2880 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2881 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2882 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2883 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2884 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2885 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2889 static struct hda_input_mux alc880_medion_rim_capture_source = {
2893 { "Internal Mic", 0x1 },
2897 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2898 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2900 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2901 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2903 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2904 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2905 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2906 /* Mic2 (as headphone out) for HP output */
2907 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2908 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2909 /* Internal Speaker */
2910 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2911 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2913 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2914 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2916 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2920 /* toggle speaker-output according to the hp-jack state */
2921 static void alc880_medion_rim_automute(struct hda_codec *codec)
2923 unsigned int present;
2926 present = snd_hda_codec_read(codec, 0x14, 0,
2927 AC_VERB_GET_PIN_SENSE, 0)
2928 & AC_PINSENSE_PRESENCE;
2929 bits = present ? HDA_AMP_MUTE : 0;
2930 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2931 HDA_AMP_MUTE, bits);
2933 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2935 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2938 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2941 /* Looks like the unsol event is incompatible with the standard
2942 * definition. 4bit tag is placed at 28 bit!
2944 if ((res >> 28) == ALC880_HP_EVENT)
2945 alc880_medion_rim_automute(codec);
2948 #ifdef CONFIG_SND_HDA_POWER_SAVE
2949 static struct hda_amp_list alc880_loopbacks[] = {
2950 { 0x0b, HDA_INPUT, 0 },
2951 { 0x0b, HDA_INPUT, 1 },
2952 { 0x0b, HDA_INPUT, 2 },
2953 { 0x0b, HDA_INPUT, 3 },
2954 { 0x0b, HDA_INPUT, 4 },
2958 static struct hda_amp_list alc880_lg_loopbacks[] = {
2959 { 0x0b, HDA_INPUT, 1 },
2960 { 0x0b, HDA_INPUT, 6 },
2961 { 0x0b, HDA_INPUT, 7 },
2970 static int alc_init(struct hda_codec *codec)
2972 struct alc_spec *spec = codec->spec;
2976 alc_auto_init_amp(codec, spec->init_amp);
2978 for (i = 0; i < spec->num_init_verbs; i++)
2979 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2981 if (spec->init_hook)
2982 spec->init_hook(codec);
2987 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2989 struct alc_spec *spec = codec->spec;
2991 if (spec->unsol_event)
2992 spec->unsol_event(codec, res);
2995 #ifdef CONFIG_SND_HDA_POWER_SAVE
2996 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2998 struct alc_spec *spec = codec->spec;
2999 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3004 * Analog playback callbacks
3006 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3007 struct hda_codec *codec,
3008 struct snd_pcm_substream *substream)
3010 struct alc_spec *spec = codec->spec;
3011 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3015 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3016 struct hda_codec *codec,
3017 unsigned int stream_tag,
3018 unsigned int format,
3019 struct snd_pcm_substream *substream)
3021 struct alc_spec *spec = codec->spec;
3022 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3023 stream_tag, format, substream);
3026 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3027 struct hda_codec *codec,
3028 struct snd_pcm_substream *substream)
3030 struct alc_spec *spec = codec->spec;
3031 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3037 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3038 struct hda_codec *codec,
3039 struct snd_pcm_substream *substream)
3041 struct alc_spec *spec = codec->spec;
3042 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3045 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3046 struct hda_codec *codec,
3047 unsigned int stream_tag,
3048 unsigned int format,
3049 struct snd_pcm_substream *substream)
3051 struct alc_spec *spec = codec->spec;
3052 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3053 stream_tag, format, substream);
3056 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3057 struct hda_codec *codec,
3058 struct snd_pcm_substream *substream)
3060 struct alc_spec *spec = codec->spec;
3061 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3064 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3065 struct hda_codec *codec,
3066 struct snd_pcm_substream *substream)
3068 struct alc_spec *spec = codec->spec;
3069 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3075 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3076 struct hda_codec *codec,
3077 unsigned int stream_tag,
3078 unsigned int format,
3079 struct snd_pcm_substream *substream)
3081 struct alc_spec *spec = codec->spec;
3083 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3084 stream_tag, 0, format);
3088 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3089 struct hda_codec *codec,
3090 struct snd_pcm_substream *substream)
3092 struct alc_spec *spec = codec->spec;
3094 snd_hda_codec_cleanup_stream(codec,
3095 spec->adc_nids[substream->number + 1]);
3102 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3106 /* NID is set in alc_build_pcms */
3108 .open = alc880_playback_pcm_open,
3109 .prepare = alc880_playback_pcm_prepare,
3110 .cleanup = alc880_playback_pcm_cleanup
3114 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3118 /* NID is set in alc_build_pcms */
3121 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3125 /* NID is set in alc_build_pcms */
3128 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3129 .substreams = 2, /* can be overridden */
3132 /* NID is set in alc_build_pcms */
3134 .prepare = alc880_alt_capture_pcm_prepare,
3135 .cleanup = alc880_alt_capture_pcm_cleanup
3139 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3143 /* NID is set in alc_build_pcms */
3145 .open = alc880_dig_playback_pcm_open,
3146 .close = alc880_dig_playback_pcm_close,
3147 .prepare = alc880_dig_playback_pcm_prepare,
3148 .cleanup = alc880_dig_playback_pcm_cleanup
3152 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3156 /* NID is set in alc_build_pcms */
3159 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3160 static struct hda_pcm_stream alc_pcm_null_stream = {
3166 static int alc_build_pcms(struct hda_codec *codec)
3168 struct alc_spec *spec = codec->spec;
3169 struct hda_pcm *info = spec->pcm_rec;
3172 codec->num_pcms = 1;
3173 codec->pcm_info = info;
3175 if (spec->no_analog)
3178 info->name = spec->stream_name_analog;
3179 if (spec->stream_analog_playback) {
3180 if (snd_BUG_ON(!spec->multiout.dac_nids))
3182 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3183 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3185 if (spec->stream_analog_capture) {
3186 if (snd_BUG_ON(!spec->adc_nids))
3188 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3189 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3192 if (spec->channel_mode) {
3193 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3194 for (i = 0; i < spec->num_channel_mode; i++) {
3195 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3196 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3202 /* SPDIF for stream index #1 */
3203 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3204 codec->num_pcms = 2;
3205 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3206 info = spec->pcm_rec + 1;
3207 info->name = spec->stream_name_digital;
3208 if (spec->dig_out_type)
3209 info->pcm_type = spec->dig_out_type;
3211 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3212 if (spec->multiout.dig_out_nid &&
3213 spec->stream_digital_playback) {
3214 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3215 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3217 if (spec->dig_in_nid &&
3218 spec->stream_digital_capture) {
3219 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3220 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3222 /* FIXME: do we need this for all Realtek codec models? */
3223 codec->spdif_status_reset = 1;
3226 if (spec->no_analog)
3229 /* If the use of more than one ADC is requested for the current
3230 * model, configure a second analog capture-only PCM.
3232 /* Additional Analaog capture for index #2 */
3233 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3234 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3235 codec->num_pcms = 3;
3236 info = spec->pcm_rec + 2;
3237 info->name = spec->stream_name_analog;
3238 if (spec->alt_dac_nid) {
3239 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3240 *spec->stream_analog_alt_playback;
3241 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3244 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3245 alc_pcm_null_stream;
3246 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3248 if (spec->num_adc_nids > 1) {
3249 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3250 *spec->stream_analog_alt_capture;
3251 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3253 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3254 spec->num_adc_nids - 1;
3256 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3257 alc_pcm_null_stream;
3258 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3265 static void alc_free_kctls(struct hda_codec *codec)
3267 struct alc_spec *spec = codec->spec;
3269 if (spec->kctls.list) {
3270 struct snd_kcontrol_new *kctl = spec->kctls.list;
3272 for (i = 0; i < spec->kctls.used; i++)
3273 kfree(kctl[i].name);
3275 snd_array_free(&spec->kctls);
3278 static void alc_free(struct hda_codec *codec)
3280 struct alc_spec *spec = codec->spec;
3285 alc_free_kctls(codec);
3287 snd_hda_detach_beep_device(codec);
3290 #ifdef SND_HDA_NEEDS_RESUME
3291 static int alc_resume(struct hda_codec *codec)
3293 codec->patch_ops.init(codec);
3294 snd_hda_codec_resume_amp(codec);
3295 snd_hda_codec_resume_cache(codec);
3302 static struct hda_codec_ops alc_patch_ops = {
3303 .build_controls = alc_build_controls,
3304 .build_pcms = alc_build_pcms,
3307 .unsol_event = alc_unsol_event,
3308 #ifdef SND_HDA_NEEDS_RESUME
3309 .resume = alc_resume,
3311 #ifdef CONFIG_SND_HDA_POWER_SAVE
3312 .check_power_status = alc_check_power_status,
3318 * Test configuration for debugging
3320 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3323 #ifdef CONFIG_SND_DEBUG
3324 static hda_nid_t alc880_test_dac_nids[4] = {
3325 0x02, 0x03, 0x04, 0x05
3328 static struct hda_input_mux alc880_test_capture_source = {
3337 { "Surround", 0x6 },
3341 static struct hda_channel_mode alc880_test_modes[4] = {
3348 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3349 struct snd_ctl_elem_info *uinfo)
3351 static char *texts[] = {
3352 "N/A", "Line Out", "HP Out",
3353 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3355 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3357 uinfo->value.enumerated.items = 8;
3358 if (uinfo->value.enumerated.item >= 8)
3359 uinfo->value.enumerated.item = 7;
3360 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3364 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3365 struct snd_ctl_elem_value *ucontrol)
3367 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3368 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3369 unsigned int pin_ctl, item = 0;
3371 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3372 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3373 if (pin_ctl & AC_PINCTL_OUT_EN) {
3374 if (pin_ctl & AC_PINCTL_HP_EN)
3378 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3379 switch (pin_ctl & AC_PINCTL_VREFEN) {
3380 case AC_PINCTL_VREF_HIZ: item = 3; break;
3381 case AC_PINCTL_VREF_50: item = 4; break;
3382 case AC_PINCTL_VREF_GRD: item = 5; break;
3383 case AC_PINCTL_VREF_80: item = 6; break;
3384 case AC_PINCTL_VREF_100: item = 7; break;
3387 ucontrol->value.enumerated.item[0] = item;
3391 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3392 struct snd_ctl_elem_value *ucontrol)
3394 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3395 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3396 static unsigned int ctls[] = {
3397 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3398 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3399 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3400 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3401 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3402 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3404 unsigned int old_ctl, new_ctl;
3406 old_ctl = snd_hda_codec_read(codec, nid, 0,
3407 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3408 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3409 if (old_ctl != new_ctl) {
3411 snd_hda_codec_write_cache(codec, nid, 0,
3412 AC_VERB_SET_PIN_WIDGET_CONTROL,
3414 val = ucontrol->value.enumerated.item[0] >= 3 ?
3416 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3423 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3424 struct snd_ctl_elem_info *uinfo)
3426 static char *texts[] = {
3427 "Front", "Surround", "CLFE", "Side"
3429 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3431 uinfo->value.enumerated.items = 4;
3432 if (uinfo->value.enumerated.item >= 4)
3433 uinfo->value.enumerated.item = 3;
3434 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3438 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3439 struct snd_ctl_elem_value *ucontrol)
3441 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3442 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3445 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3446 ucontrol->value.enumerated.item[0] = sel & 3;
3450 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3451 struct snd_ctl_elem_value *ucontrol)
3453 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3454 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3457 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3458 if (ucontrol->value.enumerated.item[0] != sel) {
3459 sel = ucontrol->value.enumerated.item[0] & 3;
3460 snd_hda_codec_write_cache(codec, nid, 0,
3461 AC_VERB_SET_CONNECT_SEL, sel);
3467 #define PIN_CTL_TEST(xname,nid) { \
3468 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3470 .info = alc_test_pin_ctl_info, \
3471 .get = alc_test_pin_ctl_get, \
3472 .put = alc_test_pin_ctl_put, \
3473 .private_value = nid \
3476 #define PIN_SRC_TEST(xname,nid) { \
3477 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3479 .info = alc_test_pin_src_info, \
3480 .get = alc_test_pin_src_get, \
3481 .put = alc_test_pin_src_put, \
3482 .private_value = nid \
3485 static struct snd_kcontrol_new alc880_test_mixer[] = {
3486 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3487 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3488 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3489 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3490 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3491 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3492 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3493 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3494 PIN_CTL_TEST("Front Pin Mode", 0x14),
3495 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3496 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3497 PIN_CTL_TEST("Side Pin Mode", 0x17),
3498 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3499 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3500 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3501 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3502 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3503 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3504 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3505 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3506 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3507 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3508 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3509 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3510 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3511 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3512 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3513 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3514 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3515 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3517 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3518 .name = "Channel Mode",
3519 .info = alc_ch_mode_info,
3520 .get = alc_ch_mode_get,
3521 .put = alc_ch_mode_put,
3526 static struct hda_verb alc880_test_init_verbs[] = {
3527 /* Unmute inputs of 0x0c - 0x0f */
3528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3529 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3530 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3531 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3532 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3533 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3534 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3535 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3536 /* Vol output for 0x0c-0x0f */
3537 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3538 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3539 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3540 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3541 /* Set output pins 0x14-0x17 */
3542 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3543 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3544 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3545 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3546 /* Unmute output pins 0x14-0x17 */
3547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3548 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3549 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3550 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3551 /* Set input pins 0x18-0x1c */
3552 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3553 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3554 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3555 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3556 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3557 /* Mute input pins 0x18-0x1b */
3558 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3559 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3560 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3561 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3563 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3564 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3565 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3566 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3567 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3568 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3569 /* Analog input/passthru */
3570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3572 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3573 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3574 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3582 static const char *alc880_models[ALC880_MODEL_LAST] = {
3583 [ALC880_3ST] = "3stack",
3584 [ALC880_TCL_S700] = "tcl",
3585 [ALC880_3ST_DIG] = "3stack-digout",
3586 [ALC880_CLEVO] = "clevo",
3587 [ALC880_5ST] = "5stack",
3588 [ALC880_5ST_DIG] = "5stack-digout",
3589 [ALC880_W810] = "w810",
3590 [ALC880_Z71V] = "z71v",
3591 [ALC880_6ST] = "6stack",
3592 [ALC880_6ST_DIG] = "6stack-digout",
3593 [ALC880_ASUS] = "asus",
3594 [ALC880_ASUS_W1V] = "asus-w1v",
3595 [ALC880_ASUS_DIG] = "asus-dig",
3596 [ALC880_ASUS_DIG2] = "asus-dig2",
3597 [ALC880_UNIWILL_DIG] = "uniwill",
3598 [ALC880_UNIWILL_P53] = "uniwill-p53",
3599 [ALC880_FUJITSU] = "fujitsu",
3600 [ALC880_F1734] = "F1734",
3602 [ALC880_LG_LW] = "lg-lw",
3603 [ALC880_MEDION_RIM] = "medion",
3604 #ifdef CONFIG_SND_DEBUG
3605 [ALC880_TEST] = "test",
3607 [ALC880_AUTO] = "auto",
3610 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3611 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3612 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3613 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3614 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3615 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3616 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3617 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3618 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3619 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3620 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3621 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3622 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3623 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3624 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3625 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3626 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3627 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3628 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3629 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3630 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3631 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3632 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3633 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3634 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3635 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3636 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3637 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3638 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3639 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3640 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3641 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3642 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3643 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3644 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3645 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3646 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3647 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3648 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3649 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3650 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3651 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3652 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3653 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3654 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3655 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3656 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3657 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3658 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3659 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3660 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3661 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3662 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3663 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3664 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3665 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3666 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3667 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3668 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3669 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3670 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3671 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3672 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3673 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3674 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3675 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3676 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3677 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3678 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3680 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3681 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3682 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3687 * ALC880 codec presets
3689 static struct alc_config_preset alc880_presets[] = {
3691 .mixers = { alc880_three_stack_mixer },
3692 .init_verbs = { alc880_volume_init_verbs,
3693 alc880_pin_3stack_init_verbs },
3694 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3695 .dac_nids = alc880_dac_nids,
3696 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3697 .channel_mode = alc880_threestack_modes,
3699 .input_mux = &alc880_capture_source,
3701 [ALC880_3ST_DIG] = {
3702 .mixers = { alc880_three_stack_mixer },
3703 .init_verbs = { alc880_volume_init_verbs,
3704 alc880_pin_3stack_init_verbs },
3705 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3706 .dac_nids = alc880_dac_nids,
3707 .dig_out_nid = ALC880_DIGOUT_NID,
3708 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3709 .channel_mode = alc880_threestack_modes,
3711 .input_mux = &alc880_capture_source,
3713 [ALC880_TCL_S700] = {
3714 .mixers = { alc880_tcl_s700_mixer },
3715 .init_verbs = { alc880_volume_init_verbs,
3716 alc880_pin_tcl_S700_init_verbs,
3717 alc880_gpio2_init_verbs },
3718 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3719 .dac_nids = alc880_dac_nids,
3720 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3721 .num_adc_nids = 1, /* single ADC */
3723 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3724 .channel_mode = alc880_2_jack_modes,
3725 .input_mux = &alc880_capture_source,
3728 .mixers = { alc880_three_stack_mixer,
3729 alc880_five_stack_mixer},
3730 .init_verbs = { alc880_volume_init_verbs,
3731 alc880_pin_5stack_init_verbs },
3732 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3733 .dac_nids = alc880_dac_nids,
3734 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3735 .channel_mode = alc880_fivestack_modes,
3736 .input_mux = &alc880_capture_source,
3738 [ALC880_5ST_DIG] = {
3739 .mixers = { alc880_three_stack_mixer,
3740 alc880_five_stack_mixer },
3741 .init_verbs = { alc880_volume_init_verbs,
3742 alc880_pin_5stack_init_verbs },
3743 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3744 .dac_nids = alc880_dac_nids,
3745 .dig_out_nid = ALC880_DIGOUT_NID,
3746 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3747 .channel_mode = alc880_fivestack_modes,
3748 .input_mux = &alc880_capture_source,
3751 .mixers = { alc880_six_stack_mixer },
3752 .init_verbs = { alc880_volume_init_verbs,
3753 alc880_pin_6stack_init_verbs },
3754 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3755 .dac_nids = alc880_6st_dac_nids,
3756 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3757 .channel_mode = alc880_sixstack_modes,
3758 .input_mux = &alc880_6stack_capture_source,
3760 [ALC880_6ST_DIG] = {
3761 .mixers = { alc880_six_stack_mixer },
3762 .init_verbs = { alc880_volume_init_verbs,
3763 alc880_pin_6stack_init_verbs },
3764 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3765 .dac_nids = alc880_6st_dac_nids,
3766 .dig_out_nid = ALC880_DIGOUT_NID,
3767 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3768 .channel_mode = alc880_sixstack_modes,
3769 .input_mux = &alc880_6stack_capture_source,
3772 .mixers = { alc880_w810_base_mixer },
3773 .init_verbs = { alc880_volume_init_verbs,
3774 alc880_pin_w810_init_verbs,
3775 alc880_gpio2_init_verbs },
3776 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3777 .dac_nids = alc880_w810_dac_nids,
3778 .dig_out_nid = ALC880_DIGOUT_NID,
3779 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3780 .channel_mode = alc880_w810_modes,
3781 .input_mux = &alc880_capture_source,
3784 .mixers = { alc880_z71v_mixer },
3785 .init_verbs = { alc880_volume_init_verbs,
3786 alc880_pin_z71v_init_verbs },
3787 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3788 .dac_nids = alc880_z71v_dac_nids,
3789 .dig_out_nid = ALC880_DIGOUT_NID,
3791 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3792 .channel_mode = alc880_2_jack_modes,
3793 .input_mux = &alc880_capture_source,
3796 .mixers = { alc880_f1734_mixer },
3797 .init_verbs = { alc880_volume_init_verbs,
3798 alc880_pin_f1734_init_verbs },
3799 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3800 .dac_nids = alc880_f1734_dac_nids,
3802 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3803 .channel_mode = alc880_2_jack_modes,
3804 .input_mux = &alc880_f1734_capture_source,
3805 .unsol_event = alc880_uniwill_p53_unsol_event,
3806 .init_hook = alc880_uniwill_p53_hp_automute,
3809 .mixers = { alc880_asus_mixer },
3810 .init_verbs = { alc880_volume_init_verbs,
3811 alc880_pin_asus_init_verbs,
3812 alc880_gpio1_init_verbs },
3813 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3814 .dac_nids = alc880_asus_dac_nids,
3815 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3816 .channel_mode = alc880_asus_modes,
3818 .input_mux = &alc880_capture_source,
3820 [ALC880_ASUS_DIG] = {
3821 .mixers = { alc880_asus_mixer },
3822 .init_verbs = { alc880_volume_init_verbs,
3823 alc880_pin_asus_init_verbs,
3824 alc880_gpio1_init_verbs },
3825 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3826 .dac_nids = alc880_asus_dac_nids,
3827 .dig_out_nid = ALC880_DIGOUT_NID,
3828 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3829 .channel_mode = alc880_asus_modes,
3831 .input_mux = &alc880_capture_source,
3833 [ALC880_ASUS_DIG2] = {
3834 .mixers = { alc880_asus_mixer },
3835 .init_verbs = { alc880_volume_init_verbs,
3836 alc880_pin_asus_init_verbs,
3837 alc880_gpio2_init_verbs }, /* use GPIO2 */
3838 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3839 .dac_nids = alc880_asus_dac_nids,
3840 .dig_out_nid = ALC880_DIGOUT_NID,
3841 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3842 .channel_mode = alc880_asus_modes,
3844 .input_mux = &alc880_capture_source,
3846 [ALC880_ASUS_W1V] = {
3847 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3848 .init_verbs = { alc880_volume_init_verbs,
3849 alc880_pin_asus_init_verbs,
3850 alc880_gpio1_init_verbs },
3851 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3852 .dac_nids = alc880_asus_dac_nids,
3853 .dig_out_nid = ALC880_DIGOUT_NID,
3854 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3855 .channel_mode = alc880_asus_modes,
3857 .input_mux = &alc880_capture_source,
3859 [ALC880_UNIWILL_DIG] = {
3860 .mixers = { alc880_asus_mixer },
3861 .init_verbs = { alc880_volume_init_verbs,
3862 alc880_pin_asus_init_verbs },
3863 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3864 .dac_nids = alc880_asus_dac_nids,
3865 .dig_out_nid = ALC880_DIGOUT_NID,
3866 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3867 .channel_mode = alc880_asus_modes,
3869 .input_mux = &alc880_capture_source,
3871 [ALC880_UNIWILL] = {
3872 .mixers = { alc880_uniwill_mixer },
3873 .init_verbs = { alc880_volume_init_verbs,
3874 alc880_uniwill_init_verbs },
3875 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3876 .dac_nids = alc880_asus_dac_nids,
3877 .dig_out_nid = ALC880_DIGOUT_NID,
3878 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3879 .channel_mode = alc880_threestack_modes,
3881 .input_mux = &alc880_capture_source,
3882 .unsol_event = alc880_uniwill_unsol_event,
3883 .init_hook = alc880_uniwill_automute,
3885 [ALC880_UNIWILL_P53] = {
3886 .mixers = { alc880_uniwill_p53_mixer },
3887 .init_verbs = { alc880_volume_init_verbs,
3888 alc880_uniwill_p53_init_verbs },
3889 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3890 .dac_nids = alc880_asus_dac_nids,
3891 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3892 .channel_mode = alc880_threestack_modes,
3893 .input_mux = &alc880_capture_source,
3894 .unsol_event = alc880_uniwill_p53_unsol_event,
3895 .init_hook = alc880_uniwill_p53_hp_automute,
3897 [ALC880_FUJITSU] = {
3898 .mixers = { alc880_fujitsu_mixer },
3899 .init_verbs = { alc880_volume_init_verbs,
3900 alc880_uniwill_p53_init_verbs,
3901 alc880_beep_init_verbs },
3902 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3903 .dac_nids = alc880_dac_nids,
3904 .dig_out_nid = ALC880_DIGOUT_NID,
3905 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3906 .channel_mode = alc880_2_jack_modes,
3907 .input_mux = &alc880_capture_source,
3908 .unsol_event = alc880_uniwill_p53_unsol_event,
3909 .init_hook = alc880_uniwill_p53_hp_automute,
3912 .mixers = { alc880_three_stack_mixer },
3913 .init_verbs = { alc880_volume_init_verbs,
3914 alc880_pin_clevo_init_verbs },
3915 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3916 .dac_nids = alc880_dac_nids,
3918 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3919 .channel_mode = alc880_threestack_modes,
3921 .input_mux = &alc880_capture_source,
3924 .mixers = { alc880_lg_mixer },
3925 .init_verbs = { alc880_volume_init_verbs,
3926 alc880_lg_init_verbs },
3927 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3928 .dac_nids = alc880_lg_dac_nids,
3929 .dig_out_nid = ALC880_DIGOUT_NID,
3930 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3931 .channel_mode = alc880_lg_ch_modes,
3933 .input_mux = &alc880_lg_capture_source,
3934 .unsol_event = alc880_lg_unsol_event,
3935 .init_hook = alc880_lg_automute,
3936 #ifdef CONFIG_SND_HDA_POWER_SAVE
3937 .loopbacks = alc880_lg_loopbacks,
3941 .mixers = { alc880_lg_lw_mixer },
3942 .init_verbs = { alc880_volume_init_verbs,
3943 alc880_lg_lw_init_verbs },
3944 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3945 .dac_nids = alc880_dac_nids,
3946 .dig_out_nid = ALC880_DIGOUT_NID,
3947 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3948 .channel_mode = alc880_lg_lw_modes,
3949 .input_mux = &alc880_lg_lw_capture_source,
3950 .unsol_event = alc880_lg_lw_unsol_event,
3951 .init_hook = alc880_lg_lw_automute,
3953 [ALC880_MEDION_RIM] = {
3954 .mixers = { alc880_medion_rim_mixer },
3955 .init_verbs = { alc880_volume_init_verbs,
3956 alc880_medion_rim_init_verbs,
3957 alc_gpio2_init_verbs },
3958 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3959 .dac_nids = alc880_dac_nids,
3960 .dig_out_nid = ALC880_DIGOUT_NID,
3961 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3962 .channel_mode = alc880_2_jack_modes,
3963 .input_mux = &alc880_medion_rim_capture_source,
3964 .unsol_event = alc880_medion_rim_unsol_event,
3965 .init_hook = alc880_medion_rim_automute,
3967 #ifdef CONFIG_SND_DEBUG
3969 .mixers = { alc880_test_mixer },
3970 .init_verbs = { alc880_test_init_verbs },
3971 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3972 .dac_nids = alc880_test_dac_nids,
3973 .dig_out_nid = ALC880_DIGOUT_NID,
3974 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3975 .channel_mode = alc880_test_modes,
3976 .input_mux = &alc880_test_capture_source,
3982 * Automatic parse of I/O pins from the BIOS configuration
3987 ALC_CTL_WIDGET_MUTE,
3990 static struct snd_kcontrol_new alc880_control_templates[] = {
3991 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3992 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3993 HDA_BIND_MUTE(NULL, 0, 0, 0),
3996 /* add dynamic controls */
3997 static int add_control(struct alc_spec *spec, int type, const char *name,
4000 struct snd_kcontrol_new *knew;
4002 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4003 knew = snd_array_new(&spec->kctls);
4006 *knew = alc880_control_templates[type];
4007 knew->name = kstrdup(name, GFP_KERNEL);
4010 knew->private_value = val;
4014 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4015 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4016 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4017 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4018 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4019 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4020 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4021 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4022 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4023 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4024 #define ALC880_PIN_CD_NID 0x1c
4026 /* fill in the dac_nids table from the parsed pin configuration */
4027 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4028 const struct auto_pin_cfg *cfg)
4034 memset(assigned, 0, sizeof(assigned));
4035 spec->multiout.dac_nids = spec->private_dac_nids;
4037 /* check the pins hardwired to audio widget */
4038 for (i = 0; i < cfg->line_outs; i++) {
4039 nid = cfg->line_out_pins[i];
4040 if (alc880_is_fixed_pin(nid)) {
4041 int idx = alc880_fixed_pin_idx(nid);
4042 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4046 /* left pins can be connect to any audio widget */
4047 for (i = 0; i < cfg->line_outs; i++) {
4048 nid = cfg->line_out_pins[i];
4049 if (alc880_is_fixed_pin(nid))
4051 /* search for an empty channel */
4052 for (j = 0; j < cfg->line_outs; j++) {
4054 spec->multiout.dac_nids[i] =
4055 alc880_idx_to_dac(j);
4061 spec->multiout.num_dacs = cfg->line_outs;
4065 /* add playback controls from the parsed DAC table */
4066 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4067 const struct auto_pin_cfg *cfg)
4070 static const char *chname[4] = {
4071 "Front", "Surround", NULL /*CLFE*/, "Side"
4076 for (i = 0; i < cfg->line_outs; i++) {
4077 if (!spec->multiout.dac_nids[i])
4079 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4082 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4083 "Center Playback Volume",
4084 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4088 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4089 "LFE Playback Volume",
4090 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4094 err = add_control(spec, ALC_CTL_BIND_MUTE,
4095 "Center Playback Switch",
4096 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4100 err = add_control(spec, ALC_CTL_BIND_MUTE,
4101 "LFE Playback Switch",
4102 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4107 sprintf(name, "%s Playback Volume", chname[i]);
4108 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4109 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4113 sprintf(name, "%s Playback Switch", chname[i]);
4114 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4115 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4124 /* add playback controls for speaker and HP outputs */
4125 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4135 if (alc880_is_fixed_pin(pin)) {
4136 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4137 /* specify the DAC as the extra output */
4138 if (!spec->multiout.hp_nid)
4139 spec->multiout.hp_nid = nid;
4141 spec->multiout.extra_out_nid[0] = nid;
4142 /* control HP volume/switch on the output mixer amp */
4143 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4144 sprintf(name, "%s Playback Volume", pfx);
4145 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4146 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4149 sprintf(name, "%s Playback Switch", pfx);
4150 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4151 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4154 } else if (alc880_is_multi_pin(pin)) {
4155 /* set manual connection */
4156 /* we have only a switch on HP-out PIN */
4157 sprintf(name, "%s Playback Switch", pfx);
4158 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4159 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4166 /* create input playback/capture controls for the given pin */
4167 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4168 const char *ctlname,
4169 int idx, hda_nid_t mix_nid)
4174 sprintf(name, "%s Playback Volume", ctlname);
4175 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4176 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4179 sprintf(name, "%s Playback Switch", ctlname);
4180 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4181 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4187 /* create playback/capture controls for input pins */
4188 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4189 const struct auto_pin_cfg *cfg)
4191 struct hda_input_mux *imux = &spec->private_imux[0];
4194 for (i = 0; i < AUTO_PIN_LAST; i++) {
4195 if (alc880_is_input_pin(cfg->input_pins[i])) {
4196 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4197 err = new_analog_input(spec, cfg->input_pins[i],
4198 auto_pin_cfg_labels[i],
4202 imux->items[imux->num_items].label =
4203 auto_pin_cfg_labels[i];
4204 imux->items[imux->num_items].index =
4205 alc880_input_pin_idx(cfg->input_pins[i]);
4212 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4213 unsigned int pin_type)
4215 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4218 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4222 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4223 hda_nid_t nid, int pin_type,
4226 alc_set_pin_output(codec, nid, pin_type);
4227 /* need the manual connection? */
4228 if (alc880_is_multi_pin(nid)) {
4229 struct alc_spec *spec = codec->spec;
4230 int idx = alc880_multi_pin_idx(nid);
4231 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4232 AC_VERB_SET_CONNECT_SEL,
4233 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4237 static int get_pin_type(int line_out_type)
4239 if (line_out_type == AUTO_PIN_HP_OUT)
4245 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4247 struct alc_spec *spec = codec->spec;
4250 for (i = 0; i < spec->autocfg.line_outs; i++) {
4251 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4252 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4253 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4257 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4259 struct alc_spec *spec = codec->spec;
4262 pin = spec->autocfg.speaker_pins[0];
4263 if (pin) /* connect to front */
4264 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4265 pin = spec->autocfg.hp_pins[0];
4266 if (pin) /* connect to front */
4267 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4270 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4272 struct alc_spec *spec = codec->spec;
4275 for (i = 0; i < AUTO_PIN_LAST; i++) {
4276 hda_nid_t nid = spec->autocfg.input_pins[i];
4277 if (alc880_is_input_pin(nid)) {
4278 alc_set_input_pin(codec, nid, i);
4279 if (nid != ALC880_PIN_CD_NID &&
4280 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4281 snd_hda_codec_write(codec, nid, 0,
4282 AC_VERB_SET_AMP_GAIN_MUTE,
4288 /* parse the BIOS configuration and set up the alc_spec */
4289 /* return 1 if successful, 0 if the proper config is not found,
4290 * or a negative error code
4292 static int alc880_parse_auto_config(struct hda_codec *codec)
4294 struct alc_spec *spec = codec->spec;
4296 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4298 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4302 if (!spec->autocfg.line_outs)
4303 return 0; /* can't find valid BIOS pin config */
4305 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4308 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4311 err = alc880_auto_create_extra_out(spec,
4312 spec->autocfg.speaker_pins[0],
4316 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4320 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4324 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4326 /* check multiple SPDIF-out (for recent codecs) */
4327 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4329 err = snd_hda_get_connections(codec,
4330 spec->autocfg.dig_out_pins[i],
4335 spec->multiout.dig_out_nid = dig_nid;
4337 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4338 spec->slave_dig_outs[i - 1] = dig_nid;
4339 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4343 if (spec->autocfg.dig_in_pin)
4344 spec->dig_in_nid = ALC880_DIGIN_NID;
4346 if (spec->kctls.list)
4347 add_mixer(spec, spec->kctls.list);
4349 add_verb(spec, alc880_volume_init_verbs);
4351 spec->num_mux_defs = 1;
4352 spec->input_mux = &spec->private_imux[0];
4354 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4359 /* additional initialization for auto-configuration model */
4360 static void alc880_auto_init(struct hda_codec *codec)
4362 struct alc_spec *spec = codec->spec;
4363 alc880_auto_init_multi_out(codec);
4364 alc880_auto_init_extra_out(codec);
4365 alc880_auto_init_analog_input(codec);
4366 if (spec->unsol_event)
4367 alc_inithook(codec);
4370 static void set_capture_mixer(struct alc_spec *spec)
4372 static struct snd_kcontrol_new *caps[2][3] = {
4373 { alc_capture_mixer_nosrc1,
4374 alc_capture_mixer_nosrc2,
4375 alc_capture_mixer_nosrc3 },
4376 { alc_capture_mixer1,
4378 alc_capture_mixer3 },
4380 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4382 if (spec->input_mux && spec->input_mux->num_items > 1)
4386 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4390 #define set_beep_amp(spec, nid, idx, dir) \
4391 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4394 * OK, here we have finally the patch for ALC880
4397 static int patch_alc880(struct hda_codec *codec)
4399 struct alc_spec *spec;
4403 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4409 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4412 if (board_config < 0) {
4413 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4414 "trying auto-probe from BIOS...\n");
4415 board_config = ALC880_AUTO;
4418 if (board_config == ALC880_AUTO) {
4419 /* automatic parse from the BIOS config */
4420 err = alc880_parse_auto_config(codec);
4426 "hda_codec: Cannot set up configuration "
4427 "from BIOS. Using 3-stack mode...\n");
4428 board_config = ALC880_3ST;
4432 err = snd_hda_attach_beep_device(codec, 0x1);
4438 if (board_config != ALC880_AUTO)
4439 setup_preset(spec, &alc880_presets[board_config]);
4441 spec->stream_name_analog = "ALC880 Analog";
4442 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4443 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4444 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4446 spec->stream_name_digital = "ALC880 Digital";
4447 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4448 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4450 if (!spec->adc_nids && spec->input_mux) {
4451 /* check whether NID 0x07 is valid */
4452 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4454 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4455 if (wcap != AC_WID_AUD_IN) {
4456 spec->adc_nids = alc880_adc_nids_alt;
4457 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4459 spec->adc_nids = alc880_adc_nids;
4460 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4463 set_capture_mixer(spec);
4464 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4466 spec->vmaster_nid = 0x0c;
4468 codec->patch_ops = alc_patch_ops;
4469 if (board_config == ALC880_AUTO)
4470 spec->init_hook = alc880_auto_init;
4471 #ifdef CONFIG_SND_HDA_POWER_SAVE
4472 if (!spec->loopback.amplist)
4473 spec->loopback.amplist = alc880_loopbacks;
4475 codec->proc_widget_hook = print_realtek_coef;
4485 static hda_nid_t alc260_dac_nids[1] = {
4490 static hda_nid_t alc260_adc_nids[1] = {
4495 static hda_nid_t alc260_adc_nids_alt[1] = {
4500 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4501 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4503 static hda_nid_t alc260_dual_adc_nids[2] = {
4508 #define ALC260_DIGOUT_NID 0x03
4509 #define ALC260_DIGIN_NID 0x06
4511 static struct hda_input_mux alc260_capture_source = {
4515 { "Front Mic", 0x1 },
4521 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4522 * headphone jack and the internal CD lines since these are the only pins at
4523 * which audio can appear. For flexibility, also allow the option of
4524 * recording the mixer output on the second ADC (ADC0 doesn't have a
4525 * connection to the mixer output).
4527 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4531 { "Mic/Line", 0x0 },
4533 { "Headphone", 0x2 },
4539 { "Mic/Line", 0x0 },
4541 { "Headphone", 0x2 },
4548 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4549 * the Fujitsu S702x, but jacks are marked differently.
4551 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4558 { "Headphone", 0x5 },
4567 { "Headphone", 0x6 },
4573 /* Maxdata Favorit 100XS */
4574 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4578 { "Line/Mic", 0x0 },
4585 { "Line/Mic", 0x0 },
4593 * This is just place-holder, so there's something for alc_build_pcms to look
4594 * at when it calculates the maximum number of channels. ALC260 has no mixer
4595 * element which allows changing the channel mode, so the verb list is
4598 static struct hda_channel_mode alc260_modes[1] = {
4603 /* Mixer combinations
4605 * basic: base_output + input + pc_beep + capture
4606 * HP: base_output + input + capture_alt
4607 * HP_3013: hp_3013 + input + capture
4608 * fujitsu: fujitsu + capture
4609 * acer: acer + capture
4612 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4613 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4614 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4615 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4616 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4617 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4618 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4622 static struct snd_kcontrol_new alc260_input_mixer[] = {
4623 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4624 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4625 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4626 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4627 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4628 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4629 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4630 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4634 /* update HP, line and mono out pins according to the master switch */
4635 static void alc260_hp_master_update(struct hda_codec *codec,
4636 hda_nid_t hp, hda_nid_t line,
4639 struct alc_spec *spec = codec->spec;
4640 unsigned int val = spec->master_sw ? PIN_HP : 0;
4641 /* change HP and line-out pins */
4642 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4644 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4646 /* mono (speaker) depending on the HP jack sense */
4647 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4648 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4652 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4653 struct snd_ctl_elem_value *ucontrol)
4655 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4656 struct alc_spec *spec = codec->spec;
4657 *ucontrol->value.integer.value = spec->master_sw;
4661 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4662 struct snd_ctl_elem_value *ucontrol)
4664 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4665 struct alc_spec *spec = codec->spec;
4666 int val = !!*ucontrol->value.integer.value;
4667 hda_nid_t hp, line, mono;
4669 if (val == spec->master_sw)
4671 spec->master_sw = val;
4672 hp = (kcontrol->private_value >> 16) & 0xff;
4673 line = (kcontrol->private_value >> 8) & 0xff;
4674 mono = kcontrol->private_value & 0xff;
4675 alc260_hp_master_update(codec, hp, line, mono);
4679 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4681 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4682 .name = "Master Playback Switch",
4683 .info = snd_ctl_boolean_mono_info,
4684 .get = alc260_hp_master_sw_get,
4685 .put = alc260_hp_master_sw_put,
4686 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4688 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4689 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4690 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4691 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4692 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4694 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4698 static struct hda_verb alc260_hp_unsol_verbs[] = {
4699 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4703 static void alc260_hp_automute(struct hda_codec *codec)
4705 struct alc_spec *spec = codec->spec;
4706 unsigned int present;
4708 present = snd_hda_codec_read(codec, 0x10, 0,
4709 AC_VERB_GET_PIN_SENSE, 0);
4710 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4711 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4714 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4716 if ((res >> 26) == ALC880_HP_EVENT)
4717 alc260_hp_automute(codec);
4720 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4722 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4723 .name = "Master Playback Switch",
4724 .info = snd_ctl_boolean_mono_info,
4725 .get = alc260_hp_master_sw_get,
4726 .put = alc260_hp_master_sw_put,
4727 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4729 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4730 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4731 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4732 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4733 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4734 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4735 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4736 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4740 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4741 .ops = &snd_hda_bind_vol,
4743 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4744 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4745 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4750 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4751 .ops = &snd_hda_bind_sw,
4753 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4754 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4759 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4760 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4761 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4762 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4763 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4767 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4768 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4772 static void alc260_hp_3013_automute(struct hda_codec *codec)
4774 struct alc_spec *spec = codec->spec;
4775 unsigned int present;
4777 present = snd_hda_codec_read(codec, 0x15, 0,
4778 AC_VERB_GET_PIN_SENSE, 0);
4779 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4780 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4783 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4786 if ((res >> 26) == ALC880_HP_EVENT)
4787 alc260_hp_3013_automute(codec);
4790 static void alc260_hp_3012_automute(struct hda_codec *codec)
4792 unsigned int present, bits;
4794 present = snd_hda_codec_read(codec, 0x10, 0,
4795 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4797 bits = present ? 0 : PIN_OUT;
4798 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4800 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4802 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4806 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4809 if ((res >> 26) == ALC880_HP_EVENT)
4810 alc260_hp_3012_automute(codec);
4813 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4814 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4816 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4817 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4818 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4819 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4820 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4821 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4822 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4823 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4824 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4825 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4826 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4830 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4831 * versions of the ALC260 don't act on requests to enable mic bias from NID
4832 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4833 * datasheet doesn't mention this restriction. At this stage it's not clear
4834 * whether this behaviour is intentional or is a hardware bug in chip
4835 * revisions available in early 2006. Therefore for now allow the
4836 * "Headphone Jack Mode" control to span all choices, but if it turns out
4837 * that the lack of mic bias for this NID is intentional we could change the
4838 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4840 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4841 * don't appear to make the mic bias available from the "line" jack, even
4842 * though the NID used for this jack (0x14) can supply it. The theory is
4843 * that perhaps Acer have included blocking capacitors between the ALC260
4844 * and the output jack. If this turns out to be the case for all such
4845 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4846 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4848 * The C20x Tablet series have a mono internal speaker which is controlled
4849 * via the chip's Mono sum widget and pin complex, so include the necessary
4850 * controls for such models. On models without a "mono speaker" the control
4851 * won't do anything.
4853 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4854 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4855 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4856 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4857 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4859 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4861 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4862 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4863 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4864 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4865 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4866 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4867 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4868 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4872 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
4874 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
4875 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4876 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4877 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4878 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4879 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4880 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4884 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4885 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4887 static struct snd_kcontrol_new alc260_will_mixer[] = {
4888 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4889 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4890 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4891 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4892 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4893 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4894 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4895 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4896 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4897 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4901 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4902 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4904 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4905 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4906 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4908 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4909 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4910 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4911 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4912 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4913 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4914 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4919 * initialization verbs
4921 static struct hda_verb alc260_init_verbs[] = {
4922 /* Line In pin widget for input */
4923 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4924 /* CD pin widget for input */
4925 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4926 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4927 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4928 /* Mic2 (front panel) pin widget for input and vref at 80% */
4929 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4930 /* LINE-2 is used for line-out in rear */
4931 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4932 /* select line-out */
4933 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4935 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4937 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4939 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4940 /* mute capture amp left and right */
4941 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4942 /* set connection select to line in (default select for this ADC) */
4943 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4944 /* mute capture amp left and right */
4945 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4946 /* set connection select to line in (default select for this ADC) */
4947 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4948 /* set vol=0 Line-Out mixer amp left and right */
4949 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4950 /* unmute pin widget amp left and right (no gain on this amp) */
4951 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4952 /* set vol=0 HP mixer amp left and right */
4953 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4954 /* unmute pin widget amp left and right (no gain on this amp) */
4955 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4956 /* set vol=0 Mono mixer amp left and right */
4957 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4958 /* unmute pin widget amp left and right (no gain on this amp) */
4959 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4960 /* unmute LINE-2 out pin */
4961 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4962 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4965 /* mute analog inputs */
4966 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4967 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4968 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4969 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4970 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4971 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4972 /* mute Front out path */
4973 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4974 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4975 /* mute Headphone out path */
4976 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4977 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4978 /* mute Mono out path */
4979 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4980 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4984 #if 0 /* should be identical with alc260_init_verbs? */
4985 static struct hda_verb alc260_hp_init_verbs[] = {
4986 /* Headphone and output */
4987 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4989 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4990 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4991 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4992 /* Mic2 (front panel) pin widget for input and vref at 80% */
4993 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4994 /* Line In pin widget for input */
4995 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4996 /* Line-2 pin widget for output */
4997 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4998 /* CD pin widget for input */
4999 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5000 /* unmute amp left and right */
5001 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5002 /* set connection select to line in (default select for this ADC) */
5003 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5004 /* unmute Line-Out mixer amp left and right (volume = 0) */
5005 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5006 /* mute pin widget amp left and right (no gain on this amp) */
5007 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5008 /* unmute HP mixer amp left and right (volume = 0) */
5009 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5010 /* mute pin widget amp left and right (no gain on this amp) */
5011 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5012 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5015 /* mute analog inputs */
5016 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5017 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5018 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5019 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5020 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5021 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5022 /* Unmute Front out path */
5023 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5024 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5025 /* Unmute Headphone out path */
5026 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5027 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5028 /* Unmute Mono out path */
5029 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5030 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5035 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5036 /* Line out and output */
5037 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5039 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5040 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5041 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5042 /* Mic2 (front panel) pin widget for input and vref at 80% */
5043 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5044 /* Line In pin widget for input */
5045 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5046 /* Headphone pin widget for output */
5047 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5048 /* CD pin widget for input */
5049 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5050 /* unmute amp left and right */
5051 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5052 /* set connection select to line in (default select for this ADC) */
5053 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5054 /* unmute Line-Out mixer amp left and right (volume = 0) */
5055 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5056 /* mute pin widget amp left and right (no gain on this amp) */
5057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5058 /* unmute HP mixer amp left and right (volume = 0) */
5059 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5060 /* mute pin widget amp left and right (no gain on this amp) */
5061 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5062 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5065 /* mute analog inputs */
5066 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5067 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5068 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5069 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5070 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5071 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5072 /* Unmute Front out path */
5073 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5074 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5075 /* Unmute Headphone out path */
5076 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5077 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5078 /* Unmute Mono out path */
5079 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5080 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5084 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5085 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5086 * audio = 0x16, internal speaker = 0x10.
5088 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5089 /* Disable all GPIOs */
5090 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5091 /* Internal speaker is connected to headphone pin */
5092 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5093 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5094 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5095 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5096 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5097 /* Ensure all other unused pins are disabled and muted. */
5098 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5099 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5100 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5101 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5102 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5103 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5104 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5105 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5107 /* Disable digital (SPDIF) pins */
5108 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5109 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5111 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5112 * when acting as an output.
5114 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5116 /* Start with output sum widgets muted and their output gains at min */
5117 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5118 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5119 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5120 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5121 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5122 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5123 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5124 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5125 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5127 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5128 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5129 /* Unmute Line1 pin widget output buffer since it starts as an output.
5130 * If the pin mode is changed by the user the pin mode control will
5131 * take care of enabling the pin's input/output buffers as needed.
5132 * Therefore there's no need to enable the input buffer at this
5135 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5136 /* Unmute input buffer of pin widget used for Line-in (no equiv
5139 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5141 /* Mute capture amp left and right */
5142 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5143 /* Set ADC connection select to match default mixer setting - line
5146 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5148 /* Do the same for the second ADC: mute capture input amp and
5149 * set ADC connection to line in (on mic1 pin)
5151 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5152 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5154 /* Mute all inputs to mixer widget (even unconnected ones) */
5155 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5156 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5158 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5159 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5161 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5162 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5167 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5168 * similar laptops (adapted from Fujitsu init verbs).
5170 static struct hda_verb alc260_acer_init_verbs[] = {
5171 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5172 * the headphone jack. Turn this on and rely on the standard mute
5173 * methods whenever the user wants to turn these outputs off.
5175 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5176 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5177 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5178 /* Internal speaker/Headphone jack is connected to Line-out pin */
5179 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5180 /* Internal microphone/Mic jack is connected to Mic1 pin */
5181 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5182 /* Line In jack is connected to Line1 pin */
5183 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5184 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5185 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5186 /* Ensure all other unused pins are disabled and muted. */
5187 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5188 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5189 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5190 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5191 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5192 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5193 /* Disable digital (SPDIF) pins */
5194 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5195 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5197 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5198 * bus when acting as outputs.
5200 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5201 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5203 /* Start with output sum widgets muted and their output gains at min */
5204 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5205 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5206 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5207 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5208 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5209 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5210 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5211 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5212 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5214 /* Unmute Line-out pin widget amp left and right
5215 * (no equiv mixer ctrl)
5217 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5218 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5219 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5220 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5221 * inputs. If the pin mode is changed by the user the pin mode control
5222 * will take care of enabling the pin's input/output buffers as needed.
5223 * Therefore there's no need to enable the input buffer at this
5226 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5227 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5229 /* Mute capture amp left and right */
5230 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5231 /* Set ADC connection select to match default mixer setting - mic
5234 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5236 /* Do similar with the second ADC: mute capture input amp and
5237 * set ADC connection to mic to match ALSA's default state.
5239 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5240 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5242 /* Mute all inputs to mixer widget (even unconnected ones) */
5243 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5244 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5245 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5246 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5247 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5248 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5249 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5250 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5255 /* Initialisation sequence for Maxdata Favorit 100XS
5256 * (adapted from Acer init verbs).
5258 static struct hda_verb alc260_favorit100_init_verbs[] = {
5259 /* GPIO 0 enables the output jack.
5260 * Turn this on and rely on the standard mute
5261 * methods whenever the user wants to turn these outputs off.
5263 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5264 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5265 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5266 /* Line/Mic input jack is connected to Mic1 pin */
5267 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5268 /* Ensure all other unused pins are disabled and muted. */
5269 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5270 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5271 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5272 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5273 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5274 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5275 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5276 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5277 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5278 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5279 /* Disable digital (SPDIF) pins */
5280 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5281 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5283 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5284 * bus when acting as outputs.
5286 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5287 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5289 /* Start with output sum widgets muted and their output gains at min */
5290 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5291 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5292 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5293 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5294 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5295 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5296 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5297 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5298 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5300 /* Unmute Line-out pin widget amp left and right
5301 * (no equiv mixer ctrl)
5303 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5304 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5305 * inputs. If the pin mode is changed by the user the pin mode control
5306 * will take care of enabling the pin's input/output buffers as needed.
5307 * Therefore there's no need to enable the input buffer at this
5310 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5312 /* Mute capture amp left and right */
5313 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5314 /* Set ADC connection select to match default mixer setting - mic
5317 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5319 /* Do similar with the second ADC: mute capture input amp and
5320 * set ADC connection to mic to match ALSA's default state.
5322 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5323 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5325 /* Mute all inputs to mixer widget (even unconnected ones) */
5326 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5327 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5330 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5338 static struct hda_verb alc260_will_verbs[] = {
5339 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5340 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5341 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5342 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5343 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5344 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5348 static struct hda_verb alc260_replacer_672v_verbs[] = {
5349 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5350 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5351 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5353 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5354 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5355 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5357 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5361 /* toggle speaker-output according to the hp-jack state */
5362 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5364 unsigned int present;
5366 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5367 present = snd_hda_codec_read(codec, 0x0f, 0,
5368 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5370 snd_hda_codec_write_cache(codec, 0x01, 0,
5371 AC_VERB_SET_GPIO_DATA, 1);
5372 snd_hda_codec_write_cache(codec, 0x0f, 0,
5373 AC_VERB_SET_PIN_WIDGET_CONTROL,
5376 snd_hda_codec_write_cache(codec, 0x01, 0,
5377 AC_VERB_SET_GPIO_DATA, 0);
5378 snd_hda_codec_write_cache(codec, 0x0f, 0,
5379 AC_VERB_SET_PIN_WIDGET_CONTROL,
5384 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5387 if ((res >> 26) == ALC880_HP_EVENT)
5388 alc260_replacer_672v_automute(codec);
5391 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5392 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5393 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5394 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5395 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5396 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5397 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5398 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5399 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5400 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5401 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5405 /* Test configuration for debugging, modelled after the ALC880 test
5408 #ifdef CONFIG_SND_DEBUG
5409 static hda_nid_t alc260_test_dac_nids[1] = {
5412 static hda_nid_t alc260_test_adc_nids[2] = {
5415 /* For testing the ALC260, each input MUX needs its own definition since
5416 * the signal assignments are different. This assumes that the first ADC
5419 static struct hda_input_mux alc260_test_capture_sources[2] = {
5423 { "MIC1 pin", 0x0 },
5424 { "MIC2 pin", 0x1 },
5425 { "LINE1 pin", 0x2 },
5426 { "LINE2 pin", 0x3 },
5428 { "LINE-OUT pin", 0x5 },
5429 { "HP-OUT pin", 0x6 },
5435 { "MIC1 pin", 0x0 },
5436 { "MIC2 pin", 0x1 },
5437 { "LINE1 pin", 0x2 },
5438 { "LINE2 pin", 0x3 },
5441 { "LINE-OUT pin", 0x6 },
5442 { "HP-OUT pin", 0x7 },
5446 static struct snd_kcontrol_new alc260_test_mixer[] = {
5447 /* Output driver widgets */
5448 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5449 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5450 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5451 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5452 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5453 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5455 /* Modes for retasking pin widgets
5456 * Note: the ALC260 doesn't seem to act on requests to enable mic
5457 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5458 * mention this restriction. At this stage it's not clear whether
5459 * this behaviour is intentional or is a hardware bug in chip
5460 * revisions available at least up until early 2006. Therefore for
5461 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5462 * choices, but if it turns out that the lack of mic bias for these
5463 * NIDs is intentional we could change their modes from
5464 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5466 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5467 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5468 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5469 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5470 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5471 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5473 /* Loopback mixer controls */
5474 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5475 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5476 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5477 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5478 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5479 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5480 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5481 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5482 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5483 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5484 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5485 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5486 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5487 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5489 /* Controls for GPIO pins, assuming they are configured as outputs */
5490 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5491 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5492 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5493 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5495 /* Switches to allow the digital IO pins to be enabled. The datasheet
5496 * is ambigious as to which NID is which; testing on laptops which
5497 * make this output available should provide clarification.
5499 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5500 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5502 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5503 * this output to turn on an external amplifier.
5505 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5506 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5510 static struct hda_verb alc260_test_init_verbs[] = {
5511 /* Enable all GPIOs as outputs with an initial value of 0 */
5512 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5513 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5514 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5516 /* Enable retasking pins as output, initially without power amp */
5517 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5518 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5519 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5520 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5521 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5522 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5524 /* Disable digital (SPDIF) pins initially, but users can enable
5525 * them via a mixer switch. In the case of SPDIF-out, this initverb
5526 * payload also sets the generation to 0, output to be in "consumer"
5527 * PCM format, copyright asserted, no pre-emphasis and no validity
5530 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5531 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5533 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5534 * OUT1 sum bus when acting as an output.
5536 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5537 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5538 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5539 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5541 /* Start with output sum widgets muted and their output gains at min */
5542 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5543 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5544 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5545 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5546 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5547 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5548 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5549 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5550 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5552 /* Unmute retasking pin widget output buffers since the default
5553 * state appears to be output. As the pin mode is changed by the
5554 * user the pin mode control will take care of enabling the pin's
5555 * input/output buffers as needed.
5557 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5558 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5559 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5560 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5561 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5562 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5563 /* Also unmute the mono-out pin widget */
5564 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5566 /* Mute capture amp left and right */
5567 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5568 /* Set ADC connection select to match default mixer setting (mic1
5571 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5573 /* Do the same for the second ADC: mute capture input amp and
5574 * set ADC connection to mic1 pin
5576 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5577 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5579 /* Mute all inputs to mixer widget (even unconnected ones) */
5580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5582 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5583 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5584 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5585 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5586 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5587 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5593 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5594 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5596 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5597 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5600 * for BIOS auto-configuration
5603 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5604 const char *pfx, int *vol_bits)
5607 unsigned long vol_val, sw_val;
5611 if (nid >= 0x0f && nid < 0x11) {
5612 nid_vol = nid - 0x7;
5613 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5614 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5615 } else if (nid == 0x11) {
5616 nid_vol = nid - 0x7;
5617 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5618 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5619 } else if (nid >= 0x12 && nid <= 0x15) {
5621 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5622 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5626 if (!(*vol_bits & (1 << nid_vol))) {
5627 /* first control for the volume widget */
5628 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5629 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5632 *vol_bits |= (1 << nid_vol);
5634 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5635 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5641 /* add playback controls from the parsed DAC table */
5642 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5643 const struct auto_pin_cfg *cfg)
5649 spec->multiout.num_dacs = 1;
5650 spec->multiout.dac_nids = spec->private_dac_nids;
5651 spec->multiout.dac_nids[0] = 0x02;
5653 nid = cfg->line_out_pins[0];
5655 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5660 nid = cfg->speaker_pins[0];
5662 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5667 nid = cfg->hp_pins[0];
5669 err = alc260_add_playback_controls(spec, nid, "Headphone",
5677 /* create playback/capture controls for input pins */
5678 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5679 const struct auto_pin_cfg *cfg)
5681 struct hda_input_mux *imux = &spec->private_imux[0];
5684 for (i = 0; i < AUTO_PIN_LAST; i++) {
5685 if (cfg->input_pins[i] >= 0x12) {
5686 idx = cfg->input_pins[i] - 0x12;
5687 err = new_analog_input(spec, cfg->input_pins[i],
5688 auto_pin_cfg_labels[i], idx,
5692 imux->items[imux->num_items].label =
5693 auto_pin_cfg_labels[i];
5694 imux->items[imux->num_items].index = idx;
5697 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5698 idx = cfg->input_pins[i] - 0x09;
5699 err = new_analog_input(spec, cfg->input_pins[i],
5700 auto_pin_cfg_labels[i], idx,
5704 imux->items[imux->num_items].label =
5705 auto_pin_cfg_labels[i];
5706 imux->items[imux->num_items].index = idx;
5713 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5714 hda_nid_t nid, int pin_type,
5717 alc_set_pin_output(codec, nid, pin_type);
5718 /* need the manual connection? */
5720 int idx = nid - 0x12;
5721 snd_hda_codec_write(codec, idx + 0x0b, 0,
5722 AC_VERB_SET_CONNECT_SEL, sel_idx);
5726 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5728 struct alc_spec *spec = codec->spec;
5731 nid = spec->autocfg.line_out_pins[0];
5733 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5734 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5737 nid = spec->autocfg.speaker_pins[0];
5739 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5741 nid = spec->autocfg.hp_pins[0];
5743 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5746 #define ALC260_PIN_CD_NID 0x16
5747 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5749 struct alc_spec *spec = codec->spec;
5752 for (i = 0; i < AUTO_PIN_LAST; i++) {
5753 hda_nid_t nid = spec->autocfg.input_pins[i];
5755 alc_set_input_pin(codec, nid, i);
5756 if (nid != ALC260_PIN_CD_NID &&
5757 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5758 snd_hda_codec_write(codec, nid, 0,
5759 AC_VERB_SET_AMP_GAIN_MUTE,
5766 * generic initialization of ADC, input mixers and output mixers
5768 static struct hda_verb alc260_volume_init_verbs[] = {
5770 * Unmute ADC0-1 and set the default input to mic-in
5772 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5773 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5774 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5775 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5777 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5779 * Note: PASD motherboards uses the Line In 2 as the input for
5780 * front panel mic (mic 2)
5782 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5783 /* mute analog inputs */
5784 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5785 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5786 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5787 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5788 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5791 * Set up output mixers (0x08 - 0x0a)
5793 /* set vol=0 to output mixers */
5794 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5795 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5796 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5797 /* set up input amps for analog loopback */
5798 /* Amp Indices: DAC = 0, mixer = 1 */
5799 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5800 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5801 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5802 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5803 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5804 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5809 static int alc260_parse_auto_config(struct hda_codec *codec)
5811 struct alc_spec *spec = codec->spec;
5813 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5815 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5819 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5822 if (!spec->kctls.list)
5823 return 0; /* can't find valid BIOS pin config */
5824 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5828 spec->multiout.max_channels = 2;
5830 if (spec->autocfg.dig_outs)
5831 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5832 if (spec->kctls.list)
5833 add_mixer(spec, spec->kctls.list);
5835 add_verb(spec, alc260_volume_init_verbs);
5837 spec->num_mux_defs = 1;
5838 spec->input_mux = &spec->private_imux[0];
5840 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
5845 /* additional initialization for auto-configuration model */
5846 static void alc260_auto_init(struct hda_codec *codec)
5848 struct alc_spec *spec = codec->spec;
5849 alc260_auto_init_multi_out(codec);
5850 alc260_auto_init_analog_input(codec);
5851 if (spec->unsol_event)
5852 alc_inithook(codec);
5855 #ifdef CONFIG_SND_HDA_POWER_SAVE
5856 static struct hda_amp_list alc260_loopbacks[] = {
5857 { 0x07, HDA_INPUT, 0 },
5858 { 0x07, HDA_INPUT, 1 },
5859 { 0x07, HDA_INPUT, 2 },
5860 { 0x07, HDA_INPUT, 3 },
5861 { 0x07, HDA_INPUT, 4 },
5867 * ALC260 configurations
5869 static const char *alc260_models[ALC260_MODEL_LAST] = {
5870 [ALC260_BASIC] = "basic",
5872 [ALC260_HP_3013] = "hp-3013",
5873 [ALC260_HP_DC7600] = "hp-dc7600",
5874 [ALC260_FUJITSU_S702X] = "fujitsu",
5875 [ALC260_ACER] = "acer",
5876 [ALC260_WILL] = "will",
5877 [ALC260_REPLACER_672V] = "replacer",
5878 [ALC260_FAVORIT100] = "favorit100",
5879 #ifdef CONFIG_SND_DEBUG
5880 [ALC260_TEST] = "test",
5882 [ALC260_AUTO] = "auto",
5885 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5886 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5887 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5888 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
5889 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5890 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5891 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5892 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5893 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5894 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5895 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5896 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5897 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5898 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5899 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5900 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5901 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5902 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5903 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5904 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5908 static struct alc_config_preset alc260_presets[] = {
5910 .mixers = { alc260_base_output_mixer,
5911 alc260_input_mixer },
5912 .init_verbs = { alc260_init_verbs },
5913 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5914 .dac_nids = alc260_dac_nids,
5915 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5916 .adc_nids = alc260_adc_nids,
5917 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5918 .channel_mode = alc260_modes,
5919 .input_mux = &alc260_capture_source,
5922 .mixers = { alc260_hp_output_mixer,
5923 alc260_input_mixer },
5924 .init_verbs = { alc260_init_verbs,
5925 alc260_hp_unsol_verbs },
5926 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5927 .dac_nids = alc260_dac_nids,
5928 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5929 .adc_nids = alc260_adc_nids_alt,
5930 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5931 .channel_mode = alc260_modes,
5932 .input_mux = &alc260_capture_source,
5933 .unsol_event = alc260_hp_unsol_event,
5934 .init_hook = alc260_hp_automute,
5936 [ALC260_HP_DC7600] = {
5937 .mixers = { alc260_hp_dc7600_mixer,
5938 alc260_input_mixer },
5939 .init_verbs = { alc260_init_verbs,
5940 alc260_hp_dc7600_verbs },
5941 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5942 .dac_nids = alc260_dac_nids,
5943 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5944 .adc_nids = alc260_adc_nids_alt,
5945 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5946 .channel_mode = alc260_modes,
5947 .input_mux = &alc260_capture_source,
5948 .unsol_event = alc260_hp_3012_unsol_event,
5949 .init_hook = alc260_hp_3012_automute,
5951 [ALC260_HP_3013] = {
5952 .mixers = { alc260_hp_3013_mixer,
5953 alc260_input_mixer },
5954 .init_verbs = { alc260_hp_3013_init_verbs,
5955 alc260_hp_3013_unsol_verbs },
5956 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5957 .dac_nids = alc260_dac_nids,
5958 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5959 .adc_nids = alc260_adc_nids_alt,
5960 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5961 .channel_mode = alc260_modes,
5962 .input_mux = &alc260_capture_source,
5963 .unsol_event = alc260_hp_3013_unsol_event,
5964 .init_hook = alc260_hp_3013_automute,
5966 [ALC260_FUJITSU_S702X] = {
5967 .mixers = { alc260_fujitsu_mixer },
5968 .init_verbs = { alc260_fujitsu_init_verbs },
5969 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5970 .dac_nids = alc260_dac_nids,
5971 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5972 .adc_nids = alc260_dual_adc_nids,
5973 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5974 .channel_mode = alc260_modes,
5975 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5976 .input_mux = alc260_fujitsu_capture_sources,
5979 .mixers = { alc260_acer_mixer },
5980 .init_verbs = { alc260_acer_init_verbs },
5981 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5982 .dac_nids = alc260_dac_nids,
5983 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5984 .adc_nids = alc260_dual_adc_nids,
5985 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5986 .channel_mode = alc260_modes,
5987 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5988 .input_mux = alc260_acer_capture_sources,
5990 [ALC260_FAVORIT100] = {
5991 .mixers = { alc260_favorit100_mixer },
5992 .init_verbs = { alc260_favorit100_init_verbs },
5993 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5994 .dac_nids = alc260_dac_nids,
5995 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5996 .adc_nids = alc260_dual_adc_nids,
5997 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5998 .channel_mode = alc260_modes,
5999 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6000 .input_mux = alc260_favorit100_capture_sources,
6003 .mixers = { alc260_will_mixer },
6004 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6005 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6006 .dac_nids = alc260_dac_nids,
6007 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6008 .adc_nids = alc260_adc_nids,
6009 .dig_out_nid = ALC260_DIGOUT_NID,
6010 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6011 .channel_mode = alc260_modes,
6012 .input_mux = &alc260_capture_source,
6014 [ALC260_REPLACER_672V] = {
6015 .mixers = { alc260_replacer_672v_mixer },
6016 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6017 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6018 .dac_nids = alc260_dac_nids,
6019 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6020 .adc_nids = alc260_adc_nids,
6021 .dig_out_nid = ALC260_DIGOUT_NID,
6022 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6023 .channel_mode = alc260_modes,
6024 .input_mux = &alc260_capture_source,
6025 .unsol_event = alc260_replacer_672v_unsol_event,
6026 .init_hook = alc260_replacer_672v_automute,
6028 #ifdef CONFIG_SND_DEBUG
6030 .mixers = { alc260_test_mixer },
6031 .init_verbs = { alc260_test_init_verbs },
6032 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6033 .dac_nids = alc260_test_dac_nids,
6034 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6035 .adc_nids = alc260_test_adc_nids,
6036 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6037 .channel_mode = alc260_modes,
6038 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6039 .input_mux = alc260_test_capture_sources,
6044 static int patch_alc260(struct hda_codec *codec)
6046 struct alc_spec *spec;
6047 int err, board_config;
6049 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6055 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6058 if (board_config < 0) {
6059 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
6060 "trying auto-probe from BIOS...\n");
6061 board_config = ALC260_AUTO;
6064 if (board_config == ALC260_AUTO) {
6065 /* automatic parse from the BIOS config */
6066 err = alc260_parse_auto_config(codec);
6072 "hda_codec: Cannot set up configuration "
6073 "from BIOS. Using base mode...\n");
6074 board_config = ALC260_BASIC;
6078 err = snd_hda_attach_beep_device(codec, 0x1);
6084 if (board_config != ALC260_AUTO)
6085 setup_preset(spec, &alc260_presets[board_config]);
6087 spec->stream_name_analog = "ALC260 Analog";
6088 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6089 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6091 spec->stream_name_digital = "ALC260 Digital";
6092 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6093 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6095 if (!spec->adc_nids && spec->input_mux) {
6096 /* check whether NID 0x04 is valid */
6097 unsigned int wcap = get_wcaps(codec, 0x04);
6098 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6100 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6101 spec->adc_nids = alc260_adc_nids_alt;
6102 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6104 spec->adc_nids = alc260_adc_nids;
6105 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6108 set_capture_mixer(spec);
6109 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6111 spec->vmaster_nid = 0x08;
6113 codec->patch_ops = alc_patch_ops;
6114 if (board_config == ALC260_AUTO)
6115 spec->init_hook = alc260_auto_init;
6116 #ifdef CONFIG_SND_HDA_POWER_SAVE
6117 if (!spec->loopback.amplist)
6118 spec->loopback.amplist = alc260_loopbacks;
6120 codec->proc_widget_hook = print_realtek_coef;
6129 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6130 * configuration. Each pin widget can choose any input DACs and a mixer.
6131 * Each ADC is connected from a mixer of all inputs. This makes possible
6132 * 6-channel independent captures.
6134 * In addition, an independent DAC for the multi-playback (not used in this
6137 #define ALC882_DIGOUT_NID 0x06
6138 #define ALC882_DIGIN_NID 0x0a
6140 static struct hda_channel_mode alc882_ch_modes[1] = {
6144 static hda_nid_t alc882_dac_nids[4] = {
6145 /* front, rear, clfe, rear_surr */
6146 0x02, 0x03, 0x04, 0x05
6149 /* identical with ALC880 */
6150 #define alc882_adc_nids alc880_adc_nids
6151 #define alc882_adc_nids_alt alc880_adc_nids_alt
6153 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6154 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6157 /* FIXME: should be a matrix-type input source selection */
6159 static struct hda_input_mux alc882_capture_source = {
6163 { "Front Mic", 0x1 },
6169 static struct hda_input_mux mb5_capture_source = {
6181 static struct hda_verb alc882_3ST_ch2_init[] = {
6182 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6183 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6184 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6185 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6192 static struct hda_verb alc882_3ST_ch6_init[] = {
6193 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6194 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6195 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6196 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6197 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6198 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6202 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6203 { 2, alc882_3ST_ch2_init },
6204 { 6, alc882_3ST_ch6_init },
6210 static struct hda_verb alc882_sixstack_ch6_init[] = {
6211 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
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 },
6221 static struct hda_verb alc882_sixstack_ch8_init[] = {
6222 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6223 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6224 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6225 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6229 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6230 { 6, alc882_sixstack_ch6_init },
6231 { 8, alc882_sixstack_ch8_init },
6235 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6241 static struct hda_verb alc885_mbp_ch2_init[] = {
6242 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6243 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6244 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6251 static struct hda_verb alc885_mbp_ch6_init[] = {
6252 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6253 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6254 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6255 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6256 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6260 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6261 { 2, alc885_mbp_ch2_init },
6262 { 6, alc885_mbp_ch6_init },
6266 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6267 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6269 static struct snd_kcontrol_new alc882_base_mixer[] = {
6270 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6271 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6272 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6273 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6274 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6275 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6276 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6277 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6278 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6279 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6280 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6281 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6282 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6283 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6284 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6285 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6286 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6287 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6288 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6289 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6290 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6294 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6295 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6296 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6297 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6298 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6299 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6300 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6301 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6302 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6303 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6304 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6308 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6309 HDA_CODEC_VOLUME("Front Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6310 HDA_BIND_MUTE ("Front Playback Switch", 0x0d, 0x02, HDA_INPUT),
6311 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6312 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
6313 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6314 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6315 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6316 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6317 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6318 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6321 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6322 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6323 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6324 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6325 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6326 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6327 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6328 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6329 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6330 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6334 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6335 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6336 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6337 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6338 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6339 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6340 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6341 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6342 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6343 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6344 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6345 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6346 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6347 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6351 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6352 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6354 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6355 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6356 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6357 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6358 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6359 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6360 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6361 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6362 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6363 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6364 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6365 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6366 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6367 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6371 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6372 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6373 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6374 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6375 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6376 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6377 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6378 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6379 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6380 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6381 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6385 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6387 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6388 .name = "Channel Mode",
6389 .info = alc_ch_mode_info,
6390 .get = alc_ch_mode_get,
6391 .put = alc_ch_mode_put,
6396 static struct hda_verb alc882_init_verbs[] = {
6397 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6398 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6399 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6400 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6402 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6403 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6404 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6406 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6408 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6410 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6411 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6412 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6414 /* Front Pin: output 0 (0x0c) */
6415 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6416 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6417 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6418 /* Rear Pin: output 1 (0x0d) */
6419 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6420 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6421 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6422 /* CLFE Pin: output 2 (0x0e) */
6423 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6424 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6425 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6426 /* Side Pin: output 3 (0x0f) */
6427 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6428 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6429 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6430 /* Mic (rear) pin: input vref at 80% */
6431 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6432 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6433 /* Front Mic pin: input vref at 80% */
6434 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6435 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6436 /* Line In pin: input */
6437 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6438 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6439 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6440 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6441 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6442 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6443 /* CD pin widget for input */
6444 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6446 /* FIXME: use matrix-type input source selection */
6447 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6448 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6454 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6455 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6456 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6457 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6459 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6460 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6461 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6462 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6463 /* ADC1: mute amp left and right */
6464 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6465 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6466 /* ADC2: mute amp left and right */
6467 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6468 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6469 /* ADC3: mute amp left and right */
6470 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6471 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6476 static struct hda_verb alc882_eapd_verbs[] = {
6477 /* change to EAPD mode */
6478 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6479 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6484 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6485 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6486 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6487 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6488 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6489 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6490 /* FIXME: this looks suspicious...
6491 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6492 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6497 static struct hda_verb alc882_macpro_init_verbs[] = {
6498 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6499 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6500 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6501 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6502 /* Front Pin: output 0 (0x0c) */
6503 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6504 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6505 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6506 /* Front Mic pin: input vref at 80% */
6507 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6508 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6509 /* Speaker: output */
6510 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6511 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6512 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6513 /* Headphone output (output 0 - 0x0c) */
6514 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6515 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6516 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6518 /* FIXME: use matrix-type input source selection */
6519 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6520 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6521 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6522 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6523 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6524 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6526 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6527 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6528 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6529 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6531 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6532 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6533 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6534 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6535 /* ADC1: mute amp left and right */
6536 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6537 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6538 /* ADC2: mute amp left and right */
6539 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6540 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6541 /* ADC3: mute amp left and right */
6542 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6543 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6549 static struct hda_verb alc885_mb5_init_verbs[] = {
6551 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6552 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6553 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6555 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6556 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6557 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6558 /* Front Pin: output 0 (0x0d) */
6559 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
6560 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6561 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01},
6562 /* HP Pin: output 0 (0x0c) */
6563 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6564 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6565 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6566 /* Front Mic pin: input vref at 80% */
6567 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6568 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6570 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6571 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6573 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6574 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6575 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6576 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6580 /* Macbook Pro rev3 */
6581 static struct hda_verb alc885_mbp3_init_verbs[] = {
6582 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6584 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6585 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6587 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6588 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6589 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6590 /* Front Pin: output 0 (0x0c) */
6591 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6592 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6593 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6594 /* HP Pin: output 0 (0x0d) */
6595 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6596 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6597 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6598 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6599 /* Mic (rear) pin: input vref at 80% */
6600 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6601 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6602 /* Front Mic pin: input vref at 80% */
6603 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6604 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6605 /* Line In pin: use output 1 when in LineOut mode */
6606 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6607 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6608 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6610 /* FIXME: use matrix-type input source selection */
6611 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6612 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6614 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6615 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6616 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6618 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6619 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6620 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6621 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6626 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6627 /* ADC1: mute amp left and right */
6628 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6629 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6630 /* ADC2: mute amp left and right */
6631 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6632 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6633 /* ADC3: mute amp left and right */
6634 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6635 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6640 /* iMac 24 mixer. */
6641 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6642 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6643 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6647 /* iMac 24 init verbs. */
6648 static struct hda_verb alc885_imac24_init_verbs[] = {
6649 /* Internal speakers: output 0 (0x0c) */
6650 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6651 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6652 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6653 /* Internal speakers: output 0 (0x0c) */
6654 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6655 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6656 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6657 /* Headphone: output 0 (0x0c) */
6658 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6659 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6660 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6661 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6662 /* Front Mic: input vref at 80% */
6663 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6664 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6668 /* Toggle speaker-output according to the hp-jack state */
6669 static void alc885_imac24_automute(struct hda_codec *codec)
6671 unsigned int present;
6673 present = snd_hda_codec_read(codec, 0x14, 0,
6674 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6675 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6676 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6677 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6678 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6681 /* Processes unsolicited events. */
6682 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6685 /* Headphone insertion or removal. */
6686 if ((res >> 26) == ALC880_HP_EVENT)
6687 alc885_imac24_automute(codec);
6690 static void alc885_mbp3_automute(struct hda_codec *codec)
6692 unsigned int present;
6694 present = snd_hda_codec_read(codec, 0x15, 0,
6695 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6696 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6697 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6698 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6699 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6702 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6705 /* Headphone insertion or removal. */
6706 if ((res >> 26) == ALC880_HP_EVENT)
6707 alc885_mbp3_automute(codec);
6711 static struct hda_verb alc882_targa_verbs[] = {
6712 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6713 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6715 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6716 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6718 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6719 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6720 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6722 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6723 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6724 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6725 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6729 /* toggle speaker-output according to the hp-jack state */
6730 static void alc882_targa_automute(struct hda_codec *codec)
6732 unsigned int present;
6734 present = snd_hda_codec_read(codec, 0x14, 0,
6735 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6736 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6737 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6738 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6742 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6744 /* Looks like the unsol event is incompatible with the standard
6745 * definition. 4bit tag is placed at 26 bit!
6747 if (((res >> 26) == ALC880_HP_EVENT)) {
6748 alc882_targa_automute(codec);
6752 static struct hda_verb alc882_asus_a7j_verbs[] = {
6753 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6754 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6756 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6757 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6758 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6760 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6761 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6762 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6764 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6765 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6766 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6770 static struct hda_verb alc882_asus_a7m_verbs[] = {
6771 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6772 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6774 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6775 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6776 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6778 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6779 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6780 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6782 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6783 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6784 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6788 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6790 unsigned int gpiostate, gpiomask, gpiodir;
6792 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6793 AC_VERB_GET_GPIO_DATA, 0);
6796 gpiostate |= (1 << pin);
6798 gpiostate &= ~(1 << pin);
6800 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6801 AC_VERB_GET_GPIO_MASK, 0);
6802 gpiomask |= (1 << pin);
6804 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6805 AC_VERB_GET_GPIO_DIRECTION, 0);
6806 gpiodir |= (1 << pin);
6809 snd_hda_codec_write(codec, codec->afg, 0,
6810 AC_VERB_SET_GPIO_MASK, gpiomask);
6811 snd_hda_codec_write(codec, codec->afg, 0,
6812 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6816 snd_hda_codec_write(codec, codec->afg, 0,
6817 AC_VERB_SET_GPIO_DATA, gpiostate);
6820 /* set up GPIO at initialization */
6821 static void alc885_macpro_init_hook(struct hda_codec *codec)
6823 alc882_gpio_mute(codec, 0, 0);
6824 alc882_gpio_mute(codec, 1, 0);
6827 /* set up GPIO and update auto-muting at initialization */
6828 static void alc885_imac24_init_hook(struct hda_codec *codec)
6830 alc885_macpro_init_hook(codec);
6831 alc885_imac24_automute(codec);
6835 * generic initialization of ADC, input mixers and output mixers
6837 static struct hda_verb alc882_auto_init_verbs[] = {
6839 * Unmute ADC0-2 and set the default input to mic-in
6841 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6842 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6843 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6844 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6845 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6846 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6848 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6850 * Note: PASD motherboards uses the Line In 2 as the input for
6851 * front panel mic (mic 2)
6853 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6854 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6855 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6856 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6857 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6858 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6861 * Set up output mixers (0x0c - 0x0f)
6863 /* set vol=0 to output mixers */
6864 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6865 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6866 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6867 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6868 /* set up input amps for analog loopback */
6869 /* Amp Indices: DAC = 0, mixer = 1 */
6870 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6871 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6872 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6873 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6874 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6875 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6876 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6877 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6878 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6879 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6881 /* FIXME: use matrix-type input source selection */
6882 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6883 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6884 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6885 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6886 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6887 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6889 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6890 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6891 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6892 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6894 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6895 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6896 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6897 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6902 #ifdef CONFIG_SND_HDA_POWER_SAVE
6903 #define alc882_loopbacks alc880_loopbacks
6906 /* pcm configuration: identiacal with ALC880 */
6907 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6908 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6909 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6910 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6913 * configuration and preset
6915 static const char *alc882_models[ALC882_MODEL_LAST] = {
6916 [ALC882_3ST_DIG] = "3stack-dig",
6917 [ALC882_6ST_DIG] = "6stack-dig",
6918 [ALC882_ARIMA] = "arima",
6919 [ALC882_W2JC] = "w2jc",
6920 [ALC882_TARGA] = "targa",
6921 [ALC882_ASUS_A7J] = "asus-a7j",
6922 [ALC882_ASUS_A7M] = "asus-a7m",
6923 [ALC885_MACPRO] = "macpro",
6924 [ALC885_MB5] = "mb5",
6925 [ALC885_MBP3] = "mbp3",
6926 [ALC885_IMAC24] = "imac24",
6927 [ALC882_AUTO] = "auto",
6930 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6931 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6932 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6933 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6934 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6935 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6936 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6937 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6938 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6939 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6940 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6941 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6942 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6946 static struct alc_config_preset alc882_presets[] = {
6947 [ALC882_3ST_DIG] = {
6948 .mixers = { alc882_base_mixer },
6949 .init_verbs = { alc882_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,
6957 .input_mux = &alc882_capture_source,
6959 [ALC882_6ST_DIG] = {
6960 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6961 .init_verbs = { alc882_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_sixstack_modes),
6967 .channel_mode = alc882_sixstack_modes,
6968 .input_mux = &alc882_capture_source,
6971 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6972 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6973 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6974 .dac_nids = alc882_dac_nids,
6975 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6976 .channel_mode = alc882_sixstack_modes,
6977 .input_mux = &alc882_capture_source,
6980 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6981 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6982 alc880_gpio1_init_verbs },
6983 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6984 .dac_nids = alc882_dac_nids,
6985 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6986 .channel_mode = alc880_threestack_modes,
6988 .input_mux = &alc882_capture_source,
6989 .dig_out_nid = ALC882_DIGOUT_NID,
6992 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6993 .init_verbs = { alc885_mbp3_init_verbs,
6994 alc880_gpio1_init_verbs },
6995 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6996 .dac_nids = alc882_dac_nids,
6997 .channel_mode = alc885_mbp_6ch_modes,
6998 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6999 .input_mux = &alc882_capture_source,
7000 .dig_out_nid = ALC882_DIGOUT_NID,
7001 .dig_in_nid = ALC882_DIGIN_NID,
7002 .unsol_event = alc885_mbp3_unsol_event,
7003 .init_hook = alc885_mbp3_automute,
7006 .mixers = { alc885_mb5_mixer },
7007 .init_verbs = { alc885_mb5_init_verbs,
7008 alc880_gpio1_init_verbs },
7009 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7010 .dac_nids = alc882_dac_nids,
7011 .channel_mode = alc885_mbp_6ch_modes,
7012 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
7013 .input_mux = &mb5_capture_source,
7014 .dig_out_nid = ALC882_DIGOUT_NID,
7015 .dig_in_nid = ALC882_DIGIN_NID,
7018 .mixers = { alc882_macpro_mixer },
7019 .init_verbs = { alc882_macpro_init_verbs },
7020 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7021 .dac_nids = alc882_dac_nids,
7022 .dig_out_nid = ALC882_DIGOUT_NID,
7023 .dig_in_nid = ALC882_DIGIN_NID,
7024 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7025 .channel_mode = alc882_ch_modes,
7026 .input_mux = &alc882_capture_source,
7027 .init_hook = alc885_macpro_init_hook,
7030 .mixers = { alc885_imac24_mixer },
7031 .init_verbs = { alc885_imac24_init_verbs },
7032 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7033 .dac_nids = alc882_dac_nids,
7034 .dig_out_nid = ALC882_DIGOUT_NID,
7035 .dig_in_nid = ALC882_DIGIN_NID,
7036 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7037 .channel_mode = alc882_ch_modes,
7038 .input_mux = &alc882_capture_source,
7039 .unsol_event = alc885_imac24_unsol_event,
7040 .init_hook = alc885_imac24_init_hook,
7043 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
7044 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
7045 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7046 .dac_nids = alc882_dac_nids,
7047 .dig_out_nid = ALC882_DIGOUT_NID,
7048 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7049 .adc_nids = alc882_adc_nids,
7050 .capsrc_nids = alc882_capsrc_nids,
7051 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7052 .channel_mode = alc882_3ST_6ch_modes,
7054 .input_mux = &alc882_capture_source,
7055 .unsol_event = alc882_targa_unsol_event,
7056 .init_hook = alc882_targa_automute,
7058 [ALC882_ASUS_A7J] = {
7059 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
7060 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
7061 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7062 .dac_nids = alc882_dac_nids,
7063 .dig_out_nid = ALC882_DIGOUT_NID,
7064 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7065 .adc_nids = alc882_adc_nids,
7066 .capsrc_nids = alc882_capsrc_nids,
7067 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7068 .channel_mode = alc882_3ST_6ch_modes,
7070 .input_mux = &alc882_capture_source,
7072 [ALC882_ASUS_A7M] = {
7073 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
7074 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
7075 alc880_gpio1_init_verbs,
7076 alc882_asus_a7m_verbs },
7077 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7078 .dac_nids = alc882_dac_nids,
7079 .dig_out_nid = ALC882_DIGOUT_NID,
7080 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
7081 .channel_mode = alc880_threestack_modes,
7083 .input_mux = &alc882_capture_source,
7092 PINFIX_ABIT_AW9D_MAX
7095 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
7096 { 0x15, 0x01080104 }, /* side */
7097 { 0x16, 0x01011012 }, /* rear */
7098 { 0x17, 0x01016011 }, /* clfe */
7102 static const struct alc_pincfg *alc882_pin_fixes[] = {
7103 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
7106 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
7107 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
7112 * BIOS auto configuration
7114 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
7115 hda_nid_t nid, int pin_type,
7119 struct alc_spec *spec = codec->spec;
7122 alc_set_pin_output(codec, nid, pin_type);
7123 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7126 idx = spec->multiout.dac_nids[dac_idx] - 2;
7127 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7131 static void alc882_auto_init_multi_out(struct hda_codec *codec)
7133 struct alc_spec *spec = codec->spec;
7136 for (i = 0; i <= HDA_SIDE; i++) {
7137 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7138 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7140 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
7145 static void alc882_auto_init_hp_out(struct hda_codec *codec)
7147 struct alc_spec *spec = codec->spec;
7150 pin = spec->autocfg.hp_pins[0];
7151 if (pin) /* connect to front */
7153 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7154 pin = spec->autocfg.speaker_pins[0];
7156 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7159 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7160 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7162 static void alc882_auto_init_analog_input(struct hda_codec *codec)
7164 struct alc_spec *spec = codec->spec;
7167 for (i = 0; i < AUTO_PIN_LAST; i++) {
7168 hda_nid_t nid = spec->autocfg.input_pins[i];
7171 alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/);
7172 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
7173 snd_hda_codec_write(codec, nid, 0,
7174 AC_VERB_SET_AMP_GAIN_MUTE,
7179 static void alc882_auto_init_input_src(struct hda_codec *codec)
7181 struct alc_spec *spec = codec->spec;
7184 for (c = 0; c < spec->num_adc_nids; c++) {
7185 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
7186 hda_nid_t nid = spec->capsrc_nids[c];
7187 unsigned int mux_idx;
7188 const struct hda_input_mux *imux;
7189 int conns, mute, idx, item;
7191 conns = snd_hda_get_connections(codec, nid, conn_list,
7192 ARRAY_SIZE(conn_list));
7195 mux_idx = c >= spec->num_mux_defs ? 0 : c;
7196 imux = &spec->input_mux[mux_idx];
7197 for (idx = 0; idx < conns; idx++) {
7198 /* if the current connection is the selected one,
7199 * unmute it as default - otherwise mute it
7201 mute = AMP_IN_MUTE(idx);
7202 for (item = 0; item < imux->num_items; item++) {
7203 if (imux->items[item].index == idx) {
7204 if (spec->cur_mux[c] == item)
7205 mute = AMP_IN_UNMUTE(idx);
7209 /* check if we have a selector or mixer
7210 * we could check for the widget type instead, but
7211 * just check for Amp-In presence (in case of mixer
7212 * without amp-in there is something wrong, this
7213 * function shouldn't be used or capsrc nid is wrong)
7215 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
7216 snd_hda_codec_write(codec, nid, 0,
7217 AC_VERB_SET_AMP_GAIN_MUTE,
7219 else if (mute != AMP_IN_MUTE(idx))
7220 snd_hda_codec_write(codec, nid, 0,
7221 AC_VERB_SET_CONNECT_SEL,
7227 /* add mic boosts if needed */
7228 static int alc_auto_add_mic_boost(struct hda_codec *codec)
7230 struct alc_spec *spec = codec->spec;
7234 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7235 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7236 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7238 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7242 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7243 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7244 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7246 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7253 /* almost identical with ALC880 parser... */
7254 static int alc882_parse_auto_config(struct hda_codec *codec)
7256 struct alc_spec *spec = codec->spec;
7257 int err = alc880_parse_auto_config(codec);
7262 return 0; /* no config found */
7264 err = alc_auto_add_mic_boost(codec);
7268 /* hack - override the init verbs */
7269 spec->init_verbs[0] = alc882_auto_init_verbs;
7271 return 1; /* config found */
7274 /* additional initialization for auto-configuration model */
7275 static void alc882_auto_init(struct hda_codec *codec)
7277 struct alc_spec *spec = codec->spec;
7278 alc882_auto_init_multi_out(codec);
7279 alc882_auto_init_hp_out(codec);
7280 alc882_auto_init_analog_input(codec);
7281 alc882_auto_init_input_src(codec);
7282 if (spec->unsol_event)
7283 alc_inithook(codec);
7286 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7288 static int patch_alc882(struct hda_codec *codec)
7290 struct alc_spec *spec;
7291 int err, board_config;
7293 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7299 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7303 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7304 /* Pick up systems that don't supply PCI SSID */
7305 switch (codec->subsystem_id) {
7306 case 0x106b0c00: /* Mac Pro */
7307 board_config = ALC885_MACPRO;
7309 case 0x106b1000: /* iMac 24 */
7310 case 0x106b2800: /* AppleTV */
7311 case 0x106b3e00: /* iMac 24 Aluminium */
7312 board_config = ALC885_IMAC24;
7314 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7315 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7316 case 0x106b00a4: /* MacbookPro4,1 */
7317 case 0x106b2c00: /* Macbook Pro rev3 */
7318 case 0x106b3600: /* Macbook 3.1 */
7319 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7320 board_config = ALC885_MBP3;
7322 case 0x106b3f00: /* Macbook 5,1 */
7323 board_config = ALC885_MB5;
7326 /* ALC889A is handled better as ALC888-compatible */
7327 if (codec->revision_id == 0x100101 ||
7328 codec->revision_id == 0x100103) {
7330 return patch_alc883(codec);
7332 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7333 "trying auto-probe from BIOS...\n");
7334 board_config = ALC882_AUTO;
7338 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7340 if (board_config == ALC882_AUTO) {
7341 /* automatic parse from the BIOS config */
7342 err = alc882_parse_auto_config(codec);
7348 "hda_codec: Cannot set up configuration "
7349 "from BIOS. Using base mode...\n");
7350 board_config = ALC882_3ST_DIG;
7354 err = snd_hda_attach_beep_device(codec, 0x1);
7360 if (board_config != ALC882_AUTO)
7361 setup_preset(spec, &alc882_presets[board_config]);
7363 if (codec->vendor_id == 0x10ec0885) {
7364 spec->stream_name_analog = "ALC885 Analog";
7365 spec->stream_name_digital = "ALC885 Digital";
7367 spec->stream_name_analog = "ALC882 Analog";
7368 spec->stream_name_digital = "ALC882 Digital";
7371 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7372 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7373 /* FIXME: setup DAC5 */
7374 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7375 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7377 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7378 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7380 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7381 if (!spec->adc_nids && spec->input_mux) {
7382 /* check whether NID 0x07 is valid */
7383 unsigned int wcap = get_wcaps(codec, 0x07);
7385 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7386 if (wcap != AC_WID_AUD_IN) {
7387 spec->adc_nids = alc882_adc_nids_alt;
7388 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7389 spec->capsrc_nids = alc882_capsrc_nids_alt;
7391 spec->adc_nids = alc882_adc_nids;
7392 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7393 spec->capsrc_nids = alc882_capsrc_nids;
7396 set_capture_mixer(spec);
7397 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7399 spec->vmaster_nid = 0x0c;
7401 codec->patch_ops = alc_patch_ops;
7402 if (board_config == ALC882_AUTO)
7403 spec->init_hook = alc882_auto_init;
7404 #ifdef CONFIG_SND_HDA_POWER_SAVE
7405 if (!spec->loopback.amplist)
7406 spec->loopback.amplist = alc882_loopbacks;
7408 codec->proc_widget_hook = print_realtek_coef;
7416 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7417 * configuration. Each pin widget can choose any input DACs and a mixer.
7418 * Each ADC is connected from a mixer of all inputs. This makes possible
7419 * 6-channel independent captures.
7421 * In addition, an independent DAC for the multi-playback (not used in this
7424 #define ALC883_DIGOUT_NID 0x06
7425 #define ALC883_DIGIN_NID 0x0a
7427 #define ALC1200_DIGOUT_NID 0x10
7429 static hda_nid_t alc883_dac_nids[4] = {
7430 /* front, rear, clfe, rear_surr */
7431 0x02, 0x03, 0x04, 0x05
7434 static hda_nid_t alc883_adc_nids[2] = {
7439 static hda_nid_t alc883_adc_nids_alt[1] = {
7444 static hda_nid_t alc883_adc_nids_rev[2] = {
7449 #define alc889_adc_nids alc880_adc_nids
7451 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7453 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7455 #define alc889_capsrc_nids alc882_capsrc_nids
7458 /* FIXME: should be a matrix-type input source selection */
7460 static struct hda_input_mux alc883_capture_source = {
7464 { "Front Mic", 0x1 },
7470 static struct hda_input_mux alc883_3stack_6ch_intel = {
7474 { "Front Mic", 0x0 },
7480 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7488 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7498 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7506 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7510 { "Front Mic", 0x1 },
7515 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7526 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7533 static struct hda_verb alc883_3ST_ch2_init[] = {
7534 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7535 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7536 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7537 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7544 static struct hda_verb alc883_3ST_ch4_init[] = {
7545 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7546 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7547 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7548 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7549 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7556 static struct hda_verb alc883_3ST_ch6_init[] = {
7557 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7558 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7559 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7560 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7561 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7562 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7566 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7567 { 2, alc883_3ST_ch2_init },
7568 { 4, alc883_3ST_ch4_init },
7569 { 6, alc883_3ST_ch6_init },
7575 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7576 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7577 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7578 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7579 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7586 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7587 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7588 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7589 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7590 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7591 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7598 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7599 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7600 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7601 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7602 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7603 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7604 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7608 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7609 { 2, alc883_3ST_ch2_intel_init },
7610 { 4, alc883_3ST_ch4_intel_init },
7611 { 6, alc883_3ST_ch6_intel_init },
7617 static struct hda_verb alc883_sixstack_ch6_init[] = {
7618 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7619 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7620 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7621 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7628 static struct hda_verb alc883_sixstack_ch8_init[] = {
7629 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7630 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7631 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7632 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7636 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7637 { 6, alc883_sixstack_ch6_init },
7638 { 8, alc883_sixstack_ch8_init },
7641 static struct hda_verb alc883_medion_eapd_verbs[] = {
7642 /* eanable EAPD on medion laptop */
7643 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7644 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7648 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7649 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7652 static struct snd_kcontrol_new alc883_base_mixer[] = {
7653 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7654 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7655 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7656 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7657 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7658 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7659 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7660 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7661 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7662 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7663 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7664 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7665 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7666 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7667 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7668 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7669 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7670 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7671 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7672 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7673 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7677 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7678 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7679 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7680 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7681 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7682 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7683 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7684 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7685 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7686 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7687 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7688 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7689 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7690 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7694 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7695 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7696 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7697 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7698 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7699 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7700 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7701 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7702 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7703 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7704 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7708 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7709 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7710 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7711 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7712 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7713 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7714 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7715 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7716 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7717 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7718 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7722 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7723 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7724 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7725 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7726 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7727 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7728 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7729 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7730 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7731 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7732 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7733 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7734 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7735 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7739 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7740 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7741 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7742 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7743 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7744 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7745 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7746 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7747 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7748 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7749 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7750 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7751 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7752 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7753 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7754 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7755 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7756 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7757 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7758 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7762 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7763 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7764 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7765 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7766 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7767 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7769 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7770 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7771 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7772 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7773 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7774 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7775 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7776 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7778 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7780 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7781 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7782 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7786 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7787 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7788 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7789 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7790 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7791 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7792 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7793 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7794 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7795 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7796 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7797 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7798 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7799 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7800 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7801 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7802 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7803 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7804 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7805 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7809 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7810 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7811 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7812 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7813 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7814 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7815 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7816 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7817 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7818 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7819 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7820 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7821 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7822 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7823 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7824 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7829 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7830 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7831 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7832 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7833 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7834 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7835 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7836 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7837 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7838 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7839 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7840 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7844 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7845 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7846 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7847 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7848 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7849 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7850 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7851 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7852 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7856 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7857 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7858 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7859 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7860 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7861 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7862 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7863 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7864 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7865 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7869 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7870 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7871 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7872 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7873 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7874 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7875 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7876 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7877 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7878 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7882 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7883 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7884 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7885 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7886 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7887 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7888 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7889 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7890 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7894 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7895 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7896 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7897 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7898 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7899 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7900 0x0d, 1, 0x0, HDA_OUTPUT),
7901 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7902 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7903 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7904 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7905 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7906 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7907 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7908 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7909 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7910 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7911 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7913 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7914 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7915 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7916 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7917 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7921 static struct hda_bind_ctls alc883_bind_cap_vol = {
7922 .ops = &snd_hda_bind_vol,
7924 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7925 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7930 static struct hda_bind_ctls alc883_bind_cap_switch = {
7931 .ops = &snd_hda_bind_sw,
7933 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7934 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7939 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7940 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7941 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7942 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7943 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7944 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7945 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7946 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7947 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7951 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7952 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7953 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7955 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7956 /* .name = "Capture Source", */
7957 .name = "Input Source",
7959 .info = alc_mux_enum_info,
7960 .get = alc_mux_enum_get,
7961 .put = alc_mux_enum_put,
7966 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7968 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7969 .name = "Channel Mode",
7970 .info = alc_ch_mode_info,
7971 .get = alc_ch_mode_get,
7972 .put = alc_ch_mode_put,
7977 static struct hda_verb alc883_init_verbs[] = {
7978 /* ADC1: mute amp left and right */
7979 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7980 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7981 /* ADC2: mute amp left and right */
7982 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7983 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7984 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7985 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7986 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7987 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7989 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7990 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7991 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7993 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7994 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7995 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7997 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7998 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7999 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8001 /* mute analog input loopbacks */
8002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8003 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8004 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8005 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8006 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8008 /* Front Pin: output 0 (0x0c) */
8009 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8010 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8011 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8012 /* Rear Pin: output 1 (0x0d) */
8013 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8014 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8015 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8016 /* CLFE Pin: output 2 (0x0e) */
8017 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8018 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8019 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8020 /* Side Pin: output 3 (0x0f) */
8021 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8022 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8023 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8024 /* Mic (rear) pin: input vref at 80% */
8025 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8026 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8027 /* Front Mic pin: input vref at 80% */
8028 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8029 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8030 /* Line In pin: input */
8031 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8032 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8033 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8034 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8035 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8036 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8037 /* CD pin widget for input */
8038 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8040 /* FIXME: use matrix-type input source selection */
8041 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8043 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8044 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8045 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8046 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8048 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8049 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8050 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8051 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8055 /* toggle speaker-output according to the hp-jack state */
8056 static void alc883_mitac_hp_automute(struct hda_codec *codec)
8058 unsigned int present;
8060 present = snd_hda_codec_read(codec, 0x15, 0,
8061 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8062 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8063 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8064 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8065 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8068 /* auto-toggle front mic */
8070 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8072 unsigned int present;
8075 present = snd_hda_codec_read(codec, 0x18, 0,
8076 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8077 bits = present ? HDA_AMP_MUTE : 0;
8078 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8082 static void alc883_mitac_automute(struct hda_codec *codec)
8084 alc883_mitac_hp_automute(codec);
8085 /* alc883_mitac_mic_automute(codec); */
8088 static void alc883_mitac_unsol_event(struct hda_codec *codec,
8091 switch (res >> 26) {
8092 case ALC880_HP_EVENT:
8093 alc883_mitac_hp_automute(codec);
8095 case ALC880_MIC_EVENT:
8096 /* alc883_mitac_mic_automute(codec); */
8101 static struct hda_verb alc883_mitac_verbs[] = {
8103 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8104 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8106 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8107 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8109 /* enable unsolicited event */
8110 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8111 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8116 static struct hda_verb alc883_clevo_m720_verbs[] = {
8118 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8119 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8121 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8122 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8124 /* enable unsolicited event */
8125 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8126 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8131 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8133 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8134 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8136 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8137 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8139 /* enable unsolicited event */
8140 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8145 static struct hda_verb alc883_tagra_verbs[] = {
8146 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8147 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8149 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8150 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8152 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8153 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8154 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8156 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8157 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
8158 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
8159 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
8164 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8165 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8166 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8167 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8171 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8172 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8173 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8174 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8175 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8179 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8180 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8181 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8182 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8183 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8184 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8188 static struct hda_verb alc883_haier_w66_verbs[] = {
8189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8190 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8192 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8194 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8195 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8196 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8197 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8201 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8202 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8203 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8204 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8205 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8206 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8207 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8208 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8209 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8213 static struct hda_verb alc888_6st_dell_verbs[] = {
8214 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8218 static void alc888_3st_hp_front_automute(struct hda_codec *codec)
8220 unsigned int present, bits;
8222 present = snd_hda_codec_read(codec, 0x1b, 0,
8223 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8224 bits = present ? HDA_AMP_MUTE : 0;
8225 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8226 HDA_AMP_MUTE, bits);
8227 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8228 HDA_AMP_MUTE, bits);
8229 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
8230 HDA_AMP_MUTE, bits);
8233 static void alc888_3st_hp_unsol_event(struct hda_codec *codec,
8236 switch (res >> 26) {
8237 case ALC880_HP_EVENT:
8238 alc888_3st_hp_front_automute(codec);
8243 static struct hda_verb alc888_3st_hp_verbs[] = {
8244 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8245 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8246 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8247 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8254 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8255 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8256 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8257 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8258 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8265 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8266 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8267 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8268 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8269 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8270 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8277 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8278 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8279 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8280 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8281 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8282 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8283 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8287 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8288 { 2, alc888_3st_hp_2ch_init },
8289 { 4, alc888_3st_hp_4ch_init },
8290 { 6, alc888_3st_hp_6ch_init },
8293 /* toggle front-jack and RCA according to the hp-jack state */
8294 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8296 unsigned int present;
8298 present = snd_hda_codec_read(codec, 0x1b, 0,
8299 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8300 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8301 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8302 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8303 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8306 /* toggle RCA according to the front-jack state */
8307 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8309 unsigned int present;
8311 present = snd_hda_codec_read(codec, 0x14, 0,
8312 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8313 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8314 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8317 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8320 if ((res >> 26) == ALC880_HP_EVENT)
8321 alc888_lenovo_ms7195_front_automute(codec);
8322 if ((res >> 26) == ALC880_FRONT_EVENT)
8323 alc888_lenovo_ms7195_rca_automute(codec);
8326 static struct hda_verb alc883_medion_md2_verbs[] = {
8327 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8328 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8330 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8332 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8336 /* toggle speaker-output according to the hp-jack state */
8337 static void alc883_medion_md2_automute(struct hda_codec *codec)
8339 unsigned int present;
8341 present = snd_hda_codec_read(codec, 0x14, 0,
8342 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8343 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8344 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8347 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8350 if ((res >> 26) == ALC880_HP_EVENT)
8351 alc883_medion_md2_automute(codec);
8354 /* toggle speaker-output according to the hp-jack state */
8355 static void alc883_tagra_automute(struct hda_codec *codec)
8357 unsigned int present;
8360 present = snd_hda_codec_read(codec, 0x14, 0,
8361 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8362 bits = present ? HDA_AMP_MUTE : 0;
8363 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8364 HDA_AMP_MUTE, bits);
8365 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8369 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8371 if ((res >> 26) == ALC880_HP_EVENT)
8372 alc883_tagra_automute(codec);
8375 /* toggle speaker-output according to the hp-jack state */
8376 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8378 unsigned int present;
8381 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8382 & AC_PINSENSE_PRESENCE;
8383 bits = present ? HDA_AMP_MUTE : 0;
8384 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8385 HDA_AMP_MUTE, bits);
8388 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8390 unsigned int present;
8392 present = snd_hda_codec_read(codec, 0x18, 0,
8393 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8394 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8395 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8398 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8400 alc883_clevo_m720_hp_automute(codec);
8401 alc883_clevo_m720_mic_automute(codec);
8404 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8407 switch (res >> 26) {
8408 case ALC880_HP_EVENT:
8409 alc883_clevo_m720_hp_automute(codec);
8411 case ALC880_MIC_EVENT:
8412 alc883_clevo_m720_mic_automute(codec);
8417 /* toggle speaker-output according to the hp-jack state */
8418 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8420 unsigned int present;
8423 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8424 & AC_PINSENSE_PRESENCE;
8425 bits = present ? HDA_AMP_MUTE : 0;
8426 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8427 HDA_AMP_MUTE, bits);
8430 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8433 if ((res >> 26) == ALC880_HP_EVENT)
8434 alc883_2ch_fujitsu_pi2515_automute(codec);
8437 static void alc883_haier_w66_automute(struct hda_codec *codec)
8439 unsigned int present;
8442 present = snd_hda_codec_read(codec, 0x1b, 0,
8443 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8444 bits = present ? 0x80 : 0;
8445 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8449 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8452 if ((res >> 26) == ALC880_HP_EVENT)
8453 alc883_haier_w66_automute(codec);
8456 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8458 unsigned int present;
8461 present = snd_hda_codec_read(codec, 0x14, 0,
8462 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8463 bits = present ? HDA_AMP_MUTE : 0;
8464 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8465 HDA_AMP_MUTE, bits);
8468 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8470 unsigned int present;
8473 present = snd_hda_codec_read(codec, 0x1b, 0,
8474 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8475 bits = present ? HDA_AMP_MUTE : 0;
8476 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8477 HDA_AMP_MUTE, bits);
8478 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8479 HDA_AMP_MUTE, bits);
8482 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8485 if ((res >> 26) == ALC880_HP_EVENT)
8486 alc883_lenovo_101e_all_automute(codec);
8487 if ((res >> 26) == ALC880_FRONT_EVENT)
8488 alc883_lenovo_101e_ispeaker_automute(codec);
8491 /* toggle speaker-output according to the hp-jack state */
8492 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8494 unsigned int present;
8496 present = snd_hda_codec_read(codec, 0x14, 0,
8497 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8498 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8499 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8500 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8501 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8504 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8507 if ((res >> 26) == ALC880_HP_EVENT)
8508 alc883_acer_aspire_automute(codec);
8511 static struct hda_verb alc883_acer_eapd_verbs[] = {
8512 /* HP Pin: output 0 (0x0c) */
8513 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8514 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8515 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8516 /* Front Pin: output 0 (0x0c) */
8517 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8518 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8519 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8520 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8521 /* eanable EAPD on medion laptop */
8522 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8523 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8524 /* enable unsolicited event */
8525 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8529 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8531 unsigned int present;
8533 present = snd_hda_codec_read(codec, 0x1b, 0,
8534 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8535 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8536 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8537 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8538 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8539 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8540 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8541 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8542 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8545 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8548 switch (res >> 26) {
8549 case ALC880_HP_EVENT:
8550 /* printk(KERN_DEBUG "hp_event\n"); */
8551 alc888_6st_dell_front_automute(codec);
8556 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8559 unsigned int present;
8561 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8562 present = snd_hda_codec_read(codec, 0x1b, 0,
8563 AC_VERB_GET_PIN_SENSE, 0);
8564 present = (present & 0x80000000) != 0;
8566 /* mute internal speaker */
8567 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8568 HDA_AMP_MUTE, HDA_AMP_MUTE);
8569 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8570 HDA_AMP_MUTE, HDA_AMP_MUTE);
8571 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8572 HDA_AMP_MUTE, HDA_AMP_MUTE);
8573 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8574 HDA_AMP_MUTE, HDA_AMP_MUTE);
8575 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8576 HDA_AMP_MUTE, HDA_AMP_MUTE);
8578 /* unmute internal speaker if necessary */
8579 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8580 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8581 HDA_AMP_MUTE, mute);
8582 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8583 HDA_AMP_MUTE, mute);
8584 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8585 HDA_AMP_MUTE, mute);
8586 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8587 HDA_AMP_MUTE, mute);
8588 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8589 HDA_AMP_MUTE, mute);
8593 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8596 if ((res >> 26) == ALC880_HP_EVENT)
8597 alc888_lenovo_sky_front_automute(codec);
8601 * generic initialization of ADC, input mixers and output mixers
8603 static struct hda_verb alc883_auto_init_verbs[] = {
8605 * Unmute ADC0-2 and set the default input to mic-in
8607 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8608 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8609 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8610 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8612 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8614 * Note: PASD motherboards uses the Line In 2 as the input for
8615 * front panel mic (mic 2)
8617 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8618 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8619 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8620 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8621 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8622 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8625 * Set up output mixers (0x0c - 0x0f)
8627 /* set vol=0 to output mixers */
8628 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8630 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8631 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8632 /* set up input amps for analog loopback */
8633 /* Amp Indices: DAC = 0, mixer = 1 */
8634 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8635 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8636 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8637 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8638 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8639 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8640 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8641 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8642 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8643 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8645 /* FIXME: use matrix-type input source selection */
8646 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8648 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8649 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8650 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8651 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8657 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8658 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8663 static struct hda_verb alc888_asus_m90v_verbs[] = {
8664 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8666 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8667 /* enable unsolicited event */
8668 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8669 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8673 static void alc883_nb_mic_automute(struct hda_codec *codec)
8675 unsigned int present;
8677 present = snd_hda_codec_read(codec, 0x18, 0,
8678 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8679 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8680 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8681 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8682 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8685 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8687 unsigned int present;
8690 present = snd_hda_codec_read(codec, 0x1b, 0,
8691 AC_VERB_GET_PIN_SENSE, 0)
8692 & AC_PINSENSE_PRESENCE;
8693 bits = present ? 0 : PIN_OUT;
8694 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8696 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8698 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8702 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8705 switch (res >> 26) {
8706 case ALC880_HP_EVENT:
8707 alc883_M90V_speaker_automute(codec);
8709 case ALC880_MIC_EVENT:
8710 alc883_nb_mic_automute(codec);
8715 static void alc883_mode2_inithook(struct hda_codec *codec)
8717 alc883_M90V_speaker_automute(codec);
8718 alc883_nb_mic_automute(codec);
8721 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8722 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8723 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8724 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8725 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8726 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8727 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8728 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8729 /* enable unsolicited event */
8730 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8734 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8736 unsigned int present;
8739 present = snd_hda_codec_read(codec, 0x14, 0,
8740 AC_VERB_GET_PIN_SENSE, 0)
8741 & AC_PINSENSE_PRESENCE;
8742 bits = present ? 0 : PIN_OUT;
8743 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8747 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8750 switch (res >> 26) {
8751 case ALC880_HP_EVENT:
8752 alc883_eee1601_speaker_automute(codec);
8757 static void alc883_eee1601_inithook(struct hda_codec *codec)
8759 alc883_eee1601_speaker_automute(codec);
8762 #ifdef CONFIG_SND_HDA_POWER_SAVE
8763 #define alc883_loopbacks alc880_loopbacks
8766 /* pcm configuration: identiacal with ALC880 */
8767 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8768 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8769 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8770 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8771 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8774 * configuration and preset
8776 static const char *alc883_models[ALC883_MODEL_LAST] = {
8777 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8778 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8779 [ALC883_3ST_6ch] = "3stack-6ch",
8780 [ALC883_6ST_DIG] = "6stack-dig",
8781 [ALC883_TARGA_DIG] = "targa-dig",
8782 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8783 [ALC883_ACER] = "acer",
8784 [ALC883_ACER_ASPIRE] = "acer-aspire",
8785 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8786 [ALC883_MEDION] = "medion",
8787 [ALC883_MEDION_MD2] = "medion-md2",
8788 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8789 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8790 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8791 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8792 [ALC888_LENOVO_SKY] = "lenovo-sky",
8793 [ALC883_HAIER_W66] = "haier-w66",
8794 [ALC888_3ST_HP] = "3stack-hp",
8795 [ALC888_6ST_DELL] = "6stack-dell",
8796 [ALC883_MITAC] = "mitac",
8797 [ALC883_CLEVO_M720] = "clevo-m720",
8798 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8799 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8800 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8801 [ALC1200_ASUS_P5Q] = "asus-p5q",
8802 [ALC883_AUTO] = "auto",
8805 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8806 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8807 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8808 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8809 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8810 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8811 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8812 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8813 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8814 ALC888_ACER_ASPIRE_4930G),
8815 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8816 ALC888_ACER_ASPIRE_4930G),
8817 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
8818 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
8819 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8820 ALC888_ACER_ASPIRE_4930G),
8821 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8822 ALC888_ACER_ASPIRE_4930G),
8824 SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER),
8825 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8826 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8827 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8828 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8829 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8830 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8831 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8832 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8833 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8834 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8835 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8836 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8837 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8838 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8839 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8840 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8841 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8842 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8843 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8844 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8845 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8846 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8847 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8848 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8849 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8850 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8851 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8852 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8853 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8854 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8855 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8856 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8857 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8858 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8859 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8860 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8861 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8862 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8863 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8864 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8865 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8866 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8867 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8868 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8869 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8870 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8871 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8872 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8873 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8874 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8875 ALC883_FUJITSU_PI2515),
8876 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8877 ALC888_FUJITSU_XA3530),
8878 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8879 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8880 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8881 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8882 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8883 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8884 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8885 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8886 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8887 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8888 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8889 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8890 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8891 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8895 static hda_nid_t alc883_slave_dig_outs[] = {
8896 ALC1200_DIGOUT_NID, 0,
8899 static hda_nid_t alc1200_slave_dig_outs[] = {
8900 ALC883_DIGOUT_NID, 0,
8903 static struct alc_config_preset alc883_presets[] = {
8904 [ALC883_3ST_2ch_DIG] = {
8905 .mixers = { alc883_3ST_2ch_mixer },
8906 .init_verbs = { alc883_init_verbs },
8907 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8908 .dac_nids = alc883_dac_nids,
8909 .dig_out_nid = ALC883_DIGOUT_NID,
8910 .dig_in_nid = ALC883_DIGIN_NID,
8911 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8912 .channel_mode = alc883_3ST_2ch_modes,
8913 .input_mux = &alc883_capture_source,
8915 [ALC883_3ST_6ch_DIG] = {
8916 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8917 .init_verbs = { alc883_init_verbs },
8918 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8919 .dac_nids = alc883_dac_nids,
8920 .dig_out_nid = ALC883_DIGOUT_NID,
8921 .dig_in_nid = ALC883_DIGIN_NID,
8922 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8923 .channel_mode = alc883_3ST_6ch_modes,
8925 .input_mux = &alc883_capture_source,
8927 [ALC883_3ST_6ch] = {
8928 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8929 .init_verbs = { alc883_init_verbs },
8930 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8931 .dac_nids = alc883_dac_nids,
8932 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8933 .channel_mode = alc883_3ST_6ch_modes,
8935 .input_mux = &alc883_capture_source,
8937 [ALC883_3ST_6ch_INTEL] = {
8938 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8939 .init_verbs = { alc883_init_verbs },
8940 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8941 .dac_nids = alc883_dac_nids,
8942 .dig_out_nid = ALC883_DIGOUT_NID,
8943 .dig_in_nid = ALC883_DIGIN_NID,
8944 .slave_dig_outs = alc883_slave_dig_outs,
8945 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8946 .channel_mode = alc883_3ST_6ch_intel_modes,
8948 .input_mux = &alc883_3stack_6ch_intel,
8950 [ALC883_6ST_DIG] = {
8951 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8952 .init_verbs = { alc883_init_verbs },
8953 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8954 .dac_nids = alc883_dac_nids,
8955 .dig_out_nid = ALC883_DIGOUT_NID,
8956 .dig_in_nid = ALC883_DIGIN_NID,
8957 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8958 .channel_mode = alc883_sixstack_modes,
8959 .input_mux = &alc883_capture_source,
8961 [ALC883_TARGA_DIG] = {
8962 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8963 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8964 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8965 .dac_nids = alc883_dac_nids,
8966 .dig_out_nid = ALC883_DIGOUT_NID,
8967 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8968 .channel_mode = alc883_3ST_6ch_modes,
8970 .input_mux = &alc883_capture_source,
8971 .unsol_event = alc883_tagra_unsol_event,
8972 .init_hook = alc883_tagra_automute,
8974 [ALC883_TARGA_2ch_DIG] = {
8975 .mixers = { alc883_tagra_2ch_mixer},
8976 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8977 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8978 .dac_nids = alc883_dac_nids,
8979 .adc_nids = alc883_adc_nids_alt,
8980 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8981 .dig_out_nid = ALC883_DIGOUT_NID,
8982 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8983 .channel_mode = alc883_3ST_2ch_modes,
8984 .input_mux = &alc883_capture_source,
8985 .unsol_event = alc883_tagra_unsol_event,
8986 .init_hook = alc883_tagra_automute,
8989 .mixers = { alc883_base_mixer },
8990 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8991 * and the headphone jack. Turn this on and rely on the
8992 * standard mute methods whenever the user wants to turn
8993 * these outputs off.
8995 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8996 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8997 .dac_nids = alc883_dac_nids,
8998 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8999 .channel_mode = alc883_3ST_2ch_modes,
9000 .input_mux = &alc883_capture_source,
9002 [ALC883_ACER_ASPIRE] = {
9003 .mixers = { alc883_acer_aspire_mixer },
9004 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9005 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9006 .dac_nids = alc883_dac_nids,
9007 .dig_out_nid = ALC883_DIGOUT_NID,
9008 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9009 .channel_mode = alc883_3ST_2ch_modes,
9010 .input_mux = &alc883_capture_source,
9011 .unsol_event = alc883_acer_aspire_unsol_event,
9012 .init_hook = alc883_acer_aspire_automute,
9014 [ALC888_ACER_ASPIRE_4930G] = {
9015 .mixers = { alc888_base_mixer,
9016 alc883_chmode_mixer },
9017 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9018 alc888_acer_aspire_4930g_verbs },
9019 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9020 .dac_nids = alc883_dac_nids,
9021 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9022 .adc_nids = alc883_adc_nids_rev,
9023 .capsrc_nids = alc883_capsrc_nids_rev,
9024 .dig_out_nid = ALC883_DIGOUT_NID,
9025 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9026 .channel_mode = alc883_3ST_6ch_modes,
9029 ARRAY_SIZE(alc888_2_capture_sources),
9030 .input_mux = alc888_2_capture_sources,
9031 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
9032 .init_hook = alc888_acer_aspire_4930g_automute,
9035 .mixers = { alc883_fivestack_mixer,
9036 alc883_chmode_mixer },
9037 .init_verbs = { alc883_init_verbs,
9038 alc883_medion_eapd_verbs },
9039 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9040 .dac_nids = alc883_dac_nids,
9041 .adc_nids = alc883_adc_nids_alt,
9042 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9043 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9044 .channel_mode = alc883_sixstack_modes,
9045 .input_mux = &alc883_capture_source,
9047 [ALC883_MEDION_MD2] = {
9048 .mixers = { alc883_medion_md2_mixer},
9049 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9050 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9051 .dac_nids = alc883_dac_nids,
9052 .dig_out_nid = ALC883_DIGOUT_NID,
9053 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9054 .channel_mode = alc883_3ST_2ch_modes,
9055 .input_mux = &alc883_capture_source,
9056 .unsol_event = alc883_medion_md2_unsol_event,
9057 .init_hook = alc883_medion_md2_automute,
9059 [ALC883_LAPTOP_EAPD] = {
9060 .mixers = { alc883_base_mixer },
9061 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9062 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9063 .dac_nids = alc883_dac_nids,
9064 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9065 .channel_mode = alc883_3ST_2ch_modes,
9066 .input_mux = &alc883_capture_source,
9068 [ALC883_CLEVO_M720] = {
9069 .mixers = { alc883_clevo_m720_mixer },
9070 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9071 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9072 .dac_nids = alc883_dac_nids,
9073 .dig_out_nid = ALC883_DIGOUT_NID,
9074 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9075 .channel_mode = alc883_3ST_2ch_modes,
9076 .input_mux = &alc883_capture_source,
9077 .unsol_event = alc883_clevo_m720_unsol_event,
9078 .init_hook = alc883_clevo_m720_automute,
9080 [ALC883_LENOVO_101E_2ch] = {
9081 .mixers = { alc883_lenovo_101e_2ch_mixer},
9082 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9083 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9084 .dac_nids = alc883_dac_nids,
9085 .adc_nids = alc883_adc_nids_alt,
9086 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9087 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9088 .channel_mode = alc883_3ST_2ch_modes,
9089 .input_mux = &alc883_lenovo_101e_capture_source,
9090 .unsol_event = alc883_lenovo_101e_unsol_event,
9091 .init_hook = alc883_lenovo_101e_all_automute,
9093 [ALC883_LENOVO_NB0763] = {
9094 .mixers = { alc883_lenovo_nb0763_mixer },
9095 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9096 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9097 .dac_nids = alc883_dac_nids,
9098 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9099 .channel_mode = alc883_3ST_2ch_modes,
9101 .input_mux = &alc883_lenovo_nb0763_capture_source,
9102 .unsol_event = alc883_medion_md2_unsol_event,
9103 .init_hook = alc883_medion_md2_automute,
9105 [ALC888_LENOVO_MS7195_DIG] = {
9106 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9107 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9108 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9109 .dac_nids = alc883_dac_nids,
9110 .dig_out_nid = ALC883_DIGOUT_NID,
9111 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9112 .channel_mode = alc883_3ST_6ch_modes,
9114 .input_mux = &alc883_capture_source,
9115 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9116 .init_hook = alc888_lenovo_ms7195_front_automute,
9118 [ALC883_HAIER_W66] = {
9119 .mixers = { alc883_tagra_2ch_mixer},
9120 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9121 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9122 .dac_nids = alc883_dac_nids,
9123 .dig_out_nid = ALC883_DIGOUT_NID,
9124 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9125 .channel_mode = alc883_3ST_2ch_modes,
9126 .input_mux = &alc883_capture_source,
9127 .unsol_event = alc883_haier_w66_unsol_event,
9128 .init_hook = alc883_haier_w66_automute,
9131 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9132 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9133 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9134 .dac_nids = alc883_dac_nids,
9135 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9136 .channel_mode = alc888_3st_hp_modes,
9138 .input_mux = &alc883_capture_source,
9139 .unsol_event = alc888_3st_hp_unsol_event,
9140 .init_hook = alc888_3st_hp_front_automute,
9142 [ALC888_6ST_DELL] = {
9143 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9144 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9145 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9146 .dac_nids = alc883_dac_nids,
9147 .dig_out_nid = ALC883_DIGOUT_NID,
9148 .dig_in_nid = ALC883_DIGIN_NID,
9149 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9150 .channel_mode = alc883_sixstack_modes,
9151 .input_mux = &alc883_capture_source,
9152 .unsol_event = alc888_6st_dell_unsol_event,
9153 .init_hook = alc888_6st_dell_front_automute,
9156 .mixers = { alc883_mitac_mixer },
9157 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9158 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9159 .dac_nids = alc883_dac_nids,
9160 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9161 .channel_mode = alc883_3ST_2ch_modes,
9162 .input_mux = &alc883_capture_source,
9163 .unsol_event = alc883_mitac_unsol_event,
9164 .init_hook = alc883_mitac_automute,
9166 [ALC883_FUJITSU_PI2515] = {
9167 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9168 .init_verbs = { alc883_init_verbs,
9169 alc883_2ch_fujitsu_pi2515_verbs},
9170 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9171 .dac_nids = alc883_dac_nids,
9172 .dig_out_nid = ALC883_DIGOUT_NID,
9173 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9174 .channel_mode = alc883_3ST_2ch_modes,
9175 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9176 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
9177 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
9179 [ALC888_FUJITSU_XA3530] = {
9180 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9181 .init_verbs = { alc883_init_verbs,
9182 alc888_fujitsu_xa3530_verbs },
9183 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9184 .dac_nids = alc883_dac_nids,
9185 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9186 .adc_nids = alc883_adc_nids_rev,
9187 .capsrc_nids = alc883_capsrc_nids_rev,
9188 .dig_out_nid = ALC883_DIGOUT_NID,
9189 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9190 .channel_mode = alc888_4ST_8ch_intel_modes,
9192 ARRAY_SIZE(alc888_2_capture_sources),
9193 .input_mux = alc888_2_capture_sources,
9194 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
9195 .init_hook = alc888_fujitsu_xa3530_automute,
9197 [ALC888_LENOVO_SKY] = {
9198 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9199 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9200 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9201 .dac_nids = alc883_dac_nids,
9202 .dig_out_nid = ALC883_DIGOUT_NID,
9203 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9204 .channel_mode = alc883_sixstack_modes,
9206 .input_mux = &alc883_lenovo_sky_capture_source,
9207 .unsol_event = alc883_lenovo_sky_unsol_event,
9208 .init_hook = alc888_lenovo_sky_front_automute,
9210 [ALC888_ASUS_M90V] = {
9211 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9212 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9213 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9214 .dac_nids = alc883_dac_nids,
9215 .dig_out_nid = ALC883_DIGOUT_NID,
9216 .dig_in_nid = ALC883_DIGIN_NID,
9217 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9218 .channel_mode = alc883_3ST_6ch_modes,
9220 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9221 .unsol_event = alc883_mode2_unsol_event,
9222 .init_hook = alc883_mode2_inithook,
9224 [ALC888_ASUS_EEE1601] = {
9225 .mixers = { alc883_asus_eee1601_mixer },
9226 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9227 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9228 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9229 .dac_nids = alc883_dac_nids,
9230 .dig_out_nid = ALC883_DIGOUT_NID,
9231 .dig_in_nid = ALC883_DIGIN_NID,
9232 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9233 .channel_mode = alc883_3ST_2ch_modes,
9235 .input_mux = &alc883_asus_eee1601_capture_source,
9236 .unsol_event = alc883_eee1601_unsol_event,
9237 .init_hook = alc883_eee1601_inithook,
9239 [ALC1200_ASUS_P5Q] = {
9240 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9241 .init_verbs = { alc883_init_verbs },
9242 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9243 .dac_nids = alc883_dac_nids,
9244 .dig_out_nid = ALC1200_DIGOUT_NID,
9245 .dig_in_nid = ALC883_DIGIN_NID,
9246 .slave_dig_outs = alc1200_slave_dig_outs,
9247 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9248 .channel_mode = alc883_sixstack_modes,
9249 .input_mux = &alc883_capture_source,
9255 * BIOS auto configuration
9257 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
9258 hda_nid_t nid, int pin_type,
9262 struct alc_spec *spec = codec->spec;
9265 alc_set_pin_output(codec, nid, pin_type);
9266 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9269 idx = spec->multiout.dac_nids[dac_idx] - 2;
9270 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9274 static void alc883_auto_init_multi_out(struct hda_codec *codec)
9276 struct alc_spec *spec = codec->spec;
9279 for (i = 0; i <= HDA_SIDE; i++) {
9280 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9281 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9283 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
9288 static void alc883_auto_init_hp_out(struct hda_codec *codec)
9290 struct alc_spec *spec = codec->spec;
9293 pin = spec->autocfg.hp_pins[0];
9294 if (pin) /* connect to front */
9296 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9297 pin = spec->autocfg.speaker_pins[0];
9299 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9302 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9303 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9305 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9307 struct alc_spec *spec = codec->spec;
9310 for (i = 0; i < AUTO_PIN_LAST; i++) {
9311 hda_nid_t nid = spec->autocfg.input_pins[i];
9312 if (alc883_is_input_pin(nid)) {
9313 alc_set_input_pin(codec, nid, i);
9314 if (nid != ALC883_PIN_CD_NID &&
9315 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
9316 snd_hda_codec_write(codec, nid, 0,
9317 AC_VERB_SET_AMP_GAIN_MUTE,
9323 #define alc883_auto_init_input_src alc882_auto_init_input_src
9325 /* almost identical with ALC880 parser... */
9326 static int alc883_parse_auto_config(struct hda_codec *codec)
9328 struct alc_spec *spec = codec->spec;
9329 int err = alc880_parse_auto_config(codec);
9330 struct auto_pin_cfg *cfg = &spec->autocfg;
9336 return 0; /* no config found */
9338 err = alc_auto_add_mic_boost(codec);
9342 /* hack - override the init verbs */
9343 spec->init_verbs[0] = alc883_auto_init_verbs;
9345 /* setup input_mux for ALC889 */
9346 if (codec->vendor_id == 0x10ec0889) {
9347 /* digital-mic input pin is excluded in alc880_auto_create..()
9348 * because it's under 0x18
9350 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9351 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9352 struct hda_input_mux *imux = &spec->private_imux[0];
9353 for (i = 1; i < 3; i++)
9354 memcpy(&spec->private_imux[i],
9355 &spec->private_imux[0],
9356 sizeof(spec->private_imux[0]));
9357 imux->items[imux->num_items].label = "Int DMic";
9358 imux->items[imux->num_items].index = 0x0b;
9360 spec->num_mux_defs = 3;
9361 spec->input_mux = spec->private_imux;
9365 return 1; /* config found */
9368 /* additional initialization for auto-configuration model */
9369 static void alc883_auto_init(struct hda_codec *codec)
9371 struct alc_spec *spec = codec->spec;
9372 alc883_auto_init_multi_out(codec);
9373 alc883_auto_init_hp_out(codec);
9374 alc883_auto_init_analog_input(codec);
9375 alc883_auto_init_input_src(codec);
9376 if (spec->unsol_event)
9377 alc_inithook(codec);
9380 static int patch_alc883(struct hda_codec *codec)
9382 struct alc_spec *spec;
9383 int err, board_config;
9385 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9391 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9393 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9396 if (board_config < 0) {
9397 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9398 "trying auto-probe from BIOS...\n");
9399 board_config = ALC883_AUTO;
9402 if (board_config == ALC883_AUTO) {
9403 /* automatic parse from the BIOS config */
9404 err = alc883_parse_auto_config(codec);
9410 "hda_codec: Cannot set up configuration "
9411 "from BIOS. Using base mode...\n");
9412 board_config = ALC883_3ST_2ch_DIG;
9416 err = snd_hda_attach_beep_device(codec, 0x1);
9422 if (board_config != ALC883_AUTO)
9423 setup_preset(spec, &alc883_presets[board_config]);
9425 switch (codec->vendor_id) {
9427 if (codec->revision_id == 0x100101) {
9428 spec->stream_name_analog = "ALC1200 Analog";
9429 spec->stream_name_digital = "ALC1200 Digital";
9431 spec->stream_name_analog = "ALC888 Analog";
9432 spec->stream_name_digital = "ALC888 Digital";
9434 if (!spec->num_adc_nids) {
9435 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9436 spec->adc_nids = alc883_adc_nids;
9438 if (!spec->capsrc_nids)
9439 spec->capsrc_nids = alc883_capsrc_nids;
9440 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9441 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9444 spec->stream_name_analog = "ALC889 Analog";
9445 spec->stream_name_digital = "ALC889 Digital";
9446 if (!spec->num_adc_nids) {
9447 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9448 spec->adc_nids = alc889_adc_nids;
9450 if (!spec->capsrc_nids)
9451 spec->capsrc_nids = alc889_capsrc_nids;
9452 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9456 spec->stream_name_analog = "ALC883 Analog";
9457 spec->stream_name_digital = "ALC883 Digital";
9458 if (!spec->num_adc_nids) {
9459 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9460 spec->adc_nids = alc883_adc_nids;
9462 if (!spec->capsrc_nids)
9463 spec->capsrc_nids = alc883_capsrc_nids;
9464 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9468 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9469 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9470 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9472 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9473 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9475 if (!spec->cap_mixer)
9476 set_capture_mixer(spec);
9477 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9479 spec->vmaster_nid = 0x0c;
9481 codec->patch_ops = alc_patch_ops;
9482 if (board_config == ALC883_AUTO)
9483 spec->init_hook = alc883_auto_init;
9485 #ifdef CONFIG_SND_HDA_POWER_SAVE
9486 if (!spec->loopback.amplist)
9487 spec->loopback.amplist = alc883_loopbacks;
9489 codec->proc_widget_hook = print_realtek_coef;
9498 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9499 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9501 #define alc262_dac_nids alc260_dac_nids
9502 #define alc262_adc_nids alc882_adc_nids
9503 #define alc262_adc_nids_alt alc882_adc_nids_alt
9504 #define alc262_capsrc_nids alc882_capsrc_nids
9505 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9507 #define alc262_modes alc260_modes
9508 #define alc262_capture_source alc882_capture_source
9510 static hda_nid_t alc262_dmic_adc_nids[1] = {
9515 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9517 static struct snd_kcontrol_new alc262_base_mixer[] = {
9518 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9519 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9520 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9521 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9522 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9523 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9524 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9525 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9526 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9527 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9528 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9529 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9530 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9531 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9532 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9533 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9537 /* update HP, line and mono-out pins according to the master switch */
9538 static void alc262_hp_master_update(struct hda_codec *codec)
9540 struct alc_spec *spec = codec->spec;
9541 int val = spec->master_sw;
9544 snd_hda_codec_write_cache(codec, 0x1b, 0,
9545 AC_VERB_SET_PIN_WIDGET_CONTROL,
9547 snd_hda_codec_write_cache(codec, 0x15, 0,
9548 AC_VERB_SET_PIN_WIDGET_CONTROL,
9550 /* mono (speaker) depending on the HP jack sense */
9551 val = val && !spec->jack_present;
9552 snd_hda_codec_write_cache(codec, 0x16, 0,
9553 AC_VERB_SET_PIN_WIDGET_CONTROL,
9557 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9559 struct alc_spec *spec = codec->spec;
9560 unsigned int presence;
9561 presence = snd_hda_codec_read(codec, 0x1b, 0,
9562 AC_VERB_GET_PIN_SENSE, 0);
9563 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9564 alc262_hp_master_update(codec);
9567 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9569 if ((res >> 26) != ALC880_HP_EVENT)
9571 alc262_hp_bpc_automute(codec);
9574 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9576 struct alc_spec *spec = codec->spec;
9577 unsigned int presence;
9578 presence = snd_hda_codec_read(codec, 0x15, 0,
9579 AC_VERB_GET_PIN_SENSE, 0);
9580 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9581 alc262_hp_master_update(codec);
9584 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9587 if ((res >> 26) != ALC880_HP_EVENT)
9589 alc262_hp_wildwest_automute(codec);
9592 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9593 struct snd_ctl_elem_value *ucontrol)
9595 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9596 struct alc_spec *spec = codec->spec;
9597 *ucontrol->value.integer.value = spec->master_sw;
9601 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9602 struct snd_ctl_elem_value *ucontrol)
9604 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9605 struct alc_spec *spec = codec->spec;
9606 int val = !!*ucontrol->value.integer.value;
9608 if (val == spec->master_sw)
9610 spec->master_sw = val;
9611 alc262_hp_master_update(codec);
9615 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9617 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9618 .name = "Master Playback Switch",
9619 .info = snd_ctl_boolean_mono_info,
9620 .get = alc262_hp_master_sw_get,
9621 .put = alc262_hp_master_sw_put,
9623 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9624 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9625 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9626 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9628 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9630 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9631 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9632 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9633 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9634 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9635 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9636 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9637 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9638 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9639 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9640 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9641 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9645 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9647 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9648 .name = "Master Playback Switch",
9649 .info = snd_ctl_boolean_mono_info,
9650 .get = alc262_hp_master_sw_get,
9651 .put = alc262_hp_master_sw_put,
9653 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9654 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 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_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9659 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9661 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9662 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9663 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9664 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9665 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9666 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9667 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9671 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9672 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9673 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9674 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9678 /* mute/unmute internal speaker according to the hp jack and mute state */
9679 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9681 struct alc_spec *spec = codec->spec;
9683 if (force || !spec->sense_updated) {
9684 unsigned int present;
9685 present = snd_hda_codec_read(codec, 0x15, 0,
9686 AC_VERB_GET_PIN_SENSE, 0);
9687 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9688 spec->sense_updated = 1;
9690 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9691 spec->jack_present ? HDA_AMP_MUTE : 0);
9694 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9697 if ((res >> 26) != ALC880_HP_EVENT)
9699 alc262_hp_t5735_automute(codec, 1);
9702 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9704 alc262_hp_t5735_automute(codec, 1);
9707 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9708 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9709 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9710 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9711 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9712 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9713 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9714 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9718 static struct hda_verb alc262_hp_t5735_verbs[] = {
9719 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9720 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9722 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9726 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9727 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9728 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9729 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9730 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9731 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9732 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9736 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9737 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9738 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9739 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9740 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9741 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9742 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9743 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9744 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9745 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9746 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9750 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9757 /* bind hp and internal speaker mute (with plug check) as master switch */
9758 static void alc262_hippo_master_update(struct hda_codec *codec)
9760 struct alc_spec *spec = codec->spec;
9761 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9762 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9763 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9767 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
9768 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
9769 HDA_AMP_MUTE, mute);
9770 /* mute internal speaker per jack sense */
9771 if (spec->jack_present)
9772 mute = HDA_AMP_MUTE;
9774 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
9775 HDA_AMP_MUTE, mute);
9776 if (speaker_nid && speaker_nid != line_nid)
9777 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
9778 HDA_AMP_MUTE, mute);
9781 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
9783 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
9784 struct snd_ctl_elem_value *ucontrol)
9786 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9787 struct alc_spec *spec = codec->spec;
9788 int val = !!*ucontrol->value.integer.value;
9790 if (val == spec->master_sw)
9792 spec->master_sw = val;
9793 alc262_hippo_master_update(codec);
9797 #define ALC262_HIPPO_MASTER_SWITCH \
9799 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9800 .name = "Master Playback Switch", \
9801 .info = snd_ctl_boolean_mono_info, \
9802 .get = alc262_hippo_master_sw_get, \
9803 .put = alc262_hippo_master_sw_put, \
9806 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
9807 ALC262_HIPPO_MASTER_SWITCH,
9808 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9809 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9810 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9811 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9812 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9813 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9814 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9815 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9816 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9817 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9818 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9819 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9823 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9824 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9825 ALC262_HIPPO_MASTER_SWITCH,
9826 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9827 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9828 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9829 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9830 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9831 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9832 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9833 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9834 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9835 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9839 /* mute/unmute internal speaker according to the hp jack and mute state */
9840 static void alc262_hippo_automute(struct hda_codec *codec)
9842 struct alc_spec *spec = codec->spec;
9843 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9844 unsigned int present;
9846 /* need to execute and sync at first */
9847 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
9848 present = snd_hda_codec_read(codec, hp_nid, 0,
9849 AC_VERB_GET_PIN_SENSE, 0);
9850 spec->jack_present = (present & 0x80000000) != 0;
9851 alc262_hippo_master_update(codec);
9854 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
9856 if ((res >> 26) != ALC880_HP_EVENT)
9858 alc262_hippo_automute(codec);
9861 static void alc262_hippo_init_hook(struct hda_codec *codec)
9863 struct alc_spec *spec = codec->spec;
9865 spec->autocfg.hp_pins[0] = 0x15;
9866 spec->autocfg.speaker_pins[0] = 0x14;
9867 alc262_hippo_automute(codec);
9870 static void alc262_hippo1_init_hook(struct hda_codec *codec)
9872 struct alc_spec *spec = codec->spec;
9874 spec->autocfg.hp_pins[0] = 0x1b;
9875 spec->autocfg.speaker_pins[0] = 0x14;
9876 alc262_hippo_automute(codec);
9880 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9881 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9882 ALC262_HIPPO_MASTER_SWITCH,
9883 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9884 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9885 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9886 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9890 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9891 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9892 ALC262_HIPPO_MASTER_SWITCH,
9893 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9894 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9895 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9896 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9897 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9901 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9902 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9903 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9904 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9905 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9906 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9907 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9908 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9909 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9910 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9911 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9912 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9913 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9917 static struct hda_verb alc262_tyan_verbs[] = {
9918 /* Headphone automute */
9919 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9920 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9921 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9923 /* P11 AUX_IN, white 4-pin connector */
9924 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9925 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9926 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9927 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9932 /* unsolicited event for HP jack sensing */
9933 static void alc262_tyan_automute(struct hda_codec *codec)
9936 unsigned int present;
9938 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9939 present = snd_hda_codec_read(codec, 0x1b, 0,
9940 AC_VERB_GET_PIN_SENSE, 0);
9941 present = (present & 0x80000000) != 0;
9943 /* mute line output on ATX panel */
9944 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9945 HDA_AMP_MUTE, HDA_AMP_MUTE);
9947 /* unmute line output if necessary */
9948 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9949 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9950 HDA_AMP_MUTE, mute);
9954 static void alc262_tyan_unsol_event(struct hda_codec *codec,
9957 if ((res >> 26) != ALC880_HP_EVENT)
9959 alc262_tyan_automute(codec);
9962 #define alc262_capture_mixer alc882_capture_mixer
9963 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9966 * generic initialization of ADC, input mixers and output mixers
9968 static struct hda_verb alc262_init_verbs[] = {
9970 * Unmute ADC0-2 and set the default input to mic-in
9972 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9973 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9974 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9975 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9976 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9977 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9979 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9981 * Note: PASD motherboards uses the Line In 2 as the input for
9982 * front panel mic (mic 2)
9984 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9985 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9986 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9987 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9988 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9989 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9992 * Set up output mixers (0x0c - 0x0e)
9994 /* set vol=0 to output mixers */
9995 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9996 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9997 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9998 /* set up input amps for analog loopback */
9999 /* Amp Indices: DAC = 0, mixer = 1 */
10000 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10001 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10002 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10003 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10004 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10005 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10008 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10009 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10010 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10011 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10012 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10014 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10015 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10016 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10017 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10018 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10020 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10021 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10023 /* FIXME: use matrix-type input source selection */
10024 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10025 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10026 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10027 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10028 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10031 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10032 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10044 static struct hda_verb alc262_eapd_verbs[] = {
10045 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10046 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10050 static struct hda_verb alc262_hippo_unsol_verbs[] = {
10051 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10052 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10056 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10057 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10058 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10059 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10061 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10062 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10066 static struct hda_verb alc262_sony_unsol_verbs[] = {
10067 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10068 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10069 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10071 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10072 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10076 static struct hda_input_mux alc262_dmic_capture_source = {
10079 { "Int DMic", 0x9 },
10084 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10085 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10086 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10087 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10088 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10089 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10093 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10094 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10095 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10096 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10097 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10098 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10099 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10100 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10101 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10105 static void alc262_dmic_automute(struct hda_codec *codec)
10107 unsigned int present;
10109 present = snd_hda_codec_read(codec, 0x18, 0,
10110 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10111 snd_hda_codec_write(codec, 0x22, 0,
10112 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
10115 /* toggle speaker-output according to the hp-jack state */
10116 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
10118 unsigned int present;
10119 unsigned char bits;
10121 present = snd_hda_codec_read(codec, 0x15, 0,
10122 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10123 bits = present ? 0 : PIN_OUT;
10124 snd_hda_codec_write(codec, 0x14, 0,
10125 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
10130 /* unsolicited event for HP jack sensing */
10131 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
10134 if ((res >> 26) == ALC880_HP_EVENT)
10135 alc262_toshiba_s06_speaker_automute(codec);
10136 if ((res >> 26) == ALC880_MIC_EVENT)
10137 alc262_dmic_automute(codec);
10141 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
10143 alc262_toshiba_s06_speaker_automute(codec);
10144 alc262_dmic_automute(codec);
10150 * 0x16 = internal speaker
10151 * 0x18 = external mic
10154 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10155 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10156 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10158 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10159 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10160 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10162 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10163 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10167 static struct hda_verb alc262_nec_verbs[] = {
10168 /* Unmute Speaker */
10169 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10172 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10173 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10175 /* External mic to headphone */
10176 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10177 /* External mic to speaker */
10178 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10184 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10185 * 0x1b = port replicator headphone out
10188 #define ALC_HP_EVENT 0x37
10190 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10191 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10192 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10193 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10194 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10198 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10199 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10200 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10204 static struct hda_input_mux alc262_fujitsu_capture_source = {
10208 { "Int Mic", 0x1 },
10213 static struct hda_input_mux alc262_HP_capture_source = {
10217 { "Front Mic", 0x1 },
10224 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10228 { "Front Mic", 0x2 },
10234 /* mute/unmute internal speaker according to the hp jacks and mute state */
10235 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10237 struct alc_spec *spec = codec->spec;
10240 if (force || !spec->sense_updated) {
10241 unsigned int present;
10242 /* need to execute and sync at first */
10243 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10244 /* check laptop HP jack */
10245 present = snd_hda_codec_read(codec, 0x14, 0,
10246 AC_VERB_GET_PIN_SENSE, 0);
10247 /* need to execute and sync at first */
10248 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10249 /* check docking HP jack */
10250 present |= snd_hda_codec_read(codec, 0x1b, 0,
10251 AC_VERB_GET_PIN_SENSE, 0);
10252 if (present & AC_PINSENSE_PRESENCE)
10253 spec->jack_present = 1;
10255 spec->jack_present = 0;
10256 spec->sense_updated = 1;
10258 /* unmute internal speaker only if both HPs are unplugged and
10259 * master switch is on
10261 if (spec->jack_present)
10262 mute = HDA_AMP_MUTE;
10264 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10265 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10266 HDA_AMP_MUTE, mute);
10269 /* unsolicited event for HP jack sensing */
10270 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10273 if ((res >> 26) != ALC_HP_EVENT)
10275 alc262_fujitsu_automute(codec, 1);
10278 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10280 alc262_fujitsu_automute(codec, 1);
10283 /* bind volumes of both NID 0x0c and 0x0d */
10284 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10285 .ops = &snd_hda_bind_vol,
10287 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10288 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10293 /* mute/unmute internal speaker according to the hp jack and mute state */
10294 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10296 struct alc_spec *spec = codec->spec;
10299 if (force || !spec->sense_updated) {
10300 unsigned int present_int_hp;
10301 /* need to execute and sync at first */
10302 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10303 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10304 AC_VERB_GET_PIN_SENSE, 0);
10305 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10306 spec->sense_updated = 1;
10308 if (spec->jack_present) {
10309 /* mute internal speaker */
10310 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10311 HDA_AMP_MUTE, HDA_AMP_MUTE);
10312 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10313 HDA_AMP_MUTE, HDA_AMP_MUTE);
10315 /* unmute internal speaker if necessary */
10316 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10317 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10318 HDA_AMP_MUTE, mute);
10319 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10320 HDA_AMP_MUTE, mute);
10324 /* unsolicited event for HP jack sensing */
10325 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10328 if ((res >> 26) != ALC_HP_EVENT)
10330 alc262_lenovo_3000_automute(codec, 1);
10333 /* bind hp and internal speaker mute (with plug check) */
10334 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10335 struct snd_ctl_elem_value *ucontrol)
10337 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10338 long *valp = ucontrol->value.integer.value;
10341 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10343 valp ? 0 : HDA_AMP_MUTE);
10344 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10346 valp ? 0 : HDA_AMP_MUTE);
10349 alc262_fujitsu_automute(codec, 0);
10353 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10354 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10356 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10357 .name = "Master Playback Switch",
10358 .info = snd_hda_mixer_amp_switch_info,
10359 .get = snd_hda_mixer_amp_switch_get,
10360 .put = alc262_fujitsu_master_sw_put,
10361 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10363 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10364 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10365 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10366 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10367 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10368 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10369 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10370 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10374 /* bind hp and internal speaker mute (with plug check) */
10375 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10376 struct snd_ctl_elem_value *ucontrol)
10378 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10379 long *valp = ucontrol->value.integer.value;
10382 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10384 valp ? 0 : HDA_AMP_MUTE);
10387 alc262_lenovo_3000_automute(codec, 0);
10391 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10392 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10394 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10395 .name = "Master Playback Switch",
10396 .info = snd_hda_mixer_amp_switch_info,
10397 .get = snd_hda_mixer_amp_switch_get,
10398 .put = alc262_lenovo_3000_master_sw_put,
10399 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10401 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10402 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10403 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10404 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10405 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10406 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10407 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10408 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10412 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10413 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10414 ALC262_HIPPO_MASTER_SWITCH,
10415 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10416 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10417 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10418 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10419 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10420 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10424 /* additional init verbs for Benq laptops */
10425 static struct hda_verb alc262_EAPD_verbs[] = {
10426 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10427 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10431 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10432 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10433 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10435 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10436 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10440 /* Samsung Q1 Ultra Vista model setup */
10441 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10442 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10443 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10444 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10445 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10446 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10447 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10451 static struct hda_verb alc262_ultra_verbs[] = {
10453 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10454 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10455 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10457 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10458 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10459 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10460 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10462 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10463 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10464 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10465 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10466 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10468 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10469 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10470 /* ADC, choose mic */
10471 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10472 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10473 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10474 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10475 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10476 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10477 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10478 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10479 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10480 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10484 /* mute/unmute internal speaker according to the hp jack and mute state */
10485 static void alc262_ultra_automute(struct hda_codec *codec)
10487 struct alc_spec *spec = codec->spec;
10491 /* auto-mute only when HP is used as HP */
10492 if (!spec->cur_mux[0]) {
10493 unsigned int present;
10494 /* need to execute and sync at first */
10495 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10496 present = snd_hda_codec_read(codec, 0x15, 0,
10497 AC_VERB_GET_PIN_SENSE, 0);
10498 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10499 if (spec->jack_present)
10500 mute = HDA_AMP_MUTE;
10502 /* mute/unmute internal speaker */
10503 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10504 HDA_AMP_MUTE, mute);
10505 /* mute/unmute HP */
10506 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10507 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10510 /* unsolicited event for HP jack sensing */
10511 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10514 if ((res >> 26) != ALC880_HP_EVENT)
10516 alc262_ultra_automute(codec);
10519 static struct hda_input_mux alc262_ultra_capture_source = {
10523 { "Headphone", 0x7 },
10527 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10528 struct snd_ctl_elem_value *ucontrol)
10530 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10531 struct alc_spec *spec = codec->spec;
10534 ret = alc_mux_enum_put(kcontrol, ucontrol);
10537 /* reprogram the HP pin as mic or HP according to the input source */
10538 snd_hda_codec_write_cache(codec, 0x15, 0,
10539 AC_VERB_SET_PIN_WIDGET_CONTROL,
10540 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10541 alc262_ultra_automute(codec); /* mute/unmute HP */
10545 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10546 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10547 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10549 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10550 .name = "Capture Source",
10551 .info = alc_mux_enum_info,
10552 .get = alc_mux_enum_get,
10553 .put = alc262_ultra_mux_enum_put,
10558 /* add playback controls from the parsed DAC table */
10559 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10560 const struct auto_pin_cfg *cfg)
10565 spec->multiout.num_dacs = 1; /* only use one dac */
10566 spec->multiout.dac_nids = spec->private_dac_nids;
10567 spec->multiout.dac_nids[0] = 2;
10569 nid = cfg->line_out_pins[0];
10571 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10572 "Front Playback Volume",
10573 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10576 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10577 "Front Playback Switch",
10578 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10583 nid = cfg->speaker_pins[0];
10586 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10587 "Speaker Playback Volume",
10588 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10592 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10593 "Speaker Playback Switch",
10594 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10599 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10600 "Speaker Playback Switch",
10601 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10607 nid = cfg->hp_pins[0];
10609 /* spec->multiout.hp_nid = 2; */
10611 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10612 "Headphone Playback Volume",
10613 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10617 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10618 "Headphone Playback Switch",
10619 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10624 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10625 "Headphone Playback Switch",
10626 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10635 /* identical with ALC880 */
10636 #define alc262_auto_create_analog_input_ctls \
10637 alc880_auto_create_analog_input_ctls
10640 * generic initialization of ADC, input mixers and output mixers
10642 static struct hda_verb alc262_volume_init_verbs[] = {
10644 * Unmute ADC0-2 and set the default input to mic-in
10646 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10647 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10648 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10649 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10650 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10651 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10653 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10655 * Note: PASD motherboards uses the Line In 2 as the input for
10656 * front panel mic (mic 2)
10658 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10659 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10660 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10661 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10662 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10663 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10666 * Set up output mixers (0x0c - 0x0f)
10668 /* set vol=0 to output mixers */
10669 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10670 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10671 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10673 /* set up input amps for analog loopback */
10674 /* Amp Indices: DAC = 0, mixer = 1 */
10675 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10676 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10677 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10678 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10679 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10680 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10682 /* FIXME: use matrix-type input source selection */
10683 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10684 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10685 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10686 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10687 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10688 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10690 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10691 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10692 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10693 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10695 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10696 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10697 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10698 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10703 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10705 * Unmute ADC0-2 and set the default input to mic-in
10707 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10708 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10709 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10710 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10711 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10712 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10714 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10716 * Note: PASD motherboards uses the Line In 2 as the input for
10717 * front panel mic (mic 2)
10719 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10720 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10721 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10722 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10729 * Set up output mixers (0x0c - 0x0e)
10731 /* set vol=0 to output mixers */
10732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10733 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10734 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10736 /* set up input amps for analog loopback */
10737 /* Amp Indices: DAC = 0, mixer = 1 */
10738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10739 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10740 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10741 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10742 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10743 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10745 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10746 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10747 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10749 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10750 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10752 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10753 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10755 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10756 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10757 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10758 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10759 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10762 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10763 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10764 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10765 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10766 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10769 /* FIXME: use matrix-type input source selection */
10770 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10771 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10772 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10773 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10774 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10775 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10777 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10778 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10779 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10780 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10782 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10783 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10784 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10785 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10787 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10792 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10794 * Unmute ADC0-2 and set the default input to mic-in
10796 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10797 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10798 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10799 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10800 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10801 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10803 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10805 * Note: PASD motherboards uses the Line In 2 as the input for front
10806 * panel mic (mic 2)
10808 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10809 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10810 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10811 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10812 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10813 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10814 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10815 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10816 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10818 * Set up output mixers (0x0c - 0x0e)
10820 /* set vol=0 to output mixers */
10821 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10822 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10823 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10825 /* set up input amps for analog loopback */
10826 /* Amp Indices: DAC = 0, mixer = 1 */
10827 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10828 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10829 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10830 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10831 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10832 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10835 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10836 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10837 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10838 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10839 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10840 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10841 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10843 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10844 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10846 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10847 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10849 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10850 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10851 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10852 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10853 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10854 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10856 /* FIXME: use matrix-type input source selection */
10857 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10858 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10859 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10860 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10861 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10862 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10863 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10864 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10865 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10867 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10868 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10869 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10870 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10871 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10872 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10873 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10875 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10876 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10877 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10878 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10879 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10880 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10881 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10883 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10888 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10890 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10891 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10892 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10894 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10895 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10896 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10897 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10899 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10900 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10901 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10906 #ifdef CONFIG_SND_HDA_POWER_SAVE
10907 #define alc262_loopbacks alc880_loopbacks
10910 /* pcm configuration: identiacal with ALC880 */
10911 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10912 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10913 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10914 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10917 * BIOS auto configuration
10919 static int alc262_parse_auto_config(struct hda_codec *codec)
10921 struct alc_spec *spec = codec->spec;
10923 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10925 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10929 if (!spec->autocfg.line_outs) {
10930 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10931 spec->multiout.max_channels = 2;
10932 spec->no_analog = 1;
10935 return 0; /* can't find valid BIOS pin config */
10937 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10940 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10944 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10947 if (spec->autocfg.dig_outs) {
10948 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10949 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10951 if (spec->autocfg.dig_in_pin)
10952 spec->dig_in_nid = ALC262_DIGIN_NID;
10954 if (spec->kctls.list)
10955 add_mixer(spec, spec->kctls.list);
10957 add_verb(spec, alc262_volume_init_verbs);
10958 spec->num_mux_defs = 1;
10959 spec->input_mux = &spec->private_imux[0];
10961 err = alc_auto_add_mic_boost(codec);
10965 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
10970 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10971 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10972 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10973 #define alc262_auto_init_input_src alc882_auto_init_input_src
10976 /* init callback for auto-configuration model -- overriding the default init */
10977 static void alc262_auto_init(struct hda_codec *codec)
10979 struct alc_spec *spec = codec->spec;
10980 alc262_auto_init_multi_out(codec);
10981 alc262_auto_init_hp_out(codec);
10982 alc262_auto_init_analog_input(codec);
10983 alc262_auto_init_input_src(codec);
10984 if (spec->unsol_event)
10985 alc_inithook(codec);
10989 * configuration and preset
10991 static const char *alc262_models[ALC262_MODEL_LAST] = {
10992 [ALC262_BASIC] = "basic",
10993 [ALC262_HIPPO] = "hippo",
10994 [ALC262_HIPPO_1] = "hippo_1",
10995 [ALC262_FUJITSU] = "fujitsu",
10996 [ALC262_HP_BPC] = "hp-bpc",
10997 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10998 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10999 [ALC262_HP_RP5700] = "hp-rp5700",
11000 [ALC262_BENQ_ED8] = "benq",
11001 [ALC262_BENQ_T31] = "benq-t31",
11002 [ALC262_SONY_ASSAMD] = "sony-assamd",
11003 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11004 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11005 [ALC262_ULTRA] = "ultra",
11006 [ALC262_LENOVO_3000] = "lenovo-3000",
11007 [ALC262_NEC] = "nec",
11008 [ALC262_TYAN] = "tyan",
11009 [ALC262_AUTO] = "auto",
11012 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11013 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11014 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11015 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11017 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11019 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11021 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11022 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11023 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11024 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11025 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11026 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11027 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11028 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11029 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11030 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11031 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11032 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11033 ALC262_HP_TC_T5735),
11034 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11035 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11036 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11037 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11038 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11039 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11040 ALC262_SONY_ASSAMD),
11041 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11042 ALC262_TOSHIBA_RX1),
11043 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11044 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11045 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11046 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11047 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11049 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11050 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11051 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11052 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11053 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11057 static struct alc_config_preset alc262_presets[] = {
11059 .mixers = { alc262_base_mixer },
11060 .init_verbs = { alc262_init_verbs },
11061 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11062 .dac_nids = alc262_dac_nids,
11064 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11065 .channel_mode = alc262_modes,
11066 .input_mux = &alc262_capture_source,
11069 .mixers = { alc262_hippo_mixer },
11070 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
11071 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11072 .dac_nids = alc262_dac_nids,
11074 .dig_out_nid = ALC262_DIGOUT_NID,
11075 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11076 .channel_mode = alc262_modes,
11077 .input_mux = &alc262_capture_source,
11078 .unsol_event = alc262_hippo_unsol_event,
11079 .init_hook = alc262_hippo_init_hook,
11081 [ALC262_HIPPO_1] = {
11082 .mixers = { alc262_hippo1_mixer },
11083 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11084 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11085 .dac_nids = alc262_dac_nids,
11087 .dig_out_nid = ALC262_DIGOUT_NID,
11088 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11089 .channel_mode = alc262_modes,
11090 .input_mux = &alc262_capture_source,
11091 .unsol_event = alc262_hippo_unsol_event,
11092 .init_hook = alc262_hippo1_init_hook,
11094 [ALC262_FUJITSU] = {
11095 .mixers = { alc262_fujitsu_mixer },
11096 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11097 alc262_fujitsu_unsol_verbs },
11098 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11099 .dac_nids = alc262_dac_nids,
11101 .dig_out_nid = ALC262_DIGOUT_NID,
11102 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11103 .channel_mode = alc262_modes,
11104 .input_mux = &alc262_fujitsu_capture_source,
11105 .unsol_event = alc262_fujitsu_unsol_event,
11106 .init_hook = alc262_fujitsu_init_hook,
11108 [ALC262_HP_BPC] = {
11109 .mixers = { alc262_HP_BPC_mixer },
11110 .init_verbs = { alc262_HP_BPC_init_verbs },
11111 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11112 .dac_nids = alc262_dac_nids,
11114 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11115 .channel_mode = alc262_modes,
11116 .input_mux = &alc262_HP_capture_source,
11117 .unsol_event = alc262_hp_bpc_unsol_event,
11118 .init_hook = alc262_hp_bpc_automute,
11120 [ALC262_HP_BPC_D7000_WF] = {
11121 .mixers = { alc262_HP_BPC_WildWest_mixer },
11122 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11123 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11124 .dac_nids = alc262_dac_nids,
11126 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11127 .channel_mode = alc262_modes,
11128 .input_mux = &alc262_HP_D7000_capture_source,
11129 .unsol_event = alc262_hp_wildwest_unsol_event,
11130 .init_hook = alc262_hp_wildwest_automute,
11132 [ALC262_HP_BPC_D7000_WL] = {
11133 .mixers = { alc262_HP_BPC_WildWest_mixer,
11134 alc262_HP_BPC_WildWest_option_mixer },
11135 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11136 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11137 .dac_nids = alc262_dac_nids,
11139 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11140 .channel_mode = alc262_modes,
11141 .input_mux = &alc262_HP_D7000_capture_source,
11142 .unsol_event = alc262_hp_wildwest_unsol_event,
11143 .init_hook = alc262_hp_wildwest_automute,
11145 [ALC262_HP_TC_T5735] = {
11146 .mixers = { alc262_hp_t5735_mixer },
11147 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11148 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11149 .dac_nids = alc262_dac_nids,
11151 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11152 .channel_mode = alc262_modes,
11153 .input_mux = &alc262_capture_source,
11154 .unsol_event = alc262_hp_t5735_unsol_event,
11155 .init_hook = alc262_hp_t5735_init_hook,
11157 [ALC262_HP_RP5700] = {
11158 .mixers = { alc262_hp_rp5700_mixer },
11159 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11160 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11161 .dac_nids = alc262_dac_nids,
11162 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11163 .channel_mode = alc262_modes,
11164 .input_mux = &alc262_hp_rp5700_capture_source,
11166 [ALC262_BENQ_ED8] = {
11167 .mixers = { alc262_base_mixer },
11168 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11169 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11170 .dac_nids = alc262_dac_nids,
11172 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11173 .channel_mode = alc262_modes,
11174 .input_mux = &alc262_capture_source,
11176 [ALC262_SONY_ASSAMD] = {
11177 .mixers = { alc262_sony_mixer },
11178 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11179 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11180 .dac_nids = alc262_dac_nids,
11182 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11183 .channel_mode = alc262_modes,
11184 .input_mux = &alc262_capture_source,
11185 .unsol_event = alc262_hippo_unsol_event,
11186 .init_hook = alc262_hippo_init_hook,
11188 [ALC262_BENQ_T31] = {
11189 .mixers = { alc262_benq_t31_mixer },
11190 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
11191 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11192 .dac_nids = alc262_dac_nids,
11194 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11195 .channel_mode = alc262_modes,
11196 .input_mux = &alc262_capture_source,
11197 .unsol_event = alc262_hippo_unsol_event,
11198 .init_hook = alc262_hippo_init_hook,
11201 .mixers = { alc262_ultra_mixer },
11202 .cap_mixer = alc262_ultra_capture_mixer,
11203 .init_verbs = { alc262_ultra_verbs },
11204 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11205 .dac_nids = alc262_dac_nids,
11206 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11207 .channel_mode = alc262_modes,
11208 .input_mux = &alc262_ultra_capture_source,
11209 .adc_nids = alc262_adc_nids, /* ADC0 */
11210 .capsrc_nids = alc262_capsrc_nids,
11211 .num_adc_nids = 1, /* single ADC */
11212 .unsol_event = alc262_ultra_unsol_event,
11213 .init_hook = alc262_ultra_automute,
11215 [ALC262_LENOVO_3000] = {
11216 .mixers = { alc262_lenovo_3000_mixer },
11217 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11218 alc262_lenovo_3000_unsol_verbs },
11219 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11220 .dac_nids = alc262_dac_nids,
11222 .dig_out_nid = ALC262_DIGOUT_NID,
11223 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11224 .channel_mode = alc262_modes,
11225 .input_mux = &alc262_fujitsu_capture_source,
11226 .unsol_event = alc262_lenovo_3000_unsol_event,
11229 .mixers = { alc262_nec_mixer },
11230 .init_verbs = { alc262_nec_verbs },
11231 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11232 .dac_nids = alc262_dac_nids,
11234 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11235 .channel_mode = alc262_modes,
11236 .input_mux = &alc262_capture_source,
11238 [ALC262_TOSHIBA_S06] = {
11239 .mixers = { alc262_toshiba_s06_mixer },
11240 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11241 alc262_eapd_verbs },
11242 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11243 .capsrc_nids = alc262_dmic_capsrc_nids,
11244 .dac_nids = alc262_dac_nids,
11245 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11246 .dig_out_nid = ALC262_DIGOUT_NID,
11247 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11248 .channel_mode = alc262_modes,
11249 .input_mux = &alc262_dmic_capture_source,
11250 .unsol_event = alc262_toshiba_s06_unsol_event,
11251 .init_hook = alc262_toshiba_s06_init_hook,
11253 [ALC262_TOSHIBA_RX1] = {
11254 .mixers = { alc262_toshiba_rx1_mixer },
11255 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11256 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11257 .dac_nids = alc262_dac_nids,
11259 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11260 .channel_mode = alc262_modes,
11261 .input_mux = &alc262_capture_source,
11262 .unsol_event = alc262_hippo_unsol_event,
11263 .init_hook = alc262_hippo_init_hook,
11266 .mixers = { alc262_tyan_mixer },
11267 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11268 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11269 .dac_nids = alc262_dac_nids,
11271 .dig_out_nid = ALC262_DIGOUT_NID,
11272 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11273 .channel_mode = alc262_modes,
11274 .input_mux = &alc262_capture_source,
11275 .unsol_event = alc262_tyan_unsol_event,
11276 .init_hook = alc262_tyan_automute,
11280 static int patch_alc262(struct hda_codec *codec)
11282 struct alc_spec *spec;
11286 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11290 codec->spec = spec;
11292 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11297 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11298 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11299 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11300 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11304 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11306 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11310 if (board_config < 0) {
11311 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
11312 "trying auto-probe from BIOS...\n");
11313 board_config = ALC262_AUTO;
11316 if (board_config == ALC262_AUTO) {
11317 /* automatic parse from the BIOS config */
11318 err = alc262_parse_auto_config(codec);
11324 "hda_codec: Cannot set up configuration "
11325 "from BIOS. Using base mode...\n");
11326 board_config = ALC262_BASIC;
11330 if (!spec->no_analog) {
11331 err = snd_hda_attach_beep_device(codec, 0x1);
11338 if (board_config != ALC262_AUTO)
11339 setup_preset(spec, &alc262_presets[board_config]);
11341 spec->stream_name_analog = "ALC262 Analog";
11342 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11343 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11345 spec->stream_name_digital = "ALC262 Digital";
11346 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11347 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11349 spec->capture_style = CAPT_MIX;
11350 if (!spec->adc_nids && spec->input_mux) {
11351 /* check whether NID 0x07 is valid */
11352 unsigned int wcap = get_wcaps(codec, 0x07);
11355 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11356 if (wcap != AC_WID_AUD_IN) {
11357 spec->adc_nids = alc262_adc_nids_alt;
11358 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11359 spec->capsrc_nids = alc262_capsrc_nids_alt;
11361 spec->adc_nids = alc262_adc_nids;
11362 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11363 spec->capsrc_nids = alc262_capsrc_nids;
11366 if (!spec->cap_mixer && !spec->no_analog)
11367 set_capture_mixer(spec);
11368 if (!spec->no_analog)
11369 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11371 spec->vmaster_nid = 0x0c;
11373 codec->patch_ops = alc_patch_ops;
11374 if (board_config == ALC262_AUTO)
11375 spec->init_hook = alc262_auto_init;
11376 #ifdef CONFIG_SND_HDA_POWER_SAVE
11377 if (!spec->loopback.amplist)
11378 spec->loopback.amplist = alc262_loopbacks;
11380 codec->proc_widget_hook = print_realtek_coef;
11386 * ALC268 channel source setting (2 channel)
11388 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11389 #define alc268_modes alc260_modes
11391 static hda_nid_t alc268_dac_nids[2] = {
11396 static hda_nid_t alc268_adc_nids[2] = {
11401 static hda_nid_t alc268_adc_nids_alt[1] = {
11406 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11408 static struct snd_kcontrol_new alc268_base_mixer[] = {
11409 /* output mixer control */
11410 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11411 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11412 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11413 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11414 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11415 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11416 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11420 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11421 /* output mixer control */
11422 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11423 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11424 ALC262_HIPPO_MASTER_SWITCH,
11425 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11426 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11427 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11431 /* bind Beep switches of both NID 0x0f and 0x10 */
11432 static struct hda_bind_ctls alc268_bind_beep_sw = {
11433 .ops = &snd_hda_bind_sw,
11435 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11436 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11441 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11442 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11443 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11447 static struct hda_verb alc268_eapd_verbs[] = {
11448 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11449 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11453 /* Toshiba specific */
11454 static struct hda_verb alc268_toshiba_verbs[] = {
11455 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11459 static struct hda_input_mux alc268_acer_lc_capture_source = {
11467 /* Acer specific */
11468 /* bind volumes of both NID 0x02 and 0x03 */
11469 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11470 .ops = &snd_hda_bind_vol,
11472 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11473 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11478 /* mute/unmute internal speaker according to the hp jack and mute state */
11479 static void alc268_acer_automute(struct hda_codec *codec, int force)
11481 struct alc_spec *spec = codec->spec;
11484 if (force || !spec->sense_updated) {
11485 unsigned int present;
11486 present = snd_hda_codec_read(codec, 0x14, 0,
11487 AC_VERB_GET_PIN_SENSE, 0);
11488 spec->jack_present = (present & 0x80000000) != 0;
11489 spec->sense_updated = 1;
11491 if (spec->jack_present)
11492 mute = HDA_AMP_MUTE; /* mute internal speaker */
11493 else /* unmute internal speaker if necessary */
11494 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11495 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11496 HDA_AMP_MUTE, mute);
11500 /* bind hp and internal speaker mute (with plug check) */
11501 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11502 struct snd_ctl_elem_value *ucontrol)
11504 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11505 long *valp = ucontrol->value.integer.value;
11508 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11510 valp[0] ? 0 : HDA_AMP_MUTE);
11511 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11513 valp[1] ? 0 : HDA_AMP_MUTE);
11515 alc268_acer_automute(codec, 0);
11519 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11520 /* output mixer control */
11521 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11523 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11524 .name = "Master Playback Switch",
11525 .info = snd_hda_mixer_amp_switch_info,
11526 .get = snd_hda_mixer_amp_switch_get,
11527 .put = alc268_acer_master_sw_put,
11528 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11530 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11534 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11535 /* output mixer control */
11536 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11538 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11539 .name = "Master Playback Switch",
11540 .info = snd_hda_mixer_amp_switch_info,
11541 .get = snd_hda_mixer_amp_switch_get,
11542 .put = alc268_acer_master_sw_put,
11543 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11545 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11546 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11547 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11551 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11552 /* output mixer control */
11553 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11555 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11556 .name = "Master Playback Switch",
11557 .info = snd_hda_mixer_amp_switch_info,
11558 .get = snd_hda_mixer_amp_switch_get,
11559 .put = alc268_acer_master_sw_put,
11560 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11562 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11563 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11567 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11568 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11569 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11570 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11571 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11572 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11573 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11577 static struct hda_verb alc268_acer_verbs[] = {
11578 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11579 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11580 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11581 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11582 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11583 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11584 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11588 /* unsolicited event for HP jack sensing */
11589 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11590 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11592 static void alc268_acer_unsol_event(struct hda_codec *codec,
11595 if ((res >> 26) != ALC880_HP_EVENT)
11597 alc268_acer_automute(codec, 1);
11600 static void alc268_acer_init_hook(struct hda_codec *codec)
11602 alc268_acer_automute(codec, 1);
11605 /* toggle speaker-output according to the hp-jack state */
11606 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11608 unsigned int present;
11609 unsigned char bits;
11611 present = snd_hda_codec_read(codec, 0x15, 0,
11612 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11613 bits = present ? AMP_IN_MUTE(0) : 0;
11614 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11615 AMP_IN_MUTE(0), bits);
11616 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11617 AMP_IN_MUTE(0), bits);
11621 static void alc268_acer_mic_automute(struct hda_codec *codec)
11623 unsigned int present;
11625 present = snd_hda_codec_read(codec, 0x18, 0,
11626 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11627 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11628 present ? 0x0 : 0x6);
11631 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11634 if ((res >> 26) == ALC880_HP_EVENT)
11635 alc268_aspire_one_speaker_automute(codec);
11636 if ((res >> 26) == ALC880_MIC_EVENT)
11637 alc268_acer_mic_automute(codec);
11640 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11642 alc268_aspire_one_speaker_automute(codec);
11643 alc268_acer_mic_automute(codec);
11646 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11647 /* output mixer control */
11648 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11649 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11650 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11651 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11652 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11653 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11657 static struct hda_verb alc268_dell_verbs[] = {
11658 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11659 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11660 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11664 /* mute/unmute internal speaker according to the hp jack and mute state */
11665 static void alc268_dell_automute(struct hda_codec *codec)
11667 unsigned int present;
11670 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11671 if (present & 0x80000000)
11672 mute = HDA_AMP_MUTE;
11674 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11675 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11676 HDA_AMP_MUTE, mute);
11679 static void alc268_dell_unsol_event(struct hda_codec *codec,
11682 if ((res >> 26) != ALC880_HP_EVENT)
11684 alc268_dell_automute(codec);
11687 #define alc268_dell_init_hook alc268_dell_automute
11689 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11690 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11691 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11692 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11693 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11694 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11695 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11696 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11697 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11701 static struct hda_verb alc267_quanta_il1_verbs[] = {
11702 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11703 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11707 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11709 unsigned int present;
11711 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11712 & AC_PINSENSE_PRESENCE;
11713 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11714 present ? 0 : PIN_OUT);
11717 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11719 unsigned int present;
11721 present = snd_hda_codec_read(codec, 0x18, 0,
11722 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11723 snd_hda_codec_write(codec, 0x23, 0,
11724 AC_VERB_SET_CONNECT_SEL,
11725 present ? 0x00 : 0x01);
11728 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11730 alc267_quanta_il1_hp_automute(codec);
11731 alc267_quanta_il1_mic_automute(codec);
11734 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11737 switch (res >> 26) {
11738 case ALC880_HP_EVENT:
11739 alc267_quanta_il1_hp_automute(codec);
11741 case ALC880_MIC_EVENT:
11742 alc267_quanta_il1_mic_automute(codec);
11748 * generic initialization of ADC, input mixers and output mixers
11750 static struct hda_verb alc268_base_init_verbs[] = {
11751 /* Unmute DAC0-1 and set vol = 0 */
11752 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11753 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11756 * Set up output mixers (0x0c - 0x0e)
11758 /* set vol=0 to output mixers */
11759 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11760 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11762 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11763 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11765 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11766 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11767 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11768 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11769 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11770 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11771 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11772 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11774 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11775 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11776 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11777 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11778 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11780 /* set PCBEEP vol = 0, mute connections */
11781 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11782 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11783 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11785 /* Unmute Selector 23h,24h and set the default input to mic-in */
11787 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11788 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11789 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11790 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11796 * generic initialization of ADC, input mixers and output mixers
11798 static struct hda_verb alc268_volume_init_verbs[] = {
11799 /* set output DAC */
11800 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11801 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11803 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11804 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11805 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11806 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11807 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11809 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11810 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11811 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11813 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11814 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11816 /* set PCBEEP vol = 0, mute connections */
11817 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11818 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11819 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11824 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11825 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11826 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11828 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11829 /* The multiple "Capture Source" controls confuse alsamixer
11830 * So call somewhat different..
11832 /* .name = "Capture Source", */
11833 .name = "Input Source",
11835 .info = alc_mux_enum_info,
11836 .get = alc_mux_enum_get,
11837 .put = alc_mux_enum_put,
11842 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11843 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11844 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11845 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11846 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11848 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11849 /* The multiple "Capture Source" controls confuse alsamixer
11850 * So call somewhat different..
11852 /* .name = "Capture Source", */
11853 .name = "Input Source",
11855 .info = alc_mux_enum_info,
11856 .get = alc_mux_enum_get,
11857 .put = alc_mux_enum_put,
11862 static struct hda_input_mux alc268_capture_source = {
11866 { "Front Mic", 0x1 },
11872 static struct hda_input_mux alc268_acer_capture_source = {
11876 { "Internal Mic", 0x1 },
11881 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11885 { "Internal Mic", 0x6 },
11890 #ifdef CONFIG_SND_DEBUG
11891 static struct snd_kcontrol_new alc268_test_mixer[] = {
11892 /* Volume widgets */
11893 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11894 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11895 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11896 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11897 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11898 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11899 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11900 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11901 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11902 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11903 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11904 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11905 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11906 /* The below appears problematic on some hardwares */
11907 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11908 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11909 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11910 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11911 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11913 /* Modes for retasking pin widgets */
11914 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11915 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11916 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11917 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11919 /* Controls for GPIO pins, assuming they are configured as outputs */
11920 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11921 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11922 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11923 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11925 /* Switches to allow the digital SPDIF output pin to be enabled.
11926 * The ALC268 does not have an SPDIF input.
11928 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11930 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11931 * this output to turn on an external amplifier.
11933 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11934 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11940 /* create input playback/capture controls for the given pin */
11941 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11942 const char *ctlname, int idx)
11947 sprintf(name, "%s Playback Volume", ctlname);
11949 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11950 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11954 } else if (nid == 0x15) {
11955 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11956 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11962 sprintf(name, "%s Playback Switch", ctlname);
11963 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11964 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11970 /* add playback controls from the parsed DAC table */
11971 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11972 const struct auto_pin_cfg *cfg)
11977 spec->multiout.num_dacs = 2; /* only use one dac */
11978 spec->multiout.dac_nids = spec->private_dac_nids;
11979 spec->multiout.dac_nids[0] = 2;
11980 spec->multiout.dac_nids[1] = 3;
11982 nid = cfg->line_out_pins[0];
11984 alc268_new_analog_output(spec, nid, "Front", 0);
11986 nid = cfg->speaker_pins[0];
11988 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11989 "Speaker Playback Volume",
11990 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11994 nid = cfg->hp_pins[0];
11996 alc268_new_analog_output(spec, nid, "Headphone", 0);
11998 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12000 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12001 "Mono Playback Switch",
12002 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
12009 /* create playback/capture controls for input pins */
12010 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
12011 const struct auto_pin_cfg *cfg)
12013 struct hda_input_mux *imux = &spec->private_imux[0];
12016 for (i = 0; i < AUTO_PIN_LAST; i++) {
12017 switch(cfg->input_pins[i]) {
12019 idx1 = 0; /* Mic 1 */
12022 idx1 = 1; /* Mic 2 */
12025 idx1 = 2; /* Line In */
12032 idx1 = 6; /* digital mics */
12037 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12038 imux->items[imux->num_items].index = idx1;
12044 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12046 struct alc_spec *spec = codec->spec;
12047 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12048 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12049 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12050 unsigned int dac_vol1, dac_vol2;
12053 snd_hda_codec_write(codec, speaker_nid, 0,
12054 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12055 snd_hda_codec_write(codec, 0x0f, 0,
12056 AC_VERB_SET_AMP_GAIN_MUTE,
12058 snd_hda_codec_write(codec, 0x10, 0,
12059 AC_VERB_SET_AMP_GAIN_MUTE,
12062 snd_hda_codec_write(codec, 0x0f, 0,
12063 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12064 snd_hda_codec_write(codec, 0x10, 0,
12065 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12068 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12069 if (line_nid == 0x14)
12070 dac_vol2 = AMP_OUT_ZERO;
12071 else if (line_nid == 0x15)
12072 dac_vol1 = AMP_OUT_ZERO;
12073 if (hp_nid == 0x14)
12074 dac_vol2 = AMP_OUT_ZERO;
12075 else if (hp_nid == 0x15)
12076 dac_vol1 = AMP_OUT_ZERO;
12077 if (line_nid != 0x16 || hp_nid != 0x16 ||
12078 spec->autocfg.line_out_pins[1] != 0x16 ||
12079 spec->autocfg.line_out_pins[2] != 0x16)
12080 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12082 snd_hda_codec_write(codec, 0x02, 0,
12083 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12084 snd_hda_codec_write(codec, 0x03, 0,
12085 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12088 /* pcm configuration: identiacal with ALC880 */
12089 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12090 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12091 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12092 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12095 * BIOS auto configuration
12097 static int alc268_parse_auto_config(struct hda_codec *codec)
12099 struct alc_spec *spec = codec->spec;
12101 static hda_nid_t alc268_ignore[] = { 0 };
12103 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12107 if (!spec->autocfg.line_outs) {
12108 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12109 spec->multiout.max_channels = 2;
12110 spec->no_analog = 1;
12113 return 0; /* can't find valid BIOS pin config */
12115 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12118 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
12122 spec->multiout.max_channels = 2;
12125 /* digital only support output */
12126 if (spec->autocfg.dig_outs) {
12127 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12128 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12130 if (spec->kctls.list)
12131 add_mixer(spec, spec->kctls.list);
12133 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12134 add_mixer(spec, alc268_beep_mixer);
12136 add_verb(spec, alc268_volume_init_verbs);
12137 spec->num_mux_defs = 1;
12138 spec->input_mux = &spec->private_imux[0];
12140 err = alc_auto_add_mic_boost(codec);
12147 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12148 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12149 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12151 /* init callback for auto-configuration model -- overriding the default init */
12152 static void alc268_auto_init(struct hda_codec *codec)
12154 struct alc_spec *spec = codec->spec;
12155 alc268_auto_init_multi_out(codec);
12156 alc268_auto_init_hp_out(codec);
12157 alc268_auto_init_mono_speaker_out(codec);
12158 alc268_auto_init_analog_input(codec);
12159 if (spec->unsol_event)
12160 alc_inithook(codec);
12164 * configuration and preset
12166 static const char *alc268_models[ALC268_MODEL_LAST] = {
12167 [ALC267_QUANTA_IL1] = "quanta-il1",
12168 [ALC268_3ST] = "3stack",
12169 [ALC268_TOSHIBA] = "toshiba",
12170 [ALC268_ACER] = "acer",
12171 [ALC268_ACER_DMIC] = "acer-dmic",
12172 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12173 [ALC268_DELL] = "dell",
12174 [ALC268_ZEPTO] = "zepto",
12175 #ifdef CONFIG_SND_DEBUG
12176 [ALC268_TEST] = "test",
12178 [ALC268_AUTO] = "auto",
12181 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12182 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12183 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12184 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12185 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12186 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12187 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12188 ALC268_ACER_ASPIRE_ONE),
12189 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12190 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12191 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
12192 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12193 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
12194 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
12195 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
12196 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12197 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12198 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12199 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12203 static struct alc_config_preset alc268_presets[] = {
12204 [ALC267_QUANTA_IL1] = {
12205 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12206 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12207 alc267_quanta_il1_verbs },
12208 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12209 .dac_nids = alc268_dac_nids,
12210 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12211 .adc_nids = alc268_adc_nids_alt,
12213 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12214 .channel_mode = alc268_modes,
12215 .input_mux = &alc268_capture_source,
12216 .unsol_event = alc267_quanta_il1_unsol_event,
12217 .init_hook = alc267_quanta_il1_automute,
12220 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12221 alc268_beep_mixer },
12222 .init_verbs = { alc268_base_init_verbs },
12223 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12224 .dac_nids = alc268_dac_nids,
12225 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12226 .adc_nids = alc268_adc_nids_alt,
12227 .capsrc_nids = alc268_capsrc_nids,
12229 .dig_out_nid = ALC268_DIGOUT_NID,
12230 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12231 .channel_mode = alc268_modes,
12232 .input_mux = &alc268_capture_source,
12234 [ALC268_TOSHIBA] = {
12235 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12236 alc268_beep_mixer },
12237 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12238 alc268_toshiba_verbs },
12239 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12240 .dac_nids = alc268_dac_nids,
12241 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12242 .adc_nids = alc268_adc_nids_alt,
12243 .capsrc_nids = alc268_capsrc_nids,
12245 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12246 .channel_mode = alc268_modes,
12247 .input_mux = &alc268_capture_source,
12248 .unsol_event = alc268_toshiba_unsol_event,
12249 .init_hook = alc268_toshiba_init_hook,
12252 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12253 alc268_beep_mixer },
12254 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12255 alc268_acer_verbs },
12256 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12257 .dac_nids = alc268_dac_nids,
12258 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12259 .adc_nids = alc268_adc_nids_alt,
12260 .capsrc_nids = alc268_capsrc_nids,
12262 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12263 .channel_mode = alc268_modes,
12264 .input_mux = &alc268_acer_capture_source,
12265 .unsol_event = alc268_acer_unsol_event,
12266 .init_hook = alc268_acer_init_hook,
12268 [ALC268_ACER_DMIC] = {
12269 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12270 alc268_beep_mixer },
12271 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12272 alc268_acer_verbs },
12273 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12274 .dac_nids = alc268_dac_nids,
12275 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12276 .adc_nids = alc268_adc_nids_alt,
12277 .capsrc_nids = alc268_capsrc_nids,
12279 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12280 .channel_mode = alc268_modes,
12281 .input_mux = &alc268_acer_dmic_capture_source,
12282 .unsol_event = alc268_acer_unsol_event,
12283 .init_hook = alc268_acer_init_hook,
12285 [ALC268_ACER_ASPIRE_ONE] = {
12286 .mixers = { alc268_acer_aspire_one_mixer,
12288 alc268_capture_alt_mixer },
12289 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12290 alc268_acer_aspire_one_verbs },
12291 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12292 .dac_nids = alc268_dac_nids,
12293 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12294 .adc_nids = alc268_adc_nids_alt,
12295 .capsrc_nids = alc268_capsrc_nids,
12297 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12298 .channel_mode = alc268_modes,
12299 .input_mux = &alc268_acer_lc_capture_source,
12300 .unsol_event = alc268_acer_lc_unsol_event,
12301 .init_hook = alc268_acer_lc_init_hook,
12304 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12305 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12306 alc268_dell_verbs },
12307 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12308 .dac_nids = alc268_dac_nids,
12310 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12311 .channel_mode = alc268_modes,
12312 .unsol_event = alc268_dell_unsol_event,
12313 .init_hook = alc268_dell_init_hook,
12314 .input_mux = &alc268_capture_source,
12317 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12318 alc268_beep_mixer },
12319 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12320 alc268_toshiba_verbs },
12321 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12322 .dac_nids = alc268_dac_nids,
12323 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12324 .adc_nids = alc268_adc_nids_alt,
12325 .capsrc_nids = alc268_capsrc_nids,
12327 .dig_out_nid = ALC268_DIGOUT_NID,
12328 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12329 .channel_mode = alc268_modes,
12330 .input_mux = &alc268_capture_source,
12331 .unsol_event = alc268_toshiba_unsol_event,
12332 .init_hook = alc268_toshiba_init_hook
12334 #ifdef CONFIG_SND_DEBUG
12336 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12337 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12338 alc268_volume_init_verbs },
12339 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12340 .dac_nids = alc268_dac_nids,
12341 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12342 .adc_nids = alc268_adc_nids_alt,
12343 .capsrc_nids = alc268_capsrc_nids,
12345 .dig_out_nid = ALC268_DIGOUT_NID,
12346 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12347 .channel_mode = alc268_modes,
12348 .input_mux = &alc268_capture_source,
12353 static int patch_alc268(struct hda_codec *codec)
12355 struct alc_spec *spec;
12357 int i, has_beep, err;
12359 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12363 codec->spec = spec;
12365 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12369 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12370 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
12371 "trying auto-probe from BIOS...\n");
12372 board_config = ALC268_AUTO;
12375 if (board_config == ALC268_AUTO) {
12376 /* automatic parse from the BIOS config */
12377 err = alc268_parse_auto_config(codec);
12383 "hda_codec: Cannot set up configuration "
12384 "from BIOS. Using base mode...\n");
12385 board_config = ALC268_3ST;
12389 if (board_config != ALC268_AUTO)
12390 setup_preset(spec, &alc268_presets[board_config]);
12392 if (codec->vendor_id == 0x10ec0267) {
12393 spec->stream_name_analog = "ALC267 Analog";
12394 spec->stream_name_digital = "ALC267 Digital";
12396 spec->stream_name_analog = "ALC268 Analog";
12397 spec->stream_name_digital = "ALC268 Digital";
12400 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12401 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12402 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12404 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12407 for (i = 0; i < spec->num_mixers; i++) {
12408 if (spec->mixers[i] == alc268_beep_mixer) {
12415 err = snd_hda_attach_beep_device(codec, 0x1);
12420 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12421 /* override the amp caps for beep generator */
12422 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12423 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12424 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12425 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12426 (0 << AC_AMPCAP_MUTE_SHIFT));
12429 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12430 /* check whether NID 0x07 is valid */
12431 unsigned int wcap = get_wcaps(codec, 0x07);
12435 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12436 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12437 spec->adc_nids = alc268_adc_nids_alt;
12438 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12439 add_mixer(spec, alc268_capture_alt_mixer);
12441 spec->adc_nids = alc268_adc_nids;
12442 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12443 add_mixer(spec, alc268_capture_mixer);
12445 spec->capsrc_nids = alc268_capsrc_nids;
12446 /* set default input source */
12447 for (i = 0; i < spec->num_adc_nids; i++)
12448 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12449 0, AC_VERB_SET_CONNECT_SEL,
12450 spec->input_mux->items[0].index);
12453 spec->vmaster_nid = 0x02;
12455 codec->patch_ops = alc_patch_ops;
12456 if (board_config == ALC268_AUTO)
12457 spec->init_hook = alc268_auto_init;
12459 codec->proc_widget_hook = print_realtek_coef;
12465 * ALC269 channel source setting (2 channel)
12467 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12469 #define alc269_dac_nids alc260_dac_nids
12471 static hda_nid_t alc269_adc_nids[1] = {
12476 static hda_nid_t alc269_capsrc_nids[1] = {
12480 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12484 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12492 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12500 #define alc269_modes alc260_modes
12501 #define alc269_capture_source alc880_lg_lw_capture_source
12503 static struct snd_kcontrol_new alc269_base_mixer[] = {
12504 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12505 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12506 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12507 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12508 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12509 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12510 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12511 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12512 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12513 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12514 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12515 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12519 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12520 /* output mixer control */
12521 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12523 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12524 .name = "Master Playback Switch",
12525 .info = snd_hda_mixer_amp_switch_info,
12526 .get = snd_hda_mixer_amp_switch_get,
12527 .put = alc268_acer_master_sw_put,
12528 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12530 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12531 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12532 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12533 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12534 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12535 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12539 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12540 /* output mixer control */
12541 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12543 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12544 .name = "Master Playback Switch",
12545 .info = snd_hda_mixer_amp_switch_info,
12546 .get = snd_hda_mixer_amp_switch_get,
12547 .put = alc268_acer_master_sw_put,
12548 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12550 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12551 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12552 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12553 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12554 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12555 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12556 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12557 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12558 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12562 /* bind volumes of both NID 0x0c and 0x0d */
12563 static struct hda_bind_ctls alc269_epc_bind_vol = {
12564 .ops = &snd_hda_bind_vol,
12566 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12567 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12572 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12573 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12574 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12575 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12579 /* capture mixer elements */
12580 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12581 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12582 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12583 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12588 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12589 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12590 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12591 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12595 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12596 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12597 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12598 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12599 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12600 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12601 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12605 static struct hda_verb alc269_lifebook_verbs[] = {
12606 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12607 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12608 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12610 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12611 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12612 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12613 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12614 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12615 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12619 /* toggle speaker-output according to the hp-jack state */
12620 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12622 unsigned int present;
12623 unsigned char bits;
12625 present = snd_hda_codec_read(codec, 0x15, 0,
12626 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12627 bits = present ? AMP_IN_MUTE(0) : 0;
12628 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12629 AMP_IN_MUTE(0), bits);
12630 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12631 AMP_IN_MUTE(0), bits);
12633 snd_hda_codec_write(codec, 0x20, 0,
12634 AC_VERB_SET_COEF_INDEX, 0x0c);
12635 snd_hda_codec_write(codec, 0x20, 0,
12636 AC_VERB_SET_PROC_COEF, 0x680);
12638 snd_hda_codec_write(codec, 0x20, 0,
12639 AC_VERB_SET_COEF_INDEX, 0x0c);
12640 snd_hda_codec_write(codec, 0x20, 0,
12641 AC_VERB_SET_PROC_COEF, 0x480);
12644 /* toggle speaker-output according to the hp-jacks state */
12645 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12647 unsigned int present;
12648 unsigned char bits;
12650 /* Check laptop headphone socket */
12651 present = snd_hda_codec_read(codec, 0x15, 0,
12652 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12654 /* Check port replicator headphone socket */
12655 present |= snd_hda_codec_read(codec, 0x1a, 0,
12656 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12658 bits = present ? AMP_IN_MUTE(0) : 0;
12659 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12660 AMP_IN_MUTE(0), bits);
12661 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12662 AMP_IN_MUTE(0), bits);
12664 snd_hda_codec_write(codec, 0x20, 0,
12665 AC_VERB_SET_COEF_INDEX, 0x0c);
12666 snd_hda_codec_write(codec, 0x20, 0,
12667 AC_VERB_SET_PROC_COEF, 0x680);
12669 snd_hda_codec_write(codec, 0x20, 0,
12670 AC_VERB_SET_COEF_INDEX, 0x0c);
12671 snd_hda_codec_write(codec, 0x20, 0,
12672 AC_VERB_SET_PROC_COEF, 0x480);
12675 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12677 unsigned int present;
12679 present = snd_hda_codec_read(codec, 0x18, 0,
12680 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12681 snd_hda_codec_write(codec, 0x23, 0,
12682 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12685 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12687 unsigned int present_laptop;
12688 unsigned int present_dock;
12690 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12691 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12693 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12694 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12696 /* Laptop mic port overrides dock mic port, design decision */
12698 snd_hda_codec_write(codec, 0x23, 0,
12699 AC_VERB_SET_CONNECT_SEL, 0x3);
12700 if (present_laptop)
12701 snd_hda_codec_write(codec, 0x23, 0,
12702 AC_VERB_SET_CONNECT_SEL, 0x0);
12703 if (!present_dock && !present_laptop)
12704 snd_hda_codec_write(codec, 0x23, 0,
12705 AC_VERB_SET_CONNECT_SEL, 0x1);
12708 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12711 if ((res >> 26) == ALC880_HP_EVENT)
12712 alc269_quanta_fl1_speaker_automute(codec);
12713 if ((res >> 26) == ALC880_MIC_EVENT)
12714 alc269_quanta_fl1_mic_automute(codec);
12717 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12720 if ((res >> 26) == ALC880_HP_EVENT)
12721 alc269_lifebook_speaker_automute(codec);
12722 if ((res >> 26) == ALC880_MIC_EVENT)
12723 alc269_lifebook_mic_autoswitch(codec);
12726 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12728 alc269_quanta_fl1_speaker_automute(codec);
12729 alc269_quanta_fl1_mic_automute(codec);
12732 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12734 alc269_lifebook_speaker_automute(codec);
12735 alc269_lifebook_mic_autoswitch(codec);
12738 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12739 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12740 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12741 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12742 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12743 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12744 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12745 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12749 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12750 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12751 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12752 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12753 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12754 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12755 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12759 /* toggle speaker-output according to the hp-jack state */
12760 static void alc269_speaker_automute(struct hda_codec *codec)
12762 unsigned int present;
12763 unsigned char bits;
12765 present = snd_hda_codec_read(codec, 0x15, 0,
12766 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12767 bits = present ? AMP_IN_MUTE(0) : 0;
12768 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12769 AMP_IN_MUTE(0), bits);
12770 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12771 AMP_IN_MUTE(0), bits);
12774 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12776 unsigned int present;
12778 present = snd_hda_codec_read(codec, 0x18, 0,
12779 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12780 snd_hda_codec_write(codec, 0x23, 0,
12781 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12784 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12786 unsigned int present;
12788 present = snd_hda_codec_read(codec, 0x18, 0,
12789 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12790 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12791 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12792 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12793 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12796 /* unsolicited event for HP jack sensing */
12797 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12800 if ((res >> 26) == ALC880_HP_EVENT)
12801 alc269_speaker_automute(codec);
12803 if ((res >> 26) == ALC880_MIC_EVENT)
12804 alc269_eeepc_dmic_automute(codec);
12807 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12809 alc269_speaker_automute(codec);
12810 alc269_eeepc_dmic_automute(codec);
12813 /* unsolicited event for HP jack sensing */
12814 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12817 if ((res >> 26) == ALC880_HP_EVENT)
12818 alc269_speaker_automute(codec);
12820 if ((res >> 26) == ALC880_MIC_EVENT)
12821 alc269_eeepc_amic_automute(codec);
12824 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12826 alc269_speaker_automute(codec);
12827 alc269_eeepc_amic_automute(codec);
12831 * generic initialization of ADC, input mixers and output mixers
12833 static struct hda_verb alc269_init_verbs[] = {
12835 * Unmute ADC0 and set the default input to mic-in
12837 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12839 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12840 * analog-loopback mixer widget
12841 * Note: PASD motherboards uses the Line In 2 as the input for
12842 * front panel mic (mic 2)
12844 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12845 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12846 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12847 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12848 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12849 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12852 * Set up output mixers (0x0c - 0x0e)
12854 /* set vol=0 to output mixers */
12855 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12856 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12858 /* set up input amps for analog loopback */
12859 /* Amp Indices: DAC = 0, mixer = 1 */
12860 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12861 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12862 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12863 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12864 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12865 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12867 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12868 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12869 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12870 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12871 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12872 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12873 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12875 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12876 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12877 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12878 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12879 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12880 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12881 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12883 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12884 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12886 /* FIXME: use matrix-type input source selection */
12887 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12888 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12889 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12890 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12891 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12892 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12895 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12896 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12900 /* add playback controls from the parsed DAC table */
12901 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12902 const struct auto_pin_cfg *cfg)
12907 spec->multiout.num_dacs = 1; /* only use one dac */
12908 spec->multiout.dac_nids = spec->private_dac_nids;
12909 spec->multiout.dac_nids[0] = 2;
12911 nid = cfg->line_out_pins[0];
12913 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12914 "Front Playback Volume",
12915 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12918 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12919 "Front Playback Switch",
12920 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12925 nid = cfg->speaker_pins[0];
12927 if (!cfg->line_out_pins[0]) {
12928 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12929 "Speaker Playback Volume",
12930 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12936 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12937 "Speaker Playback Switch",
12938 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12943 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12944 "Speaker Playback Switch",
12945 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12951 nid = cfg->hp_pins[0];
12953 /* spec->multiout.hp_nid = 2; */
12954 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12955 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12956 "Headphone Playback Volume",
12957 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12963 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12964 "Headphone Playback Switch",
12965 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12970 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12971 "Headphone Playback Switch",
12972 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12981 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12982 const struct auto_pin_cfg *cfg)
12986 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12989 /* digital-mic input pin is excluded in alc880_auto_create..()
12990 * because it's under 0x18
12992 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12993 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12994 struct hda_input_mux *imux = &spec->private_imux[0];
12995 imux->items[imux->num_items].label = "Int Mic";
12996 imux->items[imux->num_items].index = 0x05;
13002 #ifdef CONFIG_SND_HDA_POWER_SAVE
13003 #define alc269_loopbacks alc880_loopbacks
13006 /* pcm configuration: identiacal with ALC880 */
13007 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13008 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13009 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13010 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13012 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13016 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13017 /* NID is set in alc_build_pcms */
13019 .open = alc880_playback_pcm_open,
13020 .prepare = alc880_playback_pcm_prepare,
13021 .cleanup = alc880_playback_pcm_cleanup
13025 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13029 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13030 /* NID is set in alc_build_pcms */
13034 * BIOS auto configuration
13036 static int alc269_parse_auto_config(struct hda_codec *codec)
13038 struct alc_spec *spec = codec->spec;
13040 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13042 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13047 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13050 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
13054 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13056 if (spec->autocfg.dig_outs)
13057 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13059 if (spec->kctls.list)
13060 add_mixer(spec, spec->kctls.list);
13062 add_verb(spec, alc269_init_verbs);
13063 spec->num_mux_defs = 1;
13064 spec->input_mux = &spec->private_imux[0];
13065 /* set default input source */
13066 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13067 0, AC_VERB_SET_CONNECT_SEL,
13068 spec->input_mux->items[0].index);
13070 err = alc_auto_add_mic_boost(codec);
13074 if (!spec->cap_mixer && !spec->no_analog)
13075 set_capture_mixer(spec);
13080 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13081 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13082 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13085 /* init callback for auto-configuration model -- overriding the default init */
13086 static void alc269_auto_init(struct hda_codec *codec)
13088 struct alc_spec *spec = codec->spec;
13089 alc269_auto_init_multi_out(codec);
13090 alc269_auto_init_hp_out(codec);
13091 alc269_auto_init_analog_input(codec);
13092 if (spec->unsol_event)
13093 alc_inithook(codec);
13097 * configuration and preset
13099 static const char *alc269_models[ALC269_MODEL_LAST] = {
13100 [ALC269_BASIC] = "basic",
13101 [ALC269_QUANTA_FL1] = "quanta",
13102 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13103 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13104 [ALC269_FUJITSU] = "fujitsu",
13105 [ALC269_LIFEBOOK] = "lifebook"
13108 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13109 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13110 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13111 ALC269_ASUS_EEEPC_P703),
13112 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13113 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13114 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13115 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13116 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13117 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13118 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13119 ALC269_ASUS_EEEPC_P901),
13120 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13121 ALC269_ASUS_EEEPC_P901),
13122 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13123 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13124 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13128 static struct alc_config_preset alc269_presets[] = {
13130 .mixers = { alc269_base_mixer },
13131 .init_verbs = { alc269_init_verbs },
13132 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13133 .dac_nids = alc269_dac_nids,
13135 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13136 .channel_mode = alc269_modes,
13137 .input_mux = &alc269_capture_source,
13139 [ALC269_QUANTA_FL1] = {
13140 .mixers = { alc269_quanta_fl1_mixer },
13141 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13142 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13143 .dac_nids = alc269_dac_nids,
13145 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13146 .channel_mode = alc269_modes,
13147 .input_mux = &alc269_capture_source,
13148 .unsol_event = alc269_quanta_fl1_unsol_event,
13149 .init_hook = alc269_quanta_fl1_init_hook,
13151 [ALC269_ASUS_EEEPC_P703] = {
13152 .mixers = { alc269_eeepc_mixer },
13153 .cap_mixer = alc269_epc_capture_mixer,
13154 .init_verbs = { alc269_init_verbs,
13155 alc269_eeepc_amic_init_verbs },
13156 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13157 .dac_nids = alc269_dac_nids,
13159 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13160 .channel_mode = alc269_modes,
13161 .input_mux = &alc269_eeepc_amic_capture_source,
13162 .unsol_event = alc269_eeepc_amic_unsol_event,
13163 .init_hook = alc269_eeepc_amic_inithook,
13165 [ALC269_ASUS_EEEPC_P901] = {
13166 .mixers = { alc269_eeepc_mixer },
13167 .cap_mixer = alc269_epc_capture_mixer,
13168 .init_verbs = { alc269_init_verbs,
13169 alc269_eeepc_dmic_init_verbs },
13170 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13171 .dac_nids = alc269_dac_nids,
13173 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13174 .channel_mode = alc269_modes,
13175 .input_mux = &alc269_eeepc_dmic_capture_source,
13176 .unsol_event = alc269_eeepc_dmic_unsol_event,
13177 .init_hook = alc269_eeepc_dmic_inithook,
13179 [ALC269_FUJITSU] = {
13180 .mixers = { alc269_fujitsu_mixer },
13181 .cap_mixer = alc269_epc_capture_mixer,
13182 .init_verbs = { alc269_init_verbs,
13183 alc269_eeepc_dmic_init_verbs },
13184 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13185 .dac_nids = alc269_dac_nids,
13187 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13188 .channel_mode = alc269_modes,
13189 .input_mux = &alc269_eeepc_dmic_capture_source,
13190 .unsol_event = alc269_eeepc_dmic_unsol_event,
13191 .init_hook = alc269_eeepc_dmic_inithook,
13193 [ALC269_LIFEBOOK] = {
13194 .mixers = { alc269_lifebook_mixer },
13195 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13196 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13197 .dac_nids = alc269_dac_nids,
13199 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13200 .channel_mode = alc269_modes,
13201 .input_mux = &alc269_capture_source,
13202 .unsol_event = alc269_lifebook_unsol_event,
13203 .init_hook = alc269_lifebook_init_hook,
13207 static int patch_alc269(struct hda_codec *codec)
13209 struct alc_spec *spec;
13213 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13217 codec->spec = spec;
13219 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13221 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13225 if (board_config < 0) {
13226 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
13227 "trying auto-probe from BIOS...\n");
13228 board_config = ALC269_AUTO;
13231 if (board_config == ALC269_AUTO) {
13232 /* automatic parse from the BIOS config */
13233 err = alc269_parse_auto_config(codec);
13239 "hda_codec: Cannot set up configuration "
13240 "from BIOS. Using base mode...\n");
13241 board_config = ALC269_BASIC;
13245 err = snd_hda_attach_beep_device(codec, 0x1);
13251 if (board_config != ALC269_AUTO)
13252 setup_preset(spec, &alc269_presets[board_config]);
13254 spec->stream_name_analog = "ALC269 Analog";
13255 if (codec->subsystem_id == 0x17aa3bf8) {
13256 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13257 * fix the sample rate of analog I/O to 44.1kHz
13259 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13260 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13262 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13263 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13265 spec->stream_name_digital = "ALC269 Digital";
13266 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13267 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13269 spec->adc_nids = alc269_adc_nids;
13270 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13271 spec->capsrc_nids = alc269_capsrc_nids;
13272 if (!spec->cap_mixer)
13273 set_capture_mixer(spec);
13274 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13276 codec->patch_ops = alc_patch_ops;
13277 if (board_config == ALC269_AUTO)
13278 spec->init_hook = alc269_auto_init;
13279 #ifdef CONFIG_SND_HDA_POWER_SAVE
13280 if (!spec->loopback.amplist)
13281 spec->loopback.amplist = alc269_loopbacks;
13283 codec->proc_widget_hook = print_realtek_coef;
13289 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13293 * set the path ways for 2 channel output
13294 * need to set the codec line out and mic 1 pin widgets to inputs
13296 static struct hda_verb alc861_threestack_ch2_init[] = {
13297 /* set pin widget 1Ah (line in) for input */
13298 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13299 /* set pin widget 18h (mic1/2) for input, for mic also enable
13302 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13304 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13306 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13307 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13313 * need to set the codec line out and mic 1 pin widgets to outputs
13315 static struct hda_verb alc861_threestack_ch6_init[] = {
13316 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13317 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13318 /* set pin widget 18h (mic1) for output (CLFE)*/
13319 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13321 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13322 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13324 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13326 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13327 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13332 static struct hda_channel_mode alc861_threestack_modes[2] = {
13333 { 2, alc861_threestack_ch2_init },
13334 { 6, alc861_threestack_ch6_init },
13336 /* Set mic1 as input and unmute the mixer */
13337 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13338 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13339 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13342 /* Set mic1 as output and mute mixer */
13343 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13344 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13345 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13349 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13350 { 2, alc861_uniwill_m31_ch2_init },
13351 { 4, alc861_uniwill_m31_ch4_init },
13354 /* Set mic1 and line-in as input and unmute the mixer */
13355 static struct hda_verb alc861_asus_ch2_init[] = {
13356 /* set pin widget 1Ah (line in) for input */
13357 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13358 /* set pin widget 18h (mic1/2) for input, for mic also enable
13361 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13363 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13365 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13366 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13370 /* Set mic1 nad line-in as output and mute mixer */
13371 static struct hda_verb alc861_asus_ch6_init[] = {
13372 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13373 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13374 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13375 /* set pin widget 18h (mic1) for output (CLFE)*/
13376 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13377 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13378 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13379 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13381 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13383 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13384 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13389 static struct hda_channel_mode alc861_asus_modes[2] = {
13390 { 2, alc861_asus_ch2_init },
13391 { 6, alc861_asus_ch6_init },
13396 static struct snd_kcontrol_new alc861_base_mixer[] = {
13397 /* output mixer control */
13398 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13399 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13400 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13401 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13402 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13404 /*Input mixer control */
13405 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13406 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13407 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13408 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13409 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13410 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13411 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13412 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13413 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13414 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13419 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13420 /* output mixer control */
13421 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13422 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13423 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13424 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13425 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13427 /* Input mixer control */
13428 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13429 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13430 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13431 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13432 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13433 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13434 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13435 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13436 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13437 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13440 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13441 .name = "Channel Mode",
13442 .info = alc_ch_mode_info,
13443 .get = alc_ch_mode_get,
13444 .put = alc_ch_mode_put,
13445 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13450 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13451 /* output mixer control */
13452 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13453 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13454 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13459 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13460 /* output mixer control */
13461 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13462 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13463 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13464 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13465 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13467 /* Input mixer control */
13468 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13469 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13470 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13471 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13472 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13473 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13474 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13475 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13476 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13477 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13480 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13481 .name = "Channel Mode",
13482 .info = alc_ch_mode_info,
13483 .get = alc_ch_mode_get,
13484 .put = alc_ch_mode_put,
13485 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13490 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13491 /* output mixer control */
13492 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13493 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13494 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13495 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13496 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13498 /* Input mixer control */
13499 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13500 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13501 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13502 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13503 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13504 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13505 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13506 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13507 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13508 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13511 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13512 .name = "Channel Mode",
13513 .info = alc_ch_mode_info,
13514 .get = alc_ch_mode_get,
13515 .put = alc_ch_mode_put,
13516 .private_value = ARRAY_SIZE(alc861_asus_modes),
13521 /* additional mixer */
13522 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13523 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13524 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13529 * generic initialization of ADC, input mixers and output mixers
13531 static struct hda_verb alc861_base_init_verbs[] = {
13533 * Unmute ADC0 and set the default input to mic-in
13535 /* port-A for surround (rear panel) */
13536 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13537 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13538 /* port-B for mic-in (rear panel) with vref */
13539 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13540 /* port-C for line-in (rear panel) */
13541 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13542 /* port-D for Front */
13543 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13544 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13545 /* port-E for HP out (front panel) */
13546 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13547 /* route front PCM to HP */
13548 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13549 /* port-F for mic-in (front panel) with vref */
13550 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13551 /* port-G for CLFE (rear panel) */
13552 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13553 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13554 /* port-H for side (rear panel) */
13555 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13556 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13558 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13559 /* route front mic to ADC1*/
13560 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13561 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13563 /* Unmute DAC0~3 & spdif out*/
13564 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13565 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13566 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13567 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13568 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13570 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13571 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13572 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13573 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13574 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13576 /* Unmute Stereo Mixer 15 */
13577 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13578 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13579 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13580 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13582 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13583 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13584 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13585 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13586 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13587 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13588 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13589 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13590 /* hp used DAC 3 (Front) */
13591 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13592 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13597 static struct hda_verb alc861_threestack_init_verbs[] = {
13599 * Unmute ADC0 and set the default input to mic-in
13601 /* port-A for surround (rear panel) */
13602 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13603 /* port-B for mic-in (rear panel) with vref */
13604 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13605 /* port-C for line-in (rear panel) */
13606 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13607 /* port-D for Front */
13608 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13609 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13610 /* port-E for HP out (front panel) */
13611 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13612 /* route front PCM to HP */
13613 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13614 /* port-F for mic-in (front panel) with vref */
13615 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13616 /* port-G for CLFE (rear panel) */
13617 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13618 /* port-H for side (rear panel) */
13619 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13621 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13622 /* route front mic to ADC1*/
13623 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13624 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13625 /* Unmute DAC0~3 & spdif out*/
13626 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13627 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13628 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13629 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13630 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13632 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13633 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13634 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13635 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13636 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13638 /* Unmute Stereo Mixer 15 */
13639 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13640 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13641 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13642 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13644 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13645 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13646 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13647 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13648 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13649 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13650 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13651 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13652 /* hp used DAC 3 (Front) */
13653 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13654 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13658 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13660 * Unmute ADC0 and set the default input to mic-in
13662 /* port-A for surround (rear panel) */
13663 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13664 /* port-B for mic-in (rear panel) with vref */
13665 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13666 /* port-C for line-in (rear panel) */
13667 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13668 /* port-D for Front */
13669 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13670 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13671 /* port-E for HP out (front panel) */
13672 /* this has to be set to VREF80 */
13673 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13674 /* route front PCM to HP */
13675 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13676 /* port-F for mic-in (front panel) with vref */
13677 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13678 /* port-G for CLFE (rear panel) */
13679 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13680 /* port-H for side (rear panel) */
13681 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13683 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13684 /* route front mic to ADC1*/
13685 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13686 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13687 /* Unmute DAC0~3 & spdif out*/
13688 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13689 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13690 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13691 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13692 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13694 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13695 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13696 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13697 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13698 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13700 /* Unmute Stereo Mixer 15 */
13701 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13702 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13703 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13704 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13706 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13707 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13708 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13709 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13710 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13711 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13712 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13713 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13714 /* hp used DAC 3 (Front) */
13715 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13716 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13720 static struct hda_verb alc861_asus_init_verbs[] = {
13722 * Unmute ADC0 and set the default input to mic-in
13724 /* port-A for surround (rear panel)
13725 * according to codec#0 this is the HP jack
13727 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13728 /* route front PCM to HP */
13729 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13730 /* port-B for mic-in (rear panel) with vref */
13731 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13732 /* port-C for line-in (rear panel) */
13733 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13734 /* port-D for Front */
13735 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13736 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13737 /* port-E for HP out (front panel) */
13738 /* this has to be set to VREF80 */
13739 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13740 /* route front PCM to HP */
13741 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13742 /* port-F for mic-in (front panel) with vref */
13743 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13744 /* port-G for CLFE (rear panel) */
13745 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13746 /* port-H for side (rear panel) */
13747 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13749 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13750 /* route front mic to ADC1*/
13751 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13752 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13753 /* Unmute DAC0~3 & spdif out*/
13754 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13755 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13756 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13757 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13758 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13759 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13760 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13761 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13762 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13763 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13765 /* Unmute Stereo Mixer 15 */
13766 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13767 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13769 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13771 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13772 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13773 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13774 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13775 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13776 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13777 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13778 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13779 /* hp used DAC 3 (Front) */
13780 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13781 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13785 /* additional init verbs for ASUS laptops */
13786 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13787 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13788 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13793 * generic initialization of ADC, input mixers and output mixers
13795 static struct hda_verb alc861_auto_init_verbs[] = {
13797 * Unmute ADC0 and set the default input to mic-in
13799 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13800 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13802 /* Unmute DAC0~3 & spdif out*/
13803 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13804 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13805 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13806 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13807 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13809 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13810 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13811 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13812 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13813 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13815 /* Unmute Stereo Mixer 15 */
13816 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13817 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13818 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13819 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13821 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13822 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13823 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13824 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13825 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13826 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13827 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13828 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13830 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13831 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13832 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13833 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13834 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13835 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13836 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13837 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13839 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13844 static struct hda_verb alc861_toshiba_init_verbs[] = {
13845 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13850 /* toggle speaker-output according to the hp-jack state */
13851 static void alc861_toshiba_automute(struct hda_codec *codec)
13853 unsigned int present;
13855 present = snd_hda_codec_read(codec, 0x0f, 0,
13856 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13857 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13858 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13859 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13860 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13863 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13866 if ((res >> 26) == ALC880_HP_EVENT)
13867 alc861_toshiba_automute(codec);
13870 /* pcm configuration: identiacal with ALC880 */
13871 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13872 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13873 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13874 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13877 #define ALC861_DIGOUT_NID 0x07
13879 static struct hda_channel_mode alc861_8ch_modes[1] = {
13883 static hda_nid_t alc861_dac_nids[4] = {
13884 /* front, surround, clfe, side */
13885 0x03, 0x06, 0x05, 0x04
13888 static hda_nid_t alc660_dac_nids[3] = {
13889 /* front, clfe, surround */
13893 static hda_nid_t alc861_adc_nids[1] = {
13898 static struct hda_input_mux alc861_capture_source = {
13902 { "Front Mic", 0x3 },
13909 /* fill in the dac_nids table from the parsed pin configuration */
13910 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13911 const struct auto_pin_cfg *cfg)
13916 spec->multiout.dac_nids = spec->private_dac_nids;
13917 for (i = 0; i < cfg->line_outs; i++) {
13918 nid = cfg->line_out_pins[i];
13920 if (i >= ARRAY_SIZE(alc861_dac_nids))
13922 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13925 spec->multiout.num_dacs = cfg->line_outs;
13929 /* add playback controls from the parsed DAC table */
13930 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13931 const struct auto_pin_cfg *cfg)
13934 static const char *chname[4] = {
13935 "Front", "Surround", NULL /*CLFE*/, "Side"
13940 for (i = 0; i < cfg->line_outs; i++) {
13941 nid = spec->multiout.dac_nids[i];
13946 err = add_control(spec, ALC_CTL_BIND_MUTE,
13947 "Center Playback Switch",
13948 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13952 err = add_control(spec, ALC_CTL_BIND_MUTE,
13953 "LFE Playback Switch",
13954 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13959 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13961 if (nid == alc861_dac_nids[idx])
13963 sprintf(name, "%s Playback Switch", chname[idx]);
13964 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13965 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13974 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13982 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13984 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13985 "Headphone Playback Switch",
13986 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13989 spec->multiout.hp_nid = nid;
13994 /* create playback/capture controls for input pins */
13995 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13996 const struct auto_pin_cfg *cfg)
13998 struct hda_input_mux *imux = &spec->private_imux[0];
13999 int i, err, idx, idx1;
14001 for (i = 0; i < AUTO_PIN_LAST; i++) {
14002 switch (cfg->input_pins[i]) {
14005 idx = 2; /* Line In */
14009 idx = 2; /* Line In */
14013 idx = 1; /* Mic In */
14017 idx = 1; /* Mic In */
14027 err = new_analog_input(spec, cfg->input_pins[i],
14028 auto_pin_cfg_labels[i], idx, 0x15);
14032 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
14033 imux->items[imux->num_items].index = idx1;
14039 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14041 int pin_type, int dac_idx)
14043 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14045 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14049 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14051 struct alc_spec *spec = codec->spec;
14054 for (i = 0; i < spec->autocfg.line_outs; i++) {
14055 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14056 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14058 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14059 spec->multiout.dac_nids[i]);
14063 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14065 struct alc_spec *spec = codec->spec;
14068 pin = spec->autocfg.hp_pins[0];
14069 if (pin) /* connect to front */
14070 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14071 spec->multiout.dac_nids[0]);
14072 pin = spec->autocfg.speaker_pins[0];
14074 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14077 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14079 struct alc_spec *spec = codec->spec;
14082 for (i = 0; i < AUTO_PIN_LAST; i++) {
14083 hda_nid_t nid = spec->autocfg.input_pins[i];
14084 if (nid >= 0x0c && nid <= 0x11)
14085 alc_set_input_pin(codec, nid, i);
14089 /* parse the BIOS configuration and set up the alc_spec */
14090 /* return 1 if successful, 0 if the proper config is not found,
14091 * or a negative error code
14093 static int alc861_parse_auto_config(struct hda_codec *codec)
14095 struct alc_spec *spec = codec->spec;
14097 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14099 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14103 if (!spec->autocfg.line_outs)
14104 return 0; /* can't find valid BIOS pin config */
14106 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
14109 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
14112 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
14115 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
14119 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14121 if (spec->autocfg.dig_outs)
14122 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14124 if (spec->kctls.list)
14125 add_mixer(spec, spec->kctls.list);
14127 add_verb(spec, alc861_auto_init_verbs);
14129 spec->num_mux_defs = 1;
14130 spec->input_mux = &spec->private_imux[0];
14132 spec->adc_nids = alc861_adc_nids;
14133 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14134 set_capture_mixer(spec);
14136 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14141 /* additional initialization for auto-configuration model */
14142 static void alc861_auto_init(struct hda_codec *codec)
14144 struct alc_spec *spec = codec->spec;
14145 alc861_auto_init_multi_out(codec);
14146 alc861_auto_init_hp_out(codec);
14147 alc861_auto_init_analog_input(codec);
14148 if (spec->unsol_event)
14149 alc_inithook(codec);
14152 #ifdef CONFIG_SND_HDA_POWER_SAVE
14153 static struct hda_amp_list alc861_loopbacks[] = {
14154 { 0x15, HDA_INPUT, 0 },
14155 { 0x15, HDA_INPUT, 1 },
14156 { 0x15, HDA_INPUT, 2 },
14157 { 0x15, HDA_INPUT, 3 },
14164 * configuration and preset
14166 static const char *alc861_models[ALC861_MODEL_LAST] = {
14167 [ALC861_3ST] = "3stack",
14168 [ALC660_3ST] = "3stack-660",
14169 [ALC861_3ST_DIG] = "3stack-dig",
14170 [ALC861_6ST_DIG] = "6stack-dig",
14171 [ALC861_UNIWILL_M31] = "uniwill-m31",
14172 [ALC861_TOSHIBA] = "toshiba",
14173 [ALC861_ASUS] = "asus",
14174 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14175 [ALC861_AUTO] = "auto",
14178 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14179 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14180 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14181 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14182 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14183 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14184 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14185 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14186 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14187 * Any other models that need this preset?
14189 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14190 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14191 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14192 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14193 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14194 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14195 /* FIXME: the below seems conflict */
14196 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14197 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14198 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14202 static struct alc_config_preset alc861_presets[] = {
14204 .mixers = { alc861_3ST_mixer },
14205 .init_verbs = { alc861_threestack_init_verbs },
14206 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14207 .dac_nids = alc861_dac_nids,
14208 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14209 .channel_mode = alc861_threestack_modes,
14211 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14212 .adc_nids = alc861_adc_nids,
14213 .input_mux = &alc861_capture_source,
14215 [ALC861_3ST_DIG] = {
14216 .mixers = { alc861_base_mixer },
14217 .init_verbs = { alc861_threestack_init_verbs },
14218 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14219 .dac_nids = alc861_dac_nids,
14220 .dig_out_nid = ALC861_DIGOUT_NID,
14221 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14222 .channel_mode = alc861_threestack_modes,
14224 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14225 .adc_nids = alc861_adc_nids,
14226 .input_mux = &alc861_capture_source,
14228 [ALC861_6ST_DIG] = {
14229 .mixers = { alc861_base_mixer },
14230 .init_verbs = { alc861_base_init_verbs },
14231 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14232 .dac_nids = alc861_dac_nids,
14233 .dig_out_nid = ALC861_DIGOUT_NID,
14234 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14235 .channel_mode = alc861_8ch_modes,
14236 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14237 .adc_nids = alc861_adc_nids,
14238 .input_mux = &alc861_capture_source,
14241 .mixers = { alc861_3ST_mixer },
14242 .init_verbs = { alc861_threestack_init_verbs },
14243 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14244 .dac_nids = alc660_dac_nids,
14245 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14246 .channel_mode = alc861_threestack_modes,
14248 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14249 .adc_nids = alc861_adc_nids,
14250 .input_mux = &alc861_capture_source,
14252 [ALC861_UNIWILL_M31] = {
14253 .mixers = { alc861_uniwill_m31_mixer },
14254 .init_verbs = { alc861_uniwill_m31_init_verbs },
14255 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14256 .dac_nids = alc861_dac_nids,
14257 .dig_out_nid = ALC861_DIGOUT_NID,
14258 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14259 .channel_mode = alc861_uniwill_m31_modes,
14261 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14262 .adc_nids = alc861_adc_nids,
14263 .input_mux = &alc861_capture_source,
14265 [ALC861_TOSHIBA] = {
14266 .mixers = { alc861_toshiba_mixer },
14267 .init_verbs = { alc861_base_init_verbs,
14268 alc861_toshiba_init_verbs },
14269 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14270 .dac_nids = alc861_dac_nids,
14271 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14272 .channel_mode = alc883_3ST_2ch_modes,
14273 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14274 .adc_nids = alc861_adc_nids,
14275 .input_mux = &alc861_capture_source,
14276 .unsol_event = alc861_toshiba_unsol_event,
14277 .init_hook = alc861_toshiba_automute,
14280 .mixers = { alc861_asus_mixer },
14281 .init_verbs = { alc861_asus_init_verbs },
14282 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14283 .dac_nids = alc861_dac_nids,
14284 .dig_out_nid = ALC861_DIGOUT_NID,
14285 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14286 .channel_mode = alc861_asus_modes,
14289 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14290 .adc_nids = alc861_adc_nids,
14291 .input_mux = &alc861_capture_source,
14293 [ALC861_ASUS_LAPTOP] = {
14294 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14295 .init_verbs = { alc861_asus_init_verbs,
14296 alc861_asus_laptop_init_verbs },
14297 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14298 .dac_nids = alc861_dac_nids,
14299 .dig_out_nid = ALC861_DIGOUT_NID,
14300 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14301 .channel_mode = alc883_3ST_2ch_modes,
14303 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14304 .adc_nids = alc861_adc_nids,
14305 .input_mux = &alc861_capture_source,
14310 static int patch_alc861(struct hda_codec *codec)
14312 struct alc_spec *spec;
14316 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14320 codec->spec = spec;
14322 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14326 if (board_config < 0) {
14327 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
14328 "trying auto-probe from BIOS...\n");
14329 board_config = ALC861_AUTO;
14332 if (board_config == ALC861_AUTO) {
14333 /* automatic parse from the BIOS config */
14334 err = alc861_parse_auto_config(codec);
14340 "hda_codec: Cannot set up configuration "
14341 "from BIOS. Using base mode...\n");
14342 board_config = ALC861_3ST_DIG;
14346 err = snd_hda_attach_beep_device(codec, 0x23);
14352 if (board_config != ALC861_AUTO)
14353 setup_preset(spec, &alc861_presets[board_config]);
14355 spec->stream_name_analog = "ALC861 Analog";
14356 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14357 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14359 spec->stream_name_digital = "ALC861 Digital";
14360 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14361 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14363 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14365 spec->vmaster_nid = 0x03;
14367 codec->patch_ops = alc_patch_ops;
14368 if (board_config == ALC861_AUTO)
14369 spec->init_hook = alc861_auto_init;
14370 #ifdef CONFIG_SND_HDA_POWER_SAVE
14371 if (!spec->loopback.amplist)
14372 spec->loopback.amplist = alc861_loopbacks;
14374 codec->proc_widget_hook = print_realtek_coef;
14380 * ALC861-VD support
14384 * In addition, an independent DAC
14386 #define ALC861VD_DIGOUT_NID 0x06
14388 static hda_nid_t alc861vd_dac_nids[4] = {
14389 /* front, surr, clfe, side surr */
14390 0x02, 0x03, 0x04, 0x05
14393 /* dac_nids for ALC660vd are in a different order - according to
14394 * Realtek's driver.
14395 * This should probably tesult in a different mixer for 6stack models
14396 * of ALC660vd codecs, but for now there is only 3stack mixer
14397 * - and it is the same as in 861vd.
14398 * adc_nids in ALC660vd are (is) the same as in 861vd
14400 static hda_nid_t alc660vd_dac_nids[3] = {
14401 /* front, rear, clfe, rear_surr */
14405 static hda_nid_t alc861vd_adc_nids[1] = {
14410 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14413 /* FIXME: should be a matrix-type input source selection */
14414 static struct hda_input_mux alc861vd_capture_source = {
14418 { "Front Mic", 0x1 },
14424 static struct hda_input_mux alc861vd_dallas_capture_source = {
14427 { "Ext Mic", 0x0 },
14428 { "Int Mic", 0x1 },
14432 static struct hda_input_mux alc861vd_hp_capture_source = {
14435 { "Front Mic", 0x0 },
14436 { "ATAPI Mic", 0x1 },
14443 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14450 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14451 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14452 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14453 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14454 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14461 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14462 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14463 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14464 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14465 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14469 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14470 { 6, alc861vd_6stack_ch6_init },
14471 { 8, alc861vd_6stack_ch8_init },
14474 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14476 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14477 .name = "Channel Mode",
14478 .info = alc_ch_mode_info,
14479 .get = alc_ch_mode_get,
14480 .put = alc_ch_mode_put,
14485 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14486 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14488 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14489 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14490 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14492 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14493 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14495 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14497 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14499 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14500 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14502 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14503 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14505 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14507 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14508 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14509 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14511 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14512 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14513 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14515 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14516 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14518 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14519 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14524 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14525 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14526 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14528 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14530 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14532 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14534 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14535 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14536 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14538 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14539 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14541 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14542 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14547 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14548 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14549 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14550 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14552 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14554 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14555 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14556 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14558 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14559 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14560 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14562 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14563 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14568 /* Pin assignment: Speaker=0x14, HP = 0x15,
14569 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14571 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14572 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14573 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14574 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14575 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14576 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14577 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14578 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14579 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14580 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14581 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14585 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14586 * Front Mic=0x18, ATAPI Mic = 0x19,
14588 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14589 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14590 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14591 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14592 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14593 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14594 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14595 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14596 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14602 * generic initialization of ADC, input mixers and output mixers
14604 static struct hda_verb alc861vd_volume_init_verbs[] = {
14606 * Unmute ADC0 and set the default input to mic-in
14608 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14609 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14611 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14612 * the analog-loopback mixer widget
14614 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14615 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14616 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14617 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14618 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14619 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14621 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14628 * Set up output mixers (0x02 - 0x05)
14630 /* set vol=0 to output mixers */
14631 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14632 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14633 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14634 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14636 /* set up input amps for analog loopback */
14637 /* Amp Indices: DAC = 0, mixer = 1 */
14638 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14639 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14640 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14641 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14642 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14643 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14644 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14645 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14651 * 3-stack pin configuration:
14652 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14654 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14656 * Set pin mode and muting
14658 /* set front pin widgets 0x14 for output */
14659 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14660 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14661 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14663 /* Mic (rear) pin: input vref at 80% */
14664 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14665 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14666 /* Front Mic pin: input vref at 80% */
14667 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14668 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14669 /* Line In pin: input */
14670 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14671 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14672 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14673 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14674 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14675 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14676 /* CD pin widget for input */
14677 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14683 * 6-stack pin configuration:
14685 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14687 * Set pin mode and muting
14689 /* set front pin widgets 0x14 for output */
14690 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14691 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14692 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14694 /* Rear Pin: output 1 (0x0d) */
14695 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14696 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14697 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14698 /* CLFE Pin: output 2 (0x0e) */
14699 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14700 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14701 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14702 /* Side Pin: output 3 (0x0f) */
14703 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14704 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14705 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14707 /* Mic (rear) pin: input vref at 80% */
14708 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14709 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14710 /* Front Mic pin: input vref at 80% */
14711 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14712 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14713 /* Line In pin: input */
14714 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14715 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14716 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14717 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14718 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14719 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14720 /* CD pin widget for input */
14721 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14726 static struct hda_verb alc861vd_eapd_verbs[] = {
14727 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14731 static struct hda_verb alc660vd_eapd_verbs[] = {
14732 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14733 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14737 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14739 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14740 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14741 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14742 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14746 /* toggle speaker-output according to the hp-jack state */
14747 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14749 unsigned int present;
14750 unsigned char bits;
14752 present = snd_hda_codec_read(codec, 0x1b, 0,
14753 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14754 bits = present ? HDA_AMP_MUTE : 0;
14755 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14756 HDA_AMP_MUTE, bits);
14759 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14761 unsigned int present;
14762 unsigned char bits;
14764 present = snd_hda_codec_read(codec, 0x18, 0,
14765 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14766 bits = present ? HDA_AMP_MUTE : 0;
14767 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14768 HDA_AMP_MUTE, bits);
14771 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14773 alc861vd_lenovo_hp_automute(codec);
14774 alc861vd_lenovo_mic_automute(codec);
14777 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14780 switch (res >> 26) {
14781 case ALC880_HP_EVENT:
14782 alc861vd_lenovo_hp_automute(codec);
14784 case ALC880_MIC_EVENT:
14785 alc861vd_lenovo_mic_automute(codec);
14790 static struct hda_verb alc861vd_dallas_verbs[] = {
14791 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14792 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14793 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14794 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14796 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14797 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14798 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14799 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14800 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14801 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14802 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14803 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14805 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14806 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14807 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14808 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14809 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14810 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14811 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14812 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14814 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14815 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14816 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14817 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14818 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14819 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14820 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14821 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14823 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14824 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14825 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14826 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14828 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14829 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14830 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14835 /* toggle speaker-output according to the hp-jack state */
14836 static void alc861vd_dallas_automute(struct hda_codec *codec)
14838 unsigned int present;
14840 present = snd_hda_codec_read(codec, 0x15, 0,
14841 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14842 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14843 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14846 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14848 if ((res >> 26) == ALC880_HP_EVENT)
14849 alc861vd_dallas_automute(codec);
14852 #ifdef CONFIG_SND_HDA_POWER_SAVE
14853 #define alc861vd_loopbacks alc880_loopbacks
14856 /* pcm configuration: identiacal with ALC880 */
14857 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14858 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14859 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14860 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14863 * configuration and preset
14865 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14866 [ALC660VD_3ST] = "3stack-660",
14867 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14868 [ALC660VD_ASUS_V1S] = "asus-v1s",
14869 [ALC861VD_3ST] = "3stack",
14870 [ALC861VD_3ST_DIG] = "3stack-digout",
14871 [ALC861VD_6ST_DIG] = "6stack-digout",
14872 [ALC861VD_LENOVO] = "lenovo",
14873 [ALC861VD_DALLAS] = "dallas",
14874 [ALC861VD_HP] = "hp",
14875 [ALC861VD_AUTO] = "auto",
14878 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14879 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14880 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14881 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14882 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14883 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14884 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14885 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14886 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14887 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14888 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14889 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14890 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14891 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14892 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14893 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14897 static struct alc_config_preset alc861vd_presets[] = {
14899 .mixers = { alc861vd_3st_mixer },
14900 .init_verbs = { alc861vd_volume_init_verbs,
14901 alc861vd_3stack_init_verbs },
14902 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14903 .dac_nids = alc660vd_dac_nids,
14904 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14905 .channel_mode = alc861vd_3stack_2ch_modes,
14906 .input_mux = &alc861vd_capture_source,
14908 [ALC660VD_3ST_DIG] = {
14909 .mixers = { alc861vd_3st_mixer },
14910 .init_verbs = { alc861vd_volume_init_verbs,
14911 alc861vd_3stack_init_verbs },
14912 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14913 .dac_nids = alc660vd_dac_nids,
14914 .dig_out_nid = ALC861VD_DIGOUT_NID,
14915 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14916 .channel_mode = alc861vd_3stack_2ch_modes,
14917 .input_mux = &alc861vd_capture_source,
14920 .mixers = { alc861vd_3st_mixer },
14921 .init_verbs = { alc861vd_volume_init_verbs,
14922 alc861vd_3stack_init_verbs },
14923 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14924 .dac_nids = alc861vd_dac_nids,
14925 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14926 .channel_mode = alc861vd_3stack_2ch_modes,
14927 .input_mux = &alc861vd_capture_source,
14929 [ALC861VD_3ST_DIG] = {
14930 .mixers = { alc861vd_3st_mixer },
14931 .init_verbs = { alc861vd_volume_init_verbs,
14932 alc861vd_3stack_init_verbs },
14933 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14934 .dac_nids = alc861vd_dac_nids,
14935 .dig_out_nid = ALC861VD_DIGOUT_NID,
14936 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14937 .channel_mode = alc861vd_3stack_2ch_modes,
14938 .input_mux = &alc861vd_capture_source,
14940 [ALC861VD_6ST_DIG] = {
14941 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14942 .init_verbs = { alc861vd_volume_init_verbs,
14943 alc861vd_6stack_init_verbs },
14944 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14945 .dac_nids = alc861vd_dac_nids,
14946 .dig_out_nid = ALC861VD_DIGOUT_NID,
14947 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14948 .channel_mode = alc861vd_6stack_modes,
14949 .input_mux = &alc861vd_capture_source,
14951 [ALC861VD_LENOVO] = {
14952 .mixers = { alc861vd_lenovo_mixer },
14953 .init_verbs = { alc861vd_volume_init_verbs,
14954 alc861vd_3stack_init_verbs,
14955 alc861vd_eapd_verbs,
14956 alc861vd_lenovo_unsol_verbs },
14957 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14958 .dac_nids = alc660vd_dac_nids,
14959 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14960 .channel_mode = alc861vd_3stack_2ch_modes,
14961 .input_mux = &alc861vd_capture_source,
14962 .unsol_event = alc861vd_lenovo_unsol_event,
14963 .init_hook = alc861vd_lenovo_automute,
14965 [ALC861VD_DALLAS] = {
14966 .mixers = { alc861vd_dallas_mixer },
14967 .init_verbs = { alc861vd_dallas_verbs },
14968 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14969 .dac_nids = alc861vd_dac_nids,
14970 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14971 .channel_mode = alc861vd_3stack_2ch_modes,
14972 .input_mux = &alc861vd_dallas_capture_source,
14973 .unsol_event = alc861vd_dallas_unsol_event,
14974 .init_hook = alc861vd_dallas_automute,
14977 .mixers = { alc861vd_hp_mixer },
14978 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14979 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14980 .dac_nids = alc861vd_dac_nids,
14981 .dig_out_nid = ALC861VD_DIGOUT_NID,
14982 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14983 .channel_mode = alc861vd_3stack_2ch_modes,
14984 .input_mux = &alc861vd_hp_capture_source,
14985 .unsol_event = alc861vd_dallas_unsol_event,
14986 .init_hook = alc861vd_dallas_automute,
14988 [ALC660VD_ASUS_V1S] = {
14989 .mixers = { alc861vd_lenovo_mixer },
14990 .init_verbs = { alc861vd_volume_init_verbs,
14991 alc861vd_3stack_init_verbs,
14992 alc861vd_eapd_verbs,
14993 alc861vd_lenovo_unsol_verbs },
14994 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14995 .dac_nids = alc660vd_dac_nids,
14996 .dig_out_nid = ALC861VD_DIGOUT_NID,
14997 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14998 .channel_mode = alc861vd_3stack_2ch_modes,
14999 .input_mux = &alc861vd_capture_source,
15000 .unsol_event = alc861vd_lenovo_unsol_event,
15001 .init_hook = alc861vd_lenovo_automute,
15006 * BIOS auto configuration
15008 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15009 hda_nid_t nid, int pin_type, int dac_idx)
15011 alc_set_pin_output(codec, nid, pin_type);
15014 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15016 struct alc_spec *spec = codec->spec;
15019 for (i = 0; i <= HDA_SIDE; i++) {
15020 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15021 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15023 alc861vd_auto_set_output_and_unmute(codec, nid,
15029 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15031 struct alc_spec *spec = codec->spec;
15034 pin = spec->autocfg.hp_pins[0];
15035 if (pin) /* connect to front and use dac 0 */
15036 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15037 pin = spec->autocfg.speaker_pins[0];
15039 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15042 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
15043 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15045 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15047 struct alc_spec *spec = codec->spec;
15050 for (i = 0; i < AUTO_PIN_LAST; i++) {
15051 hda_nid_t nid = spec->autocfg.input_pins[i];
15052 if (alc861vd_is_input_pin(nid)) {
15053 alc_set_input_pin(codec, nid, i);
15054 if (nid != ALC861VD_PIN_CD_NID &&
15055 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15056 snd_hda_codec_write(codec, nid, 0,
15057 AC_VERB_SET_AMP_GAIN_MUTE,
15063 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15065 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15066 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15068 /* add playback controls from the parsed DAC table */
15069 /* Based on ALC880 version. But ALC861VD has separate,
15070 * different NIDs for mute/unmute switch and volume control */
15071 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15072 const struct auto_pin_cfg *cfg)
15075 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15076 hda_nid_t nid_v, nid_s;
15079 for (i = 0; i < cfg->line_outs; i++) {
15080 if (!spec->multiout.dac_nids[i])
15082 nid_v = alc861vd_idx_to_mixer_vol(
15084 spec->multiout.dac_nids[i]));
15085 nid_s = alc861vd_idx_to_mixer_switch(
15087 spec->multiout.dac_nids[i]));
15091 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15092 "Center Playback Volume",
15093 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15097 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15098 "LFE Playback Volume",
15099 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15103 err = add_control(spec, ALC_CTL_BIND_MUTE,
15104 "Center Playback Switch",
15105 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15109 err = add_control(spec, ALC_CTL_BIND_MUTE,
15110 "LFE Playback Switch",
15111 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15116 sprintf(name, "%s Playback Volume", chname[i]);
15117 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15118 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15122 sprintf(name, "%s Playback Switch", chname[i]);
15123 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15124 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15133 /* add playback controls for speaker and HP outputs */
15134 /* Based on ALC880 version. But ALC861VD has separate,
15135 * different NIDs for mute/unmute switch and volume control */
15136 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15137 hda_nid_t pin, const char *pfx)
15139 hda_nid_t nid_v, nid_s;
15146 if (alc880_is_fixed_pin(pin)) {
15147 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15148 /* specify the DAC as the extra output */
15149 if (!spec->multiout.hp_nid)
15150 spec->multiout.hp_nid = nid_v;
15152 spec->multiout.extra_out_nid[0] = nid_v;
15153 /* control HP volume/switch on the output mixer amp */
15154 nid_v = alc861vd_idx_to_mixer_vol(
15155 alc880_fixed_pin_idx(pin));
15156 nid_s = alc861vd_idx_to_mixer_switch(
15157 alc880_fixed_pin_idx(pin));
15159 sprintf(name, "%s Playback Volume", pfx);
15160 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15161 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15164 sprintf(name, "%s Playback Switch", pfx);
15165 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15166 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15169 } else if (alc880_is_multi_pin(pin)) {
15170 /* set manual connection */
15171 /* we have only a switch on HP-out PIN */
15172 sprintf(name, "%s Playback Switch", pfx);
15173 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15174 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15181 /* parse the BIOS configuration and set up the alc_spec
15182 * return 1 if successful, 0 if the proper config is not found,
15183 * or a negative error code
15184 * Based on ALC880 version - had to change it to override
15185 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15186 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15188 struct alc_spec *spec = codec->spec;
15190 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15192 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15196 if (!spec->autocfg.line_outs)
15197 return 0; /* can't find valid BIOS pin config */
15199 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15202 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15205 err = alc861vd_auto_create_extra_out(spec,
15206 spec->autocfg.speaker_pins[0],
15210 err = alc861vd_auto_create_extra_out(spec,
15211 spec->autocfg.hp_pins[0],
15215 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15219 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15221 if (spec->autocfg.dig_outs)
15222 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15224 if (spec->kctls.list)
15225 add_mixer(spec, spec->kctls.list);
15227 add_verb(spec, alc861vd_volume_init_verbs);
15229 spec->num_mux_defs = 1;
15230 spec->input_mux = &spec->private_imux[0];
15232 err = alc_auto_add_mic_boost(codec);
15236 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15241 /* additional initialization for auto-configuration model */
15242 static void alc861vd_auto_init(struct hda_codec *codec)
15244 struct alc_spec *spec = codec->spec;
15245 alc861vd_auto_init_multi_out(codec);
15246 alc861vd_auto_init_hp_out(codec);
15247 alc861vd_auto_init_analog_input(codec);
15248 alc861vd_auto_init_input_src(codec);
15249 if (spec->unsol_event)
15250 alc_inithook(codec);
15253 static int patch_alc861vd(struct hda_codec *codec)
15255 struct alc_spec *spec;
15256 int err, board_config;
15258 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15262 codec->spec = spec;
15264 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15268 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15269 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
15270 "ALC861VD, trying auto-probe from BIOS...\n");
15271 board_config = ALC861VD_AUTO;
15274 if (board_config == ALC861VD_AUTO) {
15275 /* automatic parse from the BIOS config */
15276 err = alc861vd_parse_auto_config(codec);
15282 "hda_codec: Cannot set up configuration "
15283 "from BIOS. Using base mode...\n");
15284 board_config = ALC861VD_3ST;
15288 err = snd_hda_attach_beep_device(codec, 0x23);
15294 if (board_config != ALC861VD_AUTO)
15295 setup_preset(spec, &alc861vd_presets[board_config]);
15297 if (codec->vendor_id == 0x10ec0660) {
15298 spec->stream_name_analog = "ALC660-VD Analog";
15299 spec->stream_name_digital = "ALC660-VD Digital";
15300 /* always turn on EAPD */
15301 add_verb(spec, alc660vd_eapd_verbs);
15303 spec->stream_name_analog = "ALC861VD Analog";
15304 spec->stream_name_digital = "ALC861VD Digital";
15307 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15308 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15310 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15311 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15313 spec->adc_nids = alc861vd_adc_nids;
15314 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15315 spec->capsrc_nids = alc861vd_capsrc_nids;
15316 spec->capture_style = CAPT_MIX;
15318 set_capture_mixer(spec);
15319 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15321 spec->vmaster_nid = 0x02;
15323 codec->patch_ops = alc_patch_ops;
15325 if (board_config == ALC861VD_AUTO)
15326 spec->init_hook = alc861vd_auto_init;
15327 #ifdef CONFIG_SND_HDA_POWER_SAVE
15328 if (!spec->loopback.amplist)
15329 spec->loopback.amplist = alc861vd_loopbacks;
15331 codec->proc_widget_hook = print_realtek_coef;
15339 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15340 * configuration. Each pin widget can choose any input DACs and a mixer.
15341 * Each ADC is connected from a mixer of all inputs. This makes possible
15342 * 6-channel independent captures.
15344 * In addition, an independent DAC for the multi-playback (not used in this
15347 #define ALC662_DIGOUT_NID 0x06
15348 #define ALC662_DIGIN_NID 0x0a
15350 static hda_nid_t alc662_dac_nids[4] = {
15351 /* front, rear, clfe, rear_surr */
15355 static hda_nid_t alc272_dac_nids[2] = {
15359 static hda_nid_t alc662_adc_nids[1] = {
15364 static hda_nid_t alc272_adc_nids[1] = {
15369 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15370 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15374 /* FIXME: should be a matrix-type input source selection */
15375 static struct hda_input_mux alc662_capture_source = {
15379 { "Front Mic", 0x1 },
15385 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15393 static struct hda_input_mux alc662_eeepc_capture_source = {
15401 static struct hda_input_mux alc663_capture_source = {
15405 { "Front Mic", 0x1 },
15410 static struct hda_input_mux alc663_m51va_capture_source = {
15413 { "Ext-Mic", 0x0 },
15421 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15428 static struct hda_verb alc662_3ST_ch2_init[] = {
15429 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15430 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15431 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15432 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15439 static struct hda_verb alc662_3ST_ch6_init[] = {
15440 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15441 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15442 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15443 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15444 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15445 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15449 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15450 { 2, alc662_3ST_ch2_init },
15451 { 6, alc662_3ST_ch6_init },
15457 static struct hda_verb alc662_sixstack_ch6_init[] = {
15458 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15459 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15460 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15467 static struct hda_verb alc662_sixstack_ch8_init[] = {
15468 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15469 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15470 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15474 static struct hda_channel_mode alc662_5stack_modes[2] = {
15475 { 2, alc662_sixstack_ch6_init },
15476 { 6, alc662_sixstack_ch8_init },
15479 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15480 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15483 static struct snd_kcontrol_new alc662_base_mixer[] = {
15484 /* output mixer control */
15485 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15486 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15487 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15488 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15489 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15490 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15491 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15492 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15493 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15495 /*Input mixer control */
15496 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15497 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15498 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15499 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15500 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15501 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15502 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15503 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15507 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15508 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15509 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15510 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15511 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15512 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15513 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15514 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15515 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15516 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15517 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15518 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15522 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15523 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15524 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15525 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15526 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15527 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15528 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15529 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15530 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15531 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15532 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15533 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15534 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15535 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15537 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15538 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15539 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15543 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15544 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15545 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15546 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15547 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15548 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15549 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15550 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15551 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15552 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15556 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15557 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15558 ALC262_HIPPO_MASTER_SWITCH,
15560 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15561 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15562 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15564 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15565 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15566 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15570 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15571 ALC262_HIPPO_MASTER_SWITCH,
15572 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15573 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15574 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15575 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15576 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15577 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15578 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15579 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15580 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15584 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15585 .ops = &snd_hda_bind_vol,
15587 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15588 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15593 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15594 .ops = &snd_hda_bind_sw,
15596 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15597 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15602 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15603 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15604 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15605 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15606 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15610 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15611 .ops = &snd_hda_bind_sw,
15613 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15614 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15615 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15620 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15621 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15622 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15623 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15624 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15625 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15626 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15631 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15632 .ops = &snd_hda_bind_sw,
15634 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15635 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15636 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15641 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15642 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15643 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15644 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15645 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15646 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15647 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15651 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15652 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15653 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15654 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15657 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15658 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15662 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15663 .ops = &snd_hda_bind_vol,
15665 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15666 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15671 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15672 .ops = &snd_hda_bind_sw,
15674 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15675 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15680 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15681 HDA_BIND_VOL("Master Playback Volume",
15682 &alc663_asus_two_bind_master_vol),
15683 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15684 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15685 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15686 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15687 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15691 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15692 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15693 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15694 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15695 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15696 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15697 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15701 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15702 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15703 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15704 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15705 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15706 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15709 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15710 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15711 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15715 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15716 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15717 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15718 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15720 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15721 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15722 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15723 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15724 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15725 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15729 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15731 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15732 .name = "Channel Mode",
15733 .info = alc_ch_mode_info,
15734 .get = alc_ch_mode_get,
15735 .put = alc_ch_mode_put,
15740 static struct hda_verb alc662_init_verbs[] = {
15741 /* ADC: mute amp left and right */
15742 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15743 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15744 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15746 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15747 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15748 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15749 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15750 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15752 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15753 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15754 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15755 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15756 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15757 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15759 /* Front Pin: output 0 (0x0c) */
15760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15763 /* Rear Pin: output 1 (0x0d) */
15764 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15765 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15767 /* CLFE Pin: output 2 (0x0e) */
15768 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15769 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15771 /* Mic (rear) pin: input vref at 80% */
15772 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15773 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15774 /* Front Mic pin: input vref at 80% */
15775 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15776 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15777 /* Line In pin: input */
15778 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15779 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15780 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15781 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15782 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15783 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15784 /* CD pin widget for input */
15785 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15787 /* FIXME: use matrix-type input source selection */
15788 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15791 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15793 /* always trun on EAPD */
15794 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15795 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15800 static struct hda_verb alc662_sue_init_verbs[] = {
15801 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15802 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15806 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15807 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15808 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15812 /* Set Unsolicited Event*/
15813 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15814 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15815 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15820 * generic initialization of ADC, input mixers and output mixers
15822 static struct hda_verb alc662_auto_init_verbs[] = {
15824 * Unmute ADC and set the default input to mic-in
15826 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15827 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15829 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15831 * Note: PASD motherboards uses the Line In 2 as the input for front
15832 * panel mic (mic 2)
15834 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15835 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15837 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15838 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15839 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15842 * Set up output mixers (0x0c - 0x0f)
15844 /* set vol=0 to output mixers */
15845 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15846 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15847 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15849 /* set up input amps for analog loopback */
15850 /* Amp Indices: DAC = 0, mixer = 1 */
15851 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15852 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15853 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15854 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15855 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15856 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15859 /* FIXME: use matrix-type input source selection */
15860 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15862 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15863 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15867 /* additional verbs for ALC663 */
15868 static struct hda_verb alc663_auto_init_verbs[] = {
15869 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15870 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15874 static struct hda_verb alc663_m51va_init_verbs[] = {
15875 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15876 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15877 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15878 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15879 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15880 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15881 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15882 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15883 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15887 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15888 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15889 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15890 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15891 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15892 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15893 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15894 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15898 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15899 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15900 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15901 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15902 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15903 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15904 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15905 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15906 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15910 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15911 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15912 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15913 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15914 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15915 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15916 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15917 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15921 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15922 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15923 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15924 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15925 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15926 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15927 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15928 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15929 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15930 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15931 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15932 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15933 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15937 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15938 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15939 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15940 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15941 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15942 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15943 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15944 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15945 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15946 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15947 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15948 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15949 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15953 static struct hda_verb alc663_g71v_init_verbs[] = {
15954 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15955 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15956 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15958 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15959 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15960 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15962 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15963 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15964 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15968 static struct hda_verb alc663_g50v_init_verbs[] = {
15969 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15970 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15971 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15973 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15974 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15978 static struct hda_verb alc662_ecs_init_verbs[] = {
15979 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15980 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15981 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15982 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15986 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
15987 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15988 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15989 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15990 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15991 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15992 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15993 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15994 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15995 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15996 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15997 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16001 static struct hda_verb alc272_dell_init_verbs[] = {
16002 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16003 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16004 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16005 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16006 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16007 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16008 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16009 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16010 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16011 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16012 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16016 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16017 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16018 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16022 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16023 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16024 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16028 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16030 unsigned int present;
16031 unsigned char bits;
16033 present = snd_hda_codec_read(codec, 0x14, 0,
16034 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16035 bits = present ? HDA_AMP_MUTE : 0;
16036 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16037 HDA_AMP_MUTE, bits);
16040 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16042 unsigned int present;
16043 unsigned char bits;
16045 present = snd_hda_codec_read(codec, 0x1b, 0,
16046 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16047 bits = present ? HDA_AMP_MUTE : 0;
16048 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16049 HDA_AMP_MUTE, bits);
16050 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16051 HDA_AMP_MUTE, bits);
16054 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16057 if ((res >> 26) == ALC880_HP_EVENT)
16058 alc662_lenovo_101e_all_automute(codec);
16059 if ((res >> 26) == ALC880_FRONT_EVENT)
16060 alc662_lenovo_101e_ispeaker_automute(codec);
16063 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
16065 unsigned int present;
16067 present = snd_hda_codec_read(codec, 0x18, 0,
16068 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16069 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16070 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16071 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16072 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16073 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16074 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16075 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16076 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16079 /* unsolicited event for HP jack sensing */
16080 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16083 if ((res >> 26) == ALC880_MIC_EVENT)
16084 alc662_eeepc_mic_automute(codec);
16086 alc262_hippo_unsol_event(codec, res);
16089 static void alc662_eeepc_inithook(struct hda_codec *codec)
16091 alc262_hippo1_init_hook(codec);
16092 alc662_eeepc_mic_automute(codec);
16095 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
16097 struct alc_spec *spec = codec->spec;
16099 spec->autocfg.hp_pins[0] = 0x14;
16100 spec->autocfg.speaker_pins[0] = 0x1b;
16101 alc262_hippo_master_update(codec);
16104 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16106 unsigned int present;
16107 unsigned char bits;
16109 present = snd_hda_codec_read(codec, 0x21, 0,
16110 AC_VERB_GET_PIN_SENSE, 0)
16111 & AC_PINSENSE_PRESENCE;
16112 bits = present ? HDA_AMP_MUTE : 0;
16113 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16114 AMP_IN_MUTE(0), bits);
16115 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16116 AMP_IN_MUTE(0), bits);
16119 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16121 unsigned int present;
16122 unsigned char bits;
16124 present = snd_hda_codec_read(codec, 0x21, 0,
16125 AC_VERB_GET_PIN_SENSE, 0)
16126 & AC_PINSENSE_PRESENCE;
16127 bits = present ? HDA_AMP_MUTE : 0;
16128 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16129 AMP_IN_MUTE(0), bits);
16130 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16131 AMP_IN_MUTE(0), bits);
16132 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16133 AMP_IN_MUTE(0), bits);
16134 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16135 AMP_IN_MUTE(0), bits);
16138 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16140 unsigned int present;
16141 unsigned char bits;
16143 present = snd_hda_codec_read(codec, 0x15, 0,
16144 AC_VERB_GET_PIN_SENSE, 0)
16145 & AC_PINSENSE_PRESENCE;
16146 bits = present ? HDA_AMP_MUTE : 0;
16147 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16148 AMP_IN_MUTE(0), bits);
16149 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16150 AMP_IN_MUTE(0), bits);
16151 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16152 AMP_IN_MUTE(0), bits);
16153 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16154 AMP_IN_MUTE(0), bits);
16157 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16159 unsigned int present;
16160 unsigned char bits;
16162 present = snd_hda_codec_read(codec, 0x1b, 0,
16163 AC_VERB_GET_PIN_SENSE, 0)
16164 & AC_PINSENSE_PRESENCE;
16165 bits = present ? 0 : PIN_OUT;
16166 snd_hda_codec_write(codec, 0x14, 0,
16167 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16170 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16172 unsigned int present1, present2;
16174 present1 = snd_hda_codec_read(codec, 0x21, 0,
16175 AC_VERB_GET_PIN_SENSE, 0)
16176 & AC_PINSENSE_PRESENCE;
16177 present2 = snd_hda_codec_read(codec, 0x15, 0,
16178 AC_VERB_GET_PIN_SENSE, 0)
16179 & AC_PINSENSE_PRESENCE;
16181 if (present1 || present2) {
16182 snd_hda_codec_write_cache(codec, 0x14, 0,
16183 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16185 snd_hda_codec_write_cache(codec, 0x14, 0,
16186 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16190 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16192 unsigned int present1, present2;
16194 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16195 AC_VERB_GET_PIN_SENSE, 0)
16196 & AC_PINSENSE_PRESENCE;
16197 present2 = snd_hda_codec_read(codec, 0x15, 0,
16198 AC_VERB_GET_PIN_SENSE, 0)
16199 & AC_PINSENSE_PRESENCE;
16201 if (present1 || present2) {
16202 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16203 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16204 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16205 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16207 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16208 AMP_IN_MUTE(0), 0);
16209 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16210 AMP_IN_MUTE(0), 0);
16214 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16216 unsigned int present;
16218 present = snd_hda_codec_read(codec, 0x18, 0,
16219 AC_VERB_GET_PIN_SENSE, 0)
16220 & AC_PINSENSE_PRESENCE;
16221 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16222 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16223 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16224 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16225 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16226 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16227 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16228 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16231 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16234 switch (res >> 26) {
16235 case ALC880_HP_EVENT:
16236 alc663_m51va_speaker_automute(codec);
16238 case ALC880_MIC_EVENT:
16239 alc663_m51va_mic_automute(codec);
16244 static void alc663_m51va_inithook(struct hda_codec *codec)
16246 alc663_m51va_speaker_automute(codec);
16247 alc663_m51va_mic_automute(codec);
16250 /* ***************** Mode1 ******************************/
16251 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16254 switch (res >> 26) {
16255 case ALC880_HP_EVENT:
16256 alc663_m51va_speaker_automute(codec);
16258 case ALC880_MIC_EVENT:
16259 alc662_eeepc_mic_automute(codec);
16264 static void alc663_mode1_inithook(struct hda_codec *codec)
16266 alc663_m51va_speaker_automute(codec);
16267 alc662_eeepc_mic_automute(codec);
16269 /* ***************** Mode2 ******************************/
16270 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16273 switch (res >> 26) {
16274 case ALC880_HP_EVENT:
16275 alc662_f5z_speaker_automute(codec);
16277 case ALC880_MIC_EVENT:
16278 alc662_eeepc_mic_automute(codec);
16283 static void alc662_mode2_inithook(struct hda_codec *codec)
16285 alc662_f5z_speaker_automute(codec);
16286 alc662_eeepc_mic_automute(codec);
16288 /* ***************** Mode3 ******************************/
16289 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16292 switch (res >> 26) {
16293 case ALC880_HP_EVENT:
16294 alc663_two_hp_m1_speaker_automute(codec);
16296 case ALC880_MIC_EVENT:
16297 alc662_eeepc_mic_automute(codec);
16302 static void alc663_mode3_inithook(struct hda_codec *codec)
16304 alc663_two_hp_m1_speaker_automute(codec);
16305 alc662_eeepc_mic_automute(codec);
16307 /* ***************** Mode4 ******************************/
16308 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16311 switch (res >> 26) {
16312 case ALC880_HP_EVENT:
16313 alc663_21jd_two_speaker_automute(codec);
16315 case ALC880_MIC_EVENT:
16316 alc662_eeepc_mic_automute(codec);
16321 static void alc663_mode4_inithook(struct hda_codec *codec)
16323 alc663_21jd_two_speaker_automute(codec);
16324 alc662_eeepc_mic_automute(codec);
16326 /* ***************** Mode5 ******************************/
16327 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16330 switch (res >> 26) {
16331 case ALC880_HP_EVENT:
16332 alc663_15jd_two_speaker_automute(codec);
16334 case ALC880_MIC_EVENT:
16335 alc662_eeepc_mic_automute(codec);
16340 static void alc663_mode5_inithook(struct hda_codec *codec)
16342 alc663_15jd_two_speaker_automute(codec);
16343 alc662_eeepc_mic_automute(codec);
16345 /* ***************** Mode6 ******************************/
16346 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16349 switch (res >> 26) {
16350 case ALC880_HP_EVENT:
16351 alc663_two_hp_m2_speaker_automute(codec);
16353 case ALC880_MIC_EVENT:
16354 alc662_eeepc_mic_automute(codec);
16359 static void alc663_mode6_inithook(struct hda_codec *codec)
16361 alc663_two_hp_m2_speaker_automute(codec);
16362 alc662_eeepc_mic_automute(codec);
16365 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16367 unsigned int present;
16368 unsigned char bits;
16370 present = snd_hda_codec_read(codec, 0x21, 0,
16371 AC_VERB_GET_PIN_SENSE, 0)
16372 & AC_PINSENSE_PRESENCE;
16373 bits = present ? HDA_AMP_MUTE : 0;
16374 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16375 HDA_AMP_MUTE, bits);
16376 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16377 HDA_AMP_MUTE, bits);
16380 static void alc663_g71v_front_automute(struct hda_codec *codec)
16382 unsigned int present;
16383 unsigned char bits;
16385 present = snd_hda_codec_read(codec, 0x15, 0,
16386 AC_VERB_GET_PIN_SENSE, 0)
16387 & AC_PINSENSE_PRESENCE;
16388 bits = present ? HDA_AMP_MUTE : 0;
16389 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16390 HDA_AMP_MUTE, bits);
16393 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16396 switch (res >> 26) {
16397 case ALC880_HP_EVENT:
16398 alc663_g71v_hp_automute(codec);
16400 case ALC880_FRONT_EVENT:
16401 alc663_g71v_front_automute(codec);
16403 case ALC880_MIC_EVENT:
16404 alc662_eeepc_mic_automute(codec);
16409 static void alc663_g71v_inithook(struct hda_codec *codec)
16411 alc663_g71v_front_automute(codec);
16412 alc663_g71v_hp_automute(codec);
16413 alc662_eeepc_mic_automute(codec);
16416 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16419 switch (res >> 26) {
16420 case ALC880_HP_EVENT:
16421 alc663_m51va_speaker_automute(codec);
16423 case ALC880_MIC_EVENT:
16424 alc662_eeepc_mic_automute(codec);
16429 static void alc663_g50v_inithook(struct hda_codec *codec)
16431 alc663_m51va_speaker_automute(codec);
16432 alc662_eeepc_mic_automute(codec);
16435 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16436 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16437 ALC262_HIPPO_MASTER_SWITCH,
16439 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16440 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16441 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16443 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16444 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16445 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16449 #ifdef CONFIG_SND_HDA_POWER_SAVE
16450 #define alc662_loopbacks alc880_loopbacks
16454 /* pcm configuration: identiacal with ALC880 */
16455 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16456 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16457 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16458 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16461 * configuration and preset
16463 static const char *alc662_models[ALC662_MODEL_LAST] = {
16464 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16465 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16466 [ALC662_3ST_6ch] = "3stack-6ch",
16467 [ALC662_5ST_DIG] = "6stack-dig",
16468 [ALC662_LENOVO_101E] = "lenovo-101e",
16469 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16470 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16471 [ALC662_ECS] = "ecs",
16472 [ALC663_ASUS_M51VA] = "m51va",
16473 [ALC663_ASUS_G71V] = "g71v",
16474 [ALC663_ASUS_H13] = "h13",
16475 [ALC663_ASUS_G50V] = "g50v",
16476 [ALC663_ASUS_MODE1] = "asus-mode1",
16477 [ALC662_ASUS_MODE2] = "asus-mode2",
16478 [ALC663_ASUS_MODE3] = "asus-mode3",
16479 [ALC663_ASUS_MODE4] = "asus-mode4",
16480 [ALC663_ASUS_MODE5] = "asus-mode5",
16481 [ALC663_ASUS_MODE6] = "asus-mode6",
16482 [ALC662_AUTO] = "auto",
16485 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16486 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16487 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16488 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16489 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16490 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16491 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16492 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16493 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16494 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16495 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16496 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16497 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16498 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16499 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16500 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16501 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16502 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16503 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16504 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16505 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16506 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16507 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16508 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16509 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16510 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16511 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16512 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16513 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16514 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16515 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16516 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16517 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16518 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16519 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16520 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16521 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16522 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16523 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16524 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16525 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16526 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16527 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16528 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16529 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16530 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16531 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16532 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16533 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16534 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16535 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16536 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16537 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16538 ALC662_3ST_6ch_DIG),
16539 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16540 ALC662_3ST_6ch_DIG),
16541 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16542 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16543 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16544 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16545 ALC662_3ST_6ch_DIG),
16546 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16551 static struct alc_config_preset alc662_presets[] = {
16552 [ALC662_3ST_2ch_DIG] = {
16553 .mixers = { alc662_3ST_2ch_mixer },
16554 .init_verbs = { alc662_init_verbs },
16555 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16556 .dac_nids = alc662_dac_nids,
16557 .dig_out_nid = ALC662_DIGOUT_NID,
16558 .dig_in_nid = ALC662_DIGIN_NID,
16559 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16560 .channel_mode = alc662_3ST_2ch_modes,
16561 .input_mux = &alc662_capture_source,
16563 [ALC662_3ST_6ch_DIG] = {
16564 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16565 .init_verbs = { alc662_init_verbs },
16566 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16567 .dac_nids = alc662_dac_nids,
16568 .dig_out_nid = ALC662_DIGOUT_NID,
16569 .dig_in_nid = ALC662_DIGIN_NID,
16570 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16571 .channel_mode = alc662_3ST_6ch_modes,
16573 .input_mux = &alc662_capture_source,
16575 [ALC662_3ST_6ch] = {
16576 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16577 .init_verbs = { alc662_init_verbs },
16578 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16579 .dac_nids = alc662_dac_nids,
16580 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16581 .channel_mode = alc662_3ST_6ch_modes,
16583 .input_mux = &alc662_capture_source,
16585 [ALC662_5ST_DIG] = {
16586 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16587 .init_verbs = { alc662_init_verbs },
16588 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16589 .dac_nids = alc662_dac_nids,
16590 .dig_out_nid = ALC662_DIGOUT_NID,
16591 .dig_in_nid = ALC662_DIGIN_NID,
16592 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16593 .channel_mode = alc662_5stack_modes,
16594 .input_mux = &alc662_capture_source,
16596 [ALC662_LENOVO_101E] = {
16597 .mixers = { alc662_lenovo_101e_mixer },
16598 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16599 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16600 .dac_nids = alc662_dac_nids,
16601 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16602 .channel_mode = alc662_3ST_2ch_modes,
16603 .input_mux = &alc662_lenovo_101e_capture_source,
16604 .unsol_event = alc662_lenovo_101e_unsol_event,
16605 .init_hook = alc662_lenovo_101e_all_automute,
16607 [ALC662_ASUS_EEEPC_P701] = {
16608 .mixers = { alc662_eeepc_p701_mixer },
16609 .init_verbs = { alc662_init_verbs,
16610 alc662_eeepc_sue_init_verbs },
16611 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16612 .dac_nids = alc662_dac_nids,
16613 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16614 .channel_mode = alc662_3ST_2ch_modes,
16615 .input_mux = &alc662_eeepc_capture_source,
16616 .unsol_event = alc662_eeepc_unsol_event,
16617 .init_hook = alc662_eeepc_inithook,
16619 [ALC662_ASUS_EEEPC_EP20] = {
16620 .mixers = { alc662_eeepc_ep20_mixer,
16621 alc662_chmode_mixer },
16622 .init_verbs = { alc662_init_verbs,
16623 alc662_eeepc_ep20_sue_init_verbs },
16624 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16625 .dac_nids = alc662_dac_nids,
16626 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16627 .channel_mode = alc662_3ST_6ch_modes,
16628 .input_mux = &alc662_lenovo_101e_capture_source,
16629 .unsol_event = alc662_eeepc_unsol_event,
16630 .init_hook = alc662_eeepc_ep20_inithook,
16633 .mixers = { alc662_ecs_mixer },
16634 .init_verbs = { alc662_init_verbs,
16635 alc662_ecs_init_verbs },
16636 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16637 .dac_nids = alc662_dac_nids,
16638 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16639 .channel_mode = alc662_3ST_2ch_modes,
16640 .input_mux = &alc662_eeepc_capture_source,
16641 .unsol_event = alc662_eeepc_unsol_event,
16642 .init_hook = alc662_eeepc_inithook,
16644 [ALC663_ASUS_M51VA] = {
16645 .mixers = { alc663_m51va_mixer },
16646 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16647 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16648 .dac_nids = alc662_dac_nids,
16649 .dig_out_nid = ALC662_DIGOUT_NID,
16650 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16651 .channel_mode = alc662_3ST_2ch_modes,
16652 .input_mux = &alc663_m51va_capture_source,
16653 .unsol_event = alc663_m51va_unsol_event,
16654 .init_hook = alc663_m51va_inithook,
16656 [ALC663_ASUS_G71V] = {
16657 .mixers = { alc663_g71v_mixer },
16658 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16659 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16660 .dac_nids = alc662_dac_nids,
16661 .dig_out_nid = ALC662_DIGOUT_NID,
16662 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16663 .channel_mode = alc662_3ST_2ch_modes,
16664 .input_mux = &alc662_eeepc_capture_source,
16665 .unsol_event = alc663_g71v_unsol_event,
16666 .init_hook = alc663_g71v_inithook,
16668 [ALC663_ASUS_H13] = {
16669 .mixers = { alc663_m51va_mixer },
16670 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16671 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16672 .dac_nids = alc662_dac_nids,
16673 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16674 .channel_mode = alc662_3ST_2ch_modes,
16675 .input_mux = &alc663_m51va_capture_source,
16676 .unsol_event = alc663_m51va_unsol_event,
16677 .init_hook = alc663_m51va_inithook,
16679 [ALC663_ASUS_G50V] = {
16680 .mixers = { alc663_g50v_mixer },
16681 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16682 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16683 .dac_nids = alc662_dac_nids,
16684 .dig_out_nid = ALC662_DIGOUT_NID,
16685 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16686 .channel_mode = alc662_3ST_6ch_modes,
16687 .input_mux = &alc663_capture_source,
16688 .unsol_event = alc663_g50v_unsol_event,
16689 .init_hook = alc663_g50v_inithook,
16691 [ALC663_ASUS_MODE1] = {
16692 .mixers = { alc663_m51va_mixer },
16693 .cap_mixer = alc662_auto_capture_mixer,
16694 .init_verbs = { alc662_init_verbs,
16695 alc663_21jd_amic_init_verbs },
16696 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16698 .dac_nids = alc662_dac_nids,
16699 .dig_out_nid = ALC662_DIGOUT_NID,
16700 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16701 .channel_mode = alc662_3ST_2ch_modes,
16702 .input_mux = &alc662_eeepc_capture_source,
16703 .unsol_event = alc663_mode1_unsol_event,
16704 .init_hook = alc663_mode1_inithook,
16706 [ALC662_ASUS_MODE2] = {
16707 .mixers = { alc662_1bjd_mixer },
16708 .cap_mixer = alc662_auto_capture_mixer,
16709 .init_verbs = { alc662_init_verbs,
16710 alc662_1bjd_amic_init_verbs },
16711 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16712 .dac_nids = alc662_dac_nids,
16713 .dig_out_nid = ALC662_DIGOUT_NID,
16714 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16715 .channel_mode = alc662_3ST_2ch_modes,
16716 .input_mux = &alc662_eeepc_capture_source,
16717 .unsol_event = alc662_mode2_unsol_event,
16718 .init_hook = alc662_mode2_inithook,
16720 [ALC663_ASUS_MODE3] = {
16721 .mixers = { alc663_two_hp_m1_mixer },
16722 .cap_mixer = alc662_auto_capture_mixer,
16723 .init_verbs = { alc662_init_verbs,
16724 alc663_two_hp_amic_m1_init_verbs },
16725 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16727 .dac_nids = alc662_dac_nids,
16728 .dig_out_nid = ALC662_DIGOUT_NID,
16729 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16730 .channel_mode = alc662_3ST_2ch_modes,
16731 .input_mux = &alc662_eeepc_capture_source,
16732 .unsol_event = alc663_mode3_unsol_event,
16733 .init_hook = alc663_mode3_inithook,
16735 [ALC663_ASUS_MODE4] = {
16736 .mixers = { alc663_asus_21jd_clfe_mixer },
16737 .cap_mixer = alc662_auto_capture_mixer,
16738 .init_verbs = { alc662_init_verbs,
16739 alc663_21jd_amic_init_verbs},
16740 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16742 .dac_nids = alc662_dac_nids,
16743 .dig_out_nid = ALC662_DIGOUT_NID,
16744 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16745 .channel_mode = alc662_3ST_2ch_modes,
16746 .input_mux = &alc662_eeepc_capture_source,
16747 .unsol_event = alc663_mode4_unsol_event,
16748 .init_hook = alc663_mode4_inithook,
16750 [ALC663_ASUS_MODE5] = {
16751 .mixers = { alc663_asus_15jd_clfe_mixer },
16752 .cap_mixer = alc662_auto_capture_mixer,
16753 .init_verbs = { alc662_init_verbs,
16754 alc663_15jd_amic_init_verbs },
16755 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16757 .dac_nids = alc662_dac_nids,
16758 .dig_out_nid = ALC662_DIGOUT_NID,
16759 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16760 .channel_mode = alc662_3ST_2ch_modes,
16761 .input_mux = &alc662_eeepc_capture_source,
16762 .unsol_event = alc663_mode5_unsol_event,
16763 .init_hook = alc663_mode5_inithook,
16765 [ALC663_ASUS_MODE6] = {
16766 .mixers = { alc663_two_hp_m2_mixer },
16767 .cap_mixer = alc662_auto_capture_mixer,
16768 .init_verbs = { alc662_init_verbs,
16769 alc663_two_hp_amic_m2_init_verbs },
16770 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16772 .dac_nids = alc662_dac_nids,
16773 .dig_out_nid = ALC662_DIGOUT_NID,
16774 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16775 .channel_mode = alc662_3ST_2ch_modes,
16776 .input_mux = &alc662_eeepc_capture_source,
16777 .unsol_event = alc663_mode6_unsol_event,
16778 .init_hook = alc663_mode6_inithook,
16781 .mixers = { alc663_m51va_mixer },
16782 .cap_mixer = alc272_auto_capture_mixer,
16783 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16784 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16785 .dac_nids = alc662_dac_nids,
16786 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16787 .adc_nids = alc272_adc_nids,
16788 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16789 .capsrc_nids = alc272_capsrc_nids,
16790 .channel_mode = alc662_3ST_2ch_modes,
16791 .input_mux = &alc663_m51va_capture_source,
16792 .unsol_event = alc663_m51va_unsol_event,
16793 .init_hook = alc663_m51va_inithook,
16795 [ALC272_DELL_ZM1] = {
16796 .mixers = { alc663_m51va_mixer },
16797 .cap_mixer = alc662_auto_capture_mixer,
16798 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16799 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16800 .dac_nids = alc662_dac_nids,
16801 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16802 .adc_nids = alc662_adc_nids,
16803 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
16804 .capsrc_nids = alc662_capsrc_nids,
16805 .channel_mode = alc662_3ST_2ch_modes,
16806 .input_mux = &alc663_m51va_capture_source,
16807 .unsol_event = alc663_m51va_unsol_event,
16808 .init_hook = alc663_m51va_inithook,
16814 * BIOS auto configuration
16817 /* add playback controls from the parsed DAC table */
16818 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16819 const struct auto_pin_cfg *cfg)
16822 static const char *chname[4] = {
16823 "Front", "Surround", NULL /*CLFE*/, "Side"
16828 for (i = 0; i < cfg->line_outs; i++) {
16829 if (!spec->multiout.dac_nids[i])
16831 nid = alc880_idx_to_dac(i);
16834 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16835 "Center Playback Volume",
16836 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16840 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16841 "LFE Playback Volume",
16842 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16846 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16847 "Center Playback Switch",
16848 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16852 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16853 "LFE Playback Switch",
16854 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16859 sprintf(name, "%s Playback Volume", chname[i]);
16860 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16861 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16865 sprintf(name, "%s Playback Switch", chname[i]);
16866 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16867 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16876 /* add playback controls for speaker and HP outputs */
16877 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16888 /* ALC663 has a mono output pin on 0x17 */
16889 sprintf(name, "%s Playback Switch", pfx);
16890 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16891 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16895 if (alc880_is_fixed_pin(pin)) {
16896 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16897 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16898 /* specify the DAC as the extra output */
16899 if (!spec->multiout.hp_nid)
16900 spec->multiout.hp_nid = nid;
16902 spec->multiout.extra_out_nid[0] = nid;
16903 /* control HP volume/switch on the output mixer amp */
16904 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16905 sprintf(name, "%s Playback Volume", pfx);
16906 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16907 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16910 sprintf(name, "%s Playback Switch", pfx);
16911 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16912 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16915 } else if (alc880_is_multi_pin(pin)) {
16916 /* set manual connection */
16917 /* we have only a switch on HP-out PIN */
16918 sprintf(name, "%s Playback Switch", pfx);
16919 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16920 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16927 /* return the index of the src widget from the connection list of the nid.
16928 * return -1 if not found
16930 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
16933 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
16936 conns = snd_hda_get_connections(codec, nid, conn_list,
16937 ARRAY_SIZE(conn_list));
16940 for (i = 0; i < conns; i++)
16941 if (conn_list[i] == src)
16946 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
16948 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
16949 return (pincap & AC_PINCAP_IN) != 0;
16952 /* create playback/capture controls for input pins */
16953 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
16954 const struct auto_pin_cfg *cfg)
16956 struct alc_spec *spec = codec->spec;
16957 struct hda_input_mux *imux = &spec->private_imux[0];
16960 for (i = 0; i < AUTO_PIN_LAST; i++) {
16961 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
16962 idx = alc662_input_pin_idx(codec, 0x0b,
16963 cfg->input_pins[i]);
16965 err = new_analog_input(spec, cfg->input_pins[i],
16966 auto_pin_cfg_labels[i],
16971 idx = alc662_input_pin_idx(codec, 0x22,
16972 cfg->input_pins[i]);
16974 imux->items[imux->num_items].label =
16975 auto_pin_cfg_labels[i];
16976 imux->items[imux->num_items].index = idx;
16984 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16985 hda_nid_t nid, int pin_type,
16988 alc_set_pin_output(codec, nid, pin_type);
16989 /* need the manual connection? */
16990 if (alc880_is_multi_pin(nid)) {
16991 struct alc_spec *spec = codec->spec;
16992 int idx = alc880_multi_pin_idx(nid);
16993 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16994 AC_VERB_SET_CONNECT_SEL,
16995 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16999 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17001 struct alc_spec *spec = codec->spec;
17004 for (i = 0; i <= HDA_SIDE; i++) {
17005 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17006 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17008 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17013 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17015 struct alc_spec *spec = codec->spec;
17018 pin = spec->autocfg.hp_pins[0];
17019 if (pin) /* connect to front */
17021 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17022 pin = spec->autocfg.speaker_pins[0];
17024 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17027 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17029 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17031 struct alc_spec *spec = codec->spec;
17034 for (i = 0; i < AUTO_PIN_LAST; i++) {
17035 hda_nid_t nid = spec->autocfg.input_pins[i];
17036 if (alc662_is_input_pin(codec, nid)) {
17037 alc_set_input_pin(codec, nid, i);
17038 if (nid != ALC662_PIN_CD_NID &&
17039 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17040 snd_hda_codec_write(codec, nid, 0,
17041 AC_VERB_SET_AMP_GAIN_MUTE,
17047 #define alc662_auto_init_input_src alc882_auto_init_input_src
17049 static int alc662_parse_auto_config(struct hda_codec *codec)
17051 struct alc_spec *spec = codec->spec;
17053 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17055 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17059 if (!spec->autocfg.line_outs)
17060 return 0; /* can't find valid BIOS pin config */
17062 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17065 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17068 err = alc662_auto_create_extra_out(spec,
17069 spec->autocfg.speaker_pins[0],
17073 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17077 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
17081 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17083 if (spec->autocfg.dig_outs)
17084 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17086 if (spec->kctls.list)
17087 add_mixer(spec, spec->kctls.list);
17089 spec->num_mux_defs = 1;
17090 spec->input_mux = &spec->private_imux[0];
17092 add_verb(spec, alc662_auto_init_verbs);
17093 if (codec->vendor_id == 0x10ec0663)
17094 add_verb(spec, alc663_auto_init_verbs);
17096 err = alc_auto_add_mic_boost(codec);
17100 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17105 /* additional initialization for auto-configuration model */
17106 static void alc662_auto_init(struct hda_codec *codec)
17108 struct alc_spec *spec = codec->spec;
17109 alc662_auto_init_multi_out(codec);
17110 alc662_auto_init_hp_out(codec);
17111 alc662_auto_init_analog_input(codec);
17112 alc662_auto_init_input_src(codec);
17113 if (spec->unsol_event)
17114 alc_inithook(codec);
17117 static int patch_alc662(struct hda_codec *codec)
17119 struct alc_spec *spec;
17120 int err, board_config;
17122 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17126 codec->spec = spec;
17128 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17130 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17133 if (board_config < 0) {
17134 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
17135 "trying auto-probe from BIOS...\n");
17136 board_config = ALC662_AUTO;
17139 if (board_config == ALC662_AUTO) {
17140 /* automatic parse from the BIOS config */
17141 err = alc662_parse_auto_config(codec);
17147 "hda_codec: Cannot set up configuration "
17148 "from BIOS. Using base mode...\n");
17149 board_config = ALC662_3ST_2ch_DIG;
17153 err = snd_hda_attach_beep_device(codec, 0x1);
17159 if (board_config != ALC662_AUTO)
17160 setup_preset(spec, &alc662_presets[board_config]);
17162 if (codec->vendor_id == 0x10ec0663) {
17163 spec->stream_name_analog = "ALC663 Analog";
17164 spec->stream_name_digital = "ALC663 Digital";
17165 } else if (codec->vendor_id == 0x10ec0272) {
17166 spec->stream_name_analog = "ALC272 Analog";
17167 spec->stream_name_digital = "ALC272 Digital";
17169 spec->stream_name_analog = "ALC662 Analog";
17170 spec->stream_name_digital = "ALC662 Digital";
17173 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17174 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17176 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17177 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17179 spec->adc_nids = alc662_adc_nids;
17180 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17181 spec->capsrc_nids = alc662_capsrc_nids;
17182 spec->capture_style = CAPT_MIX;
17184 if (!spec->cap_mixer)
17185 set_capture_mixer(spec);
17186 if (codec->vendor_id == 0x10ec0662)
17187 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17189 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17191 spec->vmaster_nid = 0x02;
17193 codec->patch_ops = alc_patch_ops;
17194 if (board_config == ALC662_AUTO)
17195 spec->init_hook = alc662_auto_init;
17196 #ifdef CONFIG_SND_HDA_POWER_SAVE
17197 if (!spec->loopback.amplist)
17198 spec->loopback.amplist = alc662_loopbacks;
17200 codec->proc_widget_hook = print_realtek_coef;
17208 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17209 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17210 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17211 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17212 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17213 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17214 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17215 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17216 .patch = patch_alc861 },
17217 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17218 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17219 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17220 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17221 .patch = patch_alc883 },
17222 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17223 .patch = patch_alc662 },
17224 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17225 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17226 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17227 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
17228 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17229 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17230 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17231 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17232 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17233 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
17234 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17235 .patch = patch_alc883 },
17236 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
17237 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
17238 {} /* terminator */
17241 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17243 MODULE_LICENSE("GPL");
17244 MODULE_DESCRIPTION("Realtek HD-audio codec");
17246 static struct hda_codec_preset_list realtek_list = {
17247 .preset = snd_hda_preset_realtek,
17248 .owner = THIS_MODULE,
17251 static int __init patch_realtek_init(void)
17253 return snd_hda_add_codec_preset(&realtek_list);
17256 static void __exit patch_realtek_exit(void)
17258 snd_hda_delete_codec_preset(&realtek_list);
17261 module_init(patch_realtek_init)
17262 module_exit(patch_realtek_exit)