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 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9594 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9595 struct snd_ctl_elem_value *ucontrol)
9597 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9598 struct alc_spec *spec = codec->spec;
9599 int val = !!*ucontrol->value.integer.value;
9601 if (val == spec->master_sw)
9603 spec->master_sw = val;
9604 alc262_hp_master_update(codec);
9608 #define ALC262_HP_MASTER_SWITCH \
9610 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9611 .name = "Master Playback Switch", \
9612 .info = snd_ctl_boolean_mono_info, \
9613 .get = alc262_hp_master_sw_get, \
9614 .put = alc262_hp_master_sw_put, \
9617 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9618 ALC262_HP_MASTER_SWITCH,
9619 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9620 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9621 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9622 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9624 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9626 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9627 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9628 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9629 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9630 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9631 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9632 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9633 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9634 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9635 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9636 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9637 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9641 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9642 ALC262_HP_MASTER_SWITCH,
9643 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9644 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9645 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9646 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9647 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9649 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9651 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9652 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9653 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9654 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9655 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9656 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9657 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9661 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9662 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9663 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9664 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9668 /* mute/unmute internal speaker according to the hp jack and mute state */
9669 static void alc262_hp_t5735_automute(struct hda_codec *codec)
9671 struct alc_spec *spec = codec->spec;
9672 unsigned int present;
9674 present = snd_hda_codec_read(codec, 0x15, 0,
9675 AC_VERB_GET_PIN_SENSE, 0);
9676 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9677 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9678 spec->jack_present ? HDA_AMP_MUTE : 0);
9681 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9684 if ((res >> 26) != ALC880_HP_EVENT)
9686 alc262_hp_t5735_automute(codec);
9689 #define alc262_hp_t5735_init_hook alc262_hp_t5735_automute
9691 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9692 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9693 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9694 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9695 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9696 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9697 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9698 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9702 static struct hda_verb alc262_hp_t5735_verbs[] = {
9703 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9704 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9706 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9710 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9711 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9712 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9713 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9714 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9715 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9716 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9720 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9721 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9722 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9723 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9724 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9725 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9726 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9727 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9728 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9729 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9730 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9734 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9741 /* bind hp and internal speaker mute (with plug check) as master switch */
9742 static void alc262_hippo_master_update(struct hda_codec *codec)
9744 struct alc_spec *spec = codec->spec;
9745 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9746 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9747 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9751 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
9752 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
9753 HDA_AMP_MUTE, mute);
9754 /* mute internal speaker per jack sense */
9755 if (spec->jack_present)
9756 mute = HDA_AMP_MUTE;
9758 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
9759 HDA_AMP_MUTE, mute);
9760 if (speaker_nid && speaker_nid != line_nid)
9761 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
9762 HDA_AMP_MUTE, mute);
9765 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
9767 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
9768 struct snd_ctl_elem_value *ucontrol)
9770 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9771 struct alc_spec *spec = codec->spec;
9772 int val = !!*ucontrol->value.integer.value;
9774 if (val == spec->master_sw)
9776 spec->master_sw = val;
9777 alc262_hippo_master_update(codec);
9781 #define ALC262_HIPPO_MASTER_SWITCH \
9783 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9784 .name = "Master Playback Switch", \
9785 .info = snd_ctl_boolean_mono_info, \
9786 .get = alc262_hippo_master_sw_get, \
9787 .put = alc262_hippo_master_sw_put, \
9790 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
9791 ALC262_HIPPO_MASTER_SWITCH,
9792 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9793 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9794 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9795 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9796 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9798 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9799 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9800 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9801 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9802 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9803 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9807 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9808 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9809 ALC262_HIPPO_MASTER_SWITCH,
9810 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9811 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9812 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9813 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9814 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9815 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9816 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9817 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9818 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9819 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9823 /* mute/unmute internal speaker according to the hp jack and mute state */
9824 static void alc262_hippo_automute(struct hda_codec *codec)
9826 struct alc_spec *spec = codec->spec;
9827 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9828 unsigned int present;
9830 /* need to execute and sync at first */
9831 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
9832 present = snd_hda_codec_read(codec, hp_nid, 0,
9833 AC_VERB_GET_PIN_SENSE, 0);
9834 spec->jack_present = (present & 0x80000000) != 0;
9835 alc262_hippo_master_update(codec);
9838 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
9840 if ((res >> 26) != ALC880_HP_EVENT)
9842 alc262_hippo_automute(codec);
9845 static void alc262_hippo_init_hook(struct hda_codec *codec)
9847 struct alc_spec *spec = codec->spec;
9849 spec->autocfg.hp_pins[0] = 0x15;
9850 spec->autocfg.speaker_pins[0] = 0x14;
9851 alc262_hippo_automute(codec);
9854 static void alc262_hippo1_init_hook(struct hda_codec *codec)
9856 struct alc_spec *spec = codec->spec;
9858 spec->autocfg.hp_pins[0] = 0x1b;
9859 spec->autocfg.speaker_pins[0] = 0x14;
9860 alc262_hippo_automute(codec);
9864 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9865 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9866 ALC262_HIPPO_MASTER_SWITCH,
9867 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9868 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9869 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9870 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9874 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9875 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9876 ALC262_HIPPO_MASTER_SWITCH,
9877 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9880 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9881 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9885 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9886 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9887 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9888 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9889 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9890 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9891 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9894 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9895 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9896 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9897 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9901 static struct hda_verb alc262_tyan_verbs[] = {
9902 /* Headphone automute */
9903 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9904 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9905 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9907 /* P11 AUX_IN, white 4-pin connector */
9908 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9909 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9910 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9911 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9916 /* unsolicited event for HP jack sensing */
9917 static void alc262_tyan_automute(struct hda_codec *codec)
9920 unsigned int present;
9922 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9923 present = snd_hda_codec_read(codec, 0x1b, 0,
9924 AC_VERB_GET_PIN_SENSE, 0);
9925 present = (present & 0x80000000) != 0;
9927 /* mute line output on ATX panel */
9928 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9929 HDA_AMP_MUTE, HDA_AMP_MUTE);
9931 /* unmute line output if necessary */
9932 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9933 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9934 HDA_AMP_MUTE, mute);
9938 static void alc262_tyan_unsol_event(struct hda_codec *codec,
9941 if ((res >> 26) != ALC880_HP_EVENT)
9943 alc262_tyan_automute(codec);
9946 #define alc262_capture_mixer alc882_capture_mixer
9947 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9950 * generic initialization of ADC, input mixers and output mixers
9952 static struct hda_verb alc262_init_verbs[] = {
9954 * Unmute ADC0-2 and set the default input to mic-in
9956 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9957 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9958 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9959 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9960 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9961 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9963 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9965 * Note: PASD motherboards uses the Line In 2 as the input for
9966 * front panel mic (mic 2)
9968 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9969 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9970 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9971 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9972 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9973 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9976 * Set up output mixers (0x0c - 0x0e)
9978 /* set vol=0 to output mixers */
9979 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9980 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9981 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9982 /* set up input amps for analog loopback */
9983 /* Amp Indices: DAC = 0, mixer = 1 */
9984 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9985 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9986 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9987 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9988 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9989 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9991 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9992 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9993 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9994 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9995 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9996 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9998 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9999 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10000 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10001 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10002 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10004 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10005 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10007 /* FIXME: use matrix-type input source selection */
10008 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10009 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10010 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10011 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10012 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10013 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10015 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10016 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10017 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10018 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10020 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10021 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10022 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10023 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10028 static struct hda_verb alc262_eapd_verbs[] = {
10029 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10030 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10034 static struct hda_verb alc262_hippo_unsol_verbs[] = {
10035 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10036 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10040 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10041 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10042 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10043 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10045 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10046 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10050 static struct hda_verb alc262_sony_unsol_verbs[] = {
10051 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10052 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10053 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10055 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10056 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10060 static struct hda_input_mux alc262_dmic_capture_source = {
10063 { "Int DMic", 0x9 },
10068 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10069 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10070 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10071 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10072 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10073 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10077 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10078 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10079 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10080 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10081 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10082 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10083 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10084 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10085 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10089 static void alc262_dmic_automute(struct hda_codec *codec)
10091 unsigned int present;
10093 present = snd_hda_codec_read(codec, 0x18, 0,
10094 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10095 snd_hda_codec_write(codec, 0x22, 0,
10096 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
10099 /* toggle speaker-output according to the hp-jack state */
10100 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
10102 unsigned int present;
10103 unsigned char bits;
10105 present = snd_hda_codec_read(codec, 0x15, 0,
10106 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10107 bits = present ? 0 : PIN_OUT;
10108 snd_hda_codec_write(codec, 0x14, 0,
10109 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
10114 /* unsolicited event for HP jack sensing */
10115 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
10118 if ((res >> 26) == ALC880_HP_EVENT)
10119 alc262_toshiba_s06_speaker_automute(codec);
10120 if ((res >> 26) == ALC880_MIC_EVENT)
10121 alc262_dmic_automute(codec);
10125 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
10127 alc262_toshiba_s06_speaker_automute(codec);
10128 alc262_dmic_automute(codec);
10134 * 0x16 = internal speaker
10135 * 0x18 = external mic
10138 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10139 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10140 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10143 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10144 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10146 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10147 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10151 static struct hda_verb alc262_nec_verbs[] = {
10152 /* Unmute Speaker */
10153 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10156 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10157 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10159 /* External mic to headphone */
10160 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10161 /* External mic to speaker */
10162 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10168 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10169 * 0x1b = port replicator headphone out
10172 #define ALC_HP_EVENT 0x37
10174 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10175 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10176 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10177 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10178 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10182 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10183 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10184 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10188 static struct hda_input_mux alc262_fujitsu_capture_source = {
10192 { "Int Mic", 0x1 },
10197 static struct hda_input_mux alc262_HP_capture_source = {
10201 { "Front Mic", 0x1 },
10208 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10212 { "Front Mic", 0x2 },
10218 /* mute/unmute internal speaker according to the hp jacks and mute state */
10219 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10221 struct alc_spec *spec = codec->spec;
10224 if (force || !spec->sense_updated) {
10225 unsigned int present;
10226 /* need to execute and sync at first */
10227 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10228 /* check laptop HP jack */
10229 present = snd_hda_codec_read(codec, 0x14, 0,
10230 AC_VERB_GET_PIN_SENSE, 0);
10231 /* need to execute and sync at first */
10232 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10233 /* check docking HP jack */
10234 present |= snd_hda_codec_read(codec, 0x1b, 0,
10235 AC_VERB_GET_PIN_SENSE, 0);
10236 if (present & AC_PINSENSE_PRESENCE)
10237 spec->jack_present = 1;
10239 spec->jack_present = 0;
10240 spec->sense_updated = 1;
10242 /* unmute internal speaker only if both HPs are unplugged and
10243 * master switch is on
10245 if (spec->jack_present)
10246 mute = HDA_AMP_MUTE;
10248 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10249 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10250 HDA_AMP_MUTE, mute);
10253 /* unsolicited event for HP jack sensing */
10254 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10257 if ((res >> 26) != ALC_HP_EVENT)
10259 alc262_fujitsu_automute(codec, 1);
10262 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10264 alc262_fujitsu_automute(codec, 1);
10267 /* bind volumes of both NID 0x0c and 0x0d */
10268 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10269 .ops = &snd_hda_bind_vol,
10271 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10272 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10277 /* mute/unmute internal speaker according to the hp jack and mute state */
10278 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10280 struct alc_spec *spec = codec->spec;
10283 if (force || !spec->sense_updated) {
10284 unsigned int present_int_hp;
10285 /* need to execute and sync at first */
10286 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10287 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10288 AC_VERB_GET_PIN_SENSE, 0);
10289 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10290 spec->sense_updated = 1;
10292 if (spec->jack_present) {
10293 /* mute internal speaker */
10294 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10295 HDA_AMP_MUTE, HDA_AMP_MUTE);
10296 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10297 HDA_AMP_MUTE, HDA_AMP_MUTE);
10299 /* unmute internal speaker if necessary */
10300 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10301 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10302 HDA_AMP_MUTE, mute);
10303 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10304 HDA_AMP_MUTE, mute);
10308 /* unsolicited event for HP jack sensing */
10309 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10312 if ((res >> 26) != ALC_HP_EVENT)
10314 alc262_lenovo_3000_automute(codec, 1);
10317 /* bind hp and internal speaker mute (with plug check) */
10318 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10319 struct snd_ctl_elem_value *ucontrol)
10321 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10322 long *valp = ucontrol->value.integer.value;
10325 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10327 valp ? 0 : HDA_AMP_MUTE);
10328 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10330 valp ? 0 : HDA_AMP_MUTE);
10333 alc262_fujitsu_automute(codec, 0);
10337 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10338 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10340 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10341 .name = "Master Playback Switch",
10342 .info = snd_hda_mixer_amp_switch_info,
10343 .get = snd_hda_mixer_amp_switch_get,
10344 .put = alc262_fujitsu_master_sw_put,
10345 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10347 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10348 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10349 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10350 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10351 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10352 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10353 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10354 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10358 /* bind hp and internal speaker mute (with plug check) */
10359 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10360 struct snd_ctl_elem_value *ucontrol)
10362 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10363 long *valp = ucontrol->value.integer.value;
10366 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10368 valp ? 0 : HDA_AMP_MUTE);
10371 alc262_lenovo_3000_automute(codec, 0);
10375 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10376 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10378 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10379 .name = "Master Playback Switch",
10380 .info = snd_hda_mixer_amp_switch_info,
10381 .get = snd_hda_mixer_amp_switch_get,
10382 .put = alc262_lenovo_3000_master_sw_put,
10383 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10385 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10386 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10387 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10388 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10389 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10390 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10391 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10392 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10396 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10397 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10398 ALC262_HIPPO_MASTER_SWITCH,
10399 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10400 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10401 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10402 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10403 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10404 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10408 /* additional init verbs for Benq laptops */
10409 static struct hda_verb alc262_EAPD_verbs[] = {
10410 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10411 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10415 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10416 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10417 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10419 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10420 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10424 /* Samsung Q1 Ultra Vista model setup */
10425 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10426 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10427 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10429 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10430 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10431 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10435 static struct hda_verb alc262_ultra_verbs[] = {
10437 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10438 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10439 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10441 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10442 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10443 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10444 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10446 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10447 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10449 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10450 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10452 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10453 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10454 /* ADC, choose mic */
10455 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10456 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10457 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10458 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10459 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10460 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10461 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10462 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10463 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10464 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10468 /* mute/unmute internal speaker according to the hp jack and mute state */
10469 static void alc262_ultra_automute(struct hda_codec *codec)
10471 struct alc_spec *spec = codec->spec;
10475 /* auto-mute only when HP is used as HP */
10476 if (!spec->cur_mux[0]) {
10477 unsigned int present;
10478 /* need to execute and sync at first */
10479 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10480 present = snd_hda_codec_read(codec, 0x15, 0,
10481 AC_VERB_GET_PIN_SENSE, 0);
10482 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10483 if (spec->jack_present)
10484 mute = HDA_AMP_MUTE;
10486 /* mute/unmute internal speaker */
10487 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10488 HDA_AMP_MUTE, mute);
10489 /* mute/unmute HP */
10490 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10491 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10494 /* unsolicited event for HP jack sensing */
10495 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10498 if ((res >> 26) != ALC880_HP_EVENT)
10500 alc262_ultra_automute(codec);
10503 static struct hda_input_mux alc262_ultra_capture_source = {
10507 { "Headphone", 0x7 },
10511 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10512 struct snd_ctl_elem_value *ucontrol)
10514 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10515 struct alc_spec *spec = codec->spec;
10518 ret = alc_mux_enum_put(kcontrol, ucontrol);
10521 /* reprogram the HP pin as mic or HP according to the input source */
10522 snd_hda_codec_write_cache(codec, 0x15, 0,
10523 AC_VERB_SET_PIN_WIDGET_CONTROL,
10524 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10525 alc262_ultra_automute(codec); /* mute/unmute HP */
10529 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10530 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10531 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10533 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10534 .name = "Capture Source",
10535 .info = alc_mux_enum_info,
10536 .get = alc_mux_enum_get,
10537 .put = alc262_ultra_mux_enum_put,
10542 /* add playback controls from the parsed DAC table */
10543 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10544 const struct auto_pin_cfg *cfg)
10549 spec->multiout.num_dacs = 1; /* only use one dac */
10550 spec->multiout.dac_nids = spec->private_dac_nids;
10551 spec->multiout.dac_nids[0] = 2;
10553 nid = cfg->line_out_pins[0];
10555 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10556 "Front Playback Volume",
10557 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10560 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10561 "Front Playback Switch",
10562 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10567 nid = cfg->speaker_pins[0];
10570 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10571 "Speaker Playback Volume",
10572 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10576 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10577 "Speaker Playback Switch",
10578 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10583 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10584 "Speaker Playback Switch",
10585 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10591 nid = cfg->hp_pins[0];
10593 /* spec->multiout.hp_nid = 2; */
10595 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10596 "Headphone Playback Volume",
10597 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10601 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10602 "Headphone Playback Switch",
10603 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10608 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10609 "Headphone Playback Switch",
10610 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10619 /* identical with ALC880 */
10620 #define alc262_auto_create_analog_input_ctls \
10621 alc880_auto_create_analog_input_ctls
10624 * generic initialization of ADC, input mixers and output mixers
10626 static struct hda_verb alc262_volume_init_verbs[] = {
10628 * Unmute ADC0-2 and set the default input to mic-in
10630 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10631 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10632 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10633 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10634 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10635 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10637 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10639 * Note: PASD motherboards uses the Line In 2 as the input for
10640 * front panel mic (mic 2)
10642 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10644 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10645 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10646 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10647 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10650 * Set up output mixers (0x0c - 0x0f)
10652 /* set vol=0 to output mixers */
10653 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10654 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10655 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10657 /* set up input amps for analog loopback */
10658 /* Amp Indices: DAC = 0, mixer = 1 */
10659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10661 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10662 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10663 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10664 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10666 /* FIXME: use matrix-type input source selection */
10667 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10668 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10669 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10670 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10671 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10672 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10674 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10675 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10676 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10677 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10679 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10681 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10682 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10687 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10689 * Unmute ADC0-2 and set the default input to mic-in
10691 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10692 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10693 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10694 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10695 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10696 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10698 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10700 * Note: PASD motherboards uses the Line In 2 as the input for
10701 * front panel mic (mic 2)
10703 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10704 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10705 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10706 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10707 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10708 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10709 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10710 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10713 * Set up output mixers (0x0c - 0x0e)
10715 /* set vol=0 to output mixers */
10716 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10717 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10718 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10720 /* set up input amps for analog loopback */
10721 /* Amp Indices: DAC = 0, mixer = 1 */
10722 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10723 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10724 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10725 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10726 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10727 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10729 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10730 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10731 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10733 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10734 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10736 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10737 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10739 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10740 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10741 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10742 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10743 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10745 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10746 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10747 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10748 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10749 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10750 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10753 /* FIXME: use matrix-type input source selection */
10754 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10755 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10756 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10757 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10758 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10759 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10761 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10762 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10763 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10764 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10766 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10767 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10768 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10769 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10771 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10776 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10778 * Unmute ADC0-2 and set the default input to mic-in
10780 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10781 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10782 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10783 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10784 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10785 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10787 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10789 * Note: PASD motherboards uses the Line In 2 as the input for front
10790 * panel mic (mic 2)
10792 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10793 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10794 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10795 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10796 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10797 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10798 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10799 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10800 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10802 * Set up output mixers (0x0c - 0x0e)
10804 /* set vol=0 to output mixers */
10805 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10806 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10807 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10809 /* set up input amps for analog loopback */
10810 /* Amp Indices: DAC = 0, mixer = 1 */
10811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10813 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10814 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10815 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10816 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10819 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10820 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10821 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10822 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10823 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10824 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10825 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10827 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10828 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10830 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10831 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10833 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10834 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10835 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10836 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10837 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10838 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10840 /* FIXME: use matrix-type input source selection */
10841 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10842 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10843 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10844 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10845 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10846 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10847 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10848 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10849 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10851 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10852 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10853 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10854 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10855 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10856 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10857 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10859 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10860 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10861 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10862 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10863 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10864 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10865 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10867 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10872 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10874 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10875 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10876 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10878 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10879 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10880 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10881 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10883 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10884 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10885 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10890 #ifdef CONFIG_SND_HDA_POWER_SAVE
10891 #define alc262_loopbacks alc880_loopbacks
10894 /* pcm configuration: identiacal with ALC880 */
10895 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10896 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10897 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10898 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10901 * BIOS auto configuration
10903 static int alc262_parse_auto_config(struct hda_codec *codec)
10905 struct alc_spec *spec = codec->spec;
10907 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10909 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10913 if (!spec->autocfg.line_outs) {
10914 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10915 spec->multiout.max_channels = 2;
10916 spec->no_analog = 1;
10919 return 0; /* can't find valid BIOS pin config */
10921 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10924 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10928 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10931 if (spec->autocfg.dig_outs) {
10932 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10933 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10935 if (spec->autocfg.dig_in_pin)
10936 spec->dig_in_nid = ALC262_DIGIN_NID;
10938 if (spec->kctls.list)
10939 add_mixer(spec, spec->kctls.list);
10941 add_verb(spec, alc262_volume_init_verbs);
10942 spec->num_mux_defs = 1;
10943 spec->input_mux = &spec->private_imux[0];
10945 err = alc_auto_add_mic_boost(codec);
10949 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
10954 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10955 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10956 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10957 #define alc262_auto_init_input_src alc882_auto_init_input_src
10960 /* init callback for auto-configuration model -- overriding the default init */
10961 static void alc262_auto_init(struct hda_codec *codec)
10963 struct alc_spec *spec = codec->spec;
10964 alc262_auto_init_multi_out(codec);
10965 alc262_auto_init_hp_out(codec);
10966 alc262_auto_init_analog_input(codec);
10967 alc262_auto_init_input_src(codec);
10968 if (spec->unsol_event)
10969 alc_inithook(codec);
10973 * configuration and preset
10975 static const char *alc262_models[ALC262_MODEL_LAST] = {
10976 [ALC262_BASIC] = "basic",
10977 [ALC262_HIPPO] = "hippo",
10978 [ALC262_HIPPO_1] = "hippo_1",
10979 [ALC262_FUJITSU] = "fujitsu",
10980 [ALC262_HP_BPC] = "hp-bpc",
10981 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10982 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10983 [ALC262_HP_RP5700] = "hp-rp5700",
10984 [ALC262_BENQ_ED8] = "benq",
10985 [ALC262_BENQ_T31] = "benq-t31",
10986 [ALC262_SONY_ASSAMD] = "sony-assamd",
10987 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10988 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10989 [ALC262_ULTRA] = "ultra",
10990 [ALC262_LENOVO_3000] = "lenovo-3000",
10991 [ALC262_NEC] = "nec",
10992 [ALC262_TYAN] = "tyan",
10993 [ALC262_AUTO] = "auto",
10996 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10997 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10998 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10999 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11001 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11003 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11005 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11006 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11007 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11008 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11009 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11010 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11011 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11012 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11013 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11014 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11015 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11016 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11017 ALC262_HP_TC_T5735),
11018 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11019 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11020 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11021 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11022 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11023 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11024 ALC262_SONY_ASSAMD),
11025 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11026 ALC262_TOSHIBA_RX1),
11027 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11028 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11029 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11030 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11031 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11033 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11034 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11035 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11036 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11037 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11041 static struct alc_config_preset alc262_presets[] = {
11043 .mixers = { alc262_base_mixer },
11044 .init_verbs = { alc262_init_verbs },
11045 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11046 .dac_nids = alc262_dac_nids,
11048 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11049 .channel_mode = alc262_modes,
11050 .input_mux = &alc262_capture_source,
11053 .mixers = { alc262_hippo_mixer },
11054 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
11055 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11056 .dac_nids = alc262_dac_nids,
11058 .dig_out_nid = ALC262_DIGOUT_NID,
11059 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11060 .channel_mode = alc262_modes,
11061 .input_mux = &alc262_capture_source,
11062 .unsol_event = alc262_hippo_unsol_event,
11063 .init_hook = alc262_hippo_init_hook,
11065 [ALC262_HIPPO_1] = {
11066 .mixers = { alc262_hippo1_mixer },
11067 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11068 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11069 .dac_nids = alc262_dac_nids,
11071 .dig_out_nid = ALC262_DIGOUT_NID,
11072 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11073 .channel_mode = alc262_modes,
11074 .input_mux = &alc262_capture_source,
11075 .unsol_event = alc262_hippo_unsol_event,
11076 .init_hook = alc262_hippo1_init_hook,
11078 [ALC262_FUJITSU] = {
11079 .mixers = { alc262_fujitsu_mixer },
11080 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11081 alc262_fujitsu_unsol_verbs },
11082 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11083 .dac_nids = alc262_dac_nids,
11085 .dig_out_nid = ALC262_DIGOUT_NID,
11086 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11087 .channel_mode = alc262_modes,
11088 .input_mux = &alc262_fujitsu_capture_source,
11089 .unsol_event = alc262_fujitsu_unsol_event,
11090 .init_hook = alc262_fujitsu_init_hook,
11092 [ALC262_HP_BPC] = {
11093 .mixers = { alc262_HP_BPC_mixer },
11094 .init_verbs = { alc262_HP_BPC_init_verbs },
11095 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11096 .dac_nids = alc262_dac_nids,
11098 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11099 .channel_mode = alc262_modes,
11100 .input_mux = &alc262_HP_capture_source,
11101 .unsol_event = alc262_hp_bpc_unsol_event,
11102 .init_hook = alc262_hp_bpc_automute,
11104 [ALC262_HP_BPC_D7000_WF] = {
11105 .mixers = { alc262_HP_BPC_WildWest_mixer },
11106 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11107 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11108 .dac_nids = alc262_dac_nids,
11110 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11111 .channel_mode = alc262_modes,
11112 .input_mux = &alc262_HP_D7000_capture_source,
11113 .unsol_event = alc262_hp_wildwest_unsol_event,
11114 .init_hook = alc262_hp_wildwest_automute,
11116 [ALC262_HP_BPC_D7000_WL] = {
11117 .mixers = { alc262_HP_BPC_WildWest_mixer,
11118 alc262_HP_BPC_WildWest_option_mixer },
11119 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11120 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11121 .dac_nids = alc262_dac_nids,
11123 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11124 .channel_mode = alc262_modes,
11125 .input_mux = &alc262_HP_D7000_capture_source,
11126 .unsol_event = alc262_hp_wildwest_unsol_event,
11127 .init_hook = alc262_hp_wildwest_automute,
11129 [ALC262_HP_TC_T5735] = {
11130 .mixers = { alc262_hp_t5735_mixer },
11131 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11132 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11133 .dac_nids = alc262_dac_nids,
11135 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11136 .channel_mode = alc262_modes,
11137 .input_mux = &alc262_capture_source,
11138 .unsol_event = alc262_hp_t5735_unsol_event,
11139 .init_hook = alc262_hp_t5735_init_hook,
11141 [ALC262_HP_RP5700] = {
11142 .mixers = { alc262_hp_rp5700_mixer },
11143 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11144 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11145 .dac_nids = alc262_dac_nids,
11146 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11147 .channel_mode = alc262_modes,
11148 .input_mux = &alc262_hp_rp5700_capture_source,
11150 [ALC262_BENQ_ED8] = {
11151 .mixers = { alc262_base_mixer },
11152 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11153 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11154 .dac_nids = alc262_dac_nids,
11156 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11157 .channel_mode = alc262_modes,
11158 .input_mux = &alc262_capture_source,
11160 [ALC262_SONY_ASSAMD] = {
11161 .mixers = { alc262_sony_mixer },
11162 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11163 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11164 .dac_nids = alc262_dac_nids,
11166 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11167 .channel_mode = alc262_modes,
11168 .input_mux = &alc262_capture_source,
11169 .unsol_event = alc262_hippo_unsol_event,
11170 .init_hook = alc262_hippo_init_hook,
11172 [ALC262_BENQ_T31] = {
11173 .mixers = { alc262_benq_t31_mixer },
11174 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
11175 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11176 .dac_nids = alc262_dac_nids,
11178 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11179 .channel_mode = alc262_modes,
11180 .input_mux = &alc262_capture_source,
11181 .unsol_event = alc262_hippo_unsol_event,
11182 .init_hook = alc262_hippo_init_hook,
11185 .mixers = { alc262_ultra_mixer },
11186 .cap_mixer = alc262_ultra_capture_mixer,
11187 .init_verbs = { alc262_ultra_verbs },
11188 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11189 .dac_nids = alc262_dac_nids,
11190 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11191 .channel_mode = alc262_modes,
11192 .input_mux = &alc262_ultra_capture_source,
11193 .adc_nids = alc262_adc_nids, /* ADC0 */
11194 .capsrc_nids = alc262_capsrc_nids,
11195 .num_adc_nids = 1, /* single ADC */
11196 .unsol_event = alc262_ultra_unsol_event,
11197 .init_hook = alc262_ultra_automute,
11199 [ALC262_LENOVO_3000] = {
11200 .mixers = { alc262_lenovo_3000_mixer },
11201 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11202 alc262_lenovo_3000_unsol_verbs },
11203 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11204 .dac_nids = alc262_dac_nids,
11206 .dig_out_nid = ALC262_DIGOUT_NID,
11207 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11208 .channel_mode = alc262_modes,
11209 .input_mux = &alc262_fujitsu_capture_source,
11210 .unsol_event = alc262_lenovo_3000_unsol_event,
11213 .mixers = { alc262_nec_mixer },
11214 .init_verbs = { alc262_nec_verbs },
11215 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11216 .dac_nids = alc262_dac_nids,
11218 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11219 .channel_mode = alc262_modes,
11220 .input_mux = &alc262_capture_source,
11222 [ALC262_TOSHIBA_S06] = {
11223 .mixers = { alc262_toshiba_s06_mixer },
11224 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11225 alc262_eapd_verbs },
11226 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11227 .capsrc_nids = alc262_dmic_capsrc_nids,
11228 .dac_nids = alc262_dac_nids,
11229 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11230 .dig_out_nid = ALC262_DIGOUT_NID,
11231 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11232 .channel_mode = alc262_modes,
11233 .input_mux = &alc262_dmic_capture_source,
11234 .unsol_event = alc262_toshiba_s06_unsol_event,
11235 .init_hook = alc262_toshiba_s06_init_hook,
11237 [ALC262_TOSHIBA_RX1] = {
11238 .mixers = { alc262_toshiba_rx1_mixer },
11239 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11240 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11241 .dac_nids = alc262_dac_nids,
11243 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11244 .channel_mode = alc262_modes,
11245 .input_mux = &alc262_capture_source,
11246 .unsol_event = alc262_hippo_unsol_event,
11247 .init_hook = alc262_hippo_init_hook,
11250 .mixers = { alc262_tyan_mixer },
11251 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11252 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11253 .dac_nids = alc262_dac_nids,
11255 .dig_out_nid = ALC262_DIGOUT_NID,
11256 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11257 .channel_mode = alc262_modes,
11258 .input_mux = &alc262_capture_source,
11259 .unsol_event = alc262_tyan_unsol_event,
11260 .init_hook = alc262_tyan_automute,
11264 static int patch_alc262(struct hda_codec *codec)
11266 struct alc_spec *spec;
11270 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11274 codec->spec = spec;
11276 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11281 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11282 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11283 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11284 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11288 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11290 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11294 if (board_config < 0) {
11295 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
11296 "trying auto-probe from BIOS...\n");
11297 board_config = ALC262_AUTO;
11300 if (board_config == ALC262_AUTO) {
11301 /* automatic parse from the BIOS config */
11302 err = alc262_parse_auto_config(codec);
11308 "hda_codec: Cannot set up configuration "
11309 "from BIOS. Using base mode...\n");
11310 board_config = ALC262_BASIC;
11314 if (!spec->no_analog) {
11315 err = snd_hda_attach_beep_device(codec, 0x1);
11322 if (board_config != ALC262_AUTO)
11323 setup_preset(spec, &alc262_presets[board_config]);
11325 spec->stream_name_analog = "ALC262 Analog";
11326 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11327 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11329 spec->stream_name_digital = "ALC262 Digital";
11330 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11331 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11333 spec->capture_style = CAPT_MIX;
11334 if (!spec->adc_nids && spec->input_mux) {
11335 /* check whether NID 0x07 is valid */
11336 unsigned int wcap = get_wcaps(codec, 0x07);
11339 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11340 if (wcap != AC_WID_AUD_IN) {
11341 spec->adc_nids = alc262_adc_nids_alt;
11342 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11343 spec->capsrc_nids = alc262_capsrc_nids_alt;
11345 spec->adc_nids = alc262_adc_nids;
11346 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11347 spec->capsrc_nids = alc262_capsrc_nids;
11350 if (!spec->cap_mixer && !spec->no_analog)
11351 set_capture_mixer(spec);
11352 if (!spec->no_analog)
11353 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11355 spec->vmaster_nid = 0x0c;
11357 codec->patch_ops = alc_patch_ops;
11358 if (board_config == ALC262_AUTO)
11359 spec->init_hook = alc262_auto_init;
11360 #ifdef CONFIG_SND_HDA_POWER_SAVE
11361 if (!spec->loopback.amplist)
11362 spec->loopback.amplist = alc262_loopbacks;
11364 codec->proc_widget_hook = print_realtek_coef;
11370 * ALC268 channel source setting (2 channel)
11372 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11373 #define alc268_modes alc260_modes
11375 static hda_nid_t alc268_dac_nids[2] = {
11380 static hda_nid_t alc268_adc_nids[2] = {
11385 static hda_nid_t alc268_adc_nids_alt[1] = {
11390 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11392 static struct snd_kcontrol_new alc268_base_mixer[] = {
11393 /* output mixer control */
11394 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11395 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11396 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11397 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11398 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11399 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11400 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11404 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11405 /* output mixer control */
11406 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11407 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11408 ALC262_HIPPO_MASTER_SWITCH,
11409 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11410 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11411 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11415 /* bind Beep switches of both NID 0x0f and 0x10 */
11416 static struct hda_bind_ctls alc268_bind_beep_sw = {
11417 .ops = &snd_hda_bind_sw,
11419 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11420 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11425 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11426 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11427 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11431 static struct hda_verb alc268_eapd_verbs[] = {
11432 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11433 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11437 /* Toshiba specific */
11438 static struct hda_verb alc268_toshiba_verbs[] = {
11439 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11443 static struct hda_input_mux alc268_acer_lc_capture_source = {
11451 /* Acer specific */
11452 /* bind volumes of both NID 0x02 and 0x03 */
11453 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11454 .ops = &snd_hda_bind_vol,
11456 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11457 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11462 /* mute/unmute internal speaker according to the hp jack and mute state */
11463 static void alc268_acer_automute(struct hda_codec *codec, int force)
11465 struct alc_spec *spec = codec->spec;
11468 if (force || !spec->sense_updated) {
11469 unsigned int present;
11470 present = snd_hda_codec_read(codec, 0x14, 0,
11471 AC_VERB_GET_PIN_SENSE, 0);
11472 spec->jack_present = (present & 0x80000000) != 0;
11473 spec->sense_updated = 1;
11475 if (spec->jack_present)
11476 mute = HDA_AMP_MUTE; /* mute internal speaker */
11477 else /* unmute internal speaker if necessary */
11478 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11479 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11480 HDA_AMP_MUTE, mute);
11484 /* bind hp and internal speaker mute (with plug check) */
11485 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11486 struct snd_ctl_elem_value *ucontrol)
11488 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11489 long *valp = ucontrol->value.integer.value;
11492 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11494 valp[0] ? 0 : HDA_AMP_MUTE);
11495 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11497 valp[1] ? 0 : HDA_AMP_MUTE);
11499 alc268_acer_automute(codec, 0);
11503 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11504 /* output mixer control */
11505 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11507 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11508 .name = "Master Playback Switch",
11509 .info = snd_hda_mixer_amp_switch_info,
11510 .get = snd_hda_mixer_amp_switch_get,
11511 .put = alc268_acer_master_sw_put,
11512 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11514 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11518 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11519 /* output mixer control */
11520 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11522 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11523 .name = "Master Playback Switch",
11524 .info = snd_hda_mixer_amp_switch_info,
11525 .get = snd_hda_mixer_amp_switch_get,
11526 .put = alc268_acer_master_sw_put,
11527 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11529 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11530 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11531 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11535 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11536 /* output mixer control */
11537 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11539 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11540 .name = "Master Playback Switch",
11541 .info = snd_hda_mixer_amp_switch_info,
11542 .get = snd_hda_mixer_amp_switch_get,
11543 .put = alc268_acer_master_sw_put,
11544 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11546 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11547 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11551 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11552 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11553 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11554 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11555 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11556 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11557 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11561 static struct hda_verb alc268_acer_verbs[] = {
11562 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11563 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11564 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11565 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11566 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11567 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11568 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11572 /* unsolicited event for HP jack sensing */
11573 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11574 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11576 static void alc268_acer_unsol_event(struct hda_codec *codec,
11579 if ((res >> 26) != ALC880_HP_EVENT)
11581 alc268_acer_automute(codec, 1);
11584 static void alc268_acer_init_hook(struct hda_codec *codec)
11586 alc268_acer_automute(codec, 1);
11589 /* toggle speaker-output according to the hp-jack state */
11590 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11592 unsigned int present;
11593 unsigned char bits;
11595 present = snd_hda_codec_read(codec, 0x15, 0,
11596 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11597 bits = present ? AMP_IN_MUTE(0) : 0;
11598 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11599 AMP_IN_MUTE(0), bits);
11600 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11601 AMP_IN_MUTE(0), bits);
11605 static void alc268_acer_mic_automute(struct hda_codec *codec)
11607 unsigned int present;
11609 present = snd_hda_codec_read(codec, 0x18, 0,
11610 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11611 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11612 present ? 0x0 : 0x6);
11615 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11618 if ((res >> 26) == ALC880_HP_EVENT)
11619 alc268_aspire_one_speaker_automute(codec);
11620 if ((res >> 26) == ALC880_MIC_EVENT)
11621 alc268_acer_mic_automute(codec);
11624 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11626 alc268_aspire_one_speaker_automute(codec);
11627 alc268_acer_mic_automute(codec);
11630 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11631 /* output mixer control */
11632 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11633 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11634 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11635 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11636 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11637 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11641 static struct hda_verb alc268_dell_verbs[] = {
11642 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11643 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11644 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11648 /* mute/unmute internal speaker according to the hp jack and mute state */
11649 static void alc268_dell_automute(struct hda_codec *codec)
11651 unsigned int present;
11654 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11655 if (present & 0x80000000)
11656 mute = HDA_AMP_MUTE;
11658 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11659 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11660 HDA_AMP_MUTE, mute);
11663 static void alc268_dell_unsol_event(struct hda_codec *codec,
11666 if ((res >> 26) != ALC880_HP_EVENT)
11668 alc268_dell_automute(codec);
11671 #define alc268_dell_init_hook alc268_dell_automute
11673 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11674 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11675 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11676 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11677 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11678 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11679 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11680 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11681 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11685 static struct hda_verb alc267_quanta_il1_verbs[] = {
11686 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11687 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11691 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11693 unsigned int present;
11695 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11696 & AC_PINSENSE_PRESENCE;
11697 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11698 present ? 0 : PIN_OUT);
11701 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11703 unsigned int present;
11705 present = snd_hda_codec_read(codec, 0x18, 0,
11706 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11707 snd_hda_codec_write(codec, 0x23, 0,
11708 AC_VERB_SET_CONNECT_SEL,
11709 present ? 0x00 : 0x01);
11712 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11714 alc267_quanta_il1_hp_automute(codec);
11715 alc267_quanta_il1_mic_automute(codec);
11718 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11721 switch (res >> 26) {
11722 case ALC880_HP_EVENT:
11723 alc267_quanta_il1_hp_automute(codec);
11725 case ALC880_MIC_EVENT:
11726 alc267_quanta_il1_mic_automute(codec);
11732 * generic initialization of ADC, input mixers and output mixers
11734 static struct hda_verb alc268_base_init_verbs[] = {
11735 /* Unmute DAC0-1 and set vol = 0 */
11736 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11737 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11740 * Set up output mixers (0x0c - 0x0e)
11742 /* set vol=0 to output mixers */
11743 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11744 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11746 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11747 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11749 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11750 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11751 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11752 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11753 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11754 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11755 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11756 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11758 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11759 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11760 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11761 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11762 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11764 /* set PCBEEP vol = 0, mute connections */
11765 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11766 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11767 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11769 /* Unmute Selector 23h,24h and set the default input to mic-in */
11771 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11772 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11773 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11774 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11780 * generic initialization of ADC, input mixers and output mixers
11782 static struct hda_verb alc268_volume_init_verbs[] = {
11783 /* set output DAC */
11784 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11785 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11787 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11788 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11789 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11790 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11791 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11793 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11794 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11795 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11797 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11798 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11800 /* set PCBEEP vol = 0, mute connections */
11801 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11802 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11803 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11808 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11809 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11810 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11812 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11813 /* The multiple "Capture Source" controls confuse alsamixer
11814 * So call somewhat different..
11816 /* .name = "Capture Source", */
11817 .name = "Input Source",
11819 .info = alc_mux_enum_info,
11820 .get = alc_mux_enum_get,
11821 .put = alc_mux_enum_put,
11826 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11827 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11828 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11829 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11830 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11832 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11833 /* The multiple "Capture Source" controls confuse alsamixer
11834 * So call somewhat different..
11836 /* .name = "Capture Source", */
11837 .name = "Input Source",
11839 .info = alc_mux_enum_info,
11840 .get = alc_mux_enum_get,
11841 .put = alc_mux_enum_put,
11846 static struct hda_input_mux alc268_capture_source = {
11850 { "Front Mic", 0x1 },
11856 static struct hda_input_mux alc268_acer_capture_source = {
11860 { "Internal Mic", 0x1 },
11865 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11869 { "Internal Mic", 0x6 },
11874 #ifdef CONFIG_SND_DEBUG
11875 static struct snd_kcontrol_new alc268_test_mixer[] = {
11876 /* Volume widgets */
11877 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11878 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11879 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11880 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11881 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11882 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11883 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11884 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11885 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11886 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11887 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11888 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11889 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11890 /* The below appears problematic on some hardwares */
11891 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11892 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11893 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11894 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11895 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11897 /* Modes for retasking pin widgets */
11898 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11899 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11900 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11901 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11903 /* Controls for GPIO pins, assuming they are configured as outputs */
11904 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11905 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11906 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11907 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11909 /* Switches to allow the digital SPDIF output pin to be enabled.
11910 * The ALC268 does not have an SPDIF input.
11912 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11914 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11915 * this output to turn on an external amplifier.
11917 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11918 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11924 /* create input playback/capture controls for the given pin */
11925 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11926 const char *ctlname, int idx)
11931 sprintf(name, "%s Playback Volume", ctlname);
11933 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11934 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11938 } else if (nid == 0x15) {
11939 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11940 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11946 sprintf(name, "%s Playback Switch", ctlname);
11947 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11948 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11954 /* add playback controls from the parsed DAC table */
11955 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11956 const struct auto_pin_cfg *cfg)
11961 spec->multiout.num_dacs = 2; /* only use one dac */
11962 spec->multiout.dac_nids = spec->private_dac_nids;
11963 spec->multiout.dac_nids[0] = 2;
11964 spec->multiout.dac_nids[1] = 3;
11966 nid = cfg->line_out_pins[0];
11968 alc268_new_analog_output(spec, nid, "Front", 0);
11970 nid = cfg->speaker_pins[0];
11972 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11973 "Speaker Playback Volume",
11974 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11978 nid = cfg->hp_pins[0];
11980 alc268_new_analog_output(spec, nid, "Headphone", 0);
11982 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11984 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11985 "Mono Playback Switch",
11986 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11993 /* create playback/capture controls for input pins */
11994 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11995 const struct auto_pin_cfg *cfg)
11997 struct hda_input_mux *imux = &spec->private_imux[0];
12000 for (i = 0; i < AUTO_PIN_LAST; i++) {
12001 switch(cfg->input_pins[i]) {
12003 idx1 = 0; /* Mic 1 */
12006 idx1 = 1; /* Mic 2 */
12009 idx1 = 2; /* Line In */
12016 idx1 = 6; /* digital mics */
12021 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12022 imux->items[imux->num_items].index = idx1;
12028 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12030 struct alc_spec *spec = codec->spec;
12031 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12032 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12033 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12034 unsigned int dac_vol1, dac_vol2;
12037 snd_hda_codec_write(codec, speaker_nid, 0,
12038 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12039 snd_hda_codec_write(codec, 0x0f, 0,
12040 AC_VERB_SET_AMP_GAIN_MUTE,
12042 snd_hda_codec_write(codec, 0x10, 0,
12043 AC_VERB_SET_AMP_GAIN_MUTE,
12046 snd_hda_codec_write(codec, 0x0f, 0,
12047 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12048 snd_hda_codec_write(codec, 0x10, 0,
12049 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12052 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12053 if (line_nid == 0x14)
12054 dac_vol2 = AMP_OUT_ZERO;
12055 else if (line_nid == 0x15)
12056 dac_vol1 = AMP_OUT_ZERO;
12057 if (hp_nid == 0x14)
12058 dac_vol2 = AMP_OUT_ZERO;
12059 else if (hp_nid == 0x15)
12060 dac_vol1 = AMP_OUT_ZERO;
12061 if (line_nid != 0x16 || hp_nid != 0x16 ||
12062 spec->autocfg.line_out_pins[1] != 0x16 ||
12063 spec->autocfg.line_out_pins[2] != 0x16)
12064 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12066 snd_hda_codec_write(codec, 0x02, 0,
12067 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12068 snd_hda_codec_write(codec, 0x03, 0,
12069 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12072 /* pcm configuration: identiacal with ALC880 */
12073 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12074 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12075 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12076 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12079 * BIOS auto configuration
12081 static int alc268_parse_auto_config(struct hda_codec *codec)
12083 struct alc_spec *spec = codec->spec;
12085 static hda_nid_t alc268_ignore[] = { 0 };
12087 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12091 if (!spec->autocfg.line_outs) {
12092 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12093 spec->multiout.max_channels = 2;
12094 spec->no_analog = 1;
12097 return 0; /* can't find valid BIOS pin config */
12099 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12102 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
12106 spec->multiout.max_channels = 2;
12109 /* digital only support output */
12110 if (spec->autocfg.dig_outs) {
12111 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12112 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12114 if (spec->kctls.list)
12115 add_mixer(spec, spec->kctls.list);
12117 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12118 add_mixer(spec, alc268_beep_mixer);
12120 add_verb(spec, alc268_volume_init_verbs);
12121 spec->num_mux_defs = 1;
12122 spec->input_mux = &spec->private_imux[0];
12124 err = alc_auto_add_mic_boost(codec);
12131 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12132 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12133 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12135 /* init callback for auto-configuration model -- overriding the default init */
12136 static void alc268_auto_init(struct hda_codec *codec)
12138 struct alc_spec *spec = codec->spec;
12139 alc268_auto_init_multi_out(codec);
12140 alc268_auto_init_hp_out(codec);
12141 alc268_auto_init_mono_speaker_out(codec);
12142 alc268_auto_init_analog_input(codec);
12143 if (spec->unsol_event)
12144 alc_inithook(codec);
12148 * configuration and preset
12150 static const char *alc268_models[ALC268_MODEL_LAST] = {
12151 [ALC267_QUANTA_IL1] = "quanta-il1",
12152 [ALC268_3ST] = "3stack",
12153 [ALC268_TOSHIBA] = "toshiba",
12154 [ALC268_ACER] = "acer",
12155 [ALC268_ACER_DMIC] = "acer-dmic",
12156 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12157 [ALC268_DELL] = "dell",
12158 [ALC268_ZEPTO] = "zepto",
12159 #ifdef CONFIG_SND_DEBUG
12160 [ALC268_TEST] = "test",
12162 [ALC268_AUTO] = "auto",
12165 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12166 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12167 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12168 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12169 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12170 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12171 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12172 ALC268_ACER_ASPIRE_ONE),
12173 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12174 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12175 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
12176 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12177 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
12178 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
12179 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
12180 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12181 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12182 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12183 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12187 static struct alc_config_preset alc268_presets[] = {
12188 [ALC267_QUANTA_IL1] = {
12189 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12190 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12191 alc267_quanta_il1_verbs },
12192 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12193 .dac_nids = alc268_dac_nids,
12194 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12195 .adc_nids = alc268_adc_nids_alt,
12197 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12198 .channel_mode = alc268_modes,
12199 .input_mux = &alc268_capture_source,
12200 .unsol_event = alc267_quanta_il1_unsol_event,
12201 .init_hook = alc267_quanta_il1_automute,
12204 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12205 alc268_beep_mixer },
12206 .init_verbs = { alc268_base_init_verbs },
12207 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12208 .dac_nids = alc268_dac_nids,
12209 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12210 .adc_nids = alc268_adc_nids_alt,
12211 .capsrc_nids = alc268_capsrc_nids,
12213 .dig_out_nid = ALC268_DIGOUT_NID,
12214 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12215 .channel_mode = alc268_modes,
12216 .input_mux = &alc268_capture_source,
12218 [ALC268_TOSHIBA] = {
12219 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12220 alc268_beep_mixer },
12221 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12222 alc268_toshiba_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 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12230 .channel_mode = alc268_modes,
12231 .input_mux = &alc268_capture_source,
12232 .unsol_event = alc268_toshiba_unsol_event,
12233 .init_hook = alc268_toshiba_init_hook,
12236 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12237 alc268_beep_mixer },
12238 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12239 alc268_acer_verbs },
12240 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12241 .dac_nids = alc268_dac_nids,
12242 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12243 .adc_nids = alc268_adc_nids_alt,
12244 .capsrc_nids = alc268_capsrc_nids,
12246 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12247 .channel_mode = alc268_modes,
12248 .input_mux = &alc268_acer_capture_source,
12249 .unsol_event = alc268_acer_unsol_event,
12250 .init_hook = alc268_acer_init_hook,
12252 [ALC268_ACER_DMIC] = {
12253 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12254 alc268_beep_mixer },
12255 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12256 alc268_acer_verbs },
12257 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12258 .dac_nids = alc268_dac_nids,
12259 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12260 .adc_nids = alc268_adc_nids_alt,
12261 .capsrc_nids = alc268_capsrc_nids,
12263 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12264 .channel_mode = alc268_modes,
12265 .input_mux = &alc268_acer_dmic_capture_source,
12266 .unsol_event = alc268_acer_unsol_event,
12267 .init_hook = alc268_acer_init_hook,
12269 [ALC268_ACER_ASPIRE_ONE] = {
12270 .mixers = { alc268_acer_aspire_one_mixer,
12272 alc268_capture_alt_mixer },
12273 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12274 alc268_acer_aspire_one_verbs },
12275 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12276 .dac_nids = alc268_dac_nids,
12277 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12278 .adc_nids = alc268_adc_nids_alt,
12279 .capsrc_nids = alc268_capsrc_nids,
12281 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12282 .channel_mode = alc268_modes,
12283 .input_mux = &alc268_acer_lc_capture_source,
12284 .unsol_event = alc268_acer_lc_unsol_event,
12285 .init_hook = alc268_acer_lc_init_hook,
12288 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12289 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12290 alc268_dell_verbs },
12291 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12292 .dac_nids = alc268_dac_nids,
12294 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12295 .channel_mode = alc268_modes,
12296 .unsol_event = alc268_dell_unsol_event,
12297 .init_hook = alc268_dell_init_hook,
12298 .input_mux = &alc268_capture_source,
12301 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12302 alc268_beep_mixer },
12303 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12304 alc268_toshiba_verbs },
12305 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12306 .dac_nids = alc268_dac_nids,
12307 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12308 .adc_nids = alc268_adc_nids_alt,
12309 .capsrc_nids = alc268_capsrc_nids,
12311 .dig_out_nid = ALC268_DIGOUT_NID,
12312 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12313 .channel_mode = alc268_modes,
12314 .input_mux = &alc268_capture_source,
12315 .unsol_event = alc268_toshiba_unsol_event,
12316 .init_hook = alc268_toshiba_init_hook
12318 #ifdef CONFIG_SND_DEBUG
12320 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12321 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12322 alc268_volume_init_verbs },
12323 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12324 .dac_nids = alc268_dac_nids,
12325 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12326 .adc_nids = alc268_adc_nids_alt,
12327 .capsrc_nids = alc268_capsrc_nids,
12329 .dig_out_nid = ALC268_DIGOUT_NID,
12330 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12331 .channel_mode = alc268_modes,
12332 .input_mux = &alc268_capture_source,
12337 static int patch_alc268(struct hda_codec *codec)
12339 struct alc_spec *spec;
12341 int i, has_beep, err;
12343 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12347 codec->spec = spec;
12349 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12353 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12354 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
12355 "trying auto-probe from BIOS...\n");
12356 board_config = ALC268_AUTO;
12359 if (board_config == ALC268_AUTO) {
12360 /* automatic parse from the BIOS config */
12361 err = alc268_parse_auto_config(codec);
12367 "hda_codec: Cannot set up configuration "
12368 "from BIOS. Using base mode...\n");
12369 board_config = ALC268_3ST;
12373 if (board_config != ALC268_AUTO)
12374 setup_preset(spec, &alc268_presets[board_config]);
12376 if (codec->vendor_id == 0x10ec0267) {
12377 spec->stream_name_analog = "ALC267 Analog";
12378 spec->stream_name_digital = "ALC267 Digital";
12380 spec->stream_name_analog = "ALC268 Analog";
12381 spec->stream_name_digital = "ALC268 Digital";
12384 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12385 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12386 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12388 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12391 for (i = 0; i < spec->num_mixers; i++) {
12392 if (spec->mixers[i] == alc268_beep_mixer) {
12399 err = snd_hda_attach_beep_device(codec, 0x1);
12404 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12405 /* override the amp caps for beep generator */
12406 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12407 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12408 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12409 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12410 (0 << AC_AMPCAP_MUTE_SHIFT));
12413 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12414 /* check whether NID 0x07 is valid */
12415 unsigned int wcap = get_wcaps(codec, 0x07);
12419 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12420 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12421 spec->adc_nids = alc268_adc_nids_alt;
12422 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12423 add_mixer(spec, alc268_capture_alt_mixer);
12425 spec->adc_nids = alc268_adc_nids;
12426 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12427 add_mixer(spec, alc268_capture_mixer);
12429 spec->capsrc_nids = alc268_capsrc_nids;
12430 /* set default input source */
12431 for (i = 0; i < spec->num_adc_nids; i++)
12432 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12433 0, AC_VERB_SET_CONNECT_SEL,
12434 spec->input_mux->items[0].index);
12437 spec->vmaster_nid = 0x02;
12439 codec->patch_ops = alc_patch_ops;
12440 if (board_config == ALC268_AUTO)
12441 spec->init_hook = alc268_auto_init;
12443 codec->proc_widget_hook = print_realtek_coef;
12449 * ALC269 channel source setting (2 channel)
12451 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12453 #define alc269_dac_nids alc260_dac_nids
12455 static hda_nid_t alc269_adc_nids[1] = {
12460 static hda_nid_t alc269_capsrc_nids[1] = {
12464 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12468 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12476 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12484 #define alc269_modes alc260_modes
12485 #define alc269_capture_source alc880_lg_lw_capture_source
12487 static struct snd_kcontrol_new alc269_base_mixer[] = {
12488 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12489 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12490 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12491 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12492 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12493 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12494 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12495 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12496 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12497 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12498 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12499 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12503 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12504 /* output mixer control */
12505 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12507 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12508 .name = "Master Playback Switch",
12509 .info = snd_hda_mixer_amp_switch_info,
12510 .get = snd_hda_mixer_amp_switch_get,
12511 .put = alc268_acer_master_sw_put,
12512 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12515 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12516 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12517 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12518 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12519 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12523 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12524 /* output mixer control */
12525 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12527 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12528 .name = "Master Playback Switch",
12529 .info = snd_hda_mixer_amp_switch_info,
12530 .get = snd_hda_mixer_amp_switch_get,
12531 .put = alc268_acer_master_sw_put,
12532 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12534 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12535 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12536 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12537 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12538 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12539 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12540 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12541 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12542 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12546 /* bind volumes of both NID 0x0c and 0x0d */
12547 static struct hda_bind_ctls alc269_epc_bind_vol = {
12548 .ops = &snd_hda_bind_vol,
12550 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12551 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12556 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12557 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12558 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12559 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12563 /* capture mixer elements */
12564 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12565 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12566 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12567 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12572 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12573 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12574 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12575 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12579 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12580 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12581 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12582 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12583 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12584 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12585 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12589 static struct hda_verb alc269_lifebook_verbs[] = {
12590 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12591 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12592 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12593 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12594 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12595 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12596 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12597 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12598 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12599 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12603 /* toggle speaker-output according to the hp-jack state */
12604 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12606 unsigned int present;
12607 unsigned char bits;
12609 present = snd_hda_codec_read(codec, 0x15, 0,
12610 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12611 bits = present ? AMP_IN_MUTE(0) : 0;
12612 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12613 AMP_IN_MUTE(0), bits);
12614 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12615 AMP_IN_MUTE(0), bits);
12617 snd_hda_codec_write(codec, 0x20, 0,
12618 AC_VERB_SET_COEF_INDEX, 0x0c);
12619 snd_hda_codec_write(codec, 0x20, 0,
12620 AC_VERB_SET_PROC_COEF, 0x680);
12622 snd_hda_codec_write(codec, 0x20, 0,
12623 AC_VERB_SET_COEF_INDEX, 0x0c);
12624 snd_hda_codec_write(codec, 0x20, 0,
12625 AC_VERB_SET_PROC_COEF, 0x480);
12628 /* toggle speaker-output according to the hp-jacks state */
12629 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12631 unsigned int present;
12632 unsigned char bits;
12634 /* Check laptop headphone socket */
12635 present = snd_hda_codec_read(codec, 0x15, 0,
12636 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12638 /* Check port replicator headphone socket */
12639 present |= snd_hda_codec_read(codec, 0x1a, 0,
12640 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12642 bits = present ? AMP_IN_MUTE(0) : 0;
12643 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12644 AMP_IN_MUTE(0), bits);
12645 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12646 AMP_IN_MUTE(0), bits);
12648 snd_hda_codec_write(codec, 0x20, 0,
12649 AC_VERB_SET_COEF_INDEX, 0x0c);
12650 snd_hda_codec_write(codec, 0x20, 0,
12651 AC_VERB_SET_PROC_COEF, 0x680);
12653 snd_hda_codec_write(codec, 0x20, 0,
12654 AC_VERB_SET_COEF_INDEX, 0x0c);
12655 snd_hda_codec_write(codec, 0x20, 0,
12656 AC_VERB_SET_PROC_COEF, 0x480);
12659 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12661 unsigned int present;
12663 present = snd_hda_codec_read(codec, 0x18, 0,
12664 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12665 snd_hda_codec_write(codec, 0x23, 0,
12666 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12669 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12671 unsigned int present_laptop;
12672 unsigned int present_dock;
12674 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12675 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12677 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12678 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12680 /* Laptop mic port overrides dock mic port, design decision */
12682 snd_hda_codec_write(codec, 0x23, 0,
12683 AC_VERB_SET_CONNECT_SEL, 0x3);
12684 if (present_laptop)
12685 snd_hda_codec_write(codec, 0x23, 0,
12686 AC_VERB_SET_CONNECT_SEL, 0x0);
12687 if (!present_dock && !present_laptop)
12688 snd_hda_codec_write(codec, 0x23, 0,
12689 AC_VERB_SET_CONNECT_SEL, 0x1);
12692 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12695 if ((res >> 26) == ALC880_HP_EVENT)
12696 alc269_quanta_fl1_speaker_automute(codec);
12697 if ((res >> 26) == ALC880_MIC_EVENT)
12698 alc269_quanta_fl1_mic_automute(codec);
12701 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12704 if ((res >> 26) == ALC880_HP_EVENT)
12705 alc269_lifebook_speaker_automute(codec);
12706 if ((res >> 26) == ALC880_MIC_EVENT)
12707 alc269_lifebook_mic_autoswitch(codec);
12710 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12712 alc269_quanta_fl1_speaker_automute(codec);
12713 alc269_quanta_fl1_mic_automute(codec);
12716 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12718 alc269_lifebook_speaker_automute(codec);
12719 alc269_lifebook_mic_autoswitch(codec);
12722 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12723 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12724 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12725 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12726 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12727 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12728 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12729 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12733 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12734 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12735 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12736 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12737 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12738 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12739 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12743 /* toggle speaker-output according to the hp-jack state */
12744 static void alc269_speaker_automute(struct hda_codec *codec)
12746 unsigned int present;
12747 unsigned char bits;
12749 present = snd_hda_codec_read(codec, 0x15, 0,
12750 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12751 bits = present ? AMP_IN_MUTE(0) : 0;
12752 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12753 AMP_IN_MUTE(0), bits);
12754 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12755 AMP_IN_MUTE(0), bits);
12758 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12760 unsigned int present;
12762 present = snd_hda_codec_read(codec, 0x18, 0,
12763 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12764 snd_hda_codec_write(codec, 0x23, 0,
12765 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12768 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12770 unsigned int present;
12772 present = snd_hda_codec_read(codec, 0x18, 0,
12773 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12774 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12775 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12776 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12777 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12780 /* unsolicited event for HP jack sensing */
12781 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12784 if ((res >> 26) == ALC880_HP_EVENT)
12785 alc269_speaker_automute(codec);
12787 if ((res >> 26) == ALC880_MIC_EVENT)
12788 alc269_eeepc_dmic_automute(codec);
12791 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12793 alc269_speaker_automute(codec);
12794 alc269_eeepc_dmic_automute(codec);
12797 /* unsolicited event for HP jack sensing */
12798 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12801 if ((res >> 26) == ALC880_HP_EVENT)
12802 alc269_speaker_automute(codec);
12804 if ((res >> 26) == ALC880_MIC_EVENT)
12805 alc269_eeepc_amic_automute(codec);
12808 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12810 alc269_speaker_automute(codec);
12811 alc269_eeepc_amic_automute(codec);
12815 * generic initialization of ADC, input mixers and output mixers
12817 static struct hda_verb alc269_init_verbs[] = {
12819 * Unmute ADC0 and set the default input to mic-in
12821 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12823 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12824 * analog-loopback mixer widget
12825 * Note: PASD motherboards uses the Line In 2 as the input for
12826 * front panel mic (mic 2)
12828 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12829 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12830 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12831 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12832 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12836 * Set up output mixers (0x0c - 0x0e)
12838 /* set vol=0 to output mixers */
12839 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12840 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12842 /* set up input amps for analog loopback */
12843 /* Amp Indices: DAC = 0, mixer = 1 */
12844 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12846 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12847 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12848 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12849 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12851 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12852 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12853 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12854 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12855 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12856 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12857 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12859 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12860 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12861 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12862 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12863 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12864 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12865 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12867 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12868 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12870 /* FIXME: use matrix-type input source selection */
12871 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12872 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12873 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12874 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12875 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12876 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12879 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12880 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12884 /* add playback controls from the parsed DAC table */
12885 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12886 const struct auto_pin_cfg *cfg)
12891 spec->multiout.num_dacs = 1; /* only use one dac */
12892 spec->multiout.dac_nids = spec->private_dac_nids;
12893 spec->multiout.dac_nids[0] = 2;
12895 nid = cfg->line_out_pins[0];
12897 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12898 "Front Playback Volume",
12899 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12902 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12903 "Front Playback Switch",
12904 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12909 nid = cfg->speaker_pins[0];
12911 if (!cfg->line_out_pins[0]) {
12912 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12913 "Speaker Playback Volume",
12914 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12920 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12921 "Speaker Playback Switch",
12922 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12927 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12928 "Speaker Playback Switch",
12929 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12935 nid = cfg->hp_pins[0];
12937 /* spec->multiout.hp_nid = 2; */
12938 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12939 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12940 "Headphone Playback Volume",
12941 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12947 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12948 "Headphone Playback Switch",
12949 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12954 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12955 "Headphone Playback Switch",
12956 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12965 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12966 const struct auto_pin_cfg *cfg)
12970 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12973 /* digital-mic input pin is excluded in alc880_auto_create..()
12974 * because it's under 0x18
12976 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12977 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12978 struct hda_input_mux *imux = &spec->private_imux[0];
12979 imux->items[imux->num_items].label = "Int Mic";
12980 imux->items[imux->num_items].index = 0x05;
12986 #ifdef CONFIG_SND_HDA_POWER_SAVE
12987 #define alc269_loopbacks alc880_loopbacks
12990 /* pcm configuration: identiacal with ALC880 */
12991 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12992 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12993 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12994 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12996 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13000 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13001 /* NID is set in alc_build_pcms */
13003 .open = alc880_playback_pcm_open,
13004 .prepare = alc880_playback_pcm_prepare,
13005 .cleanup = alc880_playback_pcm_cleanup
13009 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13013 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13014 /* NID is set in alc_build_pcms */
13018 * BIOS auto configuration
13020 static int alc269_parse_auto_config(struct hda_codec *codec)
13022 struct alc_spec *spec = codec->spec;
13024 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13026 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13031 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13034 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
13038 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13040 if (spec->autocfg.dig_outs)
13041 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13043 if (spec->kctls.list)
13044 add_mixer(spec, spec->kctls.list);
13046 add_verb(spec, alc269_init_verbs);
13047 spec->num_mux_defs = 1;
13048 spec->input_mux = &spec->private_imux[0];
13049 /* set default input source */
13050 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13051 0, AC_VERB_SET_CONNECT_SEL,
13052 spec->input_mux->items[0].index);
13054 err = alc_auto_add_mic_boost(codec);
13058 if (!spec->cap_mixer && !spec->no_analog)
13059 set_capture_mixer(spec);
13064 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13065 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13066 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13069 /* init callback for auto-configuration model -- overriding the default init */
13070 static void alc269_auto_init(struct hda_codec *codec)
13072 struct alc_spec *spec = codec->spec;
13073 alc269_auto_init_multi_out(codec);
13074 alc269_auto_init_hp_out(codec);
13075 alc269_auto_init_analog_input(codec);
13076 if (spec->unsol_event)
13077 alc_inithook(codec);
13081 * configuration and preset
13083 static const char *alc269_models[ALC269_MODEL_LAST] = {
13084 [ALC269_BASIC] = "basic",
13085 [ALC269_QUANTA_FL1] = "quanta",
13086 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13087 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13088 [ALC269_FUJITSU] = "fujitsu",
13089 [ALC269_LIFEBOOK] = "lifebook"
13092 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13093 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13094 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13095 ALC269_ASUS_EEEPC_P703),
13096 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13097 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13098 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13099 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13100 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13101 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13102 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13103 ALC269_ASUS_EEEPC_P901),
13104 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13105 ALC269_ASUS_EEEPC_P901),
13106 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13107 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13108 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13112 static struct alc_config_preset alc269_presets[] = {
13114 .mixers = { alc269_base_mixer },
13115 .init_verbs = { alc269_init_verbs },
13116 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13117 .dac_nids = alc269_dac_nids,
13119 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13120 .channel_mode = alc269_modes,
13121 .input_mux = &alc269_capture_source,
13123 [ALC269_QUANTA_FL1] = {
13124 .mixers = { alc269_quanta_fl1_mixer },
13125 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13126 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13127 .dac_nids = alc269_dac_nids,
13129 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13130 .channel_mode = alc269_modes,
13131 .input_mux = &alc269_capture_source,
13132 .unsol_event = alc269_quanta_fl1_unsol_event,
13133 .init_hook = alc269_quanta_fl1_init_hook,
13135 [ALC269_ASUS_EEEPC_P703] = {
13136 .mixers = { alc269_eeepc_mixer },
13137 .cap_mixer = alc269_epc_capture_mixer,
13138 .init_verbs = { alc269_init_verbs,
13139 alc269_eeepc_amic_init_verbs },
13140 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13141 .dac_nids = alc269_dac_nids,
13143 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13144 .channel_mode = alc269_modes,
13145 .input_mux = &alc269_eeepc_amic_capture_source,
13146 .unsol_event = alc269_eeepc_amic_unsol_event,
13147 .init_hook = alc269_eeepc_amic_inithook,
13149 [ALC269_ASUS_EEEPC_P901] = {
13150 .mixers = { alc269_eeepc_mixer },
13151 .cap_mixer = alc269_epc_capture_mixer,
13152 .init_verbs = { alc269_init_verbs,
13153 alc269_eeepc_dmic_init_verbs },
13154 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13155 .dac_nids = alc269_dac_nids,
13157 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13158 .channel_mode = alc269_modes,
13159 .input_mux = &alc269_eeepc_dmic_capture_source,
13160 .unsol_event = alc269_eeepc_dmic_unsol_event,
13161 .init_hook = alc269_eeepc_dmic_inithook,
13163 [ALC269_FUJITSU] = {
13164 .mixers = { alc269_fujitsu_mixer },
13165 .cap_mixer = alc269_epc_capture_mixer,
13166 .init_verbs = { alc269_init_verbs,
13167 alc269_eeepc_dmic_init_verbs },
13168 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13169 .dac_nids = alc269_dac_nids,
13171 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13172 .channel_mode = alc269_modes,
13173 .input_mux = &alc269_eeepc_dmic_capture_source,
13174 .unsol_event = alc269_eeepc_dmic_unsol_event,
13175 .init_hook = alc269_eeepc_dmic_inithook,
13177 [ALC269_LIFEBOOK] = {
13178 .mixers = { alc269_lifebook_mixer },
13179 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13180 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13181 .dac_nids = alc269_dac_nids,
13183 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13184 .channel_mode = alc269_modes,
13185 .input_mux = &alc269_capture_source,
13186 .unsol_event = alc269_lifebook_unsol_event,
13187 .init_hook = alc269_lifebook_init_hook,
13191 static int patch_alc269(struct hda_codec *codec)
13193 struct alc_spec *spec;
13197 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13201 codec->spec = spec;
13203 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13205 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13209 if (board_config < 0) {
13210 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
13211 "trying auto-probe from BIOS...\n");
13212 board_config = ALC269_AUTO;
13215 if (board_config == ALC269_AUTO) {
13216 /* automatic parse from the BIOS config */
13217 err = alc269_parse_auto_config(codec);
13223 "hda_codec: Cannot set up configuration "
13224 "from BIOS. Using base mode...\n");
13225 board_config = ALC269_BASIC;
13229 err = snd_hda_attach_beep_device(codec, 0x1);
13235 if (board_config != ALC269_AUTO)
13236 setup_preset(spec, &alc269_presets[board_config]);
13238 spec->stream_name_analog = "ALC269 Analog";
13239 if (codec->subsystem_id == 0x17aa3bf8) {
13240 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13241 * fix the sample rate of analog I/O to 44.1kHz
13243 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13244 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13246 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13247 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13249 spec->stream_name_digital = "ALC269 Digital";
13250 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13251 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13253 spec->adc_nids = alc269_adc_nids;
13254 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13255 spec->capsrc_nids = alc269_capsrc_nids;
13256 if (!spec->cap_mixer)
13257 set_capture_mixer(spec);
13258 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13260 codec->patch_ops = alc_patch_ops;
13261 if (board_config == ALC269_AUTO)
13262 spec->init_hook = alc269_auto_init;
13263 #ifdef CONFIG_SND_HDA_POWER_SAVE
13264 if (!spec->loopback.amplist)
13265 spec->loopback.amplist = alc269_loopbacks;
13267 codec->proc_widget_hook = print_realtek_coef;
13273 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13277 * set the path ways for 2 channel output
13278 * need to set the codec line out and mic 1 pin widgets to inputs
13280 static struct hda_verb alc861_threestack_ch2_init[] = {
13281 /* set pin widget 1Ah (line in) for input */
13282 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13283 /* set pin widget 18h (mic1/2) for input, for mic also enable
13286 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13288 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13290 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13291 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13297 * need to set the codec line out and mic 1 pin widgets to outputs
13299 static struct hda_verb alc861_threestack_ch6_init[] = {
13300 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13301 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13302 /* set pin widget 18h (mic1) for output (CLFE)*/
13303 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13305 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13306 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13308 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13310 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13311 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13316 static struct hda_channel_mode alc861_threestack_modes[2] = {
13317 { 2, alc861_threestack_ch2_init },
13318 { 6, alc861_threestack_ch6_init },
13320 /* Set mic1 as input and unmute the mixer */
13321 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13322 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13323 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13326 /* Set mic1 as output and mute mixer */
13327 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13328 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13329 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13333 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13334 { 2, alc861_uniwill_m31_ch2_init },
13335 { 4, alc861_uniwill_m31_ch4_init },
13338 /* Set mic1 and line-in as input and unmute the mixer */
13339 static struct hda_verb alc861_asus_ch2_init[] = {
13340 /* set pin widget 1Ah (line in) for input */
13341 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13342 /* set pin widget 18h (mic1/2) for input, for mic also enable
13345 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13347 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13349 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13350 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13354 /* Set mic1 nad line-in as output and mute mixer */
13355 static struct hda_verb alc861_asus_ch6_init[] = {
13356 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13357 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13358 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13359 /* set pin widget 18h (mic1) for output (CLFE)*/
13360 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13361 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13362 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13363 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13365 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13367 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13368 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13373 static struct hda_channel_mode alc861_asus_modes[2] = {
13374 { 2, alc861_asus_ch2_init },
13375 { 6, alc861_asus_ch6_init },
13380 static struct snd_kcontrol_new alc861_base_mixer[] = {
13381 /* output mixer control */
13382 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13383 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13384 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13385 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13386 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13388 /*Input mixer control */
13389 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13390 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13391 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13392 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13393 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13394 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13395 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13396 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13397 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13398 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13403 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13404 /* output mixer control */
13405 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13406 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13407 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13408 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13409 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13411 /* Input mixer control */
13412 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13413 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13414 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13415 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13416 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13417 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13418 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13419 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13420 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13421 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13424 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13425 .name = "Channel Mode",
13426 .info = alc_ch_mode_info,
13427 .get = alc_ch_mode_get,
13428 .put = alc_ch_mode_put,
13429 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13434 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13435 /* output mixer control */
13436 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13437 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13438 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13443 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13444 /* output mixer control */
13445 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13446 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13447 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13448 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13449 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13451 /* Input mixer control */
13452 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13453 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13454 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13455 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13456 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13457 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13458 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13459 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13460 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13461 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13464 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13465 .name = "Channel Mode",
13466 .info = alc_ch_mode_info,
13467 .get = alc_ch_mode_get,
13468 .put = alc_ch_mode_put,
13469 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13474 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13475 /* output mixer control */
13476 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13477 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13478 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13479 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13480 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13482 /* Input mixer control */
13483 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13484 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13485 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13486 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13487 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13488 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13489 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13490 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13491 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13492 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13495 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13496 .name = "Channel Mode",
13497 .info = alc_ch_mode_info,
13498 .get = alc_ch_mode_get,
13499 .put = alc_ch_mode_put,
13500 .private_value = ARRAY_SIZE(alc861_asus_modes),
13505 /* additional mixer */
13506 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13507 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13508 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13513 * generic initialization of ADC, input mixers and output mixers
13515 static struct hda_verb alc861_base_init_verbs[] = {
13517 * Unmute ADC0 and set the default input to mic-in
13519 /* port-A for surround (rear panel) */
13520 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13521 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13522 /* port-B for mic-in (rear panel) with vref */
13523 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13524 /* port-C for line-in (rear panel) */
13525 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13526 /* port-D for Front */
13527 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13528 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13529 /* port-E for HP out (front panel) */
13530 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13531 /* route front PCM to HP */
13532 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13533 /* port-F for mic-in (front panel) with vref */
13534 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13535 /* port-G for CLFE (rear panel) */
13536 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13537 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13538 /* port-H for side (rear panel) */
13539 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13540 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13542 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13543 /* route front mic to ADC1*/
13544 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13545 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13547 /* Unmute DAC0~3 & spdif out*/
13548 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13549 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13550 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13551 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13554 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13555 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13556 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13557 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13558 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13560 /* Unmute Stereo Mixer 15 */
13561 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13562 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13563 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13564 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13566 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13567 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13568 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13569 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13570 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13571 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13572 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13573 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13574 /* hp used DAC 3 (Front) */
13575 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13576 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13581 static struct hda_verb alc861_threestack_init_verbs[] = {
13583 * Unmute ADC0 and set the default input to mic-in
13585 /* port-A for surround (rear panel) */
13586 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13587 /* port-B for mic-in (rear panel) with vref */
13588 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13589 /* port-C for line-in (rear panel) */
13590 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13591 /* port-D for Front */
13592 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13593 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13594 /* port-E for HP out (front panel) */
13595 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13596 /* route front PCM to HP */
13597 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13598 /* port-F for mic-in (front panel) with vref */
13599 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13600 /* port-G for CLFE (rear panel) */
13601 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13602 /* port-H for side (rear panel) */
13603 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13605 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13606 /* route front mic to ADC1*/
13607 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13608 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13609 /* Unmute DAC0~3 & spdif out*/
13610 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13611 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13612 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13613 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13616 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13617 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13618 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13619 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13620 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13622 /* Unmute Stereo Mixer 15 */
13623 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13624 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13625 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13626 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13628 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13629 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13630 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13631 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13632 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13633 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13634 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13635 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13636 /* hp used DAC 3 (Front) */
13637 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13638 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13642 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13644 * Unmute ADC0 and set the default input to mic-in
13646 /* port-A for surround (rear panel) */
13647 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13648 /* port-B for mic-in (rear panel) with vref */
13649 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13650 /* port-C for line-in (rear panel) */
13651 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13652 /* port-D for Front */
13653 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13654 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13655 /* port-E for HP out (front panel) */
13656 /* this has to be set to VREF80 */
13657 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13658 /* route front PCM to HP */
13659 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13660 /* port-F for mic-in (front panel) with vref */
13661 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13662 /* port-G for CLFE (rear panel) */
13663 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13664 /* port-H for side (rear panel) */
13665 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13667 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13668 /* route front mic to ADC1*/
13669 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13670 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13671 /* Unmute DAC0~3 & spdif out*/
13672 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13673 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13674 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13675 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13676 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13678 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13679 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13680 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13681 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13682 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13684 /* Unmute Stereo Mixer 15 */
13685 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13686 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13687 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13688 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13690 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13691 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13692 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13693 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13694 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13695 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13696 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13697 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13698 /* hp used DAC 3 (Front) */
13699 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13700 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13704 static struct hda_verb alc861_asus_init_verbs[] = {
13706 * Unmute ADC0 and set the default input to mic-in
13708 /* port-A for surround (rear panel)
13709 * according to codec#0 this is the HP jack
13711 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13712 /* route front PCM to HP */
13713 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13714 /* port-B for mic-in (rear panel) with vref */
13715 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13716 /* port-C for line-in (rear panel) */
13717 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13718 /* port-D for Front */
13719 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13720 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13721 /* port-E for HP out (front panel) */
13722 /* this has to be set to VREF80 */
13723 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13724 /* route front PCM to HP */
13725 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13726 /* port-F for mic-in (front panel) with vref */
13727 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13728 /* port-G for CLFE (rear panel) */
13729 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13730 /* port-H for side (rear panel) */
13731 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13733 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13734 /* route front mic to ADC1*/
13735 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13736 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13737 /* Unmute DAC0~3 & spdif out*/
13738 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13739 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13740 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13741 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13743 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13744 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13745 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13746 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13747 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13749 /* Unmute Stereo Mixer 15 */
13750 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13751 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13752 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13753 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13755 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13756 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13757 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13758 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13759 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13760 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13761 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13762 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13763 /* hp used DAC 3 (Front) */
13764 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13765 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13769 /* additional init verbs for ASUS laptops */
13770 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13771 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13772 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13777 * generic initialization of ADC, input mixers and output mixers
13779 static struct hda_verb alc861_auto_init_verbs[] = {
13781 * Unmute ADC0 and set the default input to mic-in
13783 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13784 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13786 /* Unmute DAC0~3 & spdif out*/
13787 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13788 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13789 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13790 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13791 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13793 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13794 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13795 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13796 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13797 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13799 /* Unmute Stereo Mixer 15 */
13800 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13802 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13803 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13805 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13806 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13807 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13808 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13809 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13810 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13811 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13812 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13814 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13815 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13816 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13817 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13818 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13819 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13820 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13821 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13823 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13828 static struct hda_verb alc861_toshiba_init_verbs[] = {
13829 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13834 /* toggle speaker-output according to the hp-jack state */
13835 static void alc861_toshiba_automute(struct hda_codec *codec)
13837 unsigned int present;
13839 present = snd_hda_codec_read(codec, 0x0f, 0,
13840 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13841 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13842 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13843 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13844 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13847 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13850 if ((res >> 26) == ALC880_HP_EVENT)
13851 alc861_toshiba_automute(codec);
13854 /* pcm configuration: identiacal with ALC880 */
13855 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13856 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13857 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13858 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13861 #define ALC861_DIGOUT_NID 0x07
13863 static struct hda_channel_mode alc861_8ch_modes[1] = {
13867 static hda_nid_t alc861_dac_nids[4] = {
13868 /* front, surround, clfe, side */
13869 0x03, 0x06, 0x05, 0x04
13872 static hda_nid_t alc660_dac_nids[3] = {
13873 /* front, clfe, surround */
13877 static hda_nid_t alc861_adc_nids[1] = {
13882 static struct hda_input_mux alc861_capture_source = {
13886 { "Front Mic", 0x3 },
13893 /* fill in the dac_nids table from the parsed pin configuration */
13894 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13895 const struct auto_pin_cfg *cfg)
13900 spec->multiout.dac_nids = spec->private_dac_nids;
13901 for (i = 0; i < cfg->line_outs; i++) {
13902 nid = cfg->line_out_pins[i];
13904 if (i >= ARRAY_SIZE(alc861_dac_nids))
13906 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13909 spec->multiout.num_dacs = cfg->line_outs;
13913 /* add playback controls from the parsed DAC table */
13914 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13915 const struct auto_pin_cfg *cfg)
13918 static const char *chname[4] = {
13919 "Front", "Surround", NULL /*CLFE*/, "Side"
13924 for (i = 0; i < cfg->line_outs; i++) {
13925 nid = spec->multiout.dac_nids[i];
13930 err = add_control(spec, ALC_CTL_BIND_MUTE,
13931 "Center Playback Switch",
13932 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13936 err = add_control(spec, ALC_CTL_BIND_MUTE,
13937 "LFE Playback Switch",
13938 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13943 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13945 if (nid == alc861_dac_nids[idx])
13947 sprintf(name, "%s Playback Switch", chname[idx]);
13948 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13949 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13958 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13966 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13968 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13969 "Headphone Playback Switch",
13970 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13973 spec->multiout.hp_nid = nid;
13978 /* create playback/capture controls for input pins */
13979 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13980 const struct auto_pin_cfg *cfg)
13982 struct hda_input_mux *imux = &spec->private_imux[0];
13983 int i, err, idx, idx1;
13985 for (i = 0; i < AUTO_PIN_LAST; i++) {
13986 switch (cfg->input_pins[i]) {
13989 idx = 2; /* Line In */
13993 idx = 2; /* Line In */
13997 idx = 1; /* Mic In */
14001 idx = 1; /* Mic In */
14011 err = new_analog_input(spec, cfg->input_pins[i],
14012 auto_pin_cfg_labels[i], idx, 0x15);
14016 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
14017 imux->items[imux->num_items].index = idx1;
14023 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14025 int pin_type, int dac_idx)
14027 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14029 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14033 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14035 struct alc_spec *spec = codec->spec;
14038 for (i = 0; i < spec->autocfg.line_outs; i++) {
14039 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14040 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14042 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14043 spec->multiout.dac_nids[i]);
14047 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14049 struct alc_spec *spec = codec->spec;
14052 pin = spec->autocfg.hp_pins[0];
14053 if (pin) /* connect to front */
14054 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14055 spec->multiout.dac_nids[0]);
14056 pin = spec->autocfg.speaker_pins[0];
14058 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14061 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14063 struct alc_spec *spec = codec->spec;
14066 for (i = 0; i < AUTO_PIN_LAST; i++) {
14067 hda_nid_t nid = spec->autocfg.input_pins[i];
14068 if (nid >= 0x0c && nid <= 0x11)
14069 alc_set_input_pin(codec, nid, i);
14073 /* parse the BIOS configuration and set up the alc_spec */
14074 /* return 1 if successful, 0 if the proper config is not found,
14075 * or a negative error code
14077 static int alc861_parse_auto_config(struct hda_codec *codec)
14079 struct alc_spec *spec = codec->spec;
14081 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14083 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14087 if (!spec->autocfg.line_outs)
14088 return 0; /* can't find valid BIOS pin config */
14090 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
14093 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
14096 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
14099 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
14103 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14105 if (spec->autocfg.dig_outs)
14106 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14108 if (spec->kctls.list)
14109 add_mixer(spec, spec->kctls.list);
14111 add_verb(spec, alc861_auto_init_verbs);
14113 spec->num_mux_defs = 1;
14114 spec->input_mux = &spec->private_imux[0];
14116 spec->adc_nids = alc861_adc_nids;
14117 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14118 set_capture_mixer(spec);
14120 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14125 /* additional initialization for auto-configuration model */
14126 static void alc861_auto_init(struct hda_codec *codec)
14128 struct alc_spec *spec = codec->spec;
14129 alc861_auto_init_multi_out(codec);
14130 alc861_auto_init_hp_out(codec);
14131 alc861_auto_init_analog_input(codec);
14132 if (spec->unsol_event)
14133 alc_inithook(codec);
14136 #ifdef CONFIG_SND_HDA_POWER_SAVE
14137 static struct hda_amp_list alc861_loopbacks[] = {
14138 { 0x15, HDA_INPUT, 0 },
14139 { 0x15, HDA_INPUT, 1 },
14140 { 0x15, HDA_INPUT, 2 },
14141 { 0x15, HDA_INPUT, 3 },
14148 * configuration and preset
14150 static const char *alc861_models[ALC861_MODEL_LAST] = {
14151 [ALC861_3ST] = "3stack",
14152 [ALC660_3ST] = "3stack-660",
14153 [ALC861_3ST_DIG] = "3stack-dig",
14154 [ALC861_6ST_DIG] = "6stack-dig",
14155 [ALC861_UNIWILL_M31] = "uniwill-m31",
14156 [ALC861_TOSHIBA] = "toshiba",
14157 [ALC861_ASUS] = "asus",
14158 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14159 [ALC861_AUTO] = "auto",
14162 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14163 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14164 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14165 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14166 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14167 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14168 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14169 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14170 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14171 * Any other models that need this preset?
14173 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14174 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14175 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14176 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14177 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14178 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14179 /* FIXME: the below seems conflict */
14180 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14181 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14182 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14186 static struct alc_config_preset alc861_presets[] = {
14188 .mixers = { alc861_3ST_mixer },
14189 .init_verbs = { alc861_threestack_init_verbs },
14190 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14191 .dac_nids = alc861_dac_nids,
14192 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14193 .channel_mode = alc861_threestack_modes,
14195 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14196 .adc_nids = alc861_adc_nids,
14197 .input_mux = &alc861_capture_source,
14199 [ALC861_3ST_DIG] = {
14200 .mixers = { alc861_base_mixer },
14201 .init_verbs = { alc861_threestack_init_verbs },
14202 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14203 .dac_nids = alc861_dac_nids,
14204 .dig_out_nid = ALC861_DIGOUT_NID,
14205 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14206 .channel_mode = alc861_threestack_modes,
14208 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14209 .adc_nids = alc861_adc_nids,
14210 .input_mux = &alc861_capture_source,
14212 [ALC861_6ST_DIG] = {
14213 .mixers = { alc861_base_mixer },
14214 .init_verbs = { alc861_base_init_verbs },
14215 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14216 .dac_nids = alc861_dac_nids,
14217 .dig_out_nid = ALC861_DIGOUT_NID,
14218 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14219 .channel_mode = alc861_8ch_modes,
14220 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14221 .adc_nids = alc861_adc_nids,
14222 .input_mux = &alc861_capture_source,
14225 .mixers = { alc861_3ST_mixer },
14226 .init_verbs = { alc861_threestack_init_verbs },
14227 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14228 .dac_nids = alc660_dac_nids,
14229 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14230 .channel_mode = alc861_threestack_modes,
14232 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14233 .adc_nids = alc861_adc_nids,
14234 .input_mux = &alc861_capture_source,
14236 [ALC861_UNIWILL_M31] = {
14237 .mixers = { alc861_uniwill_m31_mixer },
14238 .init_verbs = { alc861_uniwill_m31_init_verbs },
14239 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14240 .dac_nids = alc861_dac_nids,
14241 .dig_out_nid = ALC861_DIGOUT_NID,
14242 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14243 .channel_mode = alc861_uniwill_m31_modes,
14245 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14246 .adc_nids = alc861_adc_nids,
14247 .input_mux = &alc861_capture_source,
14249 [ALC861_TOSHIBA] = {
14250 .mixers = { alc861_toshiba_mixer },
14251 .init_verbs = { alc861_base_init_verbs,
14252 alc861_toshiba_init_verbs },
14253 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14254 .dac_nids = alc861_dac_nids,
14255 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14256 .channel_mode = alc883_3ST_2ch_modes,
14257 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14258 .adc_nids = alc861_adc_nids,
14259 .input_mux = &alc861_capture_source,
14260 .unsol_event = alc861_toshiba_unsol_event,
14261 .init_hook = alc861_toshiba_automute,
14264 .mixers = { alc861_asus_mixer },
14265 .init_verbs = { alc861_asus_init_verbs },
14266 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14267 .dac_nids = alc861_dac_nids,
14268 .dig_out_nid = ALC861_DIGOUT_NID,
14269 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14270 .channel_mode = alc861_asus_modes,
14273 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14274 .adc_nids = alc861_adc_nids,
14275 .input_mux = &alc861_capture_source,
14277 [ALC861_ASUS_LAPTOP] = {
14278 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14279 .init_verbs = { alc861_asus_init_verbs,
14280 alc861_asus_laptop_init_verbs },
14281 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14282 .dac_nids = alc861_dac_nids,
14283 .dig_out_nid = ALC861_DIGOUT_NID,
14284 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14285 .channel_mode = alc883_3ST_2ch_modes,
14287 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14288 .adc_nids = alc861_adc_nids,
14289 .input_mux = &alc861_capture_source,
14294 static int patch_alc861(struct hda_codec *codec)
14296 struct alc_spec *spec;
14300 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14304 codec->spec = spec;
14306 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14310 if (board_config < 0) {
14311 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
14312 "trying auto-probe from BIOS...\n");
14313 board_config = ALC861_AUTO;
14316 if (board_config == ALC861_AUTO) {
14317 /* automatic parse from the BIOS config */
14318 err = alc861_parse_auto_config(codec);
14324 "hda_codec: Cannot set up configuration "
14325 "from BIOS. Using base mode...\n");
14326 board_config = ALC861_3ST_DIG;
14330 err = snd_hda_attach_beep_device(codec, 0x23);
14336 if (board_config != ALC861_AUTO)
14337 setup_preset(spec, &alc861_presets[board_config]);
14339 spec->stream_name_analog = "ALC861 Analog";
14340 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14341 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14343 spec->stream_name_digital = "ALC861 Digital";
14344 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14345 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14347 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14349 spec->vmaster_nid = 0x03;
14351 codec->patch_ops = alc_patch_ops;
14352 if (board_config == ALC861_AUTO)
14353 spec->init_hook = alc861_auto_init;
14354 #ifdef CONFIG_SND_HDA_POWER_SAVE
14355 if (!spec->loopback.amplist)
14356 spec->loopback.amplist = alc861_loopbacks;
14358 codec->proc_widget_hook = print_realtek_coef;
14364 * ALC861-VD support
14368 * In addition, an independent DAC
14370 #define ALC861VD_DIGOUT_NID 0x06
14372 static hda_nid_t alc861vd_dac_nids[4] = {
14373 /* front, surr, clfe, side surr */
14374 0x02, 0x03, 0x04, 0x05
14377 /* dac_nids for ALC660vd are in a different order - according to
14378 * Realtek's driver.
14379 * This should probably tesult in a different mixer for 6stack models
14380 * of ALC660vd codecs, but for now there is only 3stack mixer
14381 * - and it is the same as in 861vd.
14382 * adc_nids in ALC660vd are (is) the same as in 861vd
14384 static hda_nid_t alc660vd_dac_nids[3] = {
14385 /* front, rear, clfe, rear_surr */
14389 static hda_nid_t alc861vd_adc_nids[1] = {
14394 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14397 /* FIXME: should be a matrix-type input source selection */
14398 static struct hda_input_mux alc861vd_capture_source = {
14402 { "Front Mic", 0x1 },
14408 static struct hda_input_mux alc861vd_dallas_capture_source = {
14411 { "Ext Mic", 0x0 },
14412 { "Int Mic", 0x1 },
14416 static struct hda_input_mux alc861vd_hp_capture_source = {
14419 { "Front Mic", 0x0 },
14420 { "ATAPI Mic", 0x1 },
14427 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14434 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14435 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14436 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14437 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14438 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14445 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14446 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14447 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14448 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14449 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14453 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14454 { 6, alc861vd_6stack_ch6_init },
14455 { 8, alc861vd_6stack_ch8_init },
14458 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14460 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14461 .name = "Channel Mode",
14462 .info = alc_ch_mode_info,
14463 .get = alc_ch_mode_get,
14464 .put = alc_ch_mode_put,
14469 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14470 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14472 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14473 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14474 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14476 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14477 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14479 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14481 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14483 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14484 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14486 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14487 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14489 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14491 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14492 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14493 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14495 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14496 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14497 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14499 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14500 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14502 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14503 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14508 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14509 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14510 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14512 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14514 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14515 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14516 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14518 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14519 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14520 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14522 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14523 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14525 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14526 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14531 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14532 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14533 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14534 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14536 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14538 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14539 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14540 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14542 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14543 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14544 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14546 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14547 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14552 /* Pin assignment: Speaker=0x14, HP = 0x15,
14553 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14555 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14556 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14557 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14558 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14559 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14560 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14561 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14562 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14563 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14564 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14565 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14569 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14570 * Front Mic=0x18, ATAPI Mic = 0x19,
14572 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14573 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14574 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14575 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14576 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14577 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14578 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14579 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14580 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14586 * generic initialization of ADC, input mixers and output mixers
14588 static struct hda_verb alc861vd_volume_init_verbs[] = {
14590 * Unmute ADC0 and set the default input to mic-in
14592 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14593 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14595 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14596 * the analog-loopback mixer widget
14598 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14599 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14600 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14601 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14602 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14603 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14605 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14606 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14607 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14608 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14609 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14612 * Set up output mixers (0x02 - 0x05)
14614 /* set vol=0 to output mixers */
14615 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14616 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14617 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14618 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14620 /* set up input amps for analog loopback */
14621 /* Amp Indices: DAC = 0, mixer = 1 */
14622 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14623 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14624 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14625 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14626 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14627 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14628 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14629 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14635 * 3-stack pin configuration:
14636 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14638 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14640 * Set pin mode and muting
14642 /* set front pin widgets 0x14 for output */
14643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14644 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14645 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14647 /* Mic (rear) pin: input vref at 80% */
14648 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14649 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14650 /* Front Mic pin: input vref at 80% */
14651 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14652 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14653 /* Line In pin: input */
14654 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14655 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14656 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14657 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14658 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14659 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14660 /* CD pin widget for input */
14661 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14667 * 6-stack pin configuration:
14669 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14671 * Set pin mode and muting
14673 /* set front pin widgets 0x14 for output */
14674 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14675 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14676 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14678 /* Rear Pin: output 1 (0x0d) */
14679 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14680 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14681 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14682 /* CLFE Pin: output 2 (0x0e) */
14683 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14684 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14685 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14686 /* Side Pin: output 3 (0x0f) */
14687 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14688 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14689 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14691 /* Mic (rear) pin: input vref at 80% */
14692 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14693 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14694 /* Front Mic pin: input vref at 80% */
14695 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14696 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14697 /* Line In pin: input */
14698 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14699 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14700 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14701 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14702 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14703 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14704 /* CD pin widget for input */
14705 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14710 static struct hda_verb alc861vd_eapd_verbs[] = {
14711 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14715 static struct hda_verb alc660vd_eapd_verbs[] = {
14716 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14717 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14721 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14722 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14723 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14725 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14726 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14730 /* toggle speaker-output according to the hp-jack state */
14731 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14733 unsigned int present;
14734 unsigned char bits;
14736 present = snd_hda_codec_read(codec, 0x1b, 0,
14737 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14738 bits = present ? HDA_AMP_MUTE : 0;
14739 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14740 HDA_AMP_MUTE, bits);
14743 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14745 unsigned int present;
14746 unsigned char bits;
14748 present = snd_hda_codec_read(codec, 0x18, 0,
14749 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14750 bits = present ? HDA_AMP_MUTE : 0;
14751 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14752 HDA_AMP_MUTE, bits);
14755 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14757 alc861vd_lenovo_hp_automute(codec);
14758 alc861vd_lenovo_mic_automute(codec);
14761 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14764 switch (res >> 26) {
14765 case ALC880_HP_EVENT:
14766 alc861vd_lenovo_hp_automute(codec);
14768 case ALC880_MIC_EVENT:
14769 alc861vd_lenovo_mic_automute(codec);
14774 static struct hda_verb alc861vd_dallas_verbs[] = {
14775 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14776 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14777 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14778 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14780 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14781 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14782 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14783 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14784 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14785 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14786 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14787 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14790 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14791 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14793 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14794 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14795 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14796 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14798 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14799 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14800 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14801 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14802 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14803 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14804 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14805 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14807 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14808 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14809 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14810 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14812 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14813 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14814 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14819 /* toggle speaker-output according to the hp-jack state */
14820 static void alc861vd_dallas_automute(struct hda_codec *codec)
14822 unsigned int present;
14824 present = snd_hda_codec_read(codec, 0x15, 0,
14825 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14826 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14827 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14830 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14832 if ((res >> 26) == ALC880_HP_EVENT)
14833 alc861vd_dallas_automute(codec);
14836 #ifdef CONFIG_SND_HDA_POWER_SAVE
14837 #define alc861vd_loopbacks alc880_loopbacks
14840 /* pcm configuration: identiacal with ALC880 */
14841 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14842 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14843 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14844 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14847 * configuration and preset
14849 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14850 [ALC660VD_3ST] = "3stack-660",
14851 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14852 [ALC660VD_ASUS_V1S] = "asus-v1s",
14853 [ALC861VD_3ST] = "3stack",
14854 [ALC861VD_3ST_DIG] = "3stack-digout",
14855 [ALC861VD_6ST_DIG] = "6stack-digout",
14856 [ALC861VD_LENOVO] = "lenovo",
14857 [ALC861VD_DALLAS] = "dallas",
14858 [ALC861VD_HP] = "hp",
14859 [ALC861VD_AUTO] = "auto",
14862 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14863 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14864 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14865 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14866 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14867 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14868 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14869 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14870 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14871 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14872 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14873 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14874 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14875 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14876 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14877 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14881 static struct alc_config_preset alc861vd_presets[] = {
14883 .mixers = { alc861vd_3st_mixer },
14884 .init_verbs = { alc861vd_volume_init_verbs,
14885 alc861vd_3stack_init_verbs },
14886 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14887 .dac_nids = alc660vd_dac_nids,
14888 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14889 .channel_mode = alc861vd_3stack_2ch_modes,
14890 .input_mux = &alc861vd_capture_source,
14892 [ALC660VD_3ST_DIG] = {
14893 .mixers = { alc861vd_3st_mixer },
14894 .init_verbs = { alc861vd_volume_init_verbs,
14895 alc861vd_3stack_init_verbs },
14896 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14897 .dac_nids = alc660vd_dac_nids,
14898 .dig_out_nid = ALC861VD_DIGOUT_NID,
14899 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14900 .channel_mode = alc861vd_3stack_2ch_modes,
14901 .input_mux = &alc861vd_capture_source,
14904 .mixers = { alc861vd_3st_mixer },
14905 .init_verbs = { alc861vd_volume_init_verbs,
14906 alc861vd_3stack_init_verbs },
14907 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14908 .dac_nids = alc861vd_dac_nids,
14909 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14910 .channel_mode = alc861vd_3stack_2ch_modes,
14911 .input_mux = &alc861vd_capture_source,
14913 [ALC861VD_3ST_DIG] = {
14914 .mixers = { alc861vd_3st_mixer },
14915 .init_verbs = { alc861vd_volume_init_verbs,
14916 alc861vd_3stack_init_verbs },
14917 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14918 .dac_nids = alc861vd_dac_nids,
14919 .dig_out_nid = ALC861VD_DIGOUT_NID,
14920 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14921 .channel_mode = alc861vd_3stack_2ch_modes,
14922 .input_mux = &alc861vd_capture_source,
14924 [ALC861VD_6ST_DIG] = {
14925 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14926 .init_verbs = { alc861vd_volume_init_verbs,
14927 alc861vd_6stack_init_verbs },
14928 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14929 .dac_nids = alc861vd_dac_nids,
14930 .dig_out_nid = ALC861VD_DIGOUT_NID,
14931 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14932 .channel_mode = alc861vd_6stack_modes,
14933 .input_mux = &alc861vd_capture_source,
14935 [ALC861VD_LENOVO] = {
14936 .mixers = { alc861vd_lenovo_mixer },
14937 .init_verbs = { alc861vd_volume_init_verbs,
14938 alc861vd_3stack_init_verbs,
14939 alc861vd_eapd_verbs,
14940 alc861vd_lenovo_unsol_verbs },
14941 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14942 .dac_nids = alc660vd_dac_nids,
14943 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14944 .channel_mode = alc861vd_3stack_2ch_modes,
14945 .input_mux = &alc861vd_capture_source,
14946 .unsol_event = alc861vd_lenovo_unsol_event,
14947 .init_hook = alc861vd_lenovo_automute,
14949 [ALC861VD_DALLAS] = {
14950 .mixers = { alc861vd_dallas_mixer },
14951 .init_verbs = { alc861vd_dallas_verbs },
14952 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14953 .dac_nids = alc861vd_dac_nids,
14954 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14955 .channel_mode = alc861vd_3stack_2ch_modes,
14956 .input_mux = &alc861vd_dallas_capture_source,
14957 .unsol_event = alc861vd_dallas_unsol_event,
14958 .init_hook = alc861vd_dallas_automute,
14961 .mixers = { alc861vd_hp_mixer },
14962 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14963 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14964 .dac_nids = alc861vd_dac_nids,
14965 .dig_out_nid = ALC861VD_DIGOUT_NID,
14966 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14967 .channel_mode = alc861vd_3stack_2ch_modes,
14968 .input_mux = &alc861vd_hp_capture_source,
14969 .unsol_event = alc861vd_dallas_unsol_event,
14970 .init_hook = alc861vd_dallas_automute,
14972 [ALC660VD_ASUS_V1S] = {
14973 .mixers = { alc861vd_lenovo_mixer },
14974 .init_verbs = { alc861vd_volume_init_verbs,
14975 alc861vd_3stack_init_verbs,
14976 alc861vd_eapd_verbs,
14977 alc861vd_lenovo_unsol_verbs },
14978 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14979 .dac_nids = alc660vd_dac_nids,
14980 .dig_out_nid = ALC861VD_DIGOUT_NID,
14981 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14982 .channel_mode = alc861vd_3stack_2ch_modes,
14983 .input_mux = &alc861vd_capture_source,
14984 .unsol_event = alc861vd_lenovo_unsol_event,
14985 .init_hook = alc861vd_lenovo_automute,
14990 * BIOS auto configuration
14992 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14993 hda_nid_t nid, int pin_type, int dac_idx)
14995 alc_set_pin_output(codec, nid, pin_type);
14998 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15000 struct alc_spec *spec = codec->spec;
15003 for (i = 0; i <= HDA_SIDE; i++) {
15004 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15005 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15007 alc861vd_auto_set_output_and_unmute(codec, nid,
15013 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15015 struct alc_spec *spec = codec->spec;
15018 pin = spec->autocfg.hp_pins[0];
15019 if (pin) /* connect to front and use dac 0 */
15020 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15021 pin = spec->autocfg.speaker_pins[0];
15023 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15026 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
15027 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15029 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15031 struct alc_spec *spec = codec->spec;
15034 for (i = 0; i < AUTO_PIN_LAST; i++) {
15035 hda_nid_t nid = spec->autocfg.input_pins[i];
15036 if (alc861vd_is_input_pin(nid)) {
15037 alc_set_input_pin(codec, nid, i);
15038 if (nid != ALC861VD_PIN_CD_NID &&
15039 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15040 snd_hda_codec_write(codec, nid, 0,
15041 AC_VERB_SET_AMP_GAIN_MUTE,
15047 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15049 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15050 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15052 /* add playback controls from the parsed DAC table */
15053 /* Based on ALC880 version. But ALC861VD has separate,
15054 * different NIDs for mute/unmute switch and volume control */
15055 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15056 const struct auto_pin_cfg *cfg)
15059 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15060 hda_nid_t nid_v, nid_s;
15063 for (i = 0; i < cfg->line_outs; i++) {
15064 if (!spec->multiout.dac_nids[i])
15066 nid_v = alc861vd_idx_to_mixer_vol(
15068 spec->multiout.dac_nids[i]));
15069 nid_s = alc861vd_idx_to_mixer_switch(
15071 spec->multiout.dac_nids[i]));
15075 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15076 "Center Playback Volume",
15077 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15081 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15082 "LFE Playback Volume",
15083 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15087 err = add_control(spec, ALC_CTL_BIND_MUTE,
15088 "Center Playback Switch",
15089 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15093 err = add_control(spec, ALC_CTL_BIND_MUTE,
15094 "LFE Playback Switch",
15095 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15100 sprintf(name, "%s Playback Volume", chname[i]);
15101 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15102 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15106 sprintf(name, "%s Playback Switch", chname[i]);
15107 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15108 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15117 /* add playback controls for speaker and HP outputs */
15118 /* Based on ALC880 version. But ALC861VD has separate,
15119 * different NIDs for mute/unmute switch and volume control */
15120 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15121 hda_nid_t pin, const char *pfx)
15123 hda_nid_t nid_v, nid_s;
15130 if (alc880_is_fixed_pin(pin)) {
15131 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15132 /* specify the DAC as the extra output */
15133 if (!spec->multiout.hp_nid)
15134 spec->multiout.hp_nid = nid_v;
15136 spec->multiout.extra_out_nid[0] = nid_v;
15137 /* control HP volume/switch on the output mixer amp */
15138 nid_v = alc861vd_idx_to_mixer_vol(
15139 alc880_fixed_pin_idx(pin));
15140 nid_s = alc861vd_idx_to_mixer_switch(
15141 alc880_fixed_pin_idx(pin));
15143 sprintf(name, "%s Playback Volume", pfx);
15144 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15145 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15148 sprintf(name, "%s Playback Switch", pfx);
15149 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15150 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15153 } else if (alc880_is_multi_pin(pin)) {
15154 /* set manual connection */
15155 /* we have only a switch on HP-out PIN */
15156 sprintf(name, "%s Playback Switch", pfx);
15157 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15158 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15165 /* parse the BIOS configuration and set up the alc_spec
15166 * return 1 if successful, 0 if the proper config is not found,
15167 * or a negative error code
15168 * Based on ALC880 version - had to change it to override
15169 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15170 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15172 struct alc_spec *spec = codec->spec;
15174 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15176 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15180 if (!spec->autocfg.line_outs)
15181 return 0; /* can't find valid BIOS pin config */
15183 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15186 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15189 err = alc861vd_auto_create_extra_out(spec,
15190 spec->autocfg.speaker_pins[0],
15194 err = alc861vd_auto_create_extra_out(spec,
15195 spec->autocfg.hp_pins[0],
15199 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15203 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15205 if (spec->autocfg.dig_outs)
15206 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15208 if (spec->kctls.list)
15209 add_mixer(spec, spec->kctls.list);
15211 add_verb(spec, alc861vd_volume_init_verbs);
15213 spec->num_mux_defs = 1;
15214 spec->input_mux = &spec->private_imux[0];
15216 err = alc_auto_add_mic_boost(codec);
15220 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15225 /* additional initialization for auto-configuration model */
15226 static void alc861vd_auto_init(struct hda_codec *codec)
15228 struct alc_spec *spec = codec->spec;
15229 alc861vd_auto_init_multi_out(codec);
15230 alc861vd_auto_init_hp_out(codec);
15231 alc861vd_auto_init_analog_input(codec);
15232 alc861vd_auto_init_input_src(codec);
15233 if (spec->unsol_event)
15234 alc_inithook(codec);
15237 static int patch_alc861vd(struct hda_codec *codec)
15239 struct alc_spec *spec;
15240 int err, board_config;
15242 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15246 codec->spec = spec;
15248 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15252 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15253 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
15254 "ALC861VD, trying auto-probe from BIOS...\n");
15255 board_config = ALC861VD_AUTO;
15258 if (board_config == ALC861VD_AUTO) {
15259 /* automatic parse from the BIOS config */
15260 err = alc861vd_parse_auto_config(codec);
15266 "hda_codec: Cannot set up configuration "
15267 "from BIOS. Using base mode...\n");
15268 board_config = ALC861VD_3ST;
15272 err = snd_hda_attach_beep_device(codec, 0x23);
15278 if (board_config != ALC861VD_AUTO)
15279 setup_preset(spec, &alc861vd_presets[board_config]);
15281 if (codec->vendor_id == 0x10ec0660) {
15282 spec->stream_name_analog = "ALC660-VD Analog";
15283 spec->stream_name_digital = "ALC660-VD Digital";
15284 /* always turn on EAPD */
15285 add_verb(spec, alc660vd_eapd_verbs);
15287 spec->stream_name_analog = "ALC861VD Analog";
15288 spec->stream_name_digital = "ALC861VD Digital";
15291 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15292 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15294 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15295 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15297 spec->adc_nids = alc861vd_adc_nids;
15298 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15299 spec->capsrc_nids = alc861vd_capsrc_nids;
15300 spec->capture_style = CAPT_MIX;
15302 set_capture_mixer(spec);
15303 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15305 spec->vmaster_nid = 0x02;
15307 codec->patch_ops = alc_patch_ops;
15309 if (board_config == ALC861VD_AUTO)
15310 spec->init_hook = alc861vd_auto_init;
15311 #ifdef CONFIG_SND_HDA_POWER_SAVE
15312 if (!spec->loopback.amplist)
15313 spec->loopback.amplist = alc861vd_loopbacks;
15315 codec->proc_widget_hook = print_realtek_coef;
15323 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15324 * configuration. Each pin widget can choose any input DACs and a mixer.
15325 * Each ADC is connected from a mixer of all inputs. This makes possible
15326 * 6-channel independent captures.
15328 * In addition, an independent DAC for the multi-playback (not used in this
15331 #define ALC662_DIGOUT_NID 0x06
15332 #define ALC662_DIGIN_NID 0x0a
15334 static hda_nid_t alc662_dac_nids[4] = {
15335 /* front, rear, clfe, rear_surr */
15339 static hda_nid_t alc272_dac_nids[2] = {
15343 static hda_nid_t alc662_adc_nids[1] = {
15348 static hda_nid_t alc272_adc_nids[1] = {
15353 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15354 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15358 /* FIXME: should be a matrix-type input source selection */
15359 static struct hda_input_mux alc662_capture_source = {
15363 { "Front Mic", 0x1 },
15369 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15377 static struct hda_input_mux alc662_eeepc_capture_source = {
15385 static struct hda_input_mux alc663_capture_source = {
15389 { "Front Mic", 0x1 },
15394 static struct hda_input_mux alc663_m51va_capture_source = {
15397 { "Ext-Mic", 0x0 },
15405 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15412 static struct hda_verb alc662_3ST_ch2_init[] = {
15413 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15414 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15415 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15416 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15423 static struct hda_verb alc662_3ST_ch6_init[] = {
15424 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15425 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15426 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15427 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15428 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15429 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15433 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15434 { 2, alc662_3ST_ch2_init },
15435 { 6, alc662_3ST_ch6_init },
15441 static struct hda_verb alc662_sixstack_ch6_init[] = {
15442 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15443 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15444 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15451 static struct hda_verb alc662_sixstack_ch8_init[] = {
15452 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15453 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15454 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15458 static struct hda_channel_mode alc662_5stack_modes[2] = {
15459 { 2, alc662_sixstack_ch6_init },
15460 { 6, alc662_sixstack_ch8_init },
15463 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15464 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15467 static struct snd_kcontrol_new alc662_base_mixer[] = {
15468 /* output mixer control */
15469 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15470 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15471 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15472 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15473 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15474 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15475 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15476 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15477 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15479 /*Input mixer control */
15480 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15481 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15482 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15483 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15484 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15485 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15486 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15487 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15491 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15492 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15493 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15494 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15495 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15496 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15497 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15498 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15499 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15500 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15501 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15502 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15506 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15507 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15508 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15509 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15510 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15511 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15512 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15513 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15514 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15515 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15516 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15517 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15518 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15519 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15520 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15521 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15522 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15523 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15527 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15528 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15529 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15530 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15531 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15532 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15533 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15534 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15535 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15536 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15540 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15541 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15542 ALC262_HIPPO_MASTER_SWITCH,
15544 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15545 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15546 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15548 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15549 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15550 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15554 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15555 ALC262_HIPPO_MASTER_SWITCH,
15556 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15557 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15558 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15559 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15560 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15561 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15562 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15563 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15564 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15568 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15569 .ops = &snd_hda_bind_vol,
15571 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15572 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15577 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15578 .ops = &snd_hda_bind_sw,
15580 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15581 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15586 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15587 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15588 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15589 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15590 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15594 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15595 .ops = &snd_hda_bind_sw,
15597 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15598 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15599 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15604 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15605 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15606 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15607 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15608 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15609 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15610 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15615 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15616 .ops = &snd_hda_bind_sw,
15618 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15619 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15620 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15625 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15626 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15627 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15628 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15629 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15630 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15631 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15635 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15636 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15637 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15638 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15639 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15640 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15641 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15642 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15646 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15647 .ops = &snd_hda_bind_vol,
15649 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15650 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15655 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15656 .ops = &snd_hda_bind_sw,
15658 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15659 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15664 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15665 HDA_BIND_VOL("Master Playback Volume",
15666 &alc663_asus_two_bind_master_vol),
15667 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15668 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15669 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15670 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15671 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15675 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15676 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15677 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15678 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15679 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15680 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15681 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15685 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15686 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15687 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15688 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15689 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15690 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15692 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15693 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15694 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15695 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15699 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15700 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15701 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15702 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15704 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15705 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15706 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15707 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15708 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15709 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15713 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15715 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15716 .name = "Channel Mode",
15717 .info = alc_ch_mode_info,
15718 .get = alc_ch_mode_get,
15719 .put = alc_ch_mode_put,
15724 static struct hda_verb alc662_init_verbs[] = {
15725 /* ADC: mute amp left and right */
15726 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15727 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15728 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15733 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15734 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15736 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15737 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15738 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15739 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15740 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15741 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15743 /* Front Pin: output 0 (0x0c) */
15744 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15745 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15747 /* Rear Pin: output 1 (0x0d) */
15748 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15749 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15751 /* CLFE Pin: output 2 (0x0e) */
15752 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15753 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15755 /* Mic (rear) pin: input vref at 80% */
15756 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15757 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15758 /* Front Mic pin: input vref at 80% */
15759 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15760 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15761 /* Line In pin: input */
15762 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15763 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15764 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15765 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15766 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15767 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15768 /* CD pin widget for input */
15769 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15771 /* FIXME: use matrix-type input source selection */
15772 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15775 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15777 /* always trun on EAPD */
15778 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15779 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15784 static struct hda_verb alc662_sue_init_verbs[] = {
15785 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15786 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15790 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15791 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15792 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15796 /* Set Unsolicited Event*/
15797 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15798 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15799 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15804 * generic initialization of ADC, input mixers and output mixers
15806 static struct hda_verb alc662_auto_init_verbs[] = {
15808 * Unmute ADC and set the default input to mic-in
15810 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15811 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15813 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15815 * Note: PASD motherboards uses the Line In 2 as the input for front
15816 * panel mic (mic 2)
15818 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15819 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15820 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15821 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15822 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15823 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15826 * Set up output mixers (0x0c - 0x0f)
15828 /* set vol=0 to output mixers */
15829 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15830 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15831 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15833 /* set up input amps for analog loopback */
15834 /* Amp Indices: DAC = 0, mixer = 1 */
15835 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15836 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15837 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15838 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15839 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15840 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15843 /* FIXME: use matrix-type input source selection */
15844 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15846 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15847 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15851 /* additional verbs for ALC663 */
15852 static struct hda_verb alc663_auto_init_verbs[] = {
15853 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15854 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15858 static struct hda_verb alc663_m51va_init_verbs[] = {
15859 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15860 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15861 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15862 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15863 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15864 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15865 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15866 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15867 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15871 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15872 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15873 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15874 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15875 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15876 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15877 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15878 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15882 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15883 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15884 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15885 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15886 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15887 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15888 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15889 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15890 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15894 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15895 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15896 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15897 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15898 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15899 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15900 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15901 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15905 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15906 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15907 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15908 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15909 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15910 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15911 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15912 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15913 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15914 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15915 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15916 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15917 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15921 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15922 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15923 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15924 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15925 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* 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, 0x01}, /* 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 {0x1b, 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_g71v_init_verbs[] = {
15938 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15939 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15940 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15942 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15943 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15944 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15946 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15947 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15948 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15952 static struct hda_verb alc663_g50v_init_verbs[] = {
15953 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15954 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15955 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15957 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15958 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15962 static struct hda_verb alc662_ecs_init_verbs[] = {
15963 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15964 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15965 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15966 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15970 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
15971 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15972 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15973 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15974 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15975 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15976 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15977 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15978 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15979 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15980 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15981 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15985 static struct hda_verb alc272_dell_init_verbs[] = {
15986 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15987 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15988 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15989 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15990 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15991 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15992 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15993 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15994 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15995 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15996 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16000 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16001 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16002 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16006 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16007 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16008 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16012 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16014 unsigned int present;
16015 unsigned char bits;
16017 present = snd_hda_codec_read(codec, 0x14, 0,
16018 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16019 bits = present ? HDA_AMP_MUTE : 0;
16020 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16021 HDA_AMP_MUTE, bits);
16024 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16026 unsigned int present;
16027 unsigned char bits;
16029 present = snd_hda_codec_read(codec, 0x1b, 0,
16030 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16031 bits = present ? HDA_AMP_MUTE : 0;
16032 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16033 HDA_AMP_MUTE, bits);
16034 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16035 HDA_AMP_MUTE, bits);
16038 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16041 if ((res >> 26) == ALC880_HP_EVENT)
16042 alc662_lenovo_101e_all_automute(codec);
16043 if ((res >> 26) == ALC880_FRONT_EVENT)
16044 alc662_lenovo_101e_ispeaker_automute(codec);
16047 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
16049 unsigned int present;
16051 present = snd_hda_codec_read(codec, 0x18, 0,
16052 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16053 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16054 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16055 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16056 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16057 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16058 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16059 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16060 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16063 /* unsolicited event for HP jack sensing */
16064 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16067 if ((res >> 26) == ALC880_MIC_EVENT)
16068 alc662_eeepc_mic_automute(codec);
16070 alc262_hippo_unsol_event(codec, res);
16073 static void alc662_eeepc_inithook(struct hda_codec *codec)
16075 alc262_hippo1_init_hook(codec);
16076 alc662_eeepc_mic_automute(codec);
16079 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
16081 struct alc_spec *spec = codec->spec;
16083 spec->autocfg.hp_pins[0] = 0x14;
16084 spec->autocfg.speaker_pins[0] = 0x1b;
16085 alc262_hippo_master_update(codec);
16088 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16090 unsigned int present;
16091 unsigned char bits;
16093 present = snd_hda_codec_read(codec, 0x21, 0,
16094 AC_VERB_GET_PIN_SENSE, 0)
16095 & AC_PINSENSE_PRESENCE;
16096 bits = present ? HDA_AMP_MUTE : 0;
16097 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16098 AMP_IN_MUTE(0), bits);
16099 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16100 AMP_IN_MUTE(0), bits);
16103 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16105 unsigned int present;
16106 unsigned char bits;
16108 present = snd_hda_codec_read(codec, 0x21, 0,
16109 AC_VERB_GET_PIN_SENSE, 0)
16110 & AC_PINSENSE_PRESENCE;
16111 bits = present ? HDA_AMP_MUTE : 0;
16112 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16113 AMP_IN_MUTE(0), bits);
16114 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16115 AMP_IN_MUTE(0), bits);
16116 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16117 AMP_IN_MUTE(0), bits);
16118 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16119 AMP_IN_MUTE(0), bits);
16122 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16124 unsigned int present;
16125 unsigned char bits;
16127 present = snd_hda_codec_read(codec, 0x15, 0,
16128 AC_VERB_GET_PIN_SENSE, 0)
16129 & AC_PINSENSE_PRESENCE;
16130 bits = present ? HDA_AMP_MUTE : 0;
16131 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16132 AMP_IN_MUTE(0), bits);
16133 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16134 AMP_IN_MUTE(0), bits);
16135 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16136 AMP_IN_MUTE(0), bits);
16137 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16138 AMP_IN_MUTE(0), bits);
16141 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16143 unsigned int present;
16144 unsigned char bits;
16146 present = snd_hda_codec_read(codec, 0x1b, 0,
16147 AC_VERB_GET_PIN_SENSE, 0)
16148 & AC_PINSENSE_PRESENCE;
16149 bits = present ? 0 : PIN_OUT;
16150 snd_hda_codec_write(codec, 0x14, 0,
16151 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16154 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16156 unsigned int present1, present2;
16158 present1 = snd_hda_codec_read(codec, 0x21, 0,
16159 AC_VERB_GET_PIN_SENSE, 0)
16160 & AC_PINSENSE_PRESENCE;
16161 present2 = snd_hda_codec_read(codec, 0x15, 0,
16162 AC_VERB_GET_PIN_SENSE, 0)
16163 & AC_PINSENSE_PRESENCE;
16165 if (present1 || present2) {
16166 snd_hda_codec_write_cache(codec, 0x14, 0,
16167 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16169 snd_hda_codec_write_cache(codec, 0x14, 0,
16170 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16174 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16176 unsigned int present1, present2;
16178 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16179 AC_VERB_GET_PIN_SENSE, 0)
16180 & AC_PINSENSE_PRESENCE;
16181 present2 = snd_hda_codec_read(codec, 0x15, 0,
16182 AC_VERB_GET_PIN_SENSE, 0)
16183 & AC_PINSENSE_PRESENCE;
16185 if (present1 || present2) {
16186 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16187 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16188 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16189 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16191 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16192 AMP_IN_MUTE(0), 0);
16193 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16194 AMP_IN_MUTE(0), 0);
16198 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16200 unsigned int present;
16202 present = snd_hda_codec_read(codec, 0x18, 0,
16203 AC_VERB_GET_PIN_SENSE, 0)
16204 & AC_PINSENSE_PRESENCE;
16205 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16206 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16207 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16208 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16209 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16210 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16211 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16212 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16215 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16218 switch (res >> 26) {
16219 case ALC880_HP_EVENT:
16220 alc663_m51va_speaker_automute(codec);
16222 case ALC880_MIC_EVENT:
16223 alc663_m51va_mic_automute(codec);
16228 static void alc663_m51va_inithook(struct hda_codec *codec)
16230 alc663_m51va_speaker_automute(codec);
16231 alc663_m51va_mic_automute(codec);
16234 /* ***************** Mode1 ******************************/
16235 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16238 switch (res >> 26) {
16239 case ALC880_HP_EVENT:
16240 alc663_m51va_speaker_automute(codec);
16242 case ALC880_MIC_EVENT:
16243 alc662_eeepc_mic_automute(codec);
16248 static void alc663_mode1_inithook(struct hda_codec *codec)
16250 alc663_m51va_speaker_automute(codec);
16251 alc662_eeepc_mic_automute(codec);
16253 /* ***************** Mode2 ******************************/
16254 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16257 switch (res >> 26) {
16258 case ALC880_HP_EVENT:
16259 alc662_f5z_speaker_automute(codec);
16261 case ALC880_MIC_EVENT:
16262 alc662_eeepc_mic_automute(codec);
16267 static void alc662_mode2_inithook(struct hda_codec *codec)
16269 alc662_f5z_speaker_automute(codec);
16270 alc662_eeepc_mic_automute(codec);
16272 /* ***************** Mode3 ******************************/
16273 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16276 switch (res >> 26) {
16277 case ALC880_HP_EVENT:
16278 alc663_two_hp_m1_speaker_automute(codec);
16280 case ALC880_MIC_EVENT:
16281 alc662_eeepc_mic_automute(codec);
16286 static void alc663_mode3_inithook(struct hda_codec *codec)
16288 alc663_two_hp_m1_speaker_automute(codec);
16289 alc662_eeepc_mic_automute(codec);
16291 /* ***************** Mode4 ******************************/
16292 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16295 switch (res >> 26) {
16296 case ALC880_HP_EVENT:
16297 alc663_21jd_two_speaker_automute(codec);
16299 case ALC880_MIC_EVENT:
16300 alc662_eeepc_mic_automute(codec);
16305 static void alc663_mode4_inithook(struct hda_codec *codec)
16307 alc663_21jd_two_speaker_automute(codec);
16308 alc662_eeepc_mic_automute(codec);
16310 /* ***************** Mode5 ******************************/
16311 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16314 switch (res >> 26) {
16315 case ALC880_HP_EVENT:
16316 alc663_15jd_two_speaker_automute(codec);
16318 case ALC880_MIC_EVENT:
16319 alc662_eeepc_mic_automute(codec);
16324 static void alc663_mode5_inithook(struct hda_codec *codec)
16326 alc663_15jd_two_speaker_automute(codec);
16327 alc662_eeepc_mic_automute(codec);
16329 /* ***************** Mode6 ******************************/
16330 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16333 switch (res >> 26) {
16334 case ALC880_HP_EVENT:
16335 alc663_two_hp_m2_speaker_automute(codec);
16337 case ALC880_MIC_EVENT:
16338 alc662_eeepc_mic_automute(codec);
16343 static void alc663_mode6_inithook(struct hda_codec *codec)
16345 alc663_two_hp_m2_speaker_automute(codec);
16346 alc662_eeepc_mic_automute(codec);
16349 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16351 unsigned int present;
16352 unsigned char bits;
16354 present = snd_hda_codec_read(codec, 0x21, 0,
16355 AC_VERB_GET_PIN_SENSE, 0)
16356 & AC_PINSENSE_PRESENCE;
16357 bits = present ? HDA_AMP_MUTE : 0;
16358 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16359 HDA_AMP_MUTE, bits);
16360 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16361 HDA_AMP_MUTE, bits);
16364 static void alc663_g71v_front_automute(struct hda_codec *codec)
16366 unsigned int present;
16367 unsigned char bits;
16369 present = snd_hda_codec_read(codec, 0x15, 0,
16370 AC_VERB_GET_PIN_SENSE, 0)
16371 & AC_PINSENSE_PRESENCE;
16372 bits = present ? HDA_AMP_MUTE : 0;
16373 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16374 HDA_AMP_MUTE, bits);
16377 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16380 switch (res >> 26) {
16381 case ALC880_HP_EVENT:
16382 alc663_g71v_hp_automute(codec);
16384 case ALC880_FRONT_EVENT:
16385 alc663_g71v_front_automute(codec);
16387 case ALC880_MIC_EVENT:
16388 alc662_eeepc_mic_automute(codec);
16393 static void alc663_g71v_inithook(struct hda_codec *codec)
16395 alc663_g71v_front_automute(codec);
16396 alc663_g71v_hp_automute(codec);
16397 alc662_eeepc_mic_automute(codec);
16400 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16403 switch (res >> 26) {
16404 case ALC880_HP_EVENT:
16405 alc663_m51va_speaker_automute(codec);
16407 case ALC880_MIC_EVENT:
16408 alc662_eeepc_mic_automute(codec);
16413 static void alc663_g50v_inithook(struct hda_codec *codec)
16415 alc663_m51va_speaker_automute(codec);
16416 alc662_eeepc_mic_automute(codec);
16419 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16420 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16421 ALC262_HIPPO_MASTER_SWITCH,
16423 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16424 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16425 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16427 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16428 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16429 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16433 #ifdef CONFIG_SND_HDA_POWER_SAVE
16434 #define alc662_loopbacks alc880_loopbacks
16438 /* pcm configuration: identiacal with ALC880 */
16439 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16440 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16441 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16442 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16445 * configuration and preset
16447 static const char *alc662_models[ALC662_MODEL_LAST] = {
16448 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16449 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16450 [ALC662_3ST_6ch] = "3stack-6ch",
16451 [ALC662_5ST_DIG] = "6stack-dig",
16452 [ALC662_LENOVO_101E] = "lenovo-101e",
16453 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16454 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16455 [ALC662_ECS] = "ecs",
16456 [ALC663_ASUS_M51VA] = "m51va",
16457 [ALC663_ASUS_G71V] = "g71v",
16458 [ALC663_ASUS_H13] = "h13",
16459 [ALC663_ASUS_G50V] = "g50v",
16460 [ALC663_ASUS_MODE1] = "asus-mode1",
16461 [ALC662_ASUS_MODE2] = "asus-mode2",
16462 [ALC663_ASUS_MODE3] = "asus-mode3",
16463 [ALC663_ASUS_MODE4] = "asus-mode4",
16464 [ALC663_ASUS_MODE5] = "asus-mode5",
16465 [ALC663_ASUS_MODE6] = "asus-mode6",
16466 [ALC662_AUTO] = "auto",
16469 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16470 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16471 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16472 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16473 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16474 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16475 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16476 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16477 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16478 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16479 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16480 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16481 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16482 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16483 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16484 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16485 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16486 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16487 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16488 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16489 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16490 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16491 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16492 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16493 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16494 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16495 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16496 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16497 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16498 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16499 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16500 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16501 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16502 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16503 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16504 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16505 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16506 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16507 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16508 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16509 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16510 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16511 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16512 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16513 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16514 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16515 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16516 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16517 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16518 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16519 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16520 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16521 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16522 ALC662_3ST_6ch_DIG),
16523 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16524 ALC662_3ST_6ch_DIG),
16525 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16526 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16527 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16528 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16529 ALC662_3ST_6ch_DIG),
16530 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16535 static struct alc_config_preset alc662_presets[] = {
16536 [ALC662_3ST_2ch_DIG] = {
16537 .mixers = { alc662_3ST_2ch_mixer },
16538 .init_verbs = { alc662_init_verbs },
16539 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16540 .dac_nids = alc662_dac_nids,
16541 .dig_out_nid = ALC662_DIGOUT_NID,
16542 .dig_in_nid = ALC662_DIGIN_NID,
16543 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16544 .channel_mode = alc662_3ST_2ch_modes,
16545 .input_mux = &alc662_capture_source,
16547 [ALC662_3ST_6ch_DIG] = {
16548 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16549 .init_verbs = { alc662_init_verbs },
16550 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16551 .dac_nids = alc662_dac_nids,
16552 .dig_out_nid = ALC662_DIGOUT_NID,
16553 .dig_in_nid = ALC662_DIGIN_NID,
16554 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16555 .channel_mode = alc662_3ST_6ch_modes,
16557 .input_mux = &alc662_capture_source,
16559 [ALC662_3ST_6ch] = {
16560 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16561 .init_verbs = { alc662_init_verbs },
16562 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16563 .dac_nids = alc662_dac_nids,
16564 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16565 .channel_mode = alc662_3ST_6ch_modes,
16567 .input_mux = &alc662_capture_source,
16569 [ALC662_5ST_DIG] = {
16570 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16571 .init_verbs = { alc662_init_verbs },
16572 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16573 .dac_nids = alc662_dac_nids,
16574 .dig_out_nid = ALC662_DIGOUT_NID,
16575 .dig_in_nid = ALC662_DIGIN_NID,
16576 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16577 .channel_mode = alc662_5stack_modes,
16578 .input_mux = &alc662_capture_source,
16580 [ALC662_LENOVO_101E] = {
16581 .mixers = { alc662_lenovo_101e_mixer },
16582 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16583 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16584 .dac_nids = alc662_dac_nids,
16585 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16586 .channel_mode = alc662_3ST_2ch_modes,
16587 .input_mux = &alc662_lenovo_101e_capture_source,
16588 .unsol_event = alc662_lenovo_101e_unsol_event,
16589 .init_hook = alc662_lenovo_101e_all_automute,
16591 [ALC662_ASUS_EEEPC_P701] = {
16592 .mixers = { alc662_eeepc_p701_mixer },
16593 .init_verbs = { alc662_init_verbs,
16594 alc662_eeepc_sue_init_verbs },
16595 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16596 .dac_nids = alc662_dac_nids,
16597 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16598 .channel_mode = alc662_3ST_2ch_modes,
16599 .input_mux = &alc662_eeepc_capture_source,
16600 .unsol_event = alc662_eeepc_unsol_event,
16601 .init_hook = alc662_eeepc_inithook,
16603 [ALC662_ASUS_EEEPC_EP20] = {
16604 .mixers = { alc662_eeepc_ep20_mixer,
16605 alc662_chmode_mixer },
16606 .init_verbs = { alc662_init_verbs,
16607 alc662_eeepc_ep20_sue_init_verbs },
16608 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16609 .dac_nids = alc662_dac_nids,
16610 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16611 .channel_mode = alc662_3ST_6ch_modes,
16612 .input_mux = &alc662_lenovo_101e_capture_source,
16613 .unsol_event = alc662_eeepc_unsol_event,
16614 .init_hook = alc662_eeepc_ep20_inithook,
16617 .mixers = { alc662_ecs_mixer },
16618 .init_verbs = { alc662_init_verbs,
16619 alc662_ecs_init_verbs },
16620 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16621 .dac_nids = alc662_dac_nids,
16622 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16623 .channel_mode = alc662_3ST_2ch_modes,
16624 .input_mux = &alc662_eeepc_capture_source,
16625 .unsol_event = alc662_eeepc_unsol_event,
16626 .init_hook = alc662_eeepc_inithook,
16628 [ALC663_ASUS_M51VA] = {
16629 .mixers = { alc663_m51va_mixer },
16630 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16631 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16632 .dac_nids = alc662_dac_nids,
16633 .dig_out_nid = ALC662_DIGOUT_NID,
16634 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16635 .channel_mode = alc662_3ST_2ch_modes,
16636 .input_mux = &alc663_m51va_capture_source,
16637 .unsol_event = alc663_m51va_unsol_event,
16638 .init_hook = alc663_m51va_inithook,
16640 [ALC663_ASUS_G71V] = {
16641 .mixers = { alc663_g71v_mixer },
16642 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16643 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16644 .dac_nids = alc662_dac_nids,
16645 .dig_out_nid = ALC662_DIGOUT_NID,
16646 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16647 .channel_mode = alc662_3ST_2ch_modes,
16648 .input_mux = &alc662_eeepc_capture_source,
16649 .unsol_event = alc663_g71v_unsol_event,
16650 .init_hook = alc663_g71v_inithook,
16652 [ALC663_ASUS_H13] = {
16653 .mixers = { alc663_m51va_mixer },
16654 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16655 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16656 .dac_nids = alc662_dac_nids,
16657 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16658 .channel_mode = alc662_3ST_2ch_modes,
16659 .input_mux = &alc663_m51va_capture_source,
16660 .unsol_event = alc663_m51va_unsol_event,
16661 .init_hook = alc663_m51va_inithook,
16663 [ALC663_ASUS_G50V] = {
16664 .mixers = { alc663_g50v_mixer },
16665 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16666 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16667 .dac_nids = alc662_dac_nids,
16668 .dig_out_nid = ALC662_DIGOUT_NID,
16669 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16670 .channel_mode = alc662_3ST_6ch_modes,
16671 .input_mux = &alc663_capture_source,
16672 .unsol_event = alc663_g50v_unsol_event,
16673 .init_hook = alc663_g50v_inithook,
16675 [ALC663_ASUS_MODE1] = {
16676 .mixers = { alc663_m51va_mixer },
16677 .cap_mixer = alc662_auto_capture_mixer,
16678 .init_verbs = { alc662_init_verbs,
16679 alc663_21jd_amic_init_verbs },
16680 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16682 .dac_nids = alc662_dac_nids,
16683 .dig_out_nid = ALC662_DIGOUT_NID,
16684 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16685 .channel_mode = alc662_3ST_2ch_modes,
16686 .input_mux = &alc662_eeepc_capture_source,
16687 .unsol_event = alc663_mode1_unsol_event,
16688 .init_hook = alc663_mode1_inithook,
16690 [ALC662_ASUS_MODE2] = {
16691 .mixers = { alc662_1bjd_mixer },
16692 .cap_mixer = alc662_auto_capture_mixer,
16693 .init_verbs = { alc662_init_verbs,
16694 alc662_1bjd_amic_init_verbs },
16695 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16696 .dac_nids = alc662_dac_nids,
16697 .dig_out_nid = ALC662_DIGOUT_NID,
16698 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16699 .channel_mode = alc662_3ST_2ch_modes,
16700 .input_mux = &alc662_eeepc_capture_source,
16701 .unsol_event = alc662_mode2_unsol_event,
16702 .init_hook = alc662_mode2_inithook,
16704 [ALC663_ASUS_MODE3] = {
16705 .mixers = { alc663_two_hp_m1_mixer },
16706 .cap_mixer = alc662_auto_capture_mixer,
16707 .init_verbs = { alc662_init_verbs,
16708 alc663_two_hp_amic_m1_init_verbs },
16709 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16711 .dac_nids = alc662_dac_nids,
16712 .dig_out_nid = ALC662_DIGOUT_NID,
16713 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16714 .channel_mode = alc662_3ST_2ch_modes,
16715 .input_mux = &alc662_eeepc_capture_source,
16716 .unsol_event = alc663_mode3_unsol_event,
16717 .init_hook = alc663_mode3_inithook,
16719 [ALC663_ASUS_MODE4] = {
16720 .mixers = { alc663_asus_21jd_clfe_mixer },
16721 .cap_mixer = alc662_auto_capture_mixer,
16722 .init_verbs = { alc662_init_verbs,
16723 alc663_21jd_amic_init_verbs},
16724 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16726 .dac_nids = alc662_dac_nids,
16727 .dig_out_nid = ALC662_DIGOUT_NID,
16728 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16729 .channel_mode = alc662_3ST_2ch_modes,
16730 .input_mux = &alc662_eeepc_capture_source,
16731 .unsol_event = alc663_mode4_unsol_event,
16732 .init_hook = alc663_mode4_inithook,
16734 [ALC663_ASUS_MODE5] = {
16735 .mixers = { alc663_asus_15jd_clfe_mixer },
16736 .cap_mixer = alc662_auto_capture_mixer,
16737 .init_verbs = { alc662_init_verbs,
16738 alc663_15jd_amic_init_verbs },
16739 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16741 .dac_nids = alc662_dac_nids,
16742 .dig_out_nid = ALC662_DIGOUT_NID,
16743 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16744 .channel_mode = alc662_3ST_2ch_modes,
16745 .input_mux = &alc662_eeepc_capture_source,
16746 .unsol_event = alc663_mode5_unsol_event,
16747 .init_hook = alc663_mode5_inithook,
16749 [ALC663_ASUS_MODE6] = {
16750 .mixers = { alc663_two_hp_m2_mixer },
16751 .cap_mixer = alc662_auto_capture_mixer,
16752 .init_verbs = { alc662_init_verbs,
16753 alc663_two_hp_amic_m2_init_verbs },
16754 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16756 .dac_nids = alc662_dac_nids,
16757 .dig_out_nid = ALC662_DIGOUT_NID,
16758 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16759 .channel_mode = alc662_3ST_2ch_modes,
16760 .input_mux = &alc662_eeepc_capture_source,
16761 .unsol_event = alc663_mode6_unsol_event,
16762 .init_hook = alc663_mode6_inithook,
16765 .mixers = { alc663_m51va_mixer },
16766 .cap_mixer = alc272_auto_capture_mixer,
16767 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16768 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16769 .dac_nids = alc662_dac_nids,
16770 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16771 .adc_nids = alc272_adc_nids,
16772 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16773 .capsrc_nids = alc272_capsrc_nids,
16774 .channel_mode = alc662_3ST_2ch_modes,
16775 .input_mux = &alc663_m51va_capture_source,
16776 .unsol_event = alc663_m51va_unsol_event,
16777 .init_hook = alc663_m51va_inithook,
16779 [ALC272_DELL_ZM1] = {
16780 .mixers = { alc663_m51va_mixer },
16781 .cap_mixer = alc662_auto_capture_mixer,
16782 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16783 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16784 .dac_nids = alc662_dac_nids,
16785 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16786 .adc_nids = alc662_adc_nids,
16787 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
16788 .capsrc_nids = alc662_capsrc_nids,
16789 .channel_mode = alc662_3ST_2ch_modes,
16790 .input_mux = &alc663_m51va_capture_source,
16791 .unsol_event = alc663_m51va_unsol_event,
16792 .init_hook = alc663_m51va_inithook,
16798 * BIOS auto configuration
16801 /* add playback controls from the parsed DAC table */
16802 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16803 const struct auto_pin_cfg *cfg)
16806 static const char *chname[4] = {
16807 "Front", "Surround", NULL /*CLFE*/, "Side"
16812 for (i = 0; i < cfg->line_outs; i++) {
16813 if (!spec->multiout.dac_nids[i])
16815 nid = alc880_idx_to_dac(i);
16818 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16819 "Center Playback Volume",
16820 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16824 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16825 "LFE Playback Volume",
16826 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16830 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16831 "Center Playback Switch",
16832 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16836 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16837 "LFE Playback Switch",
16838 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16843 sprintf(name, "%s Playback Volume", chname[i]);
16844 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16845 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16849 sprintf(name, "%s Playback Switch", chname[i]);
16850 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16851 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16860 /* add playback controls for speaker and HP outputs */
16861 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16872 /* ALC663 has a mono output pin on 0x17 */
16873 sprintf(name, "%s Playback Switch", pfx);
16874 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16875 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16879 if (alc880_is_fixed_pin(pin)) {
16880 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16881 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16882 /* specify the DAC as the extra output */
16883 if (!spec->multiout.hp_nid)
16884 spec->multiout.hp_nid = nid;
16886 spec->multiout.extra_out_nid[0] = nid;
16887 /* control HP volume/switch on the output mixer amp */
16888 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16889 sprintf(name, "%s Playback Volume", pfx);
16890 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16891 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16894 sprintf(name, "%s Playback Switch", pfx);
16895 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16896 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16899 } else if (alc880_is_multi_pin(pin)) {
16900 /* set manual connection */
16901 /* we have only a switch on HP-out PIN */
16902 sprintf(name, "%s Playback Switch", pfx);
16903 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16904 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16911 /* return the index of the src widget from the connection list of the nid.
16912 * return -1 if not found
16914 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
16917 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
16920 conns = snd_hda_get_connections(codec, nid, conn_list,
16921 ARRAY_SIZE(conn_list));
16924 for (i = 0; i < conns; i++)
16925 if (conn_list[i] == src)
16930 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
16932 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
16933 return (pincap & AC_PINCAP_IN) != 0;
16936 /* create playback/capture controls for input pins */
16937 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
16938 const struct auto_pin_cfg *cfg)
16940 struct alc_spec *spec = codec->spec;
16941 struct hda_input_mux *imux = &spec->private_imux[0];
16944 for (i = 0; i < AUTO_PIN_LAST; i++) {
16945 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
16946 idx = alc662_input_pin_idx(codec, 0x0b,
16947 cfg->input_pins[i]);
16949 err = new_analog_input(spec, cfg->input_pins[i],
16950 auto_pin_cfg_labels[i],
16955 idx = alc662_input_pin_idx(codec, 0x22,
16956 cfg->input_pins[i]);
16958 imux->items[imux->num_items].label =
16959 auto_pin_cfg_labels[i];
16960 imux->items[imux->num_items].index = idx;
16968 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16969 hda_nid_t nid, int pin_type,
16972 alc_set_pin_output(codec, nid, pin_type);
16973 /* need the manual connection? */
16974 if (alc880_is_multi_pin(nid)) {
16975 struct alc_spec *spec = codec->spec;
16976 int idx = alc880_multi_pin_idx(nid);
16977 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16978 AC_VERB_SET_CONNECT_SEL,
16979 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16983 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16985 struct alc_spec *spec = codec->spec;
16988 for (i = 0; i <= HDA_SIDE; i++) {
16989 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16990 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16992 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16997 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16999 struct alc_spec *spec = codec->spec;
17002 pin = spec->autocfg.hp_pins[0];
17003 if (pin) /* connect to front */
17005 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17006 pin = spec->autocfg.speaker_pins[0];
17008 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17011 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17013 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17015 struct alc_spec *spec = codec->spec;
17018 for (i = 0; i < AUTO_PIN_LAST; i++) {
17019 hda_nid_t nid = spec->autocfg.input_pins[i];
17020 if (alc662_is_input_pin(codec, nid)) {
17021 alc_set_input_pin(codec, nid, i);
17022 if (nid != ALC662_PIN_CD_NID &&
17023 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17024 snd_hda_codec_write(codec, nid, 0,
17025 AC_VERB_SET_AMP_GAIN_MUTE,
17031 #define alc662_auto_init_input_src alc882_auto_init_input_src
17033 static int alc662_parse_auto_config(struct hda_codec *codec)
17035 struct alc_spec *spec = codec->spec;
17037 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17039 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17043 if (!spec->autocfg.line_outs)
17044 return 0; /* can't find valid BIOS pin config */
17046 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17049 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17052 err = alc662_auto_create_extra_out(spec,
17053 spec->autocfg.speaker_pins[0],
17057 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17061 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
17065 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17067 if (spec->autocfg.dig_outs)
17068 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17070 if (spec->kctls.list)
17071 add_mixer(spec, spec->kctls.list);
17073 spec->num_mux_defs = 1;
17074 spec->input_mux = &spec->private_imux[0];
17076 add_verb(spec, alc662_auto_init_verbs);
17077 if (codec->vendor_id == 0x10ec0663)
17078 add_verb(spec, alc663_auto_init_verbs);
17080 err = alc_auto_add_mic_boost(codec);
17084 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17089 /* additional initialization for auto-configuration model */
17090 static void alc662_auto_init(struct hda_codec *codec)
17092 struct alc_spec *spec = codec->spec;
17093 alc662_auto_init_multi_out(codec);
17094 alc662_auto_init_hp_out(codec);
17095 alc662_auto_init_analog_input(codec);
17096 alc662_auto_init_input_src(codec);
17097 if (spec->unsol_event)
17098 alc_inithook(codec);
17101 static int patch_alc662(struct hda_codec *codec)
17103 struct alc_spec *spec;
17104 int err, board_config;
17106 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17110 codec->spec = spec;
17112 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17114 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17117 if (board_config < 0) {
17118 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
17119 "trying auto-probe from BIOS...\n");
17120 board_config = ALC662_AUTO;
17123 if (board_config == ALC662_AUTO) {
17124 /* automatic parse from the BIOS config */
17125 err = alc662_parse_auto_config(codec);
17131 "hda_codec: Cannot set up configuration "
17132 "from BIOS. Using base mode...\n");
17133 board_config = ALC662_3ST_2ch_DIG;
17137 err = snd_hda_attach_beep_device(codec, 0x1);
17143 if (board_config != ALC662_AUTO)
17144 setup_preset(spec, &alc662_presets[board_config]);
17146 if (codec->vendor_id == 0x10ec0663) {
17147 spec->stream_name_analog = "ALC663 Analog";
17148 spec->stream_name_digital = "ALC663 Digital";
17149 } else if (codec->vendor_id == 0x10ec0272) {
17150 spec->stream_name_analog = "ALC272 Analog";
17151 spec->stream_name_digital = "ALC272 Digital";
17153 spec->stream_name_analog = "ALC662 Analog";
17154 spec->stream_name_digital = "ALC662 Digital";
17157 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17158 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17160 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17161 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17163 spec->adc_nids = alc662_adc_nids;
17164 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17165 spec->capsrc_nids = alc662_capsrc_nids;
17166 spec->capture_style = CAPT_MIX;
17168 if (!spec->cap_mixer)
17169 set_capture_mixer(spec);
17170 if (codec->vendor_id == 0x10ec0662)
17171 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17173 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17175 spec->vmaster_nid = 0x02;
17177 codec->patch_ops = alc_patch_ops;
17178 if (board_config == ALC662_AUTO)
17179 spec->init_hook = alc662_auto_init;
17180 #ifdef CONFIG_SND_HDA_POWER_SAVE
17181 if (!spec->loopback.amplist)
17182 spec->loopback.amplist = alc662_loopbacks;
17184 codec->proc_widget_hook = print_realtek_coef;
17192 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17193 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17194 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17195 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17196 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17197 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17198 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17199 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17200 .patch = patch_alc861 },
17201 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17202 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17203 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17204 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17205 .patch = patch_alc883 },
17206 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17207 .patch = patch_alc662 },
17208 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17209 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17210 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17211 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
17212 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17213 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17214 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17215 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17216 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17217 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
17218 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17219 .patch = patch_alc883 },
17220 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
17221 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
17222 {} /* terminator */
17225 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17227 MODULE_LICENSE("GPL");
17228 MODULE_DESCRIPTION("Realtek HD-audio codec");
17230 static struct hda_codec_preset_list realtek_list = {
17231 .preset = snd_hda_preset_realtek,
17232 .owner = THIS_MODULE,
17235 static int __init patch_realtek_init(void)
17237 return snd_hda_add_codec_preset(&realtek_list);
17240 static void __exit patch_realtek_exit(void)
17242 snd_hda_delete_codec_preset(&realtek_list);
17245 module_init(patch_realtek_init)
17246 module_exit(patch_realtek_exit)