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,
216 ALC883_TARGA_2ch_DIG,
217 ALC883_TARGA_8ch_DIG,
220 ALC888_ACER_ASPIRE_4930G,
221 ALC888_ACER_ASPIRE_6530G,
222 ALC888_ACER_ASPIRE_8930G,
223 ALC888_ACER_ASPIRE_7730G,
227 ALC883_LENOVO_101E_2ch,
228 ALC883_LENOVO_NB0763,
229 ALC888_LENOVO_MS7195_DIG,
237 ALC883_FUJITSU_PI2515,
238 ALC888_FUJITSU_XA3530,
239 ALC883_3ST_6ch_INTEL,
252 #define GPIO_MASK 0x03
254 /* extra amp-initialization sequence types */
263 struct alc_mic_route {
265 unsigned char mux_idx;
266 unsigned char amix_idx;
269 #define MUX_IDX_UNDEF ((unsigned char)-1)
272 /* codec parameterization */
273 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
274 unsigned int num_mixers;
275 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
276 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
278 const struct hda_verb *init_verbs[10]; /* initialization verbs
282 unsigned int num_init_verbs;
284 char stream_name_analog[32]; /* analog PCM stream */
285 struct hda_pcm_stream *stream_analog_playback;
286 struct hda_pcm_stream *stream_analog_capture;
287 struct hda_pcm_stream *stream_analog_alt_playback;
288 struct hda_pcm_stream *stream_analog_alt_capture;
290 char stream_name_digital[32]; /* digital PCM stream */
291 struct hda_pcm_stream *stream_digital_playback;
292 struct hda_pcm_stream *stream_digital_capture;
295 struct hda_multi_out multiout; /* playback set-up
296 * max_channels, dacs must be set
297 * dig_out_nid and hp_nid are optional
299 hda_nid_t alt_dac_nid;
300 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
304 unsigned int num_adc_nids;
306 hda_nid_t *capsrc_nids;
307 hda_nid_t dig_in_nid; /* digital-in NID; optional */
310 unsigned int num_mux_defs;
311 const struct hda_input_mux *input_mux;
312 unsigned int cur_mux[3];
313 struct alc_mic_route ext_mic;
314 struct alc_mic_route int_mic;
317 const struct hda_channel_mode *channel_mode;
318 int num_channel_mode;
320 int const_channel_count;
321 int ext_channel_count;
323 /* PCM information */
324 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
326 /* dynamic controls, init_verbs and input_mux */
327 struct auto_pin_cfg autocfg;
328 struct snd_array kctls;
329 struct hda_input_mux private_imux[3];
330 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
331 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
332 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
335 void (*init_hook)(struct hda_codec *codec);
336 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
338 /* for pin sensing */
339 unsigned int sense_updated: 1;
340 unsigned int jack_present: 1;
341 unsigned int master_sw: 1;
342 unsigned int auto_mic:1;
345 unsigned int no_analog :1; /* digital I/O only */
348 /* for virtual master */
349 hda_nid_t vmaster_nid;
350 #ifdef CONFIG_SND_HDA_POWER_SAVE
351 struct hda_loopback_check loopback;
356 unsigned int pll_coef_idx, pll_coef_bit;
360 * configuration template - to be copied to the spec instance
362 struct alc_config_preset {
363 struct snd_kcontrol_new *mixers[5]; /* should be identical size
366 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
367 const struct hda_verb *init_verbs[5];
368 unsigned int num_dacs;
370 hda_nid_t dig_out_nid; /* optional */
371 hda_nid_t hp_nid; /* optional */
372 hda_nid_t *slave_dig_outs;
373 unsigned int num_adc_nids;
375 hda_nid_t *capsrc_nids;
376 hda_nid_t dig_in_nid;
377 unsigned int num_channel_mode;
378 const struct hda_channel_mode *channel_mode;
380 int const_channel_count;
381 unsigned int num_mux_defs;
382 const struct hda_input_mux *input_mux;
383 void (*unsol_event)(struct hda_codec *, unsigned int);
384 void (*setup)(struct hda_codec *);
385 void (*init_hook)(struct hda_codec *);
386 #ifdef CONFIG_SND_HDA_POWER_SAVE
387 struct hda_amp_list *loopbacks;
395 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
396 struct snd_ctl_elem_info *uinfo)
398 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
399 struct alc_spec *spec = codec->spec;
400 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
401 if (mux_idx >= spec->num_mux_defs)
403 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
405 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
408 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
409 struct snd_ctl_elem_value *ucontrol)
411 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
412 struct alc_spec *spec = codec->spec;
413 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
415 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
419 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
420 struct snd_ctl_elem_value *ucontrol)
422 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
423 struct alc_spec *spec = codec->spec;
424 const struct hda_input_mux *imux;
425 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
426 unsigned int mux_idx;
427 hda_nid_t nid = spec->capsrc_nids ?
428 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
431 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
432 imux = &spec->input_mux[mux_idx];
433 if (!imux->num_items && mux_idx > 0)
434 imux = &spec->input_mux[0];
436 type = get_wcaps_type(get_wcaps(codec, nid));
437 if (type == AC_WID_AUD_MIX) {
438 /* Matrix-mixer style (e.g. ALC882) */
439 unsigned int *cur_val = &spec->cur_mux[adc_idx];
442 idx = ucontrol->value.enumerated.item[0];
443 if (idx >= imux->num_items)
444 idx = imux->num_items - 1;
447 for (i = 0; i < imux->num_items; i++) {
448 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
449 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
450 imux->items[i].index,
456 /* MUX style (e.g. ALC880) */
457 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
458 &spec->cur_mux[adc_idx]);
463 * channel mode setting
465 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
466 struct snd_ctl_elem_info *uinfo)
468 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
469 struct alc_spec *spec = codec->spec;
470 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
471 spec->num_channel_mode);
474 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
475 struct snd_ctl_elem_value *ucontrol)
477 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
478 struct alc_spec *spec = codec->spec;
479 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
480 spec->num_channel_mode,
481 spec->ext_channel_count);
484 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
485 struct snd_ctl_elem_value *ucontrol)
487 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
488 struct alc_spec *spec = codec->spec;
489 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
490 spec->num_channel_mode,
491 &spec->ext_channel_count);
492 if (err >= 0 && !spec->const_channel_count) {
493 spec->multiout.max_channels = spec->ext_channel_count;
494 if (spec->need_dac_fix)
495 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
501 * Control the mode of pin widget settings via the mixer. "pc" is used
502 * instead of "%" to avoid consequences of accidently treating the % as
503 * being part of a format specifier. Maximum allowed length of a value is
504 * 63 characters plus NULL terminator.
506 * Note: some retasking pin complexes seem to ignore requests for input
507 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
508 * are requested. Therefore order this list so that this behaviour will not
509 * cause problems when mixer clients move through the enum sequentially.
510 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
513 static char *alc_pin_mode_names[] = {
514 "Mic 50pc bias", "Mic 80pc bias",
515 "Line in", "Line out", "Headphone out",
517 static unsigned char alc_pin_mode_values[] = {
518 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
520 /* The control can present all 5 options, or it can limit the options based
521 * in the pin being assumed to be exclusively an input or an output pin. In
522 * addition, "input" pins may or may not process the mic bias option
523 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
524 * accept requests for bias as of chip versions up to March 2006) and/or
525 * wiring in the computer.
527 #define ALC_PIN_DIR_IN 0x00
528 #define ALC_PIN_DIR_OUT 0x01
529 #define ALC_PIN_DIR_INOUT 0x02
530 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
531 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
533 /* Info about the pin modes supported by the different pin direction modes.
534 * For each direction the minimum and maximum values are given.
536 static signed char alc_pin_mode_dir_info[5][2] = {
537 { 0, 2 }, /* ALC_PIN_DIR_IN */
538 { 3, 4 }, /* ALC_PIN_DIR_OUT */
539 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
540 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
541 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
543 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
544 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
545 #define alc_pin_mode_n_items(_dir) \
546 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
548 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
549 struct snd_ctl_elem_info *uinfo)
551 unsigned int item_num = uinfo->value.enumerated.item;
552 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
554 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
556 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
558 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
559 item_num = alc_pin_mode_min(dir);
560 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
564 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
565 struct snd_ctl_elem_value *ucontrol)
568 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
569 hda_nid_t nid = kcontrol->private_value & 0xffff;
570 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
571 long *valp = ucontrol->value.integer.value;
572 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
573 AC_VERB_GET_PIN_WIDGET_CONTROL,
576 /* Find enumerated value for current pinctl setting */
577 i = alc_pin_mode_min(dir);
578 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
580 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
584 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
585 struct snd_ctl_elem_value *ucontrol)
588 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
589 hda_nid_t nid = kcontrol->private_value & 0xffff;
590 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
591 long val = *ucontrol->value.integer.value;
592 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
593 AC_VERB_GET_PIN_WIDGET_CONTROL,
596 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
597 val = alc_pin_mode_min(dir);
599 change = pinctl != alc_pin_mode_values[val];
601 /* Set pin mode to that requested */
602 snd_hda_codec_write_cache(codec, nid, 0,
603 AC_VERB_SET_PIN_WIDGET_CONTROL,
604 alc_pin_mode_values[val]);
606 /* Also enable the retasking pin's input/output as required
607 * for the requested pin mode. Enum values of 2 or less are
610 * Dynamically switching the input/output buffers probably
611 * reduces noise slightly (particularly on input) so we'll
612 * do it. However, having both input and output buffers
613 * enabled simultaneously doesn't seem to be problematic if
614 * this turns out to be necessary in the future.
617 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
618 HDA_AMP_MUTE, HDA_AMP_MUTE);
619 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
622 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
623 HDA_AMP_MUTE, HDA_AMP_MUTE);
624 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
631 #define ALC_PIN_MODE(xname, nid, dir) \
632 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
633 .info = alc_pin_mode_info, \
634 .get = alc_pin_mode_get, \
635 .put = alc_pin_mode_put, \
636 .private_value = nid | (dir<<16) }
638 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
639 * together using a mask with more than one bit set. This control is
640 * currently used only by the ALC260 test model. At this stage they are not
641 * needed for any "production" models.
643 #ifdef CONFIG_SND_DEBUG
644 #define alc_gpio_data_info snd_ctl_boolean_mono_info
646 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
647 struct snd_ctl_elem_value *ucontrol)
649 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
650 hda_nid_t nid = kcontrol->private_value & 0xffff;
651 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
652 long *valp = ucontrol->value.integer.value;
653 unsigned int val = snd_hda_codec_read(codec, nid, 0,
654 AC_VERB_GET_GPIO_DATA, 0x00);
656 *valp = (val & mask) != 0;
659 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
660 struct snd_ctl_elem_value *ucontrol)
663 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
664 hda_nid_t nid = kcontrol->private_value & 0xffff;
665 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
666 long val = *ucontrol->value.integer.value;
667 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
668 AC_VERB_GET_GPIO_DATA,
671 /* Set/unset the masked GPIO bit(s) as needed */
672 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
677 snd_hda_codec_write_cache(codec, nid, 0,
678 AC_VERB_SET_GPIO_DATA, gpio_data);
682 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
683 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
684 .info = alc_gpio_data_info, \
685 .get = alc_gpio_data_get, \
686 .put = alc_gpio_data_put, \
687 .private_value = nid | (mask<<16) }
688 #endif /* CONFIG_SND_DEBUG */
690 /* A switch control to allow the enabling of the digital IO pins on the
691 * ALC260. This is incredibly simplistic; the intention of this control is
692 * to provide something in the test model allowing digital outputs to be
693 * identified if present. If models are found which can utilise these
694 * outputs a more complete mixer control can be devised for those models if
697 #ifdef CONFIG_SND_DEBUG
698 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
700 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
701 struct snd_ctl_elem_value *ucontrol)
703 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
704 hda_nid_t nid = kcontrol->private_value & 0xffff;
705 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
706 long *valp = ucontrol->value.integer.value;
707 unsigned int val = snd_hda_codec_read(codec, nid, 0,
708 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
710 *valp = (val & mask) != 0;
713 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
714 struct snd_ctl_elem_value *ucontrol)
717 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
718 hda_nid_t nid = kcontrol->private_value & 0xffff;
719 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
720 long val = *ucontrol->value.integer.value;
721 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
722 AC_VERB_GET_DIGI_CONVERT_1,
725 /* Set/unset the masked control bit(s) as needed */
726 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
731 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
736 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
737 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
738 .info = alc_spdif_ctrl_info, \
739 .get = alc_spdif_ctrl_get, \
740 .put = alc_spdif_ctrl_put, \
741 .private_value = nid | (mask<<16) }
742 #endif /* CONFIG_SND_DEBUG */
744 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
745 * Again, this is only used in the ALC26x test models to help identify when
746 * the EAPD line must be asserted for features to work.
748 #ifdef CONFIG_SND_DEBUG
749 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
751 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
752 struct snd_ctl_elem_value *ucontrol)
754 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
755 hda_nid_t nid = kcontrol->private_value & 0xffff;
756 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
757 long *valp = ucontrol->value.integer.value;
758 unsigned int val = snd_hda_codec_read(codec, nid, 0,
759 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
761 *valp = (val & mask) != 0;
765 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
766 struct snd_ctl_elem_value *ucontrol)
769 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
770 hda_nid_t nid = kcontrol->private_value & 0xffff;
771 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
772 long val = *ucontrol->value.integer.value;
773 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
774 AC_VERB_GET_EAPD_BTLENABLE,
777 /* Set/unset the masked control bit(s) as needed */
778 change = (!val ? 0 : mask) != (ctrl_data & mask);
783 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
789 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
790 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
791 .info = alc_eapd_ctrl_info, \
792 .get = alc_eapd_ctrl_get, \
793 .put = alc_eapd_ctrl_put, \
794 .private_value = nid | (mask<<16) }
795 #endif /* CONFIG_SND_DEBUG */
798 * set up the input pin config (depending on the given auto-pin type)
800 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
803 unsigned int val = PIN_IN;
805 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
807 pincap = snd_hda_query_pin_caps(codec, nid);
808 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
809 if (pincap & AC_PINCAP_VREF_80)
811 else if (pincap & AC_PINCAP_VREF_50)
813 else if (pincap & AC_PINCAP_VREF_100)
815 else if (pincap & AC_PINCAP_VREF_GRD)
818 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
823 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
825 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
827 spec->mixers[spec->num_mixers++] = mix;
830 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
832 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
834 spec->init_verbs[spec->num_init_verbs++] = verb;
837 #ifdef CONFIG_PROC_FS
841 static void print_realtek_coef(struct snd_info_buffer *buffer,
842 struct hda_codec *codec, hda_nid_t nid)
848 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
849 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
850 coeff = snd_hda_codec_read(codec, nid, 0,
851 AC_VERB_GET_COEF_INDEX, 0);
852 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
855 #define print_realtek_coef NULL
859 * set up from the preset table
861 static void setup_preset(struct hda_codec *codec,
862 const struct alc_config_preset *preset)
864 struct alc_spec *spec = codec->spec;
867 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
868 add_mixer(spec, preset->mixers[i]);
869 spec->cap_mixer = preset->cap_mixer;
870 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
872 add_verb(spec, preset->init_verbs[i]);
874 spec->channel_mode = preset->channel_mode;
875 spec->num_channel_mode = preset->num_channel_mode;
876 spec->need_dac_fix = preset->need_dac_fix;
877 spec->const_channel_count = preset->const_channel_count;
879 if (preset->const_channel_count)
880 spec->multiout.max_channels = preset->const_channel_count;
882 spec->multiout.max_channels = spec->channel_mode[0].channels;
883 spec->ext_channel_count = spec->channel_mode[0].channels;
885 spec->multiout.num_dacs = preset->num_dacs;
886 spec->multiout.dac_nids = preset->dac_nids;
887 spec->multiout.dig_out_nid = preset->dig_out_nid;
888 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
889 spec->multiout.hp_nid = preset->hp_nid;
891 spec->num_mux_defs = preset->num_mux_defs;
892 if (!spec->num_mux_defs)
893 spec->num_mux_defs = 1;
894 spec->input_mux = preset->input_mux;
896 spec->num_adc_nids = preset->num_adc_nids;
897 spec->adc_nids = preset->adc_nids;
898 spec->capsrc_nids = preset->capsrc_nids;
899 spec->dig_in_nid = preset->dig_in_nid;
901 spec->unsol_event = preset->unsol_event;
902 spec->init_hook = preset->init_hook;
903 #ifdef CONFIG_SND_HDA_POWER_SAVE
904 spec->loopback.amplist = preset->loopbacks;
908 preset->setup(codec);
911 /* Enable GPIO mask and set output */
912 static struct hda_verb alc_gpio1_init_verbs[] = {
913 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
914 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
915 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
919 static struct hda_verb alc_gpio2_init_verbs[] = {
920 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
921 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
922 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
926 static struct hda_verb alc_gpio3_init_verbs[] = {
927 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
928 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
929 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
934 * Fix hardware PLL issue
935 * On some codecs, the analog PLL gating control must be off while
936 * the default value is 1.
938 static void alc_fix_pll(struct hda_codec *codec)
940 struct alc_spec *spec = codec->spec;
945 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
947 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
948 AC_VERB_GET_PROC_COEF, 0);
949 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
951 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
952 val & ~(1 << spec->pll_coef_bit));
955 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
956 unsigned int coef_idx, unsigned int coef_bit)
958 struct alc_spec *spec = codec->spec;
960 spec->pll_coef_idx = coef_idx;
961 spec->pll_coef_bit = coef_bit;
965 static void alc_automute_pin(struct hda_codec *codec)
967 struct alc_spec *spec = codec->spec;
968 unsigned int present, pincap;
969 unsigned int nid = spec->autocfg.hp_pins[0];
974 pincap = snd_hda_query_pin_caps(codec, nid);
975 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
976 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
977 present = snd_hda_codec_read(codec, nid, 0,
978 AC_VERB_GET_PIN_SENSE, 0);
979 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
980 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
981 nid = spec->autocfg.speaker_pins[i];
984 snd_hda_codec_write(codec, nid, 0,
985 AC_VERB_SET_PIN_WIDGET_CONTROL,
986 spec->jack_present ? 0 : PIN_OUT);
990 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
993 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
996 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
997 for (i = 0; i < nums; i++)
1003 static void alc_mic_automute(struct hda_codec *codec)
1005 struct alc_spec *spec = codec->spec;
1006 struct alc_mic_route *dead, *alive;
1007 unsigned int present, type;
1010 if (!spec->auto_mic)
1012 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1014 if (snd_BUG_ON(!spec->adc_nids))
1017 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1019 present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0,
1020 AC_VERB_GET_PIN_SENSE, 0);
1021 present &= AC_PINSENSE_PRESENCE;
1023 alive = &spec->ext_mic;
1024 dead = &spec->int_mic;
1026 alive = &spec->int_mic;
1027 dead = &spec->ext_mic;
1030 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1031 if (type == AC_WID_AUD_MIX) {
1032 /* Matrix-mixer style (e.g. ALC882) */
1033 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1036 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1038 HDA_AMP_MUTE, HDA_AMP_MUTE);
1040 /* MUX style (e.g. ALC880) */
1041 snd_hda_codec_write_cache(codec, cap_nid, 0,
1042 AC_VERB_SET_CONNECT_SEL,
1046 /* FIXME: analog mixer */
1049 /* unsolicited event for HP jack sensing */
1050 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1052 if (codec->vendor_id == 0x10ec0880)
1057 case ALC880_HP_EVENT:
1058 alc_automute_pin(codec);
1060 case ALC880_MIC_EVENT:
1061 alc_mic_automute(codec);
1066 static void alc_inithook(struct hda_codec *codec)
1068 alc_automute_pin(codec);
1069 alc_mic_automute(codec);
1072 /* additional initialization for ALC888 variants */
1073 static void alc888_coef_init(struct hda_codec *codec)
1077 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1078 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1079 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1080 if ((tmp & 0xf0) == 0x20)
1082 snd_hda_codec_read(codec, 0x20, 0,
1083 AC_VERB_SET_PROC_COEF, 0x830);
1086 snd_hda_codec_read(codec, 0x20, 0,
1087 AC_VERB_SET_PROC_COEF, 0x3030);
1090 static void alc889_coef_init(struct hda_codec *codec)
1094 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1095 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1096 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1097 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1100 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1105 case ALC_INIT_GPIO1:
1106 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1108 case ALC_INIT_GPIO2:
1109 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1111 case ALC_INIT_GPIO3:
1112 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1114 case ALC_INIT_DEFAULT:
1115 switch (codec->vendor_id) {
1117 snd_hda_codec_write(codec, 0x0f, 0,
1118 AC_VERB_SET_EAPD_BTLENABLE, 2);
1119 snd_hda_codec_write(codec, 0x10, 0,
1120 AC_VERB_SET_EAPD_BTLENABLE, 2);
1132 snd_hda_codec_write(codec, 0x14, 0,
1133 AC_VERB_SET_EAPD_BTLENABLE, 2);
1134 snd_hda_codec_write(codec, 0x15, 0,
1135 AC_VERB_SET_EAPD_BTLENABLE, 2);
1138 switch (codec->vendor_id) {
1140 snd_hda_codec_write(codec, 0x1a, 0,
1141 AC_VERB_SET_COEF_INDEX, 7);
1142 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1143 AC_VERB_GET_PROC_COEF, 0);
1144 snd_hda_codec_write(codec, 0x1a, 0,
1145 AC_VERB_SET_COEF_INDEX, 7);
1146 snd_hda_codec_write(codec, 0x1a, 0,
1147 AC_VERB_SET_PROC_COEF,
1156 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
1157 alc889_coef_init(codec);
1160 alc888_coef_init(codec);
1164 snd_hda_codec_write(codec, 0x20, 0,
1165 AC_VERB_SET_COEF_INDEX, 7);
1166 tmp = snd_hda_codec_read(codec, 0x20, 0,
1167 AC_VERB_GET_PROC_COEF, 0);
1168 snd_hda_codec_write(codec, 0x20, 0,
1169 AC_VERB_SET_COEF_INDEX, 7);
1170 snd_hda_codec_write(codec, 0x20, 0,
1171 AC_VERB_SET_PROC_COEF,
1179 static void alc_init_auto_hp(struct hda_codec *codec)
1181 struct alc_spec *spec = codec->spec;
1183 if (!spec->autocfg.hp_pins[0])
1186 if (!spec->autocfg.speaker_pins[0]) {
1187 if (spec->autocfg.line_out_pins[0] &&
1188 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1189 spec->autocfg.speaker_pins[0] =
1190 spec->autocfg.line_out_pins[0];
1195 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1196 spec->autocfg.hp_pins[0]);
1197 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1198 AC_VERB_SET_UNSOLICITED_ENABLE,
1199 AC_USRSP_EN | ALC880_HP_EVENT);
1200 spec->unsol_event = alc_sku_unsol_event;
1203 static void alc_init_auto_mic(struct hda_codec *codec)
1205 struct alc_spec *spec = codec->spec;
1206 struct auto_pin_cfg *cfg = &spec->autocfg;
1207 hda_nid_t fixed, ext;
1210 /* there must be only two mic inputs exclusively */
1211 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1212 if (cfg->input_pins[i])
1216 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1217 hda_nid_t nid = cfg->input_pins[i];
1218 unsigned int defcfg;
1221 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1222 switch (get_defcfg_connect(defcfg)) {
1223 case AC_JACK_PORT_FIXED:
1225 return; /* already occupied */
1228 case AC_JACK_PORT_COMPLEX:
1230 return; /* already occupied */
1234 return; /* invalid entry */
1237 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1238 return; /* no unsol support */
1239 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1241 spec->ext_mic.pin = ext;
1242 spec->int_mic.pin = fixed;
1243 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1244 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1246 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1247 AC_VERB_SET_UNSOLICITED_ENABLE,
1248 AC_USRSP_EN | ALC880_MIC_EVENT);
1249 spec->unsol_event = alc_sku_unsol_event;
1252 /* check subsystem ID and set up device-specific initialization;
1253 * return 1 if initialized, 0 if invalid SSID
1255 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1256 * 31 ~ 16 : Manufacture ID
1258 * 7 ~ 0 : Assembly ID
1259 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1261 static int alc_subsystem_id(struct hda_codec *codec,
1262 hda_nid_t porta, hda_nid_t porte,
1265 unsigned int ass, tmp, i;
1267 struct alc_spec *spec = codec->spec;
1269 ass = codec->subsystem_id & 0xffff;
1270 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1273 /* invalid SSID, check the special NID pin defcfg instead */
1275 * 31~30 : port connectivity
1278 * 19~16 : Check sum (15:1)
1283 if (codec->vendor_id == 0x10ec0260)
1285 ass = snd_hda_codec_get_pincfg(codec, nid);
1286 snd_printd("realtek: No valid SSID, "
1287 "checking pincfg 0x%08x for NID 0x%x\n",
1289 if (!(ass & 1) && !(ass & 0x100000))
1291 if ((ass >> 30) != 1) /* no physical connection */
1296 for (i = 1; i < 16; i++) {
1300 if (((ass >> 16) & 0xf) != tmp)
1303 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1304 ass & 0xffff, codec->vendor_id);
1308 * 2 : 0 --> Desktop, 1 --> Laptop
1309 * 3~5 : External Amplifier control
1312 tmp = (ass & 0x38) >> 3; /* external Amp control */
1315 spec->init_amp = ALC_INIT_GPIO1;
1318 spec->init_amp = ALC_INIT_GPIO2;
1321 spec->init_amp = ALC_INIT_GPIO3;
1324 spec->init_amp = ALC_INIT_DEFAULT;
1328 /* is laptop or Desktop and enable the function "Mute internal speaker
1329 * when the external headphone out jack is plugged"
1331 if (!(ass & 0x8000))
1334 * 10~8 : Jack location
1335 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1337 * 15 : 1 --> enable the function "Mute internal speaker
1338 * when the external headphone out jack is plugged"
1340 if (!spec->autocfg.hp_pins[0]) {
1342 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1351 for (i = 0; i < spec->autocfg.line_outs; i++)
1352 if (spec->autocfg.line_out_pins[i] == nid)
1354 spec->autocfg.hp_pins[0] = nid;
1357 alc_init_auto_hp(codec);
1358 alc_init_auto_mic(codec);
1362 static void alc_ssid_check(struct hda_codec *codec,
1363 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1365 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1366 struct alc_spec *spec = codec->spec;
1367 snd_printd("realtek: "
1368 "Enable default setup for auto mode as fallback\n");
1369 spec->init_amp = ALC_INIT_DEFAULT;
1370 alc_init_auto_hp(codec);
1371 alc_init_auto_mic(codec);
1376 * Fix-up pin default configurations and add default verbs
1385 const struct alc_pincfg *pins;
1386 const struct hda_verb *verbs;
1389 static void alc_pick_fixup(struct hda_codec *codec,
1390 const struct snd_pci_quirk *quirk,
1391 const struct alc_fixup *fix)
1393 const struct alc_pincfg *cfg;
1395 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1399 fix += quirk->value;
1402 for (; cfg->nid; cfg++)
1403 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1406 add_verb(codec->spec, fix->verbs);
1416 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1417 /* Mic-in jack as mic in */
1418 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1419 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1420 /* Line-in jack as Line in */
1421 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1422 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1423 /* Line-Out as Front */
1424 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1431 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1432 /* Mic-in jack as mic in */
1433 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1434 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1435 /* Line-in jack as Surround */
1436 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1437 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1438 /* Line-Out as Front */
1439 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1446 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1447 /* Mic-in jack as CLFE */
1448 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1449 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1450 /* Line-in jack as Surround */
1451 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1452 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1453 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1454 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1461 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1462 /* Mic-in jack as CLFE */
1463 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1464 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1465 /* Line-in jack as Surround */
1466 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1467 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1468 /* Line-Out as Side */
1469 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1473 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1474 { 2, alc888_4ST_ch2_intel_init },
1475 { 4, alc888_4ST_ch4_intel_init },
1476 { 6, alc888_4ST_ch6_intel_init },
1477 { 8, alc888_4ST_ch8_intel_init },
1481 * ALC888 Fujitsu Siemens Amillo xa3530
1484 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1485 /* Front Mic: set to PIN_IN (empty by default) */
1486 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1487 /* Connect Internal HP to Front */
1488 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1489 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1490 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1491 /* Connect Bass HP to Front */
1492 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1493 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1494 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1495 /* Connect Line-Out side jack (SPDIF) to Side */
1496 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1497 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1498 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1499 /* Connect Mic jack to CLFE */
1500 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1501 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1502 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1503 /* Connect Line-in jack to Surround */
1504 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1505 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1506 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1507 /* Connect HP out jack to Front */
1508 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1509 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1510 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1511 /* Enable unsolicited event for HP jack and Line-out jack */
1512 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1513 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1517 static void alc_automute_amp(struct hda_codec *codec)
1519 struct alc_spec *spec = codec->spec;
1520 unsigned int val, mute, pincap;
1524 spec->jack_present = 0;
1525 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1526 nid = spec->autocfg.hp_pins[i];
1529 pincap = snd_hda_query_pin_caps(codec, nid);
1530 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1531 snd_hda_codec_read(codec, nid, 0,
1532 AC_VERB_SET_PIN_SENSE, 0);
1533 val = snd_hda_codec_read(codec, nid, 0,
1534 AC_VERB_GET_PIN_SENSE, 0);
1535 if (val & AC_PINSENSE_PRESENCE) {
1536 spec->jack_present = 1;
1541 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1542 /* Toggle internal speakers muting */
1543 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1544 nid = spec->autocfg.speaker_pins[i];
1547 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1548 HDA_AMP_MUTE, mute);
1552 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1555 if (codec->vendor_id == 0x10ec0880)
1559 if (res == ALC880_HP_EVENT)
1560 alc_automute_amp(codec);
1563 static void alc889_automute_setup(struct hda_codec *codec)
1565 struct alc_spec *spec = codec->spec;
1567 spec->autocfg.hp_pins[0] = 0x15;
1568 spec->autocfg.speaker_pins[0] = 0x14;
1569 spec->autocfg.speaker_pins[1] = 0x16;
1570 spec->autocfg.speaker_pins[2] = 0x17;
1571 spec->autocfg.speaker_pins[3] = 0x19;
1572 spec->autocfg.speaker_pins[4] = 0x1a;
1575 static void alc889_intel_init_hook(struct hda_codec *codec)
1577 alc889_coef_init(codec);
1578 alc_automute_amp(codec);
1581 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1583 struct alc_spec *spec = codec->spec;
1585 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1586 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1587 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1588 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1592 * ALC888 Acer Aspire 4930G model
1595 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1596 /* Front Mic: set to PIN_IN (empty by default) */
1597 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1598 /* Unselect Front Mic by default in input mixer 3 */
1599 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1600 /* Enable unsolicited event for HP jack */
1601 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1602 /* Connect Internal HP to front */
1603 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1604 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1605 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1606 /* Connect HP out to front */
1607 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1608 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1609 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1614 * ALC888 Acer Aspire 6530G model
1617 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1618 /* Bias voltage on for external mic port */
1619 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1620 /* Front Mic: set to PIN_IN (empty by default) */
1621 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1622 /* Unselect Front Mic by default in input mixer 3 */
1623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1624 /* Enable unsolicited event for HP jack */
1625 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1626 /* Enable speaker output */
1627 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1628 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1629 /* Enable headphone output */
1630 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1631 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1632 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1637 * ALC889 Acer Aspire 8930G model
1640 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1641 /* Front Mic: set to PIN_IN (empty by default) */
1642 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1643 /* Unselect Front Mic by default in input mixer 3 */
1644 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1645 /* Enable unsolicited event for HP jack */
1646 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1647 /* Connect Internal Front to Front */
1648 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1649 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1650 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1651 /* Connect Internal Rear to Rear */
1652 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1653 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1654 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1655 /* Connect Internal CLFE to CLFE */
1656 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1657 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1658 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1659 /* Connect HP out to Front */
1660 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1661 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1662 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1663 /* Enable all DACs */
1664 /* DAC DISABLE/MUTE 1? */
1665 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1666 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1667 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1668 /* DAC DISABLE/MUTE 2? */
1669 /* some bit here disables the other DACs. Init=0x4900 */
1670 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1671 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1672 /* Enable amplifiers */
1673 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1674 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1676 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1677 * which makes the stereo useless. However, either the mic or the ALC889
1678 * makes the signal become a difference/sum signal instead of standard
1679 * stereo, which is annoying. So instead we flip this bit which makes the
1680 * codec replicate the sum signal to both channels, turning it into a
1683 /* DMIC_CONTROL? Init value = 0x0001 */
1684 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1685 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1689 static struct hda_input_mux alc888_2_capture_sources[2] = {
1690 /* Front mic only available on one ADC */
1697 { "Front Mic", 0xb },
1710 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1711 /* Interal mic only available on one ADC */
1718 { "Input Mix", 0xa },
1728 { "Input Mix", 0xa },
1733 static struct hda_input_mux alc889_capture_sources[3] = {
1734 /* Digital mic only available on first "ADC" */
1741 { "Front Mic", 0xb },
1742 { "Input Mix", 0xa },
1751 { "Input Mix", 0xa },
1760 { "Input Mix", 0xa },
1765 static struct snd_kcontrol_new alc888_base_mixer[] = {
1766 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1767 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1768 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1769 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1770 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1772 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1773 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1774 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1775 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1776 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1777 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1778 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1779 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1780 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1781 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1782 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1783 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1787 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1789 struct alc_spec *spec = codec->spec;
1791 spec->autocfg.hp_pins[0] = 0x15;
1792 spec->autocfg.speaker_pins[0] = 0x14;
1795 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1797 struct alc_spec *spec = codec->spec;
1799 spec->autocfg.hp_pins[0] = 0x15;
1800 spec->autocfg.speaker_pins[0] = 0x14;
1801 spec->autocfg.speaker_pins[1] = 0x16;
1802 spec->autocfg.speaker_pins[2] = 0x17;
1805 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1807 struct alc_spec *spec = codec->spec;
1809 spec->autocfg.hp_pins[0] = 0x15;
1810 spec->autocfg.speaker_pins[0] = 0x14;
1811 spec->autocfg.speaker_pins[1] = 0x16;
1812 spec->autocfg.speaker_pins[2] = 0x1b;
1816 * ALC880 3-stack model
1818 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1819 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1820 * F-Mic = 0x1b, HP = 0x19
1823 static hda_nid_t alc880_dac_nids[4] = {
1824 /* front, rear, clfe, rear_surr */
1825 0x02, 0x05, 0x04, 0x03
1828 static hda_nid_t alc880_adc_nids[3] = {
1833 /* The datasheet says the node 0x07 is connected from inputs,
1834 * but it shows zero connection in the real implementation on some devices.
1835 * Note: this is a 915GAV bug, fixed on 915GLV
1837 static hda_nid_t alc880_adc_nids_alt[2] = {
1842 #define ALC880_DIGOUT_NID 0x06
1843 #define ALC880_DIGIN_NID 0x0a
1845 static struct hda_input_mux alc880_capture_source = {
1849 { "Front Mic", 0x3 },
1855 /* channel source setting (2/6 channel selection for 3-stack) */
1857 static struct hda_verb alc880_threestack_ch2_init[] = {
1858 /* set line-in to input, mute it */
1859 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1860 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1861 /* set mic-in to input vref 80%, mute it */
1862 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1863 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1868 static struct hda_verb alc880_threestack_ch6_init[] = {
1869 /* set line-in to output, unmute it */
1870 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1871 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1872 /* set mic-in to output, unmute it */
1873 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1874 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1878 static struct hda_channel_mode alc880_threestack_modes[2] = {
1879 { 2, alc880_threestack_ch2_init },
1880 { 6, alc880_threestack_ch6_init },
1883 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1884 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1885 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1886 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1887 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1888 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1889 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1890 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1891 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1892 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1893 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1894 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1895 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1896 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1897 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1898 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1899 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1900 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1902 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1903 .name = "Channel Mode",
1904 .info = alc_ch_mode_info,
1905 .get = alc_ch_mode_get,
1906 .put = alc_ch_mode_put,
1911 /* capture mixer elements */
1912 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1913 struct snd_ctl_elem_info *uinfo)
1915 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1916 struct alc_spec *spec = codec->spec;
1919 mutex_lock(&codec->control_mutex);
1920 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1922 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1923 mutex_unlock(&codec->control_mutex);
1927 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1928 unsigned int size, unsigned int __user *tlv)
1930 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1931 struct alc_spec *spec = codec->spec;
1934 mutex_lock(&codec->control_mutex);
1935 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1937 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1938 mutex_unlock(&codec->control_mutex);
1942 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1943 struct snd_ctl_elem_value *ucontrol);
1945 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1946 struct snd_ctl_elem_value *ucontrol,
1949 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1950 struct alc_spec *spec = codec->spec;
1951 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1954 mutex_lock(&codec->control_mutex);
1955 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1957 err = func(kcontrol, ucontrol);
1958 mutex_unlock(&codec->control_mutex);
1962 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1963 struct snd_ctl_elem_value *ucontrol)
1965 return alc_cap_getput_caller(kcontrol, ucontrol,
1966 snd_hda_mixer_amp_volume_get);
1969 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1970 struct snd_ctl_elem_value *ucontrol)
1972 return alc_cap_getput_caller(kcontrol, ucontrol,
1973 snd_hda_mixer_amp_volume_put);
1976 /* capture mixer elements */
1977 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1979 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1980 struct snd_ctl_elem_value *ucontrol)
1982 return alc_cap_getput_caller(kcontrol, ucontrol,
1983 snd_hda_mixer_amp_switch_get);
1986 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1987 struct snd_ctl_elem_value *ucontrol)
1989 return alc_cap_getput_caller(kcontrol, ucontrol,
1990 snd_hda_mixer_amp_switch_put);
1993 #define _DEFINE_CAPMIX(num) \
1995 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1996 .name = "Capture Switch", \
1997 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1999 .info = alc_cap_sw_info, \
2000 .get = alc_cap_sw_get, \
2001 .put = alc_cap_sw_put, \
2004 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2005 .name = "Capture Volume", \
2006 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2007 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2008 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2010 .info = alc_cap_vol_info, \
2011 .get = alc_cap_vol_get, \
2012 .put = alc_cap_vol_put, \
2013 .tlv = { .c = alc_cap_vol_tlv }, \
2016 #define _DEFINE_CAPSRC(num) \
2018 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2019 /* .name = "Capture Source", */ \
2020 .name = "Input Source", \
2022 .info = alc_mux_enum_info, \
2023 .get = alc_mux_enum_get, \
2024 .put = alc_mux_enum_put, \
2027 #define DEFINE_CAPMIX(num) \
2028 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2029 _DEFINE_CAPMIX(num), \
2030 _DEFINE_CAPSRC(num), \
2034 #define DEFINE_CAPMIX_NOSRC(num) \
2035 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2036 _DEFINE_CAPMIX(num), \
2040 /* up to three ADCs */
2044 DEFINE_CAPMIX_NOSRC(1);
2045 DEFINE_CAPMIX_NOSRC(2);
2046 DEFINE_CAPMIX_NOSRC(3);
2049 * ALC880 5-stack model
2051 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2053 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2054 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2057 /* additional mixers to alc880_three_stack_mixer */
2058 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2059 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2060 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2064 /* channel source setting (6/8 channel selection for 5-stack) */
2066 static struct hda_verb alc880_fivestack_ch6_init[] = {
2067 /* set line-in to input, mute it */
2068 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2069 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2074 static struct hda_verb alc880_fivestack_ch8_init[] = {
2075 /* set line-in to output, unmute it */
2076 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2077 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2081 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2082 { 6, alc880_fivestack_ch6_init },
2083 { 8, alc880_fivestack_ch8_init },
2088 * ALC880 6-stack model
2090 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2091 * Side = 0x05 (0x0f)
2092 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2093 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2096 static hda_nid_t alc880_6st_dac_nids[4] = {
2097 /* front, rear, clfe, rear_surr */
2098 0x02, 0x03, 0x04, 0x05
2101 static struct hda_input_mux alc880_6stack_capture_source = {
2105 { "Front Mic", 0x1 },
2111 /* fixed 8-channels */
2112 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2116 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2117 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2118 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2119 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2120 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2121 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2122 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2123 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2124 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2125 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2126 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2127 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2128 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2130 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2132 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2133 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2134 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2136 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2137 .name = "Channel Mode",
2138 .info = alc_ch_mode_info,
2139 .get = alc_ch_mode_get,
2140 .put = alc_ch_mode_put,
2149 * W810 has rear IO for:
2152 * Center/LFE (DAC 04)
2155 * The system also has a pair of internal speakers, and a headphone jack.
2156 * These are both connected to Line2 on the codec, hence to DAC 02.
2158 * There is a variable resistor to control the speaker or headphone
2159 * volume. This is a hardware-only device without a software API.
2161 * Plugging headphones in will disable the internal speakers. This is
2162 * implemented in hardware, not via the driver using jack sense. In
2163 * a similar fashion, plugging into the rear socket marked "front" will
2164 * disable both the speakers and headphones.
2166 * For input, there's a microphone jack, and an "audio in" jack.
2167 * These may not do anything useful with this driver yet, because I
2168 * haven't setup any initialization verbs for these yet...
2171 static hda_nid_t alc880_w810_dac_nids[3] = {
2172 /* front, rear/surround, clfe */
2176 /* fixed 6 channels */
2177 static struct hda_channel_mode alc880_w810_modes[1] = {
2181 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2182 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2183 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2184 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2185 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2186 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2187 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2188 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2189 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2190 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2191 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2199 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2200 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2204 static hda_nid_t alc880_z71v_dac_nids[1] = {
2207 #define ALC880_Z71V_HP_DAC 0x03
2209 /* fixed 2 channels */
2210 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2214 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2215 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2216 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2217 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2218 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2219 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2220 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2228 * ALC880 F1734 model
2230 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2231 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2234 static hda_nid_t alc880_f1734_dac_nids[1] = {
2237 #define ALC880_F1734_HP_DAC 0x02
2239 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2240 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2241 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2242 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2243 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2244 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2245 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2251 static struct hda_input_mux alc880_f1734_capture_source = {
2263 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2264 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2265 * Mic = 0x18, Line = 0x1a
2268 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2269 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2271 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2272 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2273 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2274 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2275 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2276 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2277 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2278 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2279 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2280 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2281 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2282 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2283 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2284 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2285 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2287 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2288 .name = "Channel Mode",
2289 .info = alc_ch_mode_info,
2290 .get = alc_ch_mode_get,
2291 .put = alc_ch_mode_put,
2297 * ALC880 ASUS W1V model
2299 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2300 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2301 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2304 /* additional mixers to alc880_asus_mixer */
2305 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2306 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2307 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2312 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2313 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2314 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2315 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2316 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2317 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2318 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2319 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2320 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2321 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2326 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2327 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2328 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2329 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2330 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2331 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2332 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2333 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2334 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2335 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2336 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2337 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2338 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2339 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2340 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2341 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2342 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2344 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2345 .name = "Channel Mode",
2346 .info = alc_ch_mode_info,
2347 .get = alc_ch_mode_get,
2348 .put = alc_ch_mode_put,
2353 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2354 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2355 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2356 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2357 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2358 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2359 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2360 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2361 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2362 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2363 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2367 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2368 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2369 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2370 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2371 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2372 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2373 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2378 * virtual master controls
2382 * slave controls for virtual master
2384 static const char *alc_slave_vols[] = {
2385 "Front Playback Volume",
2386 "Surround Playback Volume",
2387 "Center Playback Volume",
2388 "LFE Playback Volume",
2389 "Side Playback Volume",
2390 "Headphone Playback Volume",
2391 "Speaker Playback Volume",
2392 "Mono Playback Volume",
2393 "Line-Out Playback Volume",
2394 "PCM Playback Volume",
2398 static const char *alc_slave_sws[] = {
2399 "Front Playback Switch",
2400 "Surround Playback Switch",
2401 "Center Playback Switch",
2402 "LFE Playback Switch",
2403 "Side Playback Switch",
2404 "Headphone Playback Switch",
2405 "Speaker Playback Switch",
2406 "Mono Playback Switch",
2407 "IEC958 Playback Switch",
2408 "Line-Out Playback Switch",
2409 "PCM Playback Switch",
2414 * build control elements
2417 static void alc_free_kctls(struct hda_codec *codec);
2419 /* additional beep mixers; the actual parameters are overwritten at build */
2420 static struct snd_kcontrol_new alc_beep_mixer[] = {
2421 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2422 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2426 static int alc_build_controls(struct hda_codec *codec)
2428 struct alc_spec *spec = codec->spec;
2432 for (i = 0; i < spec->num_mixers; i++) {
2433 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2437 if (spec->cap_mixer) {
2438 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2442 if (spec->multiout.dig_out_nid) {
2443 err = snd_hda_create_spdif_out_ctls(codec,
2444 spec->multiout.dig_out_nid);
2447 if (!spec->no_analog) {
2448 err = snd_hda_create_spdif_share_sw(codec,
2452 spec->multiout.share_spdif = 1;
2455 if (spec->dig_in_nid) {
2456 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2461 /* create beep controls if needed */
2462 if (spec->beep_amp) {
2463 struct snd_kcontrol_new *knew;
2464 for (knew = alc_beep_mixer; knew->name; knew++) {
2465 struct snd_kcontrol *kctl;
2466 kctl = snd_ctl_new1(knew, codec);
2469 kctl->private_value = spec->beep_amp;
2470 err = snd_hda_ctl_add(codec, kctl);
2476 /* if we have no master control, let's create it */
2477 if (!spec->no_analog &&
2478 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2479 unsigned int vmaster_tlv[4];
2480 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2481 HDA_OUTPUT, vmaster_tlv);
2482 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2483 vmaster_tlv, alc_slave_vols);
2487 if (!spec->no_analog &&
2488 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2489 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2490 NULL, alc_slave_sws);
2495 alc_free_kctls(codec); /* no longer needed */
2501 * initialize the codec volumes, etc
2505 * generic initialization of ADC, input mixers and output mixers
2507 static struct hda_verb alc880_volume_init_verbs[] = {
2509 * Unmute ADC0-2 and set the default input to mic-in
2511 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2512 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2513 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2514 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2515 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2516 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2518 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2520 * Note: PASD motherboards uses the Line In 2 as the input for front
2523 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2525 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2526 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2527 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2528 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2529 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2530 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2533 * Set up output mixers (0x0c - 0x0f)
2535 /* set vol=0 to output mixers */
2536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2537 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2538 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2539 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2540 /* set up input amps for analog loopback */
2541 /* Amp Indices: DAC = 0, mixer = 1 */
2542 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2543 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2544 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2545 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2546 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2547 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2548 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2549 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2555 * 3-stack pin configuration:
2556 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2558 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2560 * preset connection lists of input pins
2561 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2563 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2564 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2565 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2568 * Set pin mode and muting
2570 /* set front pin widgets 0x14 for output */
2571 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2572 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2573 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2574 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2575 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2576 /* Mic2 (as headphone out) for HP output */
2577 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2578 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2579 /* Line In pin widget for input */
2580 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2581 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2582 /* Line2 (as front mic) pin widget for input and vref at 80% */
2583 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2584 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2585 /* CD pin widget for input */
2586 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2592 * 5-stack pin configuration:
2593 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2594 * line-in/side = 0x1a, f-mic = 0x1b
2596 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2598 * preset connection lists of input pins
2599 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2601 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2602 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2605 * Set pin mode and muting
2607 /* set pin widgets 0x14-0x17 for output */
2608 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2610 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2611 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2612 /* unmute pins for output (no gain on this amp) */
2613 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2614 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2615 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2616 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2618 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2619 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2620 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2621 /* Mic2 (as headphone out) for HP output */
2622 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2623 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2624 /* Line In pin widget for input */
2625 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2626 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2627 /* Line2 (as front mic) pin widget for input and vref at 80% */
2628 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2629 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2630 /* CD pin widget for input */
2631 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2637 * W810 pin configuration:
2638 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2640 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2641 /* hphone/speaker input selector: front DAC */
2642 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2644 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2645 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2646 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2647 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2648 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2649 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2651 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2652 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2658 * Z71V pin configuration:
2659 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2661 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2662 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2663 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2664 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2665 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2667 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2668 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2669 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2670 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2676 * 6-stack pin configuration:
2677 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2678 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2680 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2681 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2683 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2684 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2685 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2686 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2687 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2688 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2689 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2690 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2692 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2693 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2694 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2695 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2696 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2697 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2698 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2699 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2700 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2706 * Uniwill pin configuration:
2707 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2710 static struct hda_verb alc880_uniwill_init_verbs[] = {
2711 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2713 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2714 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2715 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2716 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2717 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2718 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2719 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2720 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2721 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2722 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2723 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2724 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2725 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2726 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2728 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2729 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2730 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2731 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2732 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2733 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2734 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2735 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2736 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2738 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2739 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2746 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2748 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2749 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2751 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2752 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2753 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2754 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2755 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2756 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2757 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2758 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2759 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2760 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2761 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2762 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2764 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2765 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2766 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2767 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2768 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2769 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2771 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2772 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2777 static struct hda_verb alc880_beep_init_verbs[] = {
2778 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2782 /* auto-toggle front mic */
2783 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2785 unsigned int present;
2788 present = snd_hda_codec_read(codec, 0x18, 0,
2789 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2790 bits = present ? HDA_AMP_MUTE : 0;
2791 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2794 static void alc880_uniwill_setup(struct hda_codec *codec)
2796 struct alc_spec *spec = codec->spec;
2798 spec->autocfg.hp_pins[0] = 0x14;
2799 spec->autocfg.speaker_pins[0] = 0x15;
2800 spec->autocfg.speaker_pins[0] = 0x16;
2803 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2805 alc_automute_amp(codec);
2806 alc880_uniwill_mic_automute(codec);
2809 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2812 /* Looks like the unsol event is incompatible with the standard
2813 * definition. 4bit tag is placed at 28 bit!
2815 switch (res >> 28) {
2816 case ALC880_MIC_EVENT:
2817 alc880_uniwill_mic_automute(codec);
2820 alc_automute_amp_unsol_event(codec, res);
2825 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2827 struct alc_spec *spec = codec->spec;
2829 spec->autocfg.hp_pins[0] = 0x14;
2830 spec->autocfg.speaker_pins[0] = 0x15;
2833 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2835 unsigned int present;
2837 present = snd_hda_codec_read(codec, 0x21, 0,
2838 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2839 present &= HDA_AMP_VOLMASK;
2840 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2841 HDA_AMP_VOLMASK, present);
2842 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2843 HDA_AMP_VOLMASK, present);
2846 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2849 /* Looks like the unsol event is incompatible with the standard
2850 * definition. 4bit tag is placed at 28 bit!
2852 if ((res >> 28) == ALC880_DCVOL_EVENT)
2853 alc880_uniwill_p53_dcvol_automute(codec);
2855 alc_automute_amp_unsol_event(codec, res);
2859 * F1734 pin configuration:
2860 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2862 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2863 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2864 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2865 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2866 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2867 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2869 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2870 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2871 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2872 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2874 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2875 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2876 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2877 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2878 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2879 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2880 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2881 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2882 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2884 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2885 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2891 * ASUS pin configuration:
2892 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2894 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2895 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2896 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2897 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2898 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2900 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2901 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2902 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2903 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2904 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2905 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2906 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2907 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2909 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2910 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2911 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2912 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2913 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2914 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2915 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2916 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2917 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2922 /* Enable GPIO mask and set output */
2923 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2924 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2925 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2927 /* Clevo m520g init */
2928 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2929 /* headphone output */
2930 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2932 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2933 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2935 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2936 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2938 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2939 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2940 /* Mic1 (rear panel) */
2941 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2942 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2943 /* Mic2 (front panel) */
2944 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2945 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2947 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2948 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2949 /* change to EAPD mode */
2950 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2951 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2956 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2957 /* change to EAPD mode */
2958 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2959 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2961 /* Headphone output */
2962 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2964 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2965 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2967 /* Line In pin widget for input */
2968 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2969 /* CD pin widget for input */
2970 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2971 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2972 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2974 /* change to EAPD mode */
2975 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2976 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2982 * LG m1 express dual
2985 * Rear Line-In/Out (blue): 0x14
2986 * Build-in Mic-In: 0x15
2988 * HP-Out (green): 0x1b
2989 * Mic-In/Out (red): 0x19
2993 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2994 static hda_nid_t alc880_lg_dac_nids[3] = {
2998 /* seems analog CD is not working */
2999 static struct hda_input_mux alc880_lg_capture_source = {
3004 { "Internal Mic", 0x6 },
3008 /* 2,4,6 channel modes */
3009 static struct hda_verb alc880_lg_ch2_init[] = {
3010 /* set line-in and mic-in to input */
3011 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3012 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3016 static struct hda_verb alc880_lg_ch4_init[] = {
3017 /* set line-in to out and mic-in to input */
3018 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3019 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3023 static struct hda_verb alc880_lg_ch6_init[] = {
3024 /* set line-in and mic-in to output */
3025 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3026 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3030 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3031 { 2, alc880_lg_ch2_init },
3032 { 4, alc880_lg_ch4_init },
3033 { 6, alc880_lg_ch6_init },
3036 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3037 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3038 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3039 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3040 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3041 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3042 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3043 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3044 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3045 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3046 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3047 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3048 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3049 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3050 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3052 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3053 .name = "Channel Mode",
3054 .info = alc_ch_mode_info,
3055 .get = alc_ch_mode_get,
3056 .put = alc_ch_mode_put,
3061 static struct hda_verb alc880_lg_init_verbs[] = {
3062 /* set capture source to mic-in */
3063 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3064 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3065 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3066 /* mute all amp mixer inputs */
3067 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3068 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3069 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3070 /* line-in to input */
3071 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3072 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3074 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3075 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3077 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3078 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3079 /* mic-in to input */
3080 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3081 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3082 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3084 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3085 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3086 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3088 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3092 /* toggle speaker-output according to the hp-jack state */
3093 static void alc880_lg_setup(struct hda_codec *codec)
3095 struct alc_spec *spec = codec->spec;
3097 spec->autocfg.hp_pins[0] = 0x1b;
3098 spec->autocfg.speaker_pins[0] = 0x17;
3107 * Built-in Mic-In: 0x19
3113 static struct hda_input_mux alc880_lg_lw_capture_source = {
3117 { "Internal Mic", 0x1 },
3122 #define alc880_lg_lw_modes alc880_threestack_modes
3124 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3125 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3126 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3127 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3128 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3129 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3130 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3131 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3132 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3133 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3134 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3135 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3136 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3137 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3138 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3140 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3141 .name = "Channel Mode",
3142 .info = alc_ch_mode_info,
3143 .get = alc_ch_mode_get,
3144 .put = alc_ch_mode_put,
3149 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3150 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3151 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3152 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3154 /* set capture source to mic-in */
3155 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3156 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3157 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3158 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3160 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3161 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3163 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3164 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3165 /* mic-in to input */
3166 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3167 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3169 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3170 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3172 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3176 /* toggle speaker-output according to the hp-jack state */
3177 static void alc880_lg_lw_setup(struct hda_codec *codec)
3179 struct alc_spec *spec = codec->spec;
3181 spec->autocfg.hp_pins[0] = 0x1b;
3182 spec->autocfg.speaker_pins[0] = 0x14;
3185 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3186 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3187 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3188 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3189 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3190 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3191 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3195 static struct hda_input_mux alc880_medion_rim_capture_source = {
3199 { "Internal Mic", 0x1 },
3203 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3204 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3206 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3207 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3209 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3210 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3211 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3212 /* Mic2 (as headphone out) for HP output */
3213 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3214 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3215 /* Internal Speaker */
3216 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3217 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3219 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3220 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3222 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3226 /* toggle speaker-output according to the hp-jack state */
3227 static void alc880_medion_rim_automute(struct hda_codec *codec)
3229 struct alc_spec *spec = codec->spec;
3230 alc_automute_amp(codec);
3232 if (spec->jack_present)
3233 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3235 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3238 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3241 /* Looks like the unsol event is incompatible with the standard
3242 * definition. 4bit tag is placed at 28 bit!
3244 if ((res >> 28) == ALC880_HP_EVENT)
3245 alc880_medion_rim_automute(codec);
3248 static void alc880_medion_rim_setup(struct hda_codec *codec)
3250 struct alc_spec *spec = codec->spec;
3252 spec->autocfg.hp_pins[0] = 0x14;
3253 spec->autocfg.speaker_pins[0] = 0x1b;
3256 #ifdef CONFIG_SND_HDA_POWER_SAVE
3257 static struct hda_amp_list alc880_loopbacks[] = {
3258 { 0x0b, HDA_INPUT, 0 },
3259 { 0x0b, HDA_INPUT, 1 },
3260 { 0x0b, HDA_INPUT, 2 },
3261 { 0x0b, HDA_INPUT, 3 },
3262 { 0x0b, HDA_INPUT, 4 },
3266 static struct hda_amp_list alc880_lg_loopbacks[] = {
3267 { 0x0b, HDA_INPUT, 1 },
3268 { 0x0b, HDA_INPUT, 6 },
3269 { 0x0b, HDA_INPUT, 7 },
3278 static int alc_init(struct hda_codec *codec)
3280 struct alc_spec *spec = codec->spec;
3284 alc_auto_init_amp(codec, spec->init_amp);
3286 for (i = 0; i < spec->num_init_verbs; i++)
3287 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3289 if (spec->init_hook)
3290 spec->init_hook(codec);
3295 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3297 struct alc_spec *spec = codec->spec;
3299 if (spec->unsol_event)
3300 spec->unsol_event(codec, res);
3303 #ifdef CONFIG_SND_HDA_POWER_SAVE
3304 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3306 struct alc_spec *spec = codec->spec;
3307 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3312 * Analog playback callbacks
3314 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3315 struct hda_codec *codec,
3316 struct snd_pcm_substream *substream)
3318 struct alc_spec *spec = codec->spec;
3319 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3323 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3324 struct hda_codec *codec,
3325 unsigned int stream_tag,
3326 unsigned int format,
3327 struct snd_pcm_substream *substream)
3329 struct alc_spec *spec = codec->spec;
3330 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3331 stream_tag, format, substream);
3334 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3335 struct hda_codec *codec,
3336 struct snd_pcm_substream *substream)
3338 struct alc_spec *spec = codec->spec;
3339 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3345 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3346 struct hda_codec *codec,
3347 struct snd_pcm_substream *substream)
3349 struct alc_spec *spec = codec->spec;
3350 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3353 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3354 struct hda_codec *codec,
3355 unsigned int stream_tag,
3356 unsigned int format,
3357 struct snd_pcm_substream *substream)
3359 struct alc_spec *spec = codec->spec;
3360 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3361 stream_tag, format, substream);
3364 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3365 struct hda_codec *codec,
3366 struct snd_pcm_substream *substream)
3368 struct alc_spec *spec = codec->spec;
3369 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3372 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3373 struct hda_codec *codec,
3374 struct snd_pcm_substream *substream)
3376 struct alc_spec *spec = codec->spec;
3377 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3383 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3384 struct hda_codec *codec,
3385 unsigned int stream_tag,
3386 unsigned int format,
3387 struct snd_pcm_substream *substream)
3389 struct alc_spec *spec = codec->spec;
3391 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3392 stream_tag, 0, format);
3396 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3397 struct hda_codec *codec,
3398 struct snd_pcm_substream *substream)
3400 struct alc_spec *spec = codec->spec;
3402 snd_hda_codec_cleanup_stream(codec,
3403 spec->adc_nids[substream->number + 1]);
3410 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3414 /* NID is set in alc_build_pcms */
3416 .open = alc880_playback_pcm_open,
3417 .prepare = alc880_playback_pcm_prepare,
3418 .cleanup = alc880_playback_pcm_cleanup
3422 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3426 /* NID is set in alc_build_pcms */
3429 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3433 /* NID is set in alc_build_pcms */
3436 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3437 .substreams = 2, /* can be overridden */
3440 /* NID is set in alc_build_pcms */
3442 .prepare = alc880_alt_capture_pcm_prepare,
3443 .cleanup = alc880_alt_capture_pcm_cleanup
3447 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3451 /* NID is set in alc_build_pcms */
3453 .open = alc880_dig_playback_pcm_open,
3454 .close = alc880_dig_playback_pcm_close,
3455 .prepare = alc880_dig_playback_pcm_prepare,
3456 .cleanup = alc880_dig_playback_pcm_cleanup
3460 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3464 /* NID is set in alc_build_pcms */
3467 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3468 static struct hda_pcm_stream alc_pcm_null_stream = {
3474 static int alc_build_pcms(struct hda_codec *codec)
3476 struct alc_spec *spec = codec->spec;
3477 struct hda_pcm *info = spec->pcm_rec;
3480 codec->num_pcms = 1;
3481 codec->pcm_info = info;
3483 if (spec->no_analog)
3486 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3487 "%s Analog", codec->chip_name);
3488 info->name = spec->stream_name_analog;
3490 if (spec->stream_analog_playback) {
3491 if (snd_BUG_ON(!spec->multiout.dac_nids))
3493 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3494 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3496 if (spec->stream_analog_capture) {
3497 if (snd_BUG_ON(!spec->adc_nids))
3499 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3500 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3503 if (spec->channel_mode) {
3504 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3505 for (i = 0; i < spec->num_channel_mode; i++) {
3506 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3507 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3513 /* SPDIF for stream index #1 */
3514 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3515 snprintf(spec->stream_name_digital,
3516 sizeof(spec->stream_name_digital),
3517 "%s Digital", codec->chip_name);
3518 codec->num_pcms = 2;
3519 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3520 info = spec->pcm_rec + 1;
3521 info->name = spec->stream_name_digital;
3522 if (spec->dig_out_type)
3523 info->pcm_type = spec->dig_out_type;
3525 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3526 if (spec->multiout.dig_out_nid &&
3527 spec->stream_digital_playback) {
3528 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3529 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3531 if (spec->dig_in_nid &&
3532 spec->stream_digital_capture) {
3533 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3534 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3536 /* FIXME: do we need this for all Realtek codec models? */
3537 codec->spdif_status_reset = 1;
3540 if (spec->no_analog)
3543 /* If the use of more than one ADC is requested for the current
3544 * model, configure a second analog capture-only PCM.
3546 /* Additional Analaog capture for index #2 */
3547 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3548 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3549 codec->num_pcms = 3;
3550 info = spec->pcm_rec + 2;
3551 info->name = spec->stream_name_analog;
3552 if (spec->alt_dac_nid) {
3553 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3554 *spec->stream_analog_alt_playback;
3555 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3558 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3559 alc_pcm_null_stream;
3560 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3562 if (spec->num_adc_nids > 1) {
3563 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3564 *spec->stream_analog_alt_capture;
3565 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3567 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3568 spec->num_adc_nids - 1;
3570 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3571 alc_pcm_null_stream;
3572 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3579 static void alc_free_kctls(struct hda_codec *codec)
3581 struct alc_spec *spec = codec->spec;
3583 if (spec->kctls.list) {
3584 struct snd_kcontrol_new *kctl = spec->kctls.list;
3586 for (i = 0; i < spec->kctls.used; i++)
3587 kfree(kctl[i].name);
3589 snd_array_free(&spec->kctls);
3592 static void alc_free(struct hda_codec *codec)
3594 struct alc_spec *spec = codec->spec;
3599 alc_free_kctls(codec);
3601 snd_hda_detach_beep_device(codec);
3604 #ifdef SND_HDA_NEEDS_RESUME
3605 static int alc_resume(struct hda_codec *codec)
3607 codec->patch_ops.init(codec);
3608 snd_hda_codec_resume_amp(codec);
3609 snd_hda_codec_resume_cache(codec);
3616 static struct hda_codec_ops alc_patch_ops = {
3617 .build_controls = alc_build_controls,
3618 .build_pcms = alc_build_pcms,
3621 .unsol_event = alc_unsol_event,
3622 #ifdef SND_HDA_NEEDS_RESUME
3623 .resume = alc_resume,
3625 #ifdef CONFIG_SND_HDA_POWER_SAVE
3626 .check_power_status = alc_check_power_status,
3632 * Test configuration for debugging
3634 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3637 #ifdef CONFIG_SND_DEBUG
3638 static hda_nid_t alc880_test_dac_nids[4] = {
3639 0x02, 0x03, 0x04, 0x05
3642 static struct hda_input_mux alc880_test_capture_source = {
3651 { "Surround", 0x6 },
3655 static struct hda_channel_mode alc880_test_modes[4] = {
3662 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3663 struct snd_ctl_elem_info *uinfo)
3665 static char *texts[] = {
3666 "N/A", "Line Out", "HP Out",
3667 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3669 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3671 uinfo->value.enumerated.items = 8;
3672 if (uinfo->value.enumerated.item >= 8)
3673 uinfo->value.enumerated.item = 7;
3674 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3678 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3679 struct snd_ctl_elem_value *ucontrol)
3681 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3682 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3683 unsigned int pin_ctl, item = 0;
3685 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3686 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3687 if (pin_ctl & AC_PINCTL_OUT_EN) {
3688 if (pin_ctl & AC_PINCTL_HP_EN)
3692 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3693 switch (pin_ctl & AC_PINCTL_VREFEN) {
3694 case AC_PINCTL_VREF_HIZ: item = 3; break;
3695 case AC_PINCTL_VREF_50: item = 4; break;
3696 case AC_PINCTL_VREF_GRD: item = 5; break;
3697 case AC_PINCTL_VREF_80: item = 6; break;
3698 case AC_PINCTL_VREF_100: item = 7; break;
3701 ucontrol->value.enumerated.item[0] = item;
3705 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3706 struct snd_ctl_elem_value *ucontrol)
3708 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3709 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3710 static unsigned int ctls[] = {
3711 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3712 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3713 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3714 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3715 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3716 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3718 unsigned int old_ctl, new_ctl;
3720 old_ctl = snd_hda_codec_read(codec, nid, 0,
3721 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3722 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3723 if (old_ctl != new_ctl) {
3725 snd_hda_codec_write_cache(codec, nid, 0,
3726 AC_VERB_SET_PIN_WIDGET_CONTROL,
3728 val = ucontrol->value.enumerated.item[0] >= 3 ?
3730 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3737 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3738 struct snd_ctl_elem_info *uinfo)
3740 static char *texts[] = {
3741 "Front", "Surround", "CLFE", "Side"
3743 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3745 uinfo->value.enumerated.items = 4;
3746 if (uinfo->value.enumerated.item >= 4)
3747 uinfo->value.enumerated.item = 3;
3748 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3752 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3753 struct snd_ctl_elem_value *ucontrol)
3755 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3756 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3759 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3760 ucontrol->value.enumerated.item[0] = sel & 3;
3764 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3765 struct snd_ctl_elem_value *ucontrol)
3767 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3768 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3771 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3772 if (ucontrol->value.enumerated.item[0] != sel) {
3773 sel = ucontrol->value.enumerated.item[0] & 3;
3774 snd_hda_codec_write_cache(codec, nid, 0,
3775 AC_VERB_SET_CONNECT_SEL, sel);
3781 #define PIN_CTL_TEST(xname,nid) { \
3782 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3784 .info = alc_test_pin_ctl_info, \
3785 .get = alc_test_pin_ctl_get, \
3786 .put = alc_test_pin_ctl_put, \
3787 .private_value = nid \
3790 #define PIN_SRC_TEST(xname,nid) { \
3791 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3793 .info = alc_test_pin_src_info, \
3794 .get = alc_test_pin_src_get, \
3795 .put = alc_test_pin_src_put, \
3796 .private_value = nid \
3799 static struct snd_kcontrol_new alc880_test_mixer[] = {
3800 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3801 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3802 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3803 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3804 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3805 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3806 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3807 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3808 PIN_CTL_TEST("Front Pin Mode", 0x14),
3809 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3810 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3811 PIN_CTL_TEST("Side Pin Mode", 0x17),
3812 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3813 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3814 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3815 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3816 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3817 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3818 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3819 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3820 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3821 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3822 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3823 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3824 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3825 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3826 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3827 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3828 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3829 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3831 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3832 .name = "Channel Mode",
3833 .info = alc_ch_mode_info,
3834 .get = alc_ch_mode_get,
3835 .put = alc_ch_mode_put,
3840 static struct hda_verb alc880_test_init_verbs[] = {
3841 /* Unmute inputs of 0x0c - 0x0f */
3842 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3843 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3844 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3845 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3846 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3847 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3848 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3849 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3850 /* Vol output for 0x0c-0x0f */
3851 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3852 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3853 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3854 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3855 /* Set output pins 0x14-0x17 */
3856 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3857 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3858 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3859 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3860 /* Unmute output pins 0x14-0x17 */
3861 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3862 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3863 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3864 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3865 /* Set input pins 0x18-0x1c */
3866 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3867 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3868 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3869 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3870 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3871 /* Mute input pins 0x18-0x1b */
3872 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3873 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3874 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3875 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3877 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3878 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3879 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3880 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3881 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3882 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3883 /* Analog input/passthru */
3884 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3885 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3886 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3887 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3888 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3896 static const char *alc880_models[ALC880_MODEL_LAST] = {
3897 [ALC880_3ST] = "3stack",
3898 [ALC880_TCL_S700] = "tcl",
3899 [ALC880_3ST_DIG] = "3stack-digout",
3900 [ALC880_CLEVO] = "clevo",
3901 [ALC880_5ST] = "5stack",
3902 [ALC880_5ST_DIG] = "5stack-digout",
3903 [ALC880_W810] = "w810",
3904 [ALC880_Z71V] = "z71v",
3905 [ALC880_6ST] = "6stack",
3906 [ALC880_6ST_DIG] = "6stack-digout",
3907 [ALC880_ASUS] = "asus",
3908 [ALC880_ASUS_W1V] = "asus-w1v",
3909 [ALC880_ASUS_DIG] = "asus-dig",
3910 [ALC880_ASUS_DIG2] = "asus-dig2",
3911 [ALC880_UNIWILL_DIG] = "uniwill",
3912 [ALC880_UNIWILL_P53] = "uniwill-p53",
3913 [ALC880_FUJITSU] = "fujitsu",
3914 [ALC880_F1734] = "F1734",
3916 [ALC880_LG_LW] = "lg-lw",
3917 [ALC880_MEDION_RIM] = "medion",
3918 #ifdef CONFIG_SND_DEBUG
3919 [ALC880_TEST] = "test",
3921 [ALC880_AUTO] = "auto",
3924 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3925 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3926 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3927 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3928 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3929 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3930 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3931 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3932 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3933 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3934 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3935 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3936 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3937 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3938 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3939 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3940 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3941 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3942 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3943 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3944 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3945 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3946 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3947 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3948 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3949 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3950 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3951 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3952 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3953 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3954 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3955 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3956 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3957 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3958 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3959 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3960 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3961 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3962 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3963 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3964 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3965 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3966 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3967 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3968 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3969 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3970 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3971 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3972 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3973 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3974 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
3975 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3976 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3977 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3978 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG),
3979 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3980 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3981 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3982 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3983 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3984 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3985 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3986 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3987 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3988 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3989 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3990 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3991 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3992 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3993 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3995 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3996 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3997 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4002 * ALC880 codec presets
4004 static struct alc_config_preset alc880_presets[] = {
4006 .mixers = { alc880_three_stack_mixer },
4007 .init_verbs = { alc880_volume_init_verbs,
4008 alc880_pin_3stack_init_verbs },
4009 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4010 .dac_nids = alc880_dac_nids,
4011 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4012 .channel_mode = alc880_threestack_modes,
4014 .input_mux = &alc880_capture_source,
4016 [ALC880_3ST_DIG] = {
4017 .mixers = { alc880_three_stack_mixer },
4018 .init_verbs = { alc880_volume_init_verbs,
4019 alc880_pin_3stack_init_verbs },
4020 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4021 .dac_nids = alc880_dac_nids,
4022 .dig_out_nid = ALC880_DIGOUT_NID,
4023 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4024 .channel_mode = alc880_threestack_modes,
4026 .input_mux = &alc880_capture_source,
4028 [ALC880_TCL_S700] = {
4029 .mixers = { alc880_tcl_s700_mixer },
4030 .init_verbs = { alc880_volume_init_verbs,
4031 alc880_pin_tcl_S700_init_verbs,
4032 alc880_gpio2_init_verbs },
4033 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4034 .dac_nids = alc880_dac_nids,
4035 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4036 .num_adc_nids = 1, /* single ADC */
4038 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4039 .channel_mode = alc880_2_jack_modes,
4040 .input_mux = &alc880_capture_source,
4043 .mixers = { alc880_three_stack_mixer,
4044 alc880_five_stack_mixer},
4045 .init_verbs = { alc880_volume_init_verbs,
4046 alc880_pin_5stack_init_verbs },
4047 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4048 .dac_nids = alc880_dac_nids,
4049 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4050 .channel_mode = alc880_fivestack_modes,
4051 .input_mux = &alc880_capture_source,
4053 [ALC880_5ST_DIG] = {
4054 .mixers = { alc880_three_stack_mixer,
4055 alc880_five_stack_mixer },
4056 .init_verbs = { alc880_volume_init_verbs,
4057 alc880_pin_5stack_init_verbs },
4058 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4059 .dac_nids = alc880_dac_nids,
4060 .dig_out_nid = ALC880_DIGOUT_NID,
4061 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4062 .channel_mode = alc880_fivestack_modes,
4063 .input_mux = &alc880_capture_source,
4066 .mixers = { alc880_six_stack_mixer },
4067 .init_verbs = { alc880_volume_init_verbs,
4068 alc880_pin_6stack_init_verbs },
4069 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4070 .dac_nids = alc880_6st_dac_nids,
4071 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4072 .channel_mode = alc880_sixstack_modes,
4073 .input_mux = &alc880_6stack_capture_source,
4075 [ALC880_6ST_DIG] = {
4076 .mixers = { alc880_six_stack_mixer },
4077 .init_verbs = { alc880_volume_init_verbs,
4078 alc880_pin_6stack_init_verbs },
4079 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4080 .dac_nids = alc880_6st_dac_nids,
4081 .dig_out_nid = ALC880_DIGOUT_NID,
4082 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4083 .channel_mode = alc880_sixstack_modes,
4084 .input_mux = &alc880_6stack_capture_source,
4087 .mixers = { alc880_w810_base_mixer },
4088 .init_verbs = { alc880_volume_init_verbs,
4089 alc880_pin_w810_init_verbs,
4090 alc880_gpio2_init_verbs },
4091 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4092 .dac_nids = alc880_w810_dac_nids,
4093 .dig_out_nid = ALC880_DIGOUT_NID,
4094 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4095 .channel_mode = alc880_w810_modes,
4096 .input_mux = &alc880_capture_source,
4099 .mixers = { alc880_z71v_mixer },
4100 .init_verbs = { alc880_volume_init_verbs,
4101 alc880_pin_z71v_init_verbs },
4102 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4103 .dac_nids = alc880_z71v_dac_nids,
4104 .dig_out_nid = ALC880_DIGOUT_NID,
4106 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4107 .channel_mode = alc880_2_jack_modes,
4108 .input_mux = &alc880_capture_source,
4111 .mixers = { alc880_f1734_mixer },
4112 .init_verbs = { alc880_volume_init_verbs,
4113 alc880_pin_f1734_init_verbs },
4114 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4115 .dac_nids = alc880_f1734_dac_nids,
4117 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4118 .channel_mode = alc880_2_jack_modes,
4119 .input_mux = &alc880_f1734_capture_source,
4120 .unsol_event = alc880_uniwill_p53_unsol_event,
4121 .setup = alc880_uniwill_p53_setup,
4122 .init_hook = alc_automute_amp,
4125 .mixers = { alc880_asus_mixer },
4126 .init_verbs = { alc880_volume_init_verbs,
4127 alc880_pin_asus_init_verbs,
4128 alc880_gpio1_init_verbs },
4129 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4130 .dac_nids = alc880_asus_dac_nids,
4131 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4132 .channel_mode = alc880_asus_modes,
4134 .input_mux = &alc880_capture_source,
4136 [ALC880_ASUS_DIG] = {
4137 .mixers = { alc880_asus_mixer },
4138 .init_verbs = { alc880_volume_init_verbs,
4139 alc880_pin_asus_init_verbs,
4140 alc880_gpio1_init_verbs },
4141 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4142 .dac_nids = alc880_asus_dac_nids,
4143 .dig_out_nid = ALC880_DIGOUT_NID,
4144 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4145 .channel_mode = alc880_asus_modes,
4147 .input_mux = &alc880_capture_source,
4149 [ALC880_ASUS_DIG2] = {
4150 .mixers = { alc880_asus_mixer },
4151 .init_verbs = { alc880_volume_init_verbs,
4152 alc880_pin_asus_init_verbs,
4153 alc880_gpio2_init_verbs }, /* use GPIO2 */
4154 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4155 .dac_nids = alc880_asus_dac_nids,
4156 .dig_out_nid = ALC880_DIGOUT_NID,
4157 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4158 .channel_mode = alc880_asus_modes,
4160 .input_mux = &alc880_capture_source,
4162 [ALC880_ASUS_W1V] = {
4163 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4164 .init_verbs = { alc880_volume_init_verbs,
4165 alc880_pin_asus_init_verbs,
4166 alc880_gpio1_init_verbs },
4167 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4168 .dac_nids = alc880_asus_dac_nids,
4169 .dig_out_nid = ALC880_DIGOUT_NID,
4170 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4171 .channel_mode = alc880_asus_modes,
4173 .input_mux = &alc880_capture_source,
4175 [ALC880_UNIWILL_DIG] = {
4176 .mixers = { alc880_asus_mixer },
4177 .init_verbs = { alc880_volume_init_verbs,
4178 alc880_pin_asus_init_verbs },
4179 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4180 .dac_nids = alc880_asus_dac_nids,
4181 .dig_out_nid = ALC880_DIGOUT_NID,
4182 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4183 .channel_mode = alc880_asus_modes,
4185 .input_mux = &alc880_capture_source,
4187 [ALC880_UNIWILL] = {
4188 .mixers = { alc880_uniwill_mixer },
4189 .init_verbs = { alc880_volume_init_verbs,
4190 alc880_uniwill_init_verbs },
4191 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4192 .dac_nids = alc880_asus_dac_nids,
4193 .dig_out_nid = ALC880_DIGOUT_NID,
4194 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4195 .channel_mode = alc880_threestack_modes,
4197 .input_mux = &alc880_capture_source,
4198 .unsol_event = alc880_uniwill_unsol_event,
4199 .setup = alc880_uniwill_setup,
4200 .init_hook = alc880_uniwill_init_hook,
4202 [ALC880_UNIWILL_P53] = {
4203 .mixers = { alc880_uniwill_p53_mixer },
4204 .init_verbs = { alc880_volume_init_verbs,
4205 alc880_uniwill_p53_init_verbs },
4206 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4207 .dac_nids = alc880_asus_dac_nids,
4208 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4209 .channel_mode = alc880_threestack_modes,
4210 .input_mux = &alc880_capture_source,
4211 .unsol_event = alc880_uniwill_p53_unsol_event,
4212 .setup = alc880_uniwill_p53_setup,
4213 .init_hook = alc_automute_amp,
4215 [ALC880_FUJITSU] = {
4216 .mixers = { alc880_fujitsu_mixer },
4217 .init_verbs = { alc880_volume_init_verbs,
4218 alc880_uniwill_p53_init_verbs,
4219 alc880_beep_init_verbs },
4220 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4221 .dac_nids = alc880_dac_nids,
4222 .dig_out_nid = ALC880_DIGOUT_NID,
4223 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4224 .channel_mode = alc880_2_jack_modes,
4225 .input_mux = &alc880_capture_source,
4226 .unsol_event = alc880_uniwill_p53_unsol_event,
4227 .setup = alc880_uniwill_p53_setup,
4228 .init_hook = alc_automute_amp,
4231 .mixers = { alc880_three_stack_mixer },
4232 .init_verbs = { alc880_volume_init_verbs,
4233 alc880_pin_clevo_init_verbs },
4234 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4235 .dac_nids = alc880_dac_nids,
4237 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4238 .channel_mode = alc880_threestack_modes,
4240 .input_mux = &alc880_capture_source,
4243 .mixers = { alc880_lg_mixer },
4244 .init_verbs = { alc880_volume_init_verbs,
4245 alc880_lg_init_verbs },
4246 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4247 .dac_nids = alc880_lg_dac_nids,
4248 .dig_out_nid = ALC880_DIGOUT_NID,
4249 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4250 .channel_mode = alc880_lg_ch_modes,
4252 .input_mux = &alc880_lg_capture_source,
4253 .unsol_event = alc_automute_amp_unsol_event,
4254 .setup = alc880_lg_setup,
4255 .init_hook = alc_automute_amp,
4256 #ifdef CONFIG_SND_HDA_POWER_SAVE
4257 .loopbacks = alc880_lg_loopbacks,
4261 .mixers = { alc880_lg_lw_mixer },
4262 .init_verbs = { alc880_volume_init_verbs,
4263 alc880_lg_lw_init_verbs },
4264 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4265 .dac_nids = alc880_dac_nids,
4266 .dig_out_nid = ALC880_DIGOUT_NID,
4267 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4268 .channel_mode = alc880_lg_lw_modes,
4269 .input_mux = &alc880_lg_lw_capture_source,
4270 .unsol_event = alc_automute_amp_unsol_event,
4271 .setup = alc880_lg_lw_setup,
4272 .init_hook = alc_automute_amp,
4274 [ALC880_MEDION_RIM] = {
4275 .mixers = { alc880_medion_rim_mixer },
4276 .init_verbs = { alc880_volume_init_verbs,
4277 alc880_medion_rim_init_verbs,
4278 alc_gpio2_init_verbs },
4279 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4280 .dac_nids = alc880_dac_nids,
4281 .dig_out_nid = ALC880_DIGOUT_NID,
4282 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4283 .channel_mode = alc880_2_jack_modes,
4284 .input_mux = &alc880_medion_rim_capture_source,
4285 .unsol_event = alc880_medion_rim_unsol_event,
4286 .setup = alc880_medion_rim_setup,
4287 .init_hook = alc880_medion_rim_automute,
4289 #ifdef CONFIG_SND_DEBUG
4291 .mixers = { alc880_test_mixer },
4292 .init_verbs = { alc880_test_init_verbs },
4293 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4294 .dac_nids = alc880_test_dac_nids,
4295 .dig_out_nid = ALC880_DIGOUT_NID,
4296 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4297 .channel_mode = alc880_test_modes,
4298 .input_mux = &alc880_test_capture_source,
4304 * Automatic parse of I/O pins from the BIOS configuration
4309 ALC_CTL_WIDGET_MUTE,
4312 static struct snd_kcontrol_new alc880_control_templates[] = {
4313 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4314 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4315 HDA_BIND_MUTE(NULL, 0, 0, 0),
4318 /* add dynamic controls */
4319 static int add_control(struct alc_spec *spec, int type, const char *name,
4322 struct snd_kcontrol_new *knew;
4324 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4325 knew = snd_array_new(&spec->kctls);
4328 *knew = alc880_control_templates[type];
4329 knew->name = kstrdup(name, GFP_KERNEL);
4332 knew->private_value = val;
4336 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4337 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4338 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4339 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4340 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4341 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4342 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4343 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4344 #define ALC880_PIN_CD_NID 0x1c
4346 /* fill in the dac_nids table from the parsed pin configuration */
4347 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4348 const struct auto_pin_cfg *cfg)
4354 memset(assigned, 0, sizeof(assigned));
4355 spec->multiout.dac_nids = spec->private_dac_nids;
4357 /* check the pins hardwired to audio widget */
4358 for (i = 0; i < cfg->line_outs; i++) {
4359 nid = cfg->line_out_pins[i];
4360 if (alc880_is_fixed_pin(nid)) {
4361 int idx = alc880_fixed_pin_idx(nid);
4362 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4366 /* left pins can be connect to any audio widget */
4367 for (i = 0; i < cfg->line_outs; i++) {
4368 nid = cfg->line_out_pins[i];
4369 if (alc880_is_fixed_pin(nid))
4371 /* search for an empty channel */
4372 for (j = 0; j < cfg->line_outs; j++) {
4374 spec->multiout.dac_nids[i] =
4375 alc880_idx_to_dac(j);
4381 spec->multiout.num_dacs = cfg->line_outs;
4385 /* add playback controls from the parsed DAC table */
4386 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4387 const struct auto_pin_cfg *cfg)
4390 static const char *chname[4] = {
4391 "Front", "Surround", NULL /*CLFE*/, "Side"
4396 for (i = 0; i < cfg->line_outs; i++) {
4397 if (!spec->multiout.dac_nids[i])
4399 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4402 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4403 "Center Playback Volume",
4404 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4408 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4409 "LFE Playback Volume",
4410 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4414 err = add_control(spec, ALC_CTL_BIND_MUTE,
4415 "Center Playback Switch",
4416 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4420 err = add_control(spec, ALC_CTL_BIND_MUTE,
4421 "LFE Playback Switch",
4422 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4428 if (cfg->line_outs == 1 &&
4429 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4433 sprintf(name, "%s Playback Volume", pfx);
4434 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4435 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4439 sprintf(name, "%s Playback Switch", pfx);
4440 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4441 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4450 /* add playback controls for speaker and HP outputs */
4451 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4461 if (alc880_is_fixed_pin(pin)) {
4462 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4463 /* specify the DAC as the extra output */
4464 if (!spec->multiout.hp_nid)
4465 spec->multiout.hp_nid = nid;
4467 spec->multiout.extra_out_nid[0] = nid;
4468 /* control HP volume/switch on the output mixer amp */
4469 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4470 sprintf(name, "%s Playback Volume", pfx);
4471 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4472 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4475 sprintf(name, "%s Playback Switch", pfx);
4476 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4477 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4480 } else if (alc880_is_multi_pin(pin)) {
4481 /* set manual connection */
4482 /* we have only a switch on HP-out PIN */
4483 sprintf(name, "%s Playback Switch", pfx);
4484 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4485 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4492 /* create input playback/capture controls for the given pin */
4493 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4494 const char *ctlname,
4495 int idx, hda_nid_t mix_nid)
4500 sprintf(name, "%s Playback Volume", ctlname);
4501 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4502 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4505 sprintf(name, "%s Playback Switch", ctlname);
4506 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4507 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4513 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4515 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4516 return (pincap & AC_PINCAP_IN) != 0;
4519 /* create playback/capture controls for input pins */
4520 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4521 const struct auto_pin_cfg *cfg,
4523 hda_nid_t cap1, hda_nid_t cap2)
4525 struct alc_spec *spec = codec->spec;
4526 struct hda_input_mux *imux = &spec->private_imux[0];
4529 for (i = 0; i < AUTO_PIN_LAST; i++) {
4532 pin = cfg->input_pins[i];
4533 if (!alc_is_input_pin(codec, pin))
4537 idx = get_connection_index(codec, mixer, pin);
4539 err = new_analog_input(spec, pin,
4540 auto_pin_cfg_labels[i],
4549 idx = get_connection_index(codec, cap1, pin);
4550 if (idx < 0 && cap2)
4551 idx = get_connection_index(codec, cap2, pin);
4553 imux->items[imux->num_items].label =
4554 auto_pin_cfg_labels[i];
4555 imux->items[imux->num_items].index = idx;
4562 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4563 const struct auto_pin_cfg *cfg)
4565 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4568 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4569 unsigned int pin_type)
4571 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4574 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4578 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4579 hda_nid_t nid, int pin_type,
4582 alc_set_pin_output(codec, nid, pin_type);
4583 /* need the manual connection? */
4584 if (alc880_is_multi_pin(nid)) {
4585 struct alc_spec *spec = codec->spec;
4586 int idx = alc880_multi_pin_idx(nid);
4587 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4588 AC_VERB_SET_CONNECT_SEL,
4589 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4593 static int get_pin_type(int line_out_type)
4595 if (line_out_type == AUTO_PIN_HP_OUT)
4601 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4603 struct alc_spec *spec = codec->spec;
4606 for (i = 0; i < spec->autocfg.line_outs; i++) {
4607 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4608 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4609 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4613 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4615 struct alc_spec *spec = codec->spec;
4618 pin = spec->autocfg.speaker_pins[0];
4619 if (pin) /* connect to front */
4620 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4621 pin = spec->autocfg.hp_pins[0];
4622 if (pin) /* connect to front */
4623 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4626 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4628 struct alc_spec *spec = codec->spec;
4631 for (i = 0; i < AUTO_PIN_LAST; i++) {
4632 hda_nid_t nid = spec->autocfg.input_pins[i];
4633 if (alc_is_input_pin(codec, nid)) {
4634 alc_set_input_pin(codec, nid, i);
4635 if (nid != ALC880_PIN_CD_NID &&
4636 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4637 snd_hda_codec_write(codec, nid, 0,
4638 AC_VERB_SET_AMP_GAIN_MUTE,
4644 /* parse the BIOS configuration and set up the alc_spec */
4645 /* return 1 if successful, 0 if the proper config is not found,
4646 * or a negative error code
4648 static int alc880_parse_auto_config(struct hda_codec *codec)
4650 struct alc_spec *spec = codec->spec;
4652 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4654 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4658 if (!spec->autocfg.line_outs)
4659 return 0; /* can't find valid BIOS pin config */
4661 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4664 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4667 err = alc880_auto_create_extra_out(spec,
4668 spec->autocfg.speaker_pins[0],
4672 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4676 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4680 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4682 /* check multiple SPDIF-out (for recent codecs) */
4683 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4685 err = snd_hda_get_connections(codec,
4686 spec->autocfg.dig_out_pins[i],
4691 spec->multiout.dig_out_nid = dig_nid;
4693 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4694 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4696 spec->slave_dig_outs[i - 1] = dig_nid;
4699 if (spec->autocfg.dig_in_pin)
4700 spec->dig_in_nid = ALC880_DIGIN_NID;
4702 if (spec->kctls.list)
4703 add_mixer(spec, spec->kctls.list);
4705 add_verb(spec, alc880_volume_init_verbs);
4707 spec->num_mux_defs = 1;
4708 spec->input_mux = &spec->private_imux[0];
4710 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4715 /* additional initialization for auto-configuration model */
4716 static void alc880_auto_init(struct hda_codec *codec)
4718 struct alc_spec *spec = codec->spec;
4719 alc880_auto_init_multi_out(codec);
4720 alc880_auto_init_extra_out(codec);
4721 alc880_auto_init_analog_input(codec);
4722 if (spec->unsol_event)
4723 alc_inithook(codec);
4726 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4727 * one of two digital mic pins, e.g. on ALC272
4729 static void fixup_automic_adc(struct hda_codec *codec)
4731 struct alc_spec *spec = codec->spec;
4734 for (i = 0; i < spec->num_adc_nids; i++) {
4735 hda_nid_t cap = spec->capsrc_nids ?
4736 spec->capsrc_nids[i] : spec->adc_nids[i];
4739 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4742 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4745 spec->int_mic.mux_idx = iidx;
4746 spec->ext_mic.mux_idx = eidx;
4747 if (spec->capsrc_nids)
4748 spec->capsrc_nids += i;
4749 spec->adc_nids += i;
4750 spec->num_adc_nids = 1;
4753 snd_printd(KERN_INFO "hda_codec: %s: "
4754 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4755 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4756 spec->auto_mic = 0; /* disable auto-mic to be sure */
4759 static void set_capture_mixer(struct hda_codec *codec)
4761 struct alc_spec *spec = codec->spec;
4762 static struct snd_kcontrol_new *caps[2][3] = {
4763 { alc_capture_mixer_nosrc1,
4764 alc_capture_mixer_nosrc2,
4765 alc_capture_mixer_nosrc3 },
4766 { alc_capture_mixer1,
4768 alc_capture_mixer3 },
4770 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4772 if (spec->auto_mic) {
4774 fixup_automic_adc(codec);
4775 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4779 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4783 #define set_beep_amp(spec, nid, idx, dir) \
4784 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4787 * OK, here we have finally the patch for ALC880
4790 static int patch_alc880(struct hda_codec *codec)
4792 struct alc_spec *spec;
4796 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4802 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4805 if (board_config < 0) {
4806 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4808 board_config = ALC880_AUTO;
4811 if (board_config == ALC880_AUTO) {
4812 /* automatic parse from the BIOS config */
4813 err = alc880_parse_auto_config(codec);
4819 "hda_codec: Cannot set up configuration "
4820 "from BIOS. Using 3-stack mode...\n");
4821 board_config = ALC880_3ST;
4825 err = snd_hda_attach_beep_device(codec, 0x1);
4831 if (board_config != ALC880_AUTO)
4832 setup_preset(codec, &alc880_presets[board_config]);
4834 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4835 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4836 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4838 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4839 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4841 if (!spec->adc_nids && spec->input_mux) {
4842 /* check whether NID 0x07 is valid */
4843 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4845 wcap = get_wcaps_type(wcap);
4846 if (wcap != AC_WID_AUD_IN) {
4847 spec->adc_nids = alc880_adc_nids_alt;
4848 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4850 spec->adc_nids = alc880_adc_nids;
4851 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4854 set_capture_mixer(codec);
4855 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4857 spec->vmaster_nid = 0x0c;
4859 codec->patch_ops = alc_patch_ops;
4860 if (board_config == ALC880_AUTO)
4861 spec->init_hook = alc880_auto_init;
4862 #ifdef CONFIG_SND_HDA_POWER_SAVE
4863 if (!spec->loopback.amplist)
4864 spec->loopback.amplist = alc880_loopbacks;
4866 codec->proc_widget_hook = print_realtek_coef;
4876 static hda_nid_t alc260_dac_nids[1] = {
4881 static hda_nid_t alc260_adc_nids[1] = {
4886 static hda_nid_t alc260_adc_nids_alt[1] = {
4891 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4892 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4894 static hda_nid_t alc260_dual_adc_nids[2] = {
4899 #define ALC260_DIGOUT_NID 0x03
4900 #define ALC260_DIGIN_NID 0x06
4902 static struct hda_input_mux alc260_capture_source = {
4906 { "Front Mic", 0x1 },
4912 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4913 * headphone jack and the internal CD lines since these are the only pins at
4914 * which audio can appear. For flexibility, also allow the option of
4915 * recording the mixer output on the second ADC (ADC0 doesn't have a
4916 * connection to the mixer output).
4918 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4922 { "Mic/Line", 0x0 },
4924 { "Headphone", 0x2 },
4930 { "Mic/Line", 0x0 },
4932 { "Headphone", 0x2 },
4939 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4940 * the Fujitsu S702x, but jacks are marked differently.
4942 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4949 { "Headphone", 0x5 },
4958 { "Headphone", 0x6 },
4964 /* Maxdata Favorit 100XS */
4965 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4969 { "Line/Mic", 0x0 },
4976 { "Line/Mic", 0x0 },
4984 * This is just place-holder, so there's something for alc_build_pcms to look
4985 * at when it calculates the maximum number of channels. ALC260 has no mixer
4986 * element which allows changing the channel mode, so the verb list is
4989 static struct hda_channel_mode alc260_modes[1] = {
4994 /* Mixer combinations
4996 * basic: base_output + input + pc_beep + capture
4997 * HP: base_output + input + capture_alt
4998 * HP_3013: hp_3013 + input + capture
4999 * fujitsu: fujitsu + capture
5000 * acer: acer + capture
5003 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5004 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5005 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5006 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5007 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5008 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5009 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5013 static struct snd_kcontrol_new alc260_input_mixer[] = {
5014 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5015 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5016 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5017 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5018 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5019 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5020 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5021 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5025 /* update HP, line and mono out pins according to the master switch */
5026 static void alc260_hp_master_update(struct hda_codec *codec,
5027 hda_nid_t hp, hda_nid_t line,
5030 struct alc_spec *spec = codec->spec;
5031 unsigned int val = spec->master_sw ? PIN_HP : 0;
5032 /* change HP and line-out pins */
5033 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5035 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5037 /* mono (speaker) depending on the HP jack sense */
5038 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5039 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5043 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5044 struct snd_ctl_elem_value *ucontrol)
5046 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5047 struct alc_spec *spec = codec->spec;
5048 *ucontrol->value.integer.value = spec->master_sw;
5052 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5053 struct snd_ctl_elem_value *ucontrol)
5055 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5056 struct alc_spec *spec = codec->spec;
5057 int val = !!*ucontrol->value.integer.value;
5058 hda_nid_t hp, line, mono;
5060 if (val == spec->master_sw)
5062 spec->master_sw = val;
5063 hp = (kcontrol->private_value >> 16) & 0xff;
5064 line = (kcontrol->private_value >> 8) & 0xff;
5065 mono = kcontrol->private_value & 0xff;
5066 alc260_hp_master_update(codec, hp, line, mono);
5070 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5072 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5073 .name = "Master Playback Switch",
5074 .info = snd_ctl_boolean_mono_info,
5075 .get = alc260_hp_master_sw_get,
5076 .put = alc260_hp_master_sw_put,
5077 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5079 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5080 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5081 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5082 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5083 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5085 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5089 static struct hda_verb alc260_hp_unsol_verbs[] = {
5090 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5094 static void alc260_hp_automute(struct hda_codec *codec)
5096 struct alc_spec *spec = codec->spec;
5097 unsigned int present;
5099 present = snd_hda_codec_read(codec, 0x10, 0,
5100 AC_VERB_GET_PIN_SENSE, 0);
5101 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5102 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5105 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5107 if ((res >> 26) == ALC880_HP_EVENT)
5108 alc260_hp_automute(codec);
5111 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5113 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5114 .name = "Master Playback Switch",
5115 .info = snd_ctl_boolean_mono_info,
5116 .get = alc260_hp_master_sw_get,
5117 .put = alc260_hp_master_sw_put,
5118 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5120 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5121 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5122 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5123 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5124 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5125 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5126 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5127 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5131 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5132 .ops = &snd_hda_bind_vol,
5134 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5135 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5136 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5141 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5142 .ops = &snd_hda_bind_sw,
5144 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5145 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5150 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5151 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5152 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5153 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5154 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5158 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5159 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5163 static void alc260_hp_3013_automute(struct hda_codec *codec)
5165 struct alc_spec *spec = codec->spec;
5166 unsigned int present;
5168 present = snd_hda_codec_read(codec, 0x15, 0,
5169 AC_VERB_GET_PIN_SENSE, 0);
5170 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5171 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5174 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5177 if ((res >> 26) == ALC880_HP_EVENT)
5178 alc260_hp_3013_automute(codec);
5181 static void alc260_hp_3012_automute(struct hda_codec *codec)
5183 unsigned int present, bits;
5185 present = snd_hda_codec_read(codec, 0x10, 0,
5186 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
5188 bits = present ? 0 : PIN_OUT;
5189 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5191 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5193 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5197 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5200 if ((res >> 26) == ALC880_HP_EVENT)
5201 alc260_hp_3012_automute(codec);
5204 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5205 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5207 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5208 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5209 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5210 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5211 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5212 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5213 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5214 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5215 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5216 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5217 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5221 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5222 * versions of the ALC260 don't act on requests to enable mic bias from NID
5223 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5224 * datasheet doesn't mention this restriction. At this stage it's not clear
5225 * whether this behaviour is intentional or is a hardware bug in chip
5226 * revisions available in early 2006. Therefore for now allow the
5227 * "Headphone Jack Mode" control to span all choices, but if it turns out
5228 * that the lack of mic bias for this NID is intentional we could change the
5229 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5231 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5232 * don't appear to make the mic bias available from the "line" jack, even
5233 * though the NID used for this jack (0x14) can supply it. The theory is
5234 * that perhaps Acer have included blocking capacitors between the ALC260
5235 * and the output jack. If this turns out to be the case for all such
5236 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5237 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5239 * The C20x Tablet series have a mono internal speaker which is controlled
5240 * via the chip's Mono sum widget and pin complex, so include the necessary
5241 * controls for such models. On models without a "mono speaker" the control
5242 * won't do anything.
5244 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5245 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5246 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5247 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5248 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5250 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5252 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5253 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5254 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5255 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5256 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5257 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5258 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5259 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5263 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5265 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5266 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5267 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5268 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5269 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5270 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5271 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5275 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5276 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5278 static struct snd_kcontrol_new alc260_will_mixer[] = {
5279 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5280 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5281 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5282 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5283 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5284 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5285 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5286 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5287 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5288 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5292 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5293 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5295 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5296 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5297 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5298 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5299 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5300 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5301 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5302 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5303 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5304 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5305 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5310 * initialization verbs
5312 static struct hda_verb alc260_init_verbs[] = {
5313 /* Line In pin widget for input */
5314 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5315 /* CD pin widget for input */
5316 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5317 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5318 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5319 /* Mic2 (front panel) pin widget for input and vref at 80% */
5320 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5321 /* LINE-2 is used for line-out in rear */
5322 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5323 /* select line-out */
5324 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5326 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5328 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5330 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5331 /* mute capture amp left and right */
5332 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5333 /* set connection select to line in (default select for this ADC) */
5334 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5335 /* mute capture amp left and right */
5336 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5337 /* set connection select to line in (default select for this ADC) */
5338 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5339 /* set vol=0 Line-Out mixer amp left and right */
5340 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5341 /* unmute pin widget amp left and right (no gain on this amp) */
5342 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5343 /* set vol=0 HP mixer amp left and right */
5344 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5345 /* unmute pin widget amp left and right (no gain on this amp) */
5346 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5347 /* set vol=0 Mono mixer amp left and right */
5348 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5349 /* unmute pin widget amp left and right (no gain on this amp) */
5350 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5351 /* unmute LINE-2 out pin */
5352 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5353 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5356 /* mute analog inputs */
5357 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5358 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5359 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5360 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5361 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5362 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5363 /* mute Front out path */
5364 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5365 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5366 /* mute Headphone out path */
5367 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5368 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5369 /* mute Mono out path */
5370 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5371 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5375 #if 0 /* should be identical with alc260_init_verbs? */
5376 static struct hda_verb alc260_hp_init_verbs[] = {
5377 /* Headphone and output */
5378 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5380 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5381 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5382 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5383 /* Mic2 (front panel) pin widget for input and vref at 80% */
5384 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5385 /* Line In pin widget for input */
5386 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5387 /* Line-2 pin widget for output */
5388 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5389 /* CD pin widget for input */
5390 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5391 /* unmute amp left and right */
5392 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5393 /* set connection select to line in (default select for this ADC) */
5394 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5395 /* unmute Line-Out mixer amp left and right (volume = 0) */
5396 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5397 /* mute pin widget amp left and right (no gain on this amp) */
5398 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5399 /* unmute HP mixer amp left and right (volume = 0) */
5400 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5401 /* mute pin widget amp left and right (no gain on this amp) */
5402 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5403 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5406 /* mute analog inputs */
5407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5409 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5410 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5411 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5412 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5413 /* Unmute Front out path */
5414 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5415 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5416 /* Unmute Headphone out path */
5417 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5418 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5419 /* Unmute Mono out path */
5420 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5421 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5426 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5427 /* Line out and output */
5428 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5430 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5431 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5432 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5433 /* Mic2 (front panel) pin widget for input and vref at 80% */
5434 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5435 /* Line In pin widget for input */
5436 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5437 /* Headphone pin widget for output */
5438 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5439 /* CD pin widget for input */
5440 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5441 /* unmute amp left and right */
5442 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5443 /* set connection select to line in (default select for this ADC) */
5444 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5445 /* unmute Line-Out mixer amp left and right (volume = 0) */
5446 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5447 /* mute pin widget amp left and right (no gain on this amp) */
5448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5449 /* unmute HP mixer amp left and right (volume = 0) */
5450 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5451 /* mute pin widget amp left and right (no gain on this amp) */
5452 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5453 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5456 /* mute analog inputs */
5457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5461 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5462 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5463 /* Unmute Front out path */
5464 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5465 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5466 /* Unmute Headphone out path */
5467 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5468 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5469 /* Unmute Mono out path */
5470 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5471 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5475 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5476 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5477 * audio = 0x16, internal speaker = 0x10.
5479 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5480 /* Disable all GPIOs */
5481 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5482 /* Internal speaker is connected to headphone pin */
5483 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5484 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5485 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5486 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5487 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5488 /* Ensure all other unused pins are disabled and muted. */
5489 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5490 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5491 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5492 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5493 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5494 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5495 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5496 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5498 /* Disable digital (SPDIF) pins */
5499 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5500 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5502 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5503 * when acting as an output.
5505 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5507 /* Start with output sum widgets muted and their output gains at min */
5508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5509 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5510 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5511 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5512 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5513 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5514 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5515 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5516 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5518 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5519 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5520 /* Unmute Line1 pin widget output buffer since it starts as an output.
5521 * If the pin mode is changed by the user the pin mode control will
5522 * take care of enabling the pin's input/output buffers as needed.
5523 * Therefore there's no need to enable the input buffer at this
5526 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5527 /* Unmute input buffer of pin widget used for Line-in (no equiv
5530 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5532 /* Mute capture amp left and right */
5533 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5534 /* Set ADC connection select to match default mixer setting - line
5537 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5539 /* Do the same for the second ADC: mute capture input amp and
5540 * set ADC connection to line in (on mic1 pin)
5542 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5543 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5545 /* Mute all inputs to mixer widget (even unconnected ones) */
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5558 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5559 * similar laptops (adapted from Fujitsu init verbs).
5561 static struct hda_verb alc260_acer_init_verbs[] = {
5562 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5563 * the headphone jack. Turn this on and rely on the standard mute
5564 * methods whenever the user wants to turn these outputs off.
5566 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5567 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5568 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5569 /* Internal speaker/Headphone jack is connected to Line-out pin */
5570 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5571 /* Internal microphone/Mic jack is connected to Mic1 pin */
5572 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5573 /* Line In jack is connected to Line1 pin */
5574 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5575 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5576 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5577 /* Ensure all other unused pins are disabled and muted. */
5578 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5579 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5580 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5581 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5582 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5583 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5584 /* Disable digital (SPDIF) pins */
5585 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5586 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5588 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5589 * bus when acting as outputs.
5591 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5592 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5594 /* Start with output sum widgets muted and their output gains at min */
5595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5596 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5597 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5598 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5599 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5600 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5601 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5602 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5603 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5605 /* Unmute Line-out pin widget amp left and right
5606 * (no equiv mixer ctrl)
5608 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5609 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5610 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5611 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5612 * inputs. If the pin mode is changed by the user the pin mode control
5613 * will take care of enabling the pin's input/output buffers as needed.
5614 * Therefore there's no need to enable the input buffer at this
5617 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5618 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5620 /* Mute capture amp left and right */
5621 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5622 /* Set ADC connection select to match default mixer setting - mic
5625 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5627 /* Do similar with the second ADC: mute capture input amp and
5628 * set ADC connection to mic to match ALSA's default state.
5630 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5631 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5633 /* Mute all inputs to mixer widget (even unconnected ones) */
5634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5638 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5639 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5640 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5641 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5646 /* Initialisation sequence for Maxdata Favorit 100XS
5647 * (adapted from Acer init verbs).
5649 static struct hda_verb alc260_favorit100_init_verbs[] = {
5650 /* GPIO 0 enables the output jack.
5651 * Turn this on and rely on the standard mute
5652 * methods whenever the user wants to turn these outputs off.
5654 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5655 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5656 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5657 /* Line/Mic input jack is connected to Mic1 pin */
5658 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5659 /* Ensure all other unused pins are disabled and muted. */
5660 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5661 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5662 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5663 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5664 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5665 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5666 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5667 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5668 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5669 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5670 /* Disable digital (SPDIF) pins */
5671 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5672 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5674 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5675 * bus when acting as outputs.
5677 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5678 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5680 /* Start with output sum widgets muted and their output gains at min */
5681 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5682 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5683 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5684 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5685 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5686 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5687 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5688 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5689 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5691 /* Unmute Line-out pin widget amp left and right
5692 * (no equiv mixer ctrl)
5694 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5695 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5696 * inputs. If the pin mode is changed by the user the pin mode control
5697 * will take care of enabling the pin's input/output buffers as needed.
5698 * Therefore there's no need to enable the input buffer at this
5701 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5703 /* Mute capture amp left and right */
5704 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5705 /* Set ADC connection select to match default mixer setting - mic
5708 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5710 /* Do similar with the second ADC: mute capture input amp and
5711 * set ADC connection to mic to match ALSA's default state.
5713 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5714 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5716 /* Mute all inputs to mixer widget (even unconnected ones) */
5717 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5718 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5719 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5720 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5722 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5724 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5729 static struct hda_verb alc260_will_verbs[] = {
5730 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5731 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5732 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5733 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5734 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5735 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5739 static struct hda_verb alc260_replacer_672v_verbs[] = {
5740 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5741 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5742 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5744 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5745 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5746 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5748 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5752 /* toggle speaker-output according to the hp-jack state */
5753 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5755 unsigned int present;
5757 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5758 present = snd_hda_codec_read(codec, 0x0f, 0,
5759 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5761 snd_hda_codec_write_cache(codec, 0x01, 0,
5762 AC_VERB_SET_GPIO_DATA, 1);
5763 snd_hda_codec_write_cache(codec, 0x0f, 0,
5764 AC_VERB_SET_PIN_WIDGET_CONTROL,
5767 snd_hda_codec_write_cache(codec, 0x01, 0,
5768 AC_VERB_SET_GPIO_DATA, 0);
5769 snd_hda_codec_write_cache(codec, 0x0f, 0,
5770 AC_VERB_SET_PIN_WIDGET_CONTROL,
5775 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5778 if ((res >> 26) == ALC880_HP_EVENT)
5779 alc260_replacer_672v_automute(codec);
5782 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5783 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5784 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5785 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5786 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5787 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5788 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5789 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5790 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5791 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5792 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5796 /* Test configuration for debugging, modelled after the ALC880 test
5799 #ifdef CONFIG_SND_DEBUG
5800 static hda_nid_t alc260_test_dac_nids[1] = {
5803 static hda_nid_t alc260_test_adc_nids[2] = {
5806 /* For testing the ALC260, each input MUX needs its own definition since
5807 * the signal assignments are different. This assumes that the first ADC
5810 static struct hda_input_mux alc260_test_capture_sources[2] = {
5814 { "MIC1 pin", 0x0 },
5815 { "MIC2 pin", 0x1 },
5816 { "LINE1 pin", 0x2 },
5817 { "LINE2 pin", 0x3 },
5819 { "LINE-OUT pin", 0x5 },
5820 { "HP-OUT pin", 0x6 },
5826 { "MIC1 pin", 0x0 },
5827 { "MIC2 pin", 0x1 },
5828 { "LINE1 pin", 0x2 },
5829 { "LINE2 pin", 0x3 },
5832 { "LINE-OUT pin", 0x6 },
5833 { "HP-OUT pin", 0x7 },
5837 static struct snd_kcontrol_new alc260_test_mixer[] = {
5838 /* Output driver widgets */
5839 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5840 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5841 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5842 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5843 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5844 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5846 /* Modes for retasking pin widgets
5847 * Note: the ALC260 doesn't seem to act on requests to enable mic
5848 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5849 * mention this restriction. At this stage it's not clear whether
5850 * this behaviour is intentional or is a hardware bug in chip
5851 * revisions available at least up until early 2006. Therefore for
5852 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5853 * choices, but if it turns out that the lack of mic bias for these
5854 * NIDs is intentional we could change their modes from
5855 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5857 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5858 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5859 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5860 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5861 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5862 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5864 /* Loopback mixer controls */
5865 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5866 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5867 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5868 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5869 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5870 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5871 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5872 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5873 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5874 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5875 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5876 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5877 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5878 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5880 /* Controls for GPIO pins, assuming they are configured as outputs */
5881 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5882 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5883 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5884 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5886 /* Switches to allow the digital IO pins to be enabled. The datasheet
5887 * is ambigious as to which NID is which; testing on laptops which
5888 * make this output available should provide clarification.
5890 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5891 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5893 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5894 * this output to turn on an external amplifier.
5896 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5897 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5901 static struct hda_verb alc260_test_init_verbs[] = {
5902 /* Enable all GPIOs as outputs with an initial value of 0 */
5903 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5904 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5905 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5907 /* Enable retasking pins as output, initially without power amp */
5908 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5909 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5910 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5911 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5912 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5913 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5915 /* Disable digital (SPDIF) pins initially, but users can enable
5916 * them via a mixer switch. In the case of SPDIF-out, this initverb
5917 * payload also sets the generation to 0, output to be in "consumer"
5918 * PCM format, copyright asserted, no pre-emphasis and no validity
5921 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5922 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5924 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5925 * OUT1 sum bus when acting as an output.
5927 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5928 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5929 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5930 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5932 /* Start with output sum widgets muted and their output gains at min */
5933 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5934 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5935 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5936 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5937 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5938 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5939 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5940 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5941 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5943 /* Unmute retasking pin widget output buffers since the default
5944 * state appears to be output. As the pin mode is changed by the
5945 * user the pin mode control will take care of enabling the pin's
5946 * input/output buffers as needed.
5948 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5949 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5950 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5951 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5952 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5953 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5954 /* Also unmute the mono-out pin widget */
5955 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5957 /* Mute capture amp left and right */
5958 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5959 /* Set ADC connection select to match default mixer setting (mic1
5962 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5964 /* Do the same for the second ADC: mute capture input amp and
5965 * set ADC connection to mic1 pin
5967 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5968 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5970 /* Mute all inputs to mixer widget (even unconnected ones) */
5971 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5972 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5973 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5974 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5975 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5976 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5977 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5978 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5984 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5985 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5987 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5988 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5991 * for BIOS auto-configuration
5994 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5995 const char *pfx, int *vol_bits)
5998 unsigned long vol_val, sw_val;
6002 if (nid >= 0x0f && nid < 0x11) {
6003 nid_vol = nid - 0x7;
6004 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6005 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6006 } else if (nid == 0x11) {
6007 nid_vol = nid - 0x7;
6008 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6009 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6010 } else if (nid >= 0x12 && nid <= 0x15) {
6012 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6013 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6017 if (!(*vol_bits & (1 << nid_vol))) {
6018 /* first control for the volume widget */
6019 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
6020 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
6023 *vol_bits |= (1 << nid_vol);
6025 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
6026 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
6032 /* add playback controls from the parsed DAC table */
6033 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6034 const struct auto_pin_cfg *cfg)
6040 spec->multiout.num_dacs = 1;
6041 spec->multiout.dac_nids = spec->private_dac_nids;
6042 spec->multiout.dac_nids[0] = 0x02;
6044 nid = cfg->line_out_pins[0];
6047 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6049 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6053 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6058 nid = cfg->speaker_pins[0];
6060 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6065 nid = cfg->hp_pins[0];
6067 err = alc260_add_playback_controls(spec, nid, "Headphone",
6075 /* create playback/capture controls for input pins */
6076 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6077 const struct auto_pin_cfg *cfg)
6079 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6082 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6083 hda_nid_t nid, int pin_type,
6086 alc_set_pin_output(codec, nid, pin_type);
6087 /* need the manual connection? */
6089 int idx = nid - 0x12;
6090 snd_hda_codec_write(codec, idx + 0x0b, 0,
6091 AC_VERB_SET_CONNECT_SEL, sel_idx);
6095 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6097 struct alc_spec *spec = codec->spec;
6100 nid = spec->autocfg.line_out_pins[0];
6102 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6103 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6106 nid = spec->autocfg.speaker_pins[0];
6108 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6110 nid = spec->autocfg.hp_pins[0];
6112 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6115 #define ALC260_PIN_CD_NID 0x16
6116 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6118 struct alc_spec *spec = codec->spec;
6121 for (i = 0; i < AUTO_PIN_LAST; i++) {
6122 hda_nid_t nid = spec->autocfg.input_pins[i];
6124 alc_set_input_pin(codec, nid, i);
6125 if (nid != ALC260_PIN_CD_NID &&
6126 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6127 snd_hda_codec_write(codec, nid, 0,
6128 AC_VERB_SET_AMP_GAIN_MUTE,
6135 * generic initialization of ADC, input mixers and output mixers
6137 static struct hda_verb alc260_volume_init_verbs[] = {
6139 * Unmute ADC0-1 and set the default input to mic-in
6141 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6142 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6143 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6144 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6146 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6148 * Note: PASD motherboards uses the Line In 2 as the input for
6149 * front panel mic (mic 2)
6151 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6152 /* mute analog inputs */
6153 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6154 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6155 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6156 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6160 * Set up output mixers (0x08 - 0x0a)
6162 /* set vol=0 to output mixers */
6163 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6164 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6165 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6166 /* set up input amps for analog loopback */
6167 /* Amp Indices: DAC = 0, mixer = 1 */
6168 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6169 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6170 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6171 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6172 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6173 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6178 static int alc260_parse_auto_config(struct hda_codec *codec)
6180 struct alc_spec *spec = codec->spec;
6182 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6184 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6188 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6191 if (!spec->kctls.list)
6192 return 0; /* can't find valid BIOS pin config */
6193 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6197 spec->multiout.max_channels = 2;
6199 if (spec->autocfg.dig_outs)
6200 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6201 if (spec->kctls.list)
6202 add_mixer(spec, spec->kctls.list);
6204 add_verb(spec, alc260_volume_init_verbs);
6206 spec->num_mux_defs = 1;
6207 spec->input_mux = &spec->private_imux[0];
6209 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6214 /* additional initialization for auto-configuration model */
6215 static void alc260_auto_init(struct hda_codec *codec)
6217 struct alc_spec *spec = codec->spec;
6218 alc260_auto_init_multi_out(codec);
6219 alc260_auto_init_analog_input(codec);
6220 if (spec->unsol_event)
6221 alc_inithook(codec);
6224 #ifdef CONFIG_SND_HDA_POWER_SAVE
6225 static struct hda_amp_list alc260_loopbacks[] = {
6226 { 0x07, HDA_INPUT, 0 },
6227 { 0x07, HDA_INPUT, 1 },
6228 { 0x07, HDA_INPUT, 2 },
6229 { 0x07, HDA_INPUT, 3 },
6230 { 0x07, HDA_INPUT, 4 },
6236 * ALC260 configurations
6238 static const char *alc260_models[ALC260_MODEL_LAST] = {
6239 [ALC260_BASIC] = "basic",
6241 [ALC260_HP_3013] = "hp-3013",
6242 [ALC260_HP_DC7600] = "hp-dc7600",
6243 [ALC260_FUJITSU_S702X] = "fujitsu",
6244 [ALC260_ACER] = "acer",
6245 [ALC260_WILL] = "will",
6246 [ALC260_REPLACER_672V] = "replacer",
6247 [ALC260_FAVORIT100] = "favorit100",
6248 #ifdef CONFIG_SND_DEBUG
6249 [ALC260_TEST] = "test",
6251 [ALC260_AUTO] = "auto",
6254 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6255 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6256 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6257 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6258 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6259 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6260 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6261 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6262 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6263 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6264 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6265 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6266 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6267 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6268 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6269 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6270 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6271 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6272 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6273 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6274 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6278 static struct alc_config_preset alc260_presets[] = {
6280 .mixers = { alc260_base_output_mixer,
6281 alc260_input_mixer },
6282 .init_verbs = { alc260_init_verbs },
6283 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6284 .dac_nids = alc260_dac_nids,
6285 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6286 .adc_nids = alc260_dual_adc_nids,
6287 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6288 .channel_mode = alc260_modes,
6289 .input_mux = &alc260_capture_source,
6292 .mixers = { alc260_hp_output_mixer,
6293 alc260_input_mixer },
6294 .init_verbs = { alc260_init_verbs,
6295 alc260_hp_unsol_verbs },
6296 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6297 .dac_nids = alc260_dac_nids,
6298 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6299 .adc_nids = alc260_adc_nids_alt,
6300 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6301 .channel_mode = alc260_modes,
6302 .input_mux = &alc260_capture_source,
6303 .unsol_event = alc260_hp_unsol_event,
6304 .init_hook = alc260_hp_automute,
6306 [ALC260_HP_DC7600] = {
6307 .mixers = { alc260_hp_dc7600_mixer,
6308 alc260_input_mixer },
6309 .init_verbs = { alc260_init_verbs,
6310 alc260_hp_dc7600_verbs },
6311 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6312 .dac_nids = alc260_dac_nids,
6313 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6314 .adc_nids = alc260_adc_nids_alt,
6315 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6316 .channel_mode = alc260_modes,
6317 .input_mux = &alc260_capture_source,
6318 .unsol_event = alc260_hp_3012_unsol_event,
6319 .init_hook = alc260_hp_3012_automute,
6321 [ALC260_HP_3013] = {
6322 .mixers = { alc260_hp_3013_mixer,
6323 alc260_input_mixer },
6324 .init_verbs = { alc260_hp_3013_init_verbs,
6325 alc260_hp_3013_unsol_verbs },
6326 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6327 .dac_nids = alc260_dac_nids,
6328 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6329 .adc_nids = alc260_adc_nids_alt,
6330 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6331 .channel_mode = alc260_modes,
6332 .input_mux = &alc260_capture_source,
6333 .unsol_event = alc260_hp_3013_unsol_event,
6334 .init_hook = alc260_hp_3013_automute,
6336 [ALC260_FUJITSU_S702X] = {
6337 .mixers = { alc260_fujitsu_mixer },
6338 .init_verbs = { alc260_fujitsu_init_verbs },
6339 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6340 .dac_nids = alc260_dac_nids,
6341 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6342 .adc_nids = alc260_dual_adc_nids,
6343 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6344 .channel_mode = alc260_modes,
6345 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6346 .input_mux = alc260_fujitsu_capture_sources,
6349 .mixers = { alc260_acer_mixer },
6350 .init_verbs = { alc260_acer_init_verbs },
6351 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6352 .dac_nids = alc260_dac_nids,
6353 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6354 .adc_nids = alc260_dual_adc_nids,
6355 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6356 .channel_mode = alc260_modes,
6357 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6358 .input_mux = alc260_acer_capture_sources,
6360 [ALC260_FAVORIT100] = {
6361 .mixers = { alc260_favorit100_mixer },
6362 .init_verbs = { alc260_favorit100_init_verbs },
6363 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6364 .dac_nids = alc260_dac_nids,
6365 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6366 .adc_nids = alc260_dual_adc_nids,
6367 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6368 .channel_mode = alc260_modes,
6369 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6370 .input_mux = alc260_favorit100_capture_sources,
6373 .mixers = { alc260_will_mixer },
6374 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6375 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6376 .dac_nids = alc260_dac_nids,
6377 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6378 .adc_nids = alc260_adc_nids,
6379 .dig_out_nid = ALC260_DIGOUT_NID,
6380 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6381 .channel_mode = alc260_modes,
6382 .input_mux = &alc260_capture_source,
6384 [ALC260_REPLACER_672V] = {
6385 .mixers = { alc260_replacer_672v_mixer },
6386 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6387 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6388 .dac_nids = alc260_dac_nids,
6389 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6390 .adc_nids = alc260_adc_nids,
6391 .dig_out_nid = ALC260_DIGOUT_NID,
6392 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6393 .channel_mode = alc260_modes,
6394 .input_mux = &alc260_capture_source,
6395 .unsol_event = alc260_replacer_672v_unsol_event,
6396 .init_hook = alc260_replacer_672v_automute,
6398 #ifdef CONFIG_SND_DEBUG
6400 .mixers = { alc260_test_mixer },
6401 .init_verbs = { alc260_test_init_verbs },
6402 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6403 .dac_nids = alc260_test_dac_nids,
6404 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6405 .adc_nids = alc260_test_adc_nids,
6406 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6407 .channel_mode = alc260_modes,
6408 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6409 .input_mux = alc260_test_capture_sources,
6414 static int patch_alc260(struct hda_codec *codec)
6416 struct alc_spec *spec;
6417 int err, board_config;
6419 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6425 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6428 if (board_config < 0) {
6429 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6431 board_config = ALC260_AUTO;
6434 if (board_config == ALC260_AUTO) {
6435 /* automatic parse from the BIOS config */
6436 err = alc260_parse_auto_config(codec);
6442 "hda_codec: Cannot set up configuration "
6443 "from BIOS. Using base mode...\n");
6444 board_config = ALC260_BASIC;
6448 err = snd_hda_attach_beep_device(codec, 0x1);
6454 if (board_config != ALC260_AUTO)
6455 setup_preset(codec, &alc260_presets[board_config]);
6457 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6458 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6459 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
6461 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6462 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6464 if (!spec->adc_nids && spec->input_mux) {
6465 /* check whether NID 0x04 is valid */
6466 unsigned int wcap = get_wcaps(codec, 0x04);
6467 wcap = get_wcaps_type(wcap);
6469 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6470 spec->adc_nids = alc260_adc_nids_alt;
6471 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6473 spec->adc_nids = alc260_adc_nids;
6474 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6477 set_capture_mixer(codec);
6478 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6480 spec->vmaster_nid = 0x08;
6482 codec->patch_ops = alc_patch_ops;
6483 if (board_config == ALC260_AUTO)
6484 spec->init_hook = alc260_auto_init;
6485 #ifdef CONFIG_SND_HDA_POWER_SAVE
6486 if (!spec->loopback.amplist)
6487 spec->loopback.amplist = alc260_loopbacks;
6489 codec->proc_widget_hook = print_realtek_coef;
6496 * ALC882/883/885/888/889 support
6498 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6499 * configuration. Each pin widget can choose any input DACs and a mixer.
6500 * Each ADC is connected from a mixer of all inputs. This makes possible
6501 * 6-channel independent captures.
6503 * In addition, an independent DAC for the multi-playback (not used in this
6506 #define ALC882_DIGOUT_NID 0x06
6507 #define ALC882_DIGIN_NID 0x0a
6508 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6509 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6510 #define ALC1200_DIGOUT_NID 0x10
6513 static struct hda_channel_mode alc882_ch_modes[1] = {
6518 static hda_nid_t alc882_dac_nids[4] = {
6519 /* front, rear, clfe, rear_surr */
6520 0x02, 0x03, 0x04, 0x05
6522 #define alc883_dac_nids alc882_dac_nids
6525 #define alc882_adc_nids alc880_adc_nids
6526 #define alc882_adc_nids_alt alc880_adc_nids_alt
6527 #define alc883_adc_nids alc882_adc_nids_alt
6528 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6529 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6530 #define alc889_adc_nids alc880_adc_nids
6532 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6533 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6534 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6535 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6536 #define alc889_capsrc_nids alc882_capsrc_nids
6539 /* FIXME: should be a matrix-type input source selection */
6541 static struct hda_input_mux alc882_capture_source = {
6545 { "Front Mic", 0x1 },
6551 #define alc883_capture_source alc882_capture_source
6553 static struct hda_input_mux alc889_capture_source = {
6556 { "Front Mic", 0x0 },
6562 static struct hda_input_mux mb5_capture_source = {
6571 static struct hda_input_mux alc883_3stack_6ch_intel = {
6575 { "Front Mic", 0x0 },
6581 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6589 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6599 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6607 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6611 { "Front Mic", 0x1 },
6616 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6624 static struct hda_input_mux alc889A_mb31_capture_source = {
6628 /* Front Mic (0x01) unused */
6630 /* Line 2 (0x03) unused */
6631 /* CD (0x04) unsused? */
6638 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6645 static struct hda_verb alc882_3ST_ch2_init[] = {
6646 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6647 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6648 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6649 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6656 static struct hda_verb alc882_3ST_ch4_init[] = {
6657 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6658 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6659 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6660 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6661 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6668 static struct hda_verb alc882_3ST_ch6_init[] = {
6669 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6670 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6671 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6672 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6673 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6674 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6678 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6679 { 2, alc882_3ST_ch2_init },
6680 { 4, alc882_3ST_ch4_init },
6681 { 6, alc882_3ST_ch6_init },
6684 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6689 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6690 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6691 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6692 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6693 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6694 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6701 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6702 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6703 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6704 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6705 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6706 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6707 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6714 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6715 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6716 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6717 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6718 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6719 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6720 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6721 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6725 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6726 { 2, alc883_3ST_ch2_clevo_init },
6727 { 4, alc883_3ST_ch4_clevo_init },
6728 { 6, alc883_3ST_ch6_clevo_init },
6735 static struct hda_verb alc882_sixstack_ch6_init[] = {
6736 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6737 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6738 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6739 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6746 static struct hda_verb alc882_sixstack_ch8_init[] = {
6747 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6748 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6749 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6750 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6754 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6755 { 6, alc882_sixstack_ch6_init },
6756 { 8, alc882_sixstack_ch8_init },
6760 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6766 static struct hda_verb alc885_mbp_ch2_init[] = {
6767 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6768 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6769 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6776 static struct hda_verb alc885_mbp_ch4_init[] = {
6777 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6778 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6779 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6780 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6781 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6785 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6786 { 2, alc885_mbp_ch2_init },
6787 { 4, alc885_mbp_ch4_init },
6792 * Speakers/Woofer/HP = Front
6795 static struct hda_verb alc885_mb5_ch2_init[] = {
6796 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6797 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6803 * Speakers/HP = Front
6807 static struct hda_verb alc885_mb5_ch6_init[] = {
6808 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6809 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6810 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6814 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6815 { 2, alc885_mb5_ch2_init },
6816 { 6, alc885_mb5_ch6_init },
6823 static struct hda_verb alc883_4ST_ch2_init[] = {
6824 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6825 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6826 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6827 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6828 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6829 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6836 static struct hda_verb alc883_4ST_ch4_init[] = {
6837 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6838 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6839 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6840 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6841 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6842 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6843 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6850 static struct hda_verb alc883_4ST_ch6_init[] = {
6851 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6852 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6853 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6854 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6855 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6856 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6857 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6858 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6865 static struct hda_verb alc883_4ST_ch8_init[] = {
6866 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6867 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6868 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6869 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6870 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6871 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6872 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6873 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6874 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6878 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6879 { 2, alc883_4ST_ch2_init },
6880 { 4, alc883_4ST_ch4_init },
6881 { 6, alc883_4ST_ch6_init },
6882 { 8, alc883_4ST_ch8_init },
6889 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6890 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6891 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6892 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6893 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6900 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6901 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6902 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6903 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6904 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6905 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6912 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6913 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6914 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6915 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6916 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6917 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6918 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6922 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6923 { 2, alc883_3ST_ch2_intel_init },
6924 { 4, alc883_3ST_ch4_intel_init },
6925 { 6, alc883_3ST_ch6_intel_init },
6931 static struct hda_verb alc889_ch2_intel_init[] = {
6932 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6933 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6934 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6935 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6936 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6937 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6944 static struct hda_verb alc889_ch6_intel_init[] = {
6945 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6946 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6947 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6948 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6949 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6950 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6957 static struct hda_verb alc889_ch8_intel_init[] = {
6958 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6959 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6960 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6961 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6962 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6963 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6964 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6968 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6969 { 2, alc889_ch2_intel_init },
6970 { 6, alc889_ch6_intel_init },
6971 { 8, alc889_ch8_intel_init },
6977 static struct hda_verb alc883_sixstack_ch6_init[] = {
6978 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6979 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6980 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6981 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6988 static struct hda_verb alc883_sixstack_ch8_init[] = {
6989 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6990 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6991 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6992 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6996 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6997 { 6, alc883_sixstack_ch6_init },
6998 { 8, alc883_sixstack_ch8_init },
7002 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7003 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7005 static struct snd_kcontrol_new alc882_base_mixer[] = {
7006 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7007 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7008 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7009 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7010 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7011 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7012 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7013 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7014 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7015 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7016 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7017 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7018 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7019 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7020 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7021 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7022 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7023 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7024 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7025 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7026 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7030 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7031 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7032 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7033 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7034 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7035 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7036 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7037 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7038 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7039 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7040 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7041 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7045 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7046 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7047 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7048 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7049 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7050 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7051 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7052 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7053 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7054 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7055 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7056 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7057 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7058 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7059 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7063 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7064 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7065 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7066 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7067 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7068 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7069 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7070 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7071 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7072 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7076 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7077 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7078 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7079 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7080 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7081 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7082 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7083 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7084 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7085 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7086 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7087 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7088 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7089 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7093 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7094 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7096 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7097 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7098 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7099 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7100 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7101 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7102 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7103 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7104 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7105 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7106 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7107 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7108 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7109 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7113 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7114 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7115 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7116 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7117 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7118 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7119 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7120 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7121 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7122 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7123 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7127 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7129 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7130 .name = "Channel Mode",
7131 .info = alc_ch_mode_info,
7132 .get = alc_ch_mode_get,
7133 .put = alc_ch_mode_put,
7138 static struct hda_verb alc882_base_init_verbs[] = {
7139 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7140 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7141 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7142 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7144 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7145 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7146 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7148 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7149 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7150 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7152 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7153 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7154 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7156 /* mute analog input loopbacks */
7157 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7158 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7159 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7160 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7161 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7163 /* Front Pin: output 0 (0x0c) */
7164 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7165 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7166 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7167 /* Rear Pin: output 1 (0x0d) */
7168 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7169 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7170 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7171 /* CLFE Pin: output 2 (0x0e) */
7172 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7173 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7174 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7175 /* Side Pin: output 3 (0x0f) */
7176 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7177 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7178 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7179 /* Mic (rear) pin: input vref at 80% */
7180 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7181 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7182 /* Front Mic pin: input vref at 80% */
7183 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7184 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7185 /* Line In pin: input */
7186 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7187 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7188 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7189 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7190 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7191 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7192 /* CD pin widget for input */
7193 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7195 /* FIXME: use matrix-type input source selection */
7196 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7198 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7199 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7200 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7201 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7206 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7207 /* ADC2: mute amp left and right */
7208 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7209 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7210 /* ADC3: mute amp left and right */
7211 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7212 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7217 static struct hda_verb alc882_adc1_init_verbs[] = {
7218 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7219 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7220 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7221 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7222 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7223 /* ADC1: mute amp left and right */
7224 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7225 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7229 static struct hda_verb alc882_eapd_verbs[] = {
7230 /* change to EAPD mode */
7231 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7232 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7236 static struct hda_verb alc889_eapd_verbs[] = {
7237 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7238 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7242 static struct hda_verb alc_hp15_unsol_verbs[] = {
7243 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7244 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7248 static struct hda_verb alc885_init_verbs[] = {
7249 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7250 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7251 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7254 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7255 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7256 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7258 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7259 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7260 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7262 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7263 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7264 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7266 /* mute analog input loopbacks */
7267 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7268 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7269 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7271 /* Front HP Pin: output 0 (0x0c) */
7272 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7273 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7274 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7275 /* Front Pin: output 0 (0x0c) */
7276 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7277 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7278 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7279 /* Rear Pin: output 1 (0x0d) */
7280 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7281 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7282 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7283 /* CLFE Pin: output 2 (0x0e) */
7284 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7285 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7286 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7287 /* Side Pin: output 3 (0x0f) */
7288 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7289 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7290 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7291 /* Mic (rear) pin: input vref at 80% */
7292 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7293 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7294 /* Front Mic pin: input vref at 80% */
7295 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7296 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7297 /* Line In pin: input */
7298 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7299 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7301 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7303 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7304 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7305 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7314 /* ADC2: mute amp left and right */
7315 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7316 /* ADC3: mute amp left and right */
7317 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7322 static struct hda_verb alc885_init_input_verbs[] = {
7323 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7324 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7325 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7330 /* Unmute Selector 24h and set the default input to front mic */
7331 static struct hda_verb alc889_init_input_verbs[] = {
7332 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7333 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7338 #define alc883_init_verbs alc882_base_init_verbs
7341 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7342 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7343 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7344 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7345 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7346 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7347 /* FIXME: this looks suspicious...
7348 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7349 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7354 static struct hda_verb alc882_macpro_init_verbs[] = {
7355 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7356 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7357 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7358 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7359 /* Front Pin: output 0 (0x0c) */
7360 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7361 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7362 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7363 /* Front Mic pin: input vref at 80% */
7364 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7365 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7366 /* Speaker: output */
7367 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7368 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7369 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7370 /* Headphone output (output 0 - 0x0c) */
7371 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7372 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7373 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7375 /* FIXME: use matrix-type input source selection */
7376 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7377 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7378 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7379 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7380 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7381 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7383 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7384 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7385 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7386 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7388 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7389 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7390 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7391 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7392 /* ADC1: mute amp left and right */
7393 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7394 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7395 /* ADC2: mute amp left and right */
7396 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7397 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7398 /* ADC3: mute amp left and right */
7399 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7400 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7406 static struct hda_verb alc885_mb5_init_verbs[] = {
7408 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7409 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7410 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7411 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7413 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7414 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7415 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7416 /* Surround mixer */
7417 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7418 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7419 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7421 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7422 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7423 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7425 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7426 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7427 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7428 /* Front Pin (0x0c) */
7429 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7430 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7431 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7432 /* LFE Pin (0x0e) */
7433 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7434 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7435 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7437 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7438 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7439 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7440 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7441 /* Front Mic pin: input vref at 80% */
7442 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7443 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7445 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7446 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7448 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7455 /* Macbook Pro rev3 */
7456 static struct hda_verb alc885_mbp3_init_verbs[] = {
7457 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7458 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7459 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7460 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7462 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7463 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7464 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7466 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7467 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7468 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7469 /* Front Pin: output 0 (0x0c) */
7470 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7471 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7472 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7473 /* HP Pin: output 0 (0x0e) */
7474 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7475 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7476 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7477 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7478 /* Mic (rear) pin: input vref at 80% */
7479 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7480 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7481 /* Front Mic pin: input vref at 80% */
7482 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7483 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7484 /* Line In pin: use output 1 when in LineOut mode */
7485 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7486 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7487 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7489 /* FIXME: use matrix-type input source selection */
7490 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7491 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7492 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7493 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7494 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7495 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7497 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7498 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7499 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7500 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7502 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7504 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7505 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7506 /* ADC1: mute amp left and right */
7507 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7508 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7509 /* ADC2: mute amp left and right */
7510 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7511 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7512 /* ADC3: mute amp left and right */
7513 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7514 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7519 /* iMac 24 mixer. */
7520 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7521 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7522 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7526 /* iMac 24 init verbs. */
7527 static struct hda_verb alc885_imac24_init_verbs[] = {
7528 /* Internal speakers: output 0 (0x0c) */
7529 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7530 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7531 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7532 /* Internal speakers: output 0 (0x0c) */
7533 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7534 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7535 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7536 /* Headphone: output 0 (0x0c) */
7537 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7538 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7539 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7540 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7541 /* Front Mic: input vref at 80% */
7542 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7543 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7547 /* Toggle speaker-output according to the hp-jack state */
7548 static void alc885_imac24_setup(struct hda_codec *codec)
7550 struct alc_spec *spec = codec->spec;
7552 spec->autocfg.hp_pins[0] = 0x14;
7553 spec->autocfg.speaker_pins[0] = 0x18;
7554 spec->autocfg.speaker_pins[1] = 0x1a;
7557 static void alc885_mbp3_setup(struct hda_codec *codec)
7559 struct alc_spec *spec = codec->spec;
7561 spec->autocfg.hp_pins[0] = 0x15;
7562 spec->autocfg.speaker_pins[0] = 0x14;
7565 static void alc885_mb5_automute(struct hda_codec *codec)
7567 unsigned int present;
7569 present = snd_hda_codec_read(codec, 0x14, 0,
7570 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7571 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7572 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7573 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7574 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7578 static void alc885_mb5_unsol_event(struct hda_codec *codec,
7581 /* Headphone insertion or removal. */
7582 if ((res >> 26) == ALC880_HP_EVENT)
7583 alc885_mb5_automute(codec);
7587 static struct hda_verb alc882_targa_verbs[] = {
7588 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7589 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7591 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7592 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7594 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7595 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7596 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7598 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7602 /* toggle speaker-output according to the hp-jack state */
7603 static void alc882_targa_automute(struct hda_codec *codec)
7605 struct alc_spec *spec = codec->spec;
7606 alc_automute_amp(codec);
7607 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7608 spec->jack_present ? 1 : 3);
7611 static void alc882_targa_setup(struct hda_codec *codec)
7613 struct alc_spec *spec = codec->spec;
7615 spec->autocfg.hp_pins[0] = 0x14;
7616 spec->autocfg.speaker_pins[0] = 0x1b;
7619 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7621 if ((res >> 26) == ALC880_HP_EVENT)
7622 alc882_targa_automute(codec);
7625 static struct hda_verb alc882_asus_a7j_verbs[] = {
7626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7629 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7630 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7631 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7633 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7634 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7635 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7637 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7638 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7639 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7643 static struct hda_verb alc882_asus_a7m_verbs[] = {
7644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7645 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7647 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7648 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7649 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7651 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7652 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7653 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7655 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7656 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7657 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7661 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7663 unsigned int gpiostate, gpiomask, gpiodir;
7665 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7666 AC_VERB_GET_GPIO_DATA, 0);
7669 gpiostate |= (1 << pin);
7671 gpiostate &= ~(1 << pin);
7673 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7674 AC_VERB_GET_GPIO_MASK, 0);
7675 gpiomask |= (1 << pin);
7677 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7678 AC_VERB_GET_GPIO_DIRECTION, 0);
7679 gpiodir |= (1 << pin);
7682 snd_hda_codec_write(codec, codec->afg, 0,
7683 AC_VERB_SET_GPIO_MASK, gpiomask);
7684 snd_hda_codec_write(codec, codec->afg, 0,
7685 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7689 snd_hda_codec_write(codec, codec->afg, 0,
7690 AC_VERB_SET_GPIO_DATA, gpiostate);
7693 /* set up GPIO at initialization */
7694 static void alc885_macpro_init_hook(struct hda_codec *codec)
7696 alc882_gpio_mute(codec, 0, 0);
7697 alc882_gpio_mute(codec, 1, 0);
7700 /* set up GPIO and update auto-muting at initialization */
7701 static void alc885_imac24_init_hook(struct hda_codec *codec)
7703 alc885_macpro_init_hook(codec);
7704 alc_automute_amp(codec);
7708 * generic initialization of ADC, input mixers and output mixers
7710 static struct hda_verb alc883_auto_init_verbs[] = {
7712 * Unmute ADC0-2 and set the default input to mic-in
7714 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7715 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7716 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7717 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7719 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7721 * Note: PASD motherboards uses the Line In 2 as the input for
7722 * front panel mic (mic 2)
7724 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7727 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7728 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7732 * Set up output mixers (0x0c - 0x0f)
7734 /* set vol=0 to output mixers */
7735 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7736 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7737 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7738 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7739 /* set up input amps for analog loopback */
7740 /* Amp Indices: DAC = 0, mixer = 1 */
7741 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7742 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7743 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7744 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7745 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7746 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7747 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7748 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7749 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7750 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7752 /* FIXME: use matrix-type input source selection */
7753 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7755 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7756 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7757 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7758 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7760 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7761 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7762 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7763 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7768 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7769 static struct hda_verb alc889A_mb31_ch2_init[] = {
7770 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7771 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7772 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7773 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7777 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7778 static struct hda_verb alc889A_mb31_ch4_init[] = {
7779 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7780 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7781 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7782 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7786 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7787 static struct hda_verb alc889A_mb31_ch5_init[] = {
7788 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7789 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7790 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7791 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7795 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7796 static struct hda_verb alc889A_mb31_ch6_init[] = {
7797 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7798 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7799 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7800 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7804 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7805 { 2, alc889A_mb31_ch2_init },
7806 { 4, alc889A_mb31_ch4_init },
7807 { 5, alc889A_mb31_ch5_init },
7808 { 6, alc889A_mb31_ch6_init },
7811 static struct hda_verb alc883_medion_eapd_verbs[] = {
7812 /* eanable EAPD on medion laptop */
7813 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7814 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7818 #define alc883_base_mixer alc882_base_mixer
7820 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7821 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7822 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7823 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7824 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7825 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7826 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7827 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7828 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7829 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7830 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7831 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7832 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7833 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7837 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7838 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7839 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7840 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7841 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7842 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7843 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7844 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7845 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7846 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7847 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7851 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7852 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7853 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7854 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7855 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7856 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7857 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7858 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7859 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7860 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7861 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7865 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7866 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7867 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7868 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7869 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7870 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7871 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7872 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7874 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7875 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7876 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7877 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7878 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7882 static struct snd_kcontrol_new alc883_3ST_6ch_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_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7886 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7887 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7888 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7889 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7890 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7891 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7892 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7893 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7894 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7895 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7896 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7897 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7898 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7899 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7900 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7901 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7905 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7906 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7907 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7908 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7909 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7910 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7912 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7913 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7914 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7915 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7916 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7917 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7918 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7919 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7921 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7922 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7923 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7924 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7925 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7929 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7930 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7931 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7932 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7933 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7934 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7936 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7937 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7938 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7939 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7940 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7941 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7942 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7943 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7944 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7945 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7946 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7947 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7948 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7949 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7953 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7954 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7955 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7956 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7957 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7958 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7959 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7960 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7961 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7962 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7963 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7964 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7965 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7966 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7967 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7968 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7969 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7970 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7971 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7972 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7976 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7977 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7978 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7979 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7980 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7981 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7982 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7983 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7984 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7985 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7986 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7987 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7988 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7989 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7990 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7991 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7992 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7997 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7998 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7999 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8000 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8001 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8002 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8003 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8004 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8005 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8006 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8007 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8008 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8009 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8013 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8014 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8015 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8016 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8017 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8018 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8022 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8023 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8024 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8025 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8026 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8027 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8028 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8029 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8030 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8034 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8035 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8036 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8037 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8038 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8039 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8040 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8041 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8042 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8043 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8047 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8048 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8049 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8050 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8051 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8052 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8053 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8054 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8055 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8056 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8060 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8061 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8062 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8063 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8064 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8065 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8067 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8072 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8073 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8074 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8075 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8076 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8077 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8078 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8079 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8080 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8081 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8082 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8083 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8087 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8089 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8090 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8091 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8092 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8093 0x0d, 1, 0x0, HDA_OUTPUT),
8094 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8095 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8096 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8097 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8098 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8099 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8100 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8101 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8102 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8103 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8104 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8105 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8106 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8107 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8108 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8112 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8114 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8115 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8116 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8117 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8118 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8120 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8121 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8122 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8123 /* Output switches */
8124 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8125 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8126 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8128 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8129 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8132 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8133 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8134 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8138 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8139 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8140 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8141 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8143 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8148 static struct hda_bind_ctls alc883_bind_cap_vol = {
8149 .ops = &snd_hda_bind_vol,
8151 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8152 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8157 static struct hda_bind_ctls alc883_bind_cap_switch = {
8158 .ops = &snd_hda_bind_sw,
8160 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8161 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8166 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8167 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8168 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8169 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8170 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8171 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8173 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8174 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8178 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8179 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8180 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8182 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8183 /* .name = "Capture Source", */
8184 .name = "Input Source",
8186 .info = alc_mux_enum_info,
8187 .get = alc_mux_enum_get,
8188 .put = alc_mux_enum_put,
8193 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8195 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8196 .name = "Channel Mode",
8197 .info = alc_ch_mode_info,
8198 .get = alc_ch_mode_get,
8199 .put = alc_ch_mode_put,
8204 /* toggle speaker-output according to the hp-jack state */
8205 static void alc883_mitac_setup(struct hda_codec *codec)
8207 struct alc_spec *spec = codec->spec;
8209 spec->autocfg.hp_pins[0] = 0x15;
8210 spec->autocfg.speaker_pins[0] = 0x14;
8211 spec->autocfg.speaker_pins[1] = 0x17;
8214 /* auto-toggle front mic */
8216 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8218 unsigned int present;
8221 present = snd_hda_codec_read(codec, 0x18, 0,
8222 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8223 bits = present ? HDA_AMP_MUTE : 0;
8224 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8228 static struct hda_verb alc883_mitac_verbs[] = {
8230 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8231 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8233 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8234 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8236 /* enable unsolicited event */
8237 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8238 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8243 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8245 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8246 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8248 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8250 /* enable unsolicited event */
8252 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8253 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8259 static struct hda_verb alc883_clevo_m720_verbs[] = {
8261 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8262 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8264 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8265 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8267 /* enable unsolicited event */
8268 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8269 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8274 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8276 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8277 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8279 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8280 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8282 /* enable unsolicited event */
8283 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8288 static struct hda_verb alc883_targa_verbs[] = {
8289 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8290 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8292 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8293 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8295 /* Connect Line-Out side jack (SPDIF) to Side */
8296 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8297 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8298 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8299 /* Connect Mic jack to CLFE */
8300 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8301 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8302 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8303 /* Connect Line-in jack to Surround */
8304 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8305 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8306 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8307 /* Connect HP out jack to Front */
8308 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8309 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8310 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8312 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8317 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8318 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8319 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8320 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8324 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8325 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8327 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8328 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8332 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8335 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8336 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8337 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8341 static struct hda_verb alc883_haier_w66_verbs[] = {
8342 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8343 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8345 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8347 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8348 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8349 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8350 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8354 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8355 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8356 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8357 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8358 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8359 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8360 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8361 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8362 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8366 static struct hda_verb alc888_6st_dell_verbs[] = {
8367 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8371 static struct hda_verb alc883_vaiott_verbs[] = {
8373 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8374 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8376 /* enable unsolicited event */
8377 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8382 static void alc888_3st_hp_setup(struct hda_codec *codec)
8384 struct alc_spec *spec = codec->spec;
8386 spec->autocfg.hp_pins[0] = 0x1b;
8387 spec->autocfg.speaker_pins[0] = 0x14;
8388 spec->autocfg.speaker_pins[1] = 0x16;
8389 spec->autocfg.speaker_pins[2] = 0x18;
8392 static struct hda_verb alc888_3st_hp_verbs[] = {
8393 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8394 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8395 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8396 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8403 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8404 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8405 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8406 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8407 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8414 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8415 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8416 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8417 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8418 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8419 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8426 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8427 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8428 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8429 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8430 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8431 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8432 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8436 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8437 { 2, alc888_3st_hp_2ch_init },
8438 { 4, alc888_3st_hp_4ch_init },
8439 { 6, alc888_3st_hp_6ch_init },
8442 /* toggle front-jack and RCA according to the hp-jack state */
8443 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8445 unsigned int present;
8447 present = snd_hda_codec_read(codec, 0x1b, 0,
8448 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8449 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8450 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8451 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8452 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8455 /* toggle RCA according to the front-jack state */
8456 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8458 unsigned int present;
8460 present = snd_hda_codec_read(codec, 0x14, 0,
8461 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8462 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8463 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8466 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8469 if ((res >> 26) == ALC880_HP_EVENT)
8470 alc888_lenovo_ms7195_front_automute(codec);
8471 if ((res >> 26) == ALC880_FRONT_EVENT)
8472 alc888_lenovo_ms7195_rca_automute(codec);
8475 static struct hda_verb alc883_medion_md2_verbs[] = {
8476 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8477 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8479 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8481 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8485 /* toggle speaker-output according to the hp-jack state */
8486 static void alc883_medion_md2_setup(struct hda_codec *codec)
8488 struct alc_spec *spec = codec->spec;
8490 spec->autocfg.hp_pins[0] = 0x14;
8491 spec->autocfg.speaker_pins[0] = 0x15;
8494 /* toggle speaker-output according to the hp-jack state */
8495 #define alc883_targa_init_hook alc882_targa_init_hook
8496 #define alc883_targa_unsol_event alc882_targa_unsol_event
8498 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8500 unsigned int present;
8502 present = snd_hda_codec_read(codec, 0x18, 0,
8503 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8504 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8505 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8508 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8510 struct alc_spec *spec = codec->spec;
8512 spec->autocfg.hp_pins[0] = 0x15;
8513 spec->autocfg.speaker_pins[0] = 0x14;
8516 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8518 alc_automute_amp(codec);
8519 alc883_clevo_m720_mic_automute(codec);
8522 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8525 switch (res >> 26) {
8526 case ALC880_MIC_EVENT:
8527 alc883_clevo_m720_mic_automute(codec);
8530 alc_automute_amp_unsol_event(codec, res);
8535 /* toggle speaker-output according to the hp-jack state */
8536 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8538 struct alc_spec *spec = codec->spec;
8540 spec->autocfg.hp_pins[0] = 0x14;
8541 spec->autocfg.speaker_pins[0] = 0x15;
8544 static void alc883_haier_w66_setup(struct hda_codec *codec)
8546 struct alc_spec *spec = codec->spec;
8548 spec->autocfg.hp_pins[0] = 0x1b;
8549 spec->autocfg.speaker_pins[0] = 0x14;
8552 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8554 unsigned int present;
8557 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8558 & AC_PINSENSE_PRESENCE;
8559 bits = present ? HDA_AMP_MUTE : 0;
8560 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8561 HDA_AMP_MUTE, bits);
8564 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8566 unsigned int present;
8569 present = snd_hda_codec_read(codec, 0x1b, 0,
8570 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8571 bits = present ? HDA_AMP_MUTE : 0;
8572 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8573 HDA_AMP_MUTE, bits);
8574 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8575 HDA_AMP_MUTE, bits);
8578 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8581 if ((res >> 26) == ALC880_HP_EVENT)
8582 alc883_lenovo_101e_all_automute(codec);
8583 if ((res >> 26) == ALC880_FRONT_EVENT)
8584 alc883_lenovo_101e_ispeaker_automute(codec);
8587 /* toggle speaker-output according to the hp-jack state */
8588 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8590 struct alc_spec *spec = codec->spec;
8592 spec->autocfg.hp_pins[0] = 0x14;
8593 spec->autocfg.speaker_pins[0] = 0x15;
8594 spec->autocfg.speaker_pins[1] = 0x16;
8597 static struct hda_verb alc883_acer_eapd_verbs[] = {
8598 /* HP Pin: output 0 (0x0c) */
8599 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8600 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8601 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8602 /* Front Pin: output 0 (0x0c) */
8603 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8604 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8605 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8606 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8607 /* eanable EAPD on medion laptop */
8608 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8609 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8610 /* enable unsolicited event */
8611 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8615 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8616 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8617 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8618 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8622 static void alc888_6st_dell_setup(struct hda_codec *codec)
8624 struct alc_spec *spec = codec->spec;
8626 spec->autocfg.hp_pins[0] = 0x1b;
8627 spec->autocfg.speaker_pins[0] = 0x14;
8628 spec->autocfg.speaker_pins[1] = 0x15;
8629 spec->autocfg.speaker_pins[2] = 0x16;
8630 spec->autocfg.speaker_pins[3] = 0x17;
8633 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8635 struct alc_spec *spec = codec->spec;
8637 spec->autocfg.hp_pins[0] = 0x1b;
8638 spec->autocfg.speaker_pins[0] = 0x14;
8639 spec->autocfg.speaker_pins[1] = 0x15;
8640 spec->autocfg.speaker_pins[2] = 0x16;
8641 spec->autocfg.speaker_pins[3] = 0x17;
8642 spec->autocfg.speaker_pins[4] = 0x1a;
8645 static void alc883_vaiott_setup(struct hda_codec *codec)
8647 struct alc_spec *spec = codec->spec;
8649 spec->autocfg.hp_pins[0] = 0x15;
8650 spec->autocfg.speaker_pins[0] = 0x14;
8651 spec->autocfg.speaker_pins[1] = 0x17;
8654 static struct hda_verb alc888_asus_m90v_verbs[] = {
8655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8656 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8657 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8658 /* enable unsolicited event */
8659 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8660 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8664 static void alc883_mode2_setup(struct hda_codec *codec)
8666 struct alc_spec *spec = codec->spec;
8668 spec->autocfg.hp_pins[0] = 0x1b;
8669 spec->autocfg.speaker_pins[0] = 0x14;
8670 spec->autocfg.speaker_pins[1] = 0x15;
8671 spec->autocfg.speaker_pins[2] = 0x16;
8672 spec->ext_mic.pin = 0x18;
8673 spec->int_mic.pin = 0x19;
8674 spec->ext_mic.mux_idx = 0;
8675 spec->int_mic.mux_idx = 1;
8679 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8680 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8681 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8682 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8683 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8684 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8685 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8686 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8687 /* enable unsolicited event */
8688 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8692 static void alc883_eee1601_inithook(struct hda_codec *codec)
8694 struct alc_spec *spec = codec->spec;
8696 spec->autocfg.hp_pins[0] = 0x14;
8697 spec->autocfg.speaker_pins[0] = 0x1b;
8698 alc_automute_pin(codec);
8701 static struct hda_verb alc889A_mb31_verbs[] = {
8702 /* Init rear pin (used as headphone output) */
8703 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8704 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8705 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8706 /* Init line pin (used as output in 4ch and 6ch mode) */
8707 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8708 /* Init line 2 pin (used as headphone out by default) */
8709 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8710 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8714 /* Mute speakers according to the headphone jack state */
8715 static void alc889A_mb31_automute(struct hda_codec *codec)
8717 unsigned int present;
8719 /* Mute only in 2ch or 4ch mode */
8720 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8722 present = snd_hda_codec_read(codec, 0x15, 0,
8723 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8724 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8725 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8726 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8727 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8731 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8733 if ((res >> 26) == ALC880_HP_EVENT)
8734 alc889A_mb31_automute(codec);
8738 #ifdef CONFIG_SND_HDA_POWER_SAVE
8739 #define alc882_loopbacks alc880_loopbacks
8742 /* pcm configuration: identical with ALC880 */
8743 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8744 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8745 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8746 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8748 static hda_nid_t alc883_slave_dig_outs[] = {
8749 ALC1200_DIGOUT_NID, 0,
8752 static hda_nid_t alc1200_slave_dig_outs[] = {
8753 ALC883_DIGOUT_NID, 0,
8757 * configuration and preset
8759 static const char *alc882_models[ALC882_MODEL_LAST] = {
8760 [ALC882_3ST_DIG] = "3stack-dig",
8761 [ALC882_6ST_DIG] = "6stack-dig",
8762 [ALC882_ARIMA] = "arima",
8763 [ALC882_W2JC] = "w2jc",
8764 [ALC882_TARGA] = "targa",
8765 [ALC882_ASUS_A7J] = "asus-a7j",
8766 [ALC882_ASUS_A7M] = "asus-a7m",
8767 [ALC885_MACPRO] = "macpro",
8768 [ALC885_MB5] = "mb5",
8769 [ALC885_MBP3] = "mbp3",
8770 [ALC885_IMAC24] = "imac24",
8771 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8772 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8773 [ALC883_3ST_6ch] = "3stack-6ch",
8774 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8775 [ALC883_TARGA_DIG] = "targa-dig",
8776 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8777 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8778 [ALC883_ACER] = "acer",
8779 [ALC883_ACER_ASPIRE] = "acer-aspire",
8780 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8781 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8782 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8783 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8784 [ALC883_MEDION] = "medion",
8785 [ALC883_MEDION_MD2] = "medion-md2",
8786 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8787 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8788 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8789 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8790 [ALC888_LENOVO_SKY] = "lenovo-sky",
8791 [ALC883_HAIER_W66] = "haier-w66",
8792 [ALC888_3ST_HP] = "3stack-hp",
8793 [ALC888_6ST_DELL] = "6stack-dell",
8794 [ALC883_MITAC] = "mitac",
8795 [ALC883_CLEVO_M540R] = "clevo-m540r",
8796 [ALC883_CLEVO_M720] = "clevo-m720",
8797 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8798 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8799 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8800 [ALC889A_INTEL] = "intel-alc889a",
8801 [ALC889_INTEL] = "intel-x58",
8802 [ALC1200_ASUS_P5Q] = "asus-p5q",
8803 [ALC889A_MB31] = "mb31",
8804 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8805 [ALC882_AUTO] = "auto",
8808 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8809 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8811 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8812 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8813 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8814 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8815 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8816 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8817 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8818 ALC888_ACER_ASPIRE_4930G),
8819 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8820 ALC888_ACER_ASPIRE_4930G),
8821 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8822 ALC888_ACER_ASPIRE_8930G),
8823 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8824 ALC888_ACER_ASPIRE_8930G),
8825 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8826 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8827 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8828 ALC888_ACER_ASPIRE_6530G),
8829 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8830 ALC888_ACER_ASPIRE_6530G),
8831 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
8832 ALC888_ACER_ASPIRE_7730G),
8833 /* default Acer -- disabled as it causes more problems.
8834 * model=auto should work fine now
8836 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8838 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8840 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8841 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8842 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8843 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8844 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8845 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8847 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8848 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8849 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8850 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8851 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8852 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8853 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8854 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8855 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8856 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8857 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8859 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8860 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8861 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8862 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8863 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8864 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8865 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8866 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8867 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8869 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8870 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8871 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8872 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8873 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
8874 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8875 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8876 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8877 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8878 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8879 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8880 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8881 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8882 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8883 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8884 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8885 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8886 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8887 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8888 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8889 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8890 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8891 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8892 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8893 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8894 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8895 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8896 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8897 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8899 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8900 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
8901 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8902 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8903 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
8904 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8905 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8906 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8907 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8908 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8909 ALC883_FUJITSU_PI2515),
8910 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8911 ALC888_FUJITSU_XA3530),
8912 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8913 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8914 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8915 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8916 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8917 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8918 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8919 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8920 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8922 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8923 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8924 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8925 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8926 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8927 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8928 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
8933 /* codec SSID table for Intel Mac */
8934 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8935 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8936 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8937 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8938 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8939 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8940 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8941 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8942 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
8943 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8944 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8945 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8946 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8947 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
8948 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
8949 * so apparently no perfect solution yet
8951 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8952 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
8956 static struct alc_config_preset alc882_presets[] = {
8957 [ALC882_3ST_DIG] = {
8958 .mixers = { alc882_base_mixer },
8959 .init_verbs = { alc882_base_init_verbs,
8960 alc882_adc1_init_verbs },
8961 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8962 .dac_nids = alc882_dac_nids,
8963 .dig_out_nid = ALC882_DIGOUT_NID,
8964 .dig_in_nid = ALC882_DIGIN_NID,
8965 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8966 .channel_mode = alc882_ch_modes,
8968 .input_mux = &alc882_capture_source,
8970 [ALC882_6ST_DIG] = {
8971 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8972 .init_verbs = { alc882_base_init_verbs,
8973 alc882_adc1_init_verbs },
8974 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8975 .dac_nids = alc882_dac_nids,
8976 .dig_out_nid = ALC882_DIGOUT_NID,
8977 .dig_in_nid = ALC882_DIGIN_NID,
8978 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8979 .channel_mode = alc882_sixstack_modes,
8980 .input_mux = &alc882_capture_source,
8983 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8984 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8985 alc882_eapd_verbs },
8986 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8987 .dac_nids = alc882_dac_nids,
8988 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8989 .channel_mode = alc882_sixstack_modes,
8990 .input_mux = &alc882_capture_source,
8993 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8994 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8995 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8996 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8997 .dac_nids = alc882_dac_nids,
8998 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8999 .channel_mode = alc880_threestack_modes,
9001 .input_mux = &alc882_capture_source,
9002 .dig_out_nid = ALC882_DIGOUT_NID,
9005 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9006 .init_verbs = { alc885_mbp3_init_verbs,
9007 alc880_gpio1_init_verbs },
9009 .dac_nids = alc882_dac_nids,
9011 .channel_mode = alc885_mbp_4ch_modes,
9012 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9013 .input_mux = &alc882_capture_source,
9014 .dig_out_nid = ALC882_DIGOUT_NID,
9015 .dig_in_nid = ALC882_DIGIN_NID,
9016 .unsol_event = alc_automute_amp_unsol_event,
9017 .setup = alc885_mbp3_setup,
9018 .init_hook = alc_automute_amp,
9021 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9022 .init_verbs = { alc885_mb5_init_verbs,
9023 alc880_gpio1_init_verbs },
9024 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9025 .dac_nids = alc882_dac_nids,
9026 .channel_mode = alc885_mb5_6ch_modes,
9027 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9028 .input_mux = &mb5_capture_source,
9029 .dig_out_nid = ALC882_DIGOUT_NID,
9030 .dig_in_nid = ALC882_DIGIN_NID,
9031 .unsol_event = alc885_mb5_unsol_event,
9032 .init_hook = alc885_mb5_automute,
9035 .mixers = { alc882_macpro_mixer },
9036 .init_verbs = { alc882_macpro_init_verbs },
9037 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9038 .dac_nids = alc882_dac_nids,
9039 .dig_out_nid = ALC882_DIGOUT_NID,
9040 .dig_in_nid = ALC882_DIGIN_NID,
9041 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9042 .channel_mode = alc882_ch_modes,
9043 .input_mux = &alc882_capture_source,
9044 .init_hook = alc885_macpro_init_hook,
9047 .mixers = { alc885_imac24_mixer },
9048 .init_verbs = { alc885_imac24_init_verbs },
9049 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9050 .dac_nids = alc882_dac_nids,
9051 .dig_out_nid = ALC882_DIGOUT_NID,
9052 .dig_in_nid = ALC882_DIGIN_NID,
9053 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9054 .channel_mode = alc882_ch_modes,
9055 .input_mux = &alc882_capture_source,
9056 .unsol_event = alc_automute_amp_unsol_event,
9057 .setup = alc885_imac24_setup,
9058 .init_hook = alc885_imac24_init_hook,
9061 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9062 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9063 alc880_gpio3_init_verbs, alc882_targa_verbs},
9064 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9065 .dac_nids = alc882_dac_nids,
9066 .dig_out_nid = ALC882_DIGOUT_NID,
9067 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9068 .adc_nids = alc882_adc_nids,
9069 .capsrc_nids = alc882_capsrc_nids,
9070 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9071 .channel_mode = alc882_3ST_6ch_modes,
9073 .input_mux = &alc882_capture_source,
9074 .unsol_event = alc882_targa_unsol_event,
9075 .setup = alc882_targa_setup,
9076 .init_hook = alc882_targa_automute,
9078 [ALC882_ASUS_A7J] = {
9079 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9080 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9081 alc882_asus_a7j_verbs},
9082 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9083 .dac_nids = alc882_dac_nids,
9084 .dig_out_nid = ALC882_DIGOUT_NID,
9085 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9086 .adc_nids = alc882_adc_nids,
9087 .capsrc_nids = alc882_capsrc_nids,
9088 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9089 .channel_mode = alc882_3ST_6ch_modes,
9091 .input_mux = &alc882_capture_source,
9093 [ALC882_ASUS_A7M] = {
9094 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9095 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9096 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9097 alc882_asus_a7m_verbs },
9098 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9099 .dac_nids = alc882_dac_nids,
9100 .dig_out_nid = ALC882_DIGOUT_NID,
9101 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9102 .channel_mode = alc880_threestack_modes,
9104 .input_mux = &alc882_capture_source,
9106 [ALC883_3ST_2ch_DIG] = {
9107 .mixers = { alc883_3ST_2ch_mixer },
9108 .init_verbs = { alc883_init_verbs },
9109 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9110 .dac_nids = alc883_dac_nids,
9111 .dig_out_nid = ALC883_DIGOUT_NID,
9112 .dig_in_nid = ALC883_DIGIN_NID,
9113 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9114 .channel_mode = alc883_3ST_2ch_modes,
9115 .input_mux = &alc883_capture_source,
9117 [ALC883_3ST_6ch_DIG] = {
9118 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9119 .init_verbs = { alc883_init_verbs },
9120 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9121 .dac_nids = alc883_dac_nids,
9122 .dig_out_nid = ALC883_DIGOUT_NID,
9123 .dig_in_nid = ALC883_DIGIN_NID,
9124 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9125 .channel_mode = alc883_3ST_6ch_modes,
9127 .input_mux = &alc883_capture_source,
9129 [ALC883_3ST_6ch] = {
9130 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9131 .init_verbs = { alc883_init_verbs },
9132 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9133 .dac_nids = alc883_dac_nids,
9134 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9135 .channel_mode = alc883_3ST_6ch_modes,
9137 .input_mux = &alc883_capture_source,
9139 [ALC883_3ST_6ch_INTEL] = {
9140 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9141 .init_verbs = { alc883_init_verbs },
9142 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9143 .dac_nids = alc883_dac_nids,
9144 .dig_out_nid = ALC883_DIGOUT_NID,
9145 .dig_in_nid = ALC883_DIGIN_NID,
9146 .slave_dig_outs = alc883_slave_dig_outs,
9147 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9148 .channel_mode = alc883_3ST_6ch_intel_modes,
9150 .input_mux = &alc883_3stack_6ch_intel,
9153 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9154 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9155 alc_hp15_unsol_verbs },
9156 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9157 .dac_nids = alc883_dac_nids,
9158 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9159 .adc_nids = alc889_adc_nids,
9160 .dig_out_nid = ALC883_DIGOUT_NID,
9161 .dig_in_nid = ALC883_DIGIN_NID,
9162 .slave_dig_outs = alc883_slave_dig_outs,
9163 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9164 .channel_mode = alc889_8ch_intel_modes,
9165 .capsrc_nids = alc889_capsrc_nids,
9166 .input_mux = &alc889_capture_source,
9167 .setup = alc889_automute_setup,
9168 .init_hook = alc_automute_amp,
9169 .unsol_event = alc_automute_amp_unsol_event,
9173 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9174 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9175 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9176 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9177 .dac_nids = alc883_dac_nids,
9178 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9179 .adc_nids = alc889_adc_nids,
9180 .capsrc_nids = alc889_capsrc_nids,
9181 .capsrc_nids = alc889_capsrc_nids,
9182 .dig_out_nid = ALC883_DIGOUT_NID,
9183 .dig_in_nid = ALC883_DIGIN_NID,
9184 .slave_dig_outs = alc883_slave_dig_outs,
9185 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9186 .channel_mode = alc889_8ch_intel_modes,
9187 .capsrc_nids = alc889_capsrc_nids,
9188 .input_mux = &alc889_capture_source,
9189 .setup = alc889_automute_setup,
9190 .init_hook = alc889_intel_init_hook,
9191 .unsol_event = alc_automute_amp_unsol_event,
9194 [ALC883_6ST_DIG] = {
9195 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9196 .init_verbs = { alc883_init_verbs },
9197 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9198 .dac_nids = alc883_dac_nids,
9199 .dig_out_nid = ALC883_DIGOUT_NID,
9200 .dig_in_nid = ALC883_DIGIN_NID,
9201 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9202 .channel_mode = alc883_sixstack_modes,
9203 .input_mux = &alc883_capture_source,
9205 [ALC883_TARGA_DIG] = {
9206 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9207 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9208 alc883_targa_verbs},
9209 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9210 .dac_nids = alc883_dac_nids,
9211 .dig_out_nid = ALC883_DIGOUT_NID,
9212 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9213 .channel_mode = alc883_3ST_6ch_modes,
9215 .input_mux = &alc883_capture_source,
9216 .unsol_event = alc883_targa_unsol_event,
9217 .setup = alc882_targa_setup,
9218 .init_hook = alc882_targa_automute,
9220 [ALC883_TARGA_2ch_DIG] = {
9221 .mixers = { alc883_targa_2ch_mixer},
9222 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9223 alc883_targa_verbs},
9224 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9225 .dac_nids = alc883_dac_nids,
9226 .adc_nids = alc883_adc_nids_alt,
9227 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9228 .capsrc_nids = alc883_capsrc_nids,
9229 .dig_out_nid = ALC883_DIGOUT_NID,
9230 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9231 .channel_mode = alc883_3ST_2ch_modes,
9232 .input_mux = &alc883_capture_source,
9233 .unsol_event = alc883_targa_unsol_event,
9234 .setup = alc882_targa_setup,
9235 .init_hook = alc882_targa_automute,
9237 [ALC883_TARGA_8ch_DIG] = {
9238 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9239 alc883_chmode_mixer },
9240 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9241 alc883_targa_verbs },
9242 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9243 .dac_nids = alc883_dac_nids,
9244 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9245 .adc_nids = alc883_adc_nids_rev,
9246 .capsrc_nids = alc883_capsrc_nids_rev,
9247 .dig_out_nid = ALC883_DIGOUT_NID,
9248 .dig_in_nid = ALC883_DIGIN_NID,
9249 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9250 .channel_mode = alc883_4ST_8ch_modes,
9252 .input_mux = &alc883_capture_source,
9253 .unsol_event = alc883_targa_unsol_event,
9254 .setup = alc882_targa_setup,
9255 .init_hook = alc882_targa_automute,
9258 .mixers = { alc883_base_mixer },
9259 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9260 * and the headphone jack. Turn this on and rely on the
9261 * standard mute methods whenever the user wants to turn
9262 * these outputs off.
9264 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9265 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9266 .dac_nids = alc883_dac_nids,
9267 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9268 .channel_mode = alc883_3ST_2ch_modes,
9269 .input_mux = &alc883_capture_source,
9271 [ALC883_ACER_ASPIRE] = {
9272 .mixers = { alc883_acer_aspire_mixer },
9273 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9274 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9275 .dac_nids = alc883_dac_nids,
9276 .dig_out_nid = ALC883_DIGOUT_NID,
9277 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9278 .channel_mode = alc883_3ST_2ch_modes,
9279 .input_mux = &alc883_capture_source,
9280 .unsol_event = alc_automute_amp_unsol_event,
9281 .setup = alc883_acer_aspire_setup,
9282 .init_hook = alc_automute_amp,
9284 [ALC888_ACER_ASPIRE_4930G] = {
9285 .mixers = { alc888_base_mixer,
9286 alc883_chmode_mixer },
9287 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9288 alc888_acer_aspire_4930g_verbs },
9289 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9290 .dac_nids = alc883_dac_nids,
9291 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9292 .adc_nids = alc883_adc_nids_rev,
9293 .capsrc_nids = alc883_capsrc_nids_rev,
9294 .dig_out_nid = ALC883_DIGOUT_NID,
9295 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9296 .channel_mode = alc883_3ST_6ch_modes,
9299 ARRAY_SIZE(alc888_2_capture_sources),
9300 .input_mux = alc888_2_capture_sources,
9301 .unsol_event = alc_automute_amp_unsol_event,
9302 .setup = alc888_acer_aspire_4930g_setup,
9303 .init_hook = alc_automute_amp,
9305 [ALC888_ACER_ASPIRE_6530G] = {
9306 .mixers = { alc888_acer_aspire_6530_mixer },
9307 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9308 alc888_acer_aspire_6530g_verbs },
9309 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9310 .dac_nids = alc883_dac_nids,
9311 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9312 .adc_nids = alc883_adc_nids_rev,
9313 .capsrc_nids = alc883_capsrc_nids_rev,
9314 .dig_out_nid = ALC883_DIGOUT_NID,
9315 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9316 .channel_mode = alc883_3ST_2ch_modes,
9318 ARRAY_SIZE(alc888_2_capture_sources),
9319 .input_mux = alc888_acer_aspire_6530_sources,
9320 .unsol_event = alc_automute_amp_unsol_event,
9321 .setup = alc888_acer_aspire_6530g_setup,
9322 .init_hook = alc_automute_amp,
9324 [ALC888_ACER_ASPIRE_8930G] = {
9325 .mixers = { alc888_base_mixer,
9326 alc883_chmode_mixer },
9327 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9328 alc889_acer_aspire_8930g_verbs },
9329 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9330 .dac_nids = alc883_dac_nids,
9331 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9332 .adc_nids = alc889_adc_nids,
9333 .capsrc_nids = alc889_capsrc_nids,
9334 .dig_out_nid = ALC883_DIGOUT_NID,
9335 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9336 .channel_mode = alc883_3ST_6ch_modes,
9338 .const_channel_count = 6,
9340 ARRAY_SIZE(alc889_capture_sources),
9341 .input_mux = alc889_capture_sources,
9342 .unsol_event = alc_automute_amp_unsol_event,
9343 .setup = alc889_acer_aspire_8930g_setup,
9344 .init_hook = alc_automute_amp,
9346 [ALC888_ACER_ASPIRE_7730G] = {
9347 .mixers = { alc883_3ST_6ch_mixer,
9348 alc883_chmode_mixer },
9349 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9350 alc888_acer_aspire_7730G_verbs },
9351 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9352 .dac_nids = alc883_dac_nids,
9353 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9354 .adc_nids = alc883_adc_nids_rev,
9355 .capsrc_nids = alc883_capsrc_nids_rev,
9356 .dig_out_nid = ALC883_DIGOUT_NID,
9357 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9358 .channel_mode = alc883_3ST_6ch_modes,
9360 .const_channel_count = 6,
9361 .input_mux = &alc883_capture_source,
9362 .unsol_event = alc_automute_amp_unsol_event,
9363 .setup = alc888_acer_aspire_6530g_setup,
9364 .init_hook = alc_automute_amp,
9367 .mixers = { alc883_fivestack_mixer,
9368 alc883_chmode_mixer },
9369 .init_verbs = { alc883_init_verbs,
9370 alc883_medion_eapd_verbs },
9371 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9372 .dac_nids = alc883_dac_nids,
9373 .adc_nids = alc883_adc_nids_alt,
9374 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9375 .capsrc_nids = alc883_capsrc_nids,
9376 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9377 .channel_mode = alc883_sixstack_modes,
9378 .input_mux = &alc883_capture_source,
9380 [ALC883_MEDION_MD2] = {
9381 .mixers = { alc883_medion_md2_mixer},
9382 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9383 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9384 .dac_nids = alc883_dac_nids,
9385 .dig_out_nid = ALC883_DIGOUT_NID,
9386 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9387 .channel_mode = alc883_3ST_2ch_modes,
9388 .input_mux = &alc883_capture_source,
9389 .unsol_event = alc_automute_amp_unsol_event,
9390 .setup = alc883_medion_md2_setup,
9391 .init_hook = alc_automute_amp,
9393 [ALC883_LAPTOP_EAPD] = {
9394 .mixers = { alc883_base_mixer },
9395 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9396 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9397 .dac_nids = alc883_dac_nids,
9398 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9399 .channel_mode = alc883_3ST_2ch_modes,
9400 .input_mux = &alc883_capture_source,
9402 [ALC883_CLEVO_M540R] = {
9403 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9404 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9405 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9406 .dac_nids = alc883_dac_nids,
9407 .dig_out_nid = ALC883_DIGOUT_NID,
9408 .dig_in_nid = ALC883_DIGIN_NID,
9409 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9410 .channel_mode = alc883_3ST_6ch_clevo_modes,
9412 .input_mux = &alc883_capture_source,
9413 /* This machine has the hardware HP auto-muting, thus
9414 * we need no software mute via unsol event
9417 [ALC883_CLEVO_M720] = {
9418 .mixers = { alc883_clevo_m720_mixer },
9419 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9420 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9421 .dac_nids = alc883_dac_nids,
9422 .dig_out_nid = ALC883_DIGOUT_NID,
9423 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9424 .channel_mode = alc883_3ST_2ch_modes,
9425 .input_mux = &alc883_capture_source,
9426 .unsol_event = alc883_clevo_m720_unsol_event,
9427 .setup = alc883_clevo_m720_setup,
9428 .init_hook = alc883_clevo_m720_init_hook,
9430 [ALC883_LENOVO_101E_2ch] = {
9431 .mixers = { alc883_lenovo_101e_2ch_mixer},
9432 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9433 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9434 .dac_nids = alc883_dac_nids,
9435 .adc_nids = alc883_adc_nids_alt,
9436 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9437 .capsrc_nids = alc883_capsrc_nids,
9438 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9439 .channel_mode = alc883_3ST_2ch_modes,
9440 .input_mux = &alc883_lenovo_101e_capture_source,
9441 .unsol_event = alc883_lenovo_101e_unsol_event,
9442 .init_hook = alc883_lenovo_101e_all_automute,
9444 [ALC883_LENOVO_NB0763] = {
9445 .mixers = { alc883_lenovo_nb0763_mixer },
9446 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9447 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9448 .dac_nids = alc883_dac_nids,
9449 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9450 .channel_mode = alc883_3ST_2ch_modes,
9452 .input_mux = &alc883_lenovo_nb0763_capture_source,
9453 .unsol_event = alc_automute_amp_unsol_event,
9454 .setup = alc883_medion_md2_setup,
9455 .init_hook = alc_automute_amp,
9457 [ALC888_LENOVO_MS7195_DIG] = {
9458 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9459 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9460 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9461 .dac_nids = alc883_dac_nids,
9462 .dig_out_nid = ALC883_DIGOUT_NID,
9463 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9464 .channel_mode = alc883_3ST_6ch_modes,
9466 .input_mux = &alc883_capture_source,
9467 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9468 .init_hook = alc888_lenovo_ms7195_front_automute,
9470 [ALC883_HAIER_W66] = {
9471 .mixers = { alc883_targa_2ch_mixer},
9472 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9473 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9474 .dac_nids = alc883_dac_nids,
9475 .dig_out_nid = ALC883_DIGOUT_NID,
9476 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9477 .channel_mode = alc883_3ST_2ch_modes,
9478 .input_mux = &alc883_capture_source,
9479 .unsol_event = alc_automute_amp_unsol_event,
9480 .setup = alc883_haier_w66_setup,
9481 .init_hook = alc_automute_amp,
9484 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9485 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9486 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9487 .dac_nids = alc883_dac_nids,
9488 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9489 .channel_mode = alc888_3st_hp_modes,
9491 .input_mux = &alc883_capture_source,
9492 .unsol_event = alc_automute_amp_unsol_event,
9493 .setup = alc888_3st_hp_setup,
9494 .init_hook = alc_automute_amp,
9496 [ALC888_6ST_DELL] = {
9497 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9498 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9499 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9500 .dac_nids = alc883_dac_nids,
9501 .dig_out_nid = ALC883_DIGOUT_NID,
9502 .dig_in_nid = ALC883_DIGIN_NID,
9503 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9504 .channel_mode = alc883_sixstack_modes,
9505 .input_mux = &alc883_capture_source,
9506 .unsol_event = alc_automute_amp_unsol_event,
9507 .setup = alc888_6st_dell_setup,
9508 .init_hook = alc_automute_amp,
9511 .mixers = { alc883_mitac_mixer },
9512 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9513 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9514 .dac_nids = alc883_dac_nids,
9515 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9516 .channel_mode = alc883_3ST_2ch_modes,
9517 .input_mux = &alc883_capture_source,
9518 .unsol_event = alc_automute_amp_unsol_event,
9519 .setup = alc883_mitac_setup,
9520 .init_hook = alc_automute_amp,
9522 [ALC883_FUJITSU_PI2515] = {
9523 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9524 .init_verbs = { alc883_init_verbs,
9525 alc883_2ch_fujitsu_pi2515_verbs},
9526 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9527 .dac_nids = alc883_dac_nids,
9528 .dig_out_nid = ALC883_DIGOUT_NID,
9529 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9530 .channel_mode = alc883_3ST_2ch_modes,
9531 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9532 .unsol_event = alc_automute_amp_unsol_event,
9533 .setup = alc883_2ch_fujitsu_pi2515_setup,
9534 .init_hook = alc_automute_amp,
9536 [ALC888_FUJITSU_XA3530] = {
9537 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9538 .init_verbs = { alc883_init_verbs,
9539 alc888_fujitsu_xa3530_verbs },
9540 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9541 .dac_nids = alc883_dac_nids,
9542 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9543 .adc_nids = alc883_adc_nids_rev,
9544 .capsrc_nids = alc883_capsrc_nids_rev,
9545 .dig_out_nid = ALC883_DIGOUT_NID,
9546 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9547 .channel_mode = alc888_4ST_8ch_intel_modes,
9549 ARRAY_SIZE(alc888_2_capture_sources),
9550 .input_mux = alc888_2_capture_sources,
9551 .unsol_event = alc_automute_amp_unsol_event,
9552 .setup = alc888_fujitsu_xa3530_setup,
9553 .init_hook = alc_automute_amp,
9555 [ALC888_LENOVO_SKY] = {
9556 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9557 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9558 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9559 .dac_nids = alc883_dac_nids,
9560 .dig_out_nid = ALC883_DIGOUT_NID,
9561 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9562 .channel_mode = alc883_sixstack_modes,
9564 .input_mux = &alc883_lenovo_sky_capture_source,
9565 .unsol_event = alc_automute_amp_unsol_event,
9566 .setup = alc888_lenovo_sky_setup,
9567 .init_hook = alc_automute_amp,
9569 [ALC888_ASUS_M90V] = {
9570 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9571 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9572 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9573 .dac_nids = alc883_dac_nids,
9574 .dig_out_nid = ALC883_DIGOUT_NID,
9575 .dig_in_nid = ALC883_DIGIN_NID,
9576 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9577 .channel_mode = alc883_3ST_6ch_modes,
9579 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9580 .unsol_event = alc_sku_unsol_event,
9581 .setup = alc883_mode2_setup,
9582 .init_hook = alc_inithook,
9584 [ALC888_ASUS_EEE1601] = {
9585 .mixers = { alc883_asus_eee1601_mixer },
9586 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9587 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9588 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9589 .dac_nids = alc883_dac_nids,
9590 .dig_out_nid = ALC883_DIGOUT_NID,
9591 .dig_in_nid = ALC883_DIGIN_NID,
9592 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9593 .channel_mode = alc883_3ST_2ch_modes,
9595 .input_mux = &alc883_asus_eee1601_capture_source,
9596 .unsol_event = alc_sku_unsol_event,
9597 .init_hook = alc883_eee1601_inithook,
9599 [ALC1200_ASUS_P5Q] = {
9600 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9601 .init_verbs = { alc883_init_verbs },
9602 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9603 .dac_nids = alc883_dac_nids,
9604 .dig_out_nid = ALC1200_DIGOUT_NID,
9605 .dig_in_nid = ALC883_DIGIN_NID,
9606 .slave_dig_outs = alc1200_slave_dig_outs,
9607 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9608 .channel_mode = alc883_sixstack_modes,
9609 .input_mux = &alc883_capture_source,
9612 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9613 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9614 alc880_gpio1_init_verbs },
9615 .adc_nids = alc883_adc_nids,
9616 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9617 .capsrc_nids = alc883_capsrc_nids,
9618 .dac_nids = alc883_dac_nids,
9619 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9620 .channel_mode = alc889A_mb31_6ch_modes,
9621 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9622 .input_mux = &alc889A_mb31_capture_source,
9623 .dig_out_nid = ALC883_DIGOUT_NID,
9624 .unsol_event = alc889A_mb31_unsol_event,
9625 .init_hook = alc889A_mb31_automute,
9627 [ALC883_SONY_VAIO_TT] = {
9628 .mixers = { alc883_vaiott_mixer },
9629 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9630 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9631 .dac_nids = alc883_dac_nids,
9632 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9633 .channel_mode = alc883_3ST_2ch_modes,
9634 .input_mux = &alc883_capture_source,
9635 .unsol_event = alc_automute_amp_unsol_event,
9636 .setup = alc883_vaiott_setup,
9637 .init_hook = alc_automute_amp,
9646 PINFIX_ABIT_AW9D_MAX
9649 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9650 { 0x15, 0x01080104 }, /* side */
9651 { 0x16, 0x01011012 }, /* rear */
9652 { 0x17, 0x01016011 }, /* clfe */
9656 static const struct alc_fixup alc882_fixups[] = {
9657 [PINFIX_ABIT_AW9D_MAX] = {
9658 .pins = alc882_abit_aw9d_pinfix
9662 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9663 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9668 * BIOS auto configuration
9670 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9671 const struct auto_pin_cfg *cfg)
9673 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9676 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9677 hda_nid_t nid, int pin_type,
9681 struct alc_spec *spec = codec->spec;
9684 alc_set_pin_output(codec, nid, pin_type);
9685 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9688 idx = spec->multiout.dac_nids[dac_idx] - 2;
9689 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9693 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9695 struct alc_spec *spec = codec->spec;
9698 for (i = 0; i <= HDA_SIDE; i++) {
9699 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9700 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9702 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9707 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9709 struct alc_spec *spec = codec->spec;
9712 pin = spec->autocfg.hp_pins[0];
9713 if (pin) /* connect to front */
9715 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9716 pin = spec->autocfg.speaker_pins[0];
9718 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9721 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9723 struct alc_spec *spec = codec->spec;
9726 for (i = 0; i < AUTO_PIN_LAST; i++) {
9727 hda_nid_t nid = spec->autocfg.input_pins[i];
9730 alc_set_input_pin(codec, nid, i);
9731 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9732 snd_hda_codec_write(codec, nid, 0,
9733 AC_VERB_SET_AMP_GAIN_MUTE,
9738 static void alc882_auto_init_input_src(struct hda_codec *codec)
9740 struct alc_spec *spec = codec->spec;
9743 for (c = 0; c < spec->num_adc_nids; c++) {
9744 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9745 hda_nid_t nid = spec->capsrc_nids[c];
9746 unsigned int mux_idx;
9747 const struct hda_input_mux *imux;
9748 int conns, mute, idx, item;
9750 conns = snd_hda_get_connections(codec, nid, conn_list,
9751 ARRAY_SIZE(conn_list));
9754 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9755 imux = &spec->input_mux[mux_idx];
9756 if (!imux->num_items && mux_idx > 0)
9757 imux = &spec->input_mux[0];
9758 for (idx = 0; idx < conns; idx++) {
9759 /* if the current connection is the selected one,
9760 * unmute it as default - otherwise mute it
9762 mute = AMP_IN_MUTE(idx);
9763 for (item = 0; item < imux->num_items; item++) {
9764 if (imux->items[item].index == idx) {
9765 if (spec->cur_mux[c] == item)
9766 mute = AMP_IN_UNMUTE(idx);
9770 /* check if we have a selector or mixer
9771 * we could check for the widget type instead, but
9772 * just check for Amp-In presence (in case of mixer
9773 * without amp-in there is something wrong, this
9774 * function shouldn't be used or capsrc nid is wrong)
9776 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9777 snd_hda_codec_write(codec, nid, 0,
9778 AC_VERB_SET_AMP_GAIN_MUTE,
9780 else if (mute != AMP_IN_MUTE(idx))
9781 snd_hda_codec_write(codec, nid, 0,
9782 AC_VERB_SET_CONNECT_SEL,
9788 /* add mic boosts if needed */
9789 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9791 struct alc_spec *spec = codec->spec;
9795 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9796 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9797 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9799 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9803 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9804 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9805 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9807 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9814 /* almost identical with ALC880 parser... */
9815 static int alc882_parse_auto_config(struct hda_codec *codec)
9817 struct alc_spec *spec = codec->spec;
9818 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9821 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9825 if (!spec->autocfg.line_outs)
9826 return 0; /* can't find valid BIOS pin config */
9828 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9831 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9834 err = alc880_auto_create_extra_out(spec,
9835 spec->autocfg.speaker_pins[0],
9839 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9843 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9847 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9849 /* check multiple SPDIF-out (for recent codecs) */
9850 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9852 err = snd_hda_get_connections(codec,
9853 spec->autocfg.dig_out_pins[i],
9858 spec->multiout.dig_out_nid = dig_nid;
9860 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9861 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
9863 spec->slave_dig_outs[i - 1] = dig_nid;
9866 if (spec->autocfg.dig_in_pin)
9867 spec->dig_in_nid = ALC880_DIGIN_NID;
9869 if (spec->kctls.list)
9870 add_mixer(spec, spec->kctls.list);
9872 add_verb(spec, alc883_auto_init_verbs);
9873 /* if ADC 0x07 is available, initialize it, too */
9874 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9875 add_verb(spec, alc882_adc1_init_verbs);
9877 spec->num_mux_defs = 1;
9878 spec->input_mux = &spec->private_imux[0];
9880 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9882 err = alc_auto_add_mic_boost(codec);
9886 return 1; /* config found */
9889 /* additional initialization for auto-configuration model */
9890 static void alc882_auto_init(struct hda_codec *codec)
9892 struct alc_spec *spec = codec->spec;
9893 alc882_auto_init_multi_out(codec);
9894 alc882_auto_init_hp_out(codec);
9895 alc882_auto_init_analog_input(codec);
9896 alc882_auto_init_input_src(codec);
9897 if (spec->unsol_event)
9898 alc_inithook(codec);
9901 static int patch_alc882(struct hda_codec *codec)
9903 struct alc_spec *spec;
9904 int err, board_config;
9906 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9912 switch (codec->vendor_id) {
9917 /* ALC883 and variants */
9918 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9922 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9926 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9927 board_config = snd_hda_check_board_codec_sid_config(codec,
9928 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9930 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9931 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9933 board_config = ALC882_AUTO;
9936 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
9938 if (board_config == ALC882_AUTO) {
9939 /* automatic parse from the BIOS config */
9940 err = alc882_parse_auto_config(codec);
9946 "hda_codec: Cannot set up configuration "
9947 "from BIOS. Using base mode...\n");
9948 board_config = ALC882_3ST_DIG;
9952 err = snd_hda_attach_beep_device(codec, 0x1);
9958 if (board_config != ALC882_AUTO)
9959 setup_preset(codec, &alc882_presets[board_config]);
9961 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9962 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9963 /* FIXME: setup DAC5 */
9964 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9965 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9967 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9968 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9970 if (codec->vendor_id == 0x10ec0888)
9971 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9973 if (!spec->adc_nids && spec->input_mux) {
9975 spec->num_adc_nids = 0;
9976 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9978 hda_nid_t nid = alc882_adc_nids[i];
9979 unsigned int wcap = get_wcaps(codec, nid);
9981 wcap = get_wcaps_type(wcap);
9982 if (wcap != AC_WID_AUD_IN)
9984 spec->private_adc_nids[spec->num_adc_nids] = nid;
9985 err = snd_hda_get_connections(codec, nid, &cap, 1);
9988 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9989 spec->num_adc_nids++;
9991 spec->adc_nids = spec->private_adc_nids;
9992 spec->capsrc_nids = spec->private_capsrc_nids;
9995 set_capture_mixer(codec);
9996 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9998 spec->vmaster_nid = 0x0c;
10000 codec->patch_ops = alc_patch_ops;
10001 if (board_config == ALC882_AUTO)
10002 spec->init_hook = alc882_auto_init;
10003 #ifdef CONFIG_SND_HDA_POWER_SAVE
10004 if (!spec->loopback.amplist)
10005 spec->loopback.amplist = alc882_loopbacks;
10007 codec->proc_widget_hook = print_realtek_coef;
10017 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10018 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10020 #define alc262_dac_nids alc260_dac_nids
10021 #define alc262_adc_nids alc882_adc_nids
10022 #define alc262_adc_nids_alt alc882_adc_nids_alt
10023 #define alc262_capsrc_nids alc882_capsrc_nids
10024 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10026 #define alc262_modes alc260_modes
10027 #define alc262_capture_source alc882_capture_source
10029 static hda_nid_t alc262_dmic_adc_nids[1] = {
10034 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10036 static struct snd_kcontrol_new alc262_base_mixer[] = {
10037 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10038 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10039 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10040 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10041 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10042 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10044 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10045 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10046 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10047 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10048 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10049 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10050 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10051 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10052 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10056 /* update HP, line and mono-out pins according to the master switch */
10057 static void alc262_hp_master_update(struct hda_codec *codec)
10059 struct alc_spec *spec = codec->spec;
10060 int val = spec->master_sw;
10062 /* HP & line-out */
10063 snd_hda_codec_write_cache(codec, 0x1b, 0,
10064 AC_VERB_SET_PIN_WIDGET_CONTROL,
10066 snd_hda_codec_write_cache(codec, 0x15, 0,
10067 AC_VERB_SET_PIN_WIDGET_CONTROL,
10069 /* mono (speaker) depending on the HP jack sense */
10070 val = val && !spec->jack_present;
10071 snd_hda_codec_write_cache(codec, 0x16, 0,
10072 AC_VERB_SET_PIN_WIDGET_CONTROL,
10073 val ? PIN_OUT : 0);
10076 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10078 struct alc_spec *spec = codec->spec;
10079 unsigned int presence;
10080 presence = snd_hda_codec_read(codec, 0x1b, 0,
10081 AC_VERB_GET_PIN_SENSE, 0);
10082 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
10083 alc262_hp_master_update(codec);
10086 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10088 if ((res >> 26) != ALC880_HP_EVENT)
10090 alc262_hp_bpc_automute(codec);
10093 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10095 struct alc_spec *spec = codec->spec;
10096 unsigned int presence;
10097 presence = snd_hda_codec_read(codec, 0x15, 0,
10098 AC_VERB_GET_PIN_SENSE, 0);
10099 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
10100 alc262_hp_master_update(codec);
10103 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10106 if ((res >> 26) != ALC880_HP_EVENT)
10108 alc262_hp_wildwest_automute(codec);
10111 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10113 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10114 struct snd_ctl_elem_value *ucontrol)
10116 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10117 struct alc_spec *spec = codec->spec;
10118 int val = !!*ucontrol->value.integer.value;
10120 if (val == spec->master_sw)
10122 spec->master_sw = val;
10123 alc262_hp_master_update(codec);
10127 #define ALC262_HP_MASTER_SWITCH \
10129 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10130 .name = "Master Playback Switch", \
10131 .info = snd_ctl_boolean_mono_info, \
10132 .get = alc262_hp_master_sw_get, \
10133 .put = alc262_hp_master_sw_put, \
10136 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10137 ALC262_HP_MASTER_SWITCH,
10138 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10139 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10140 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10141 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10143 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10147 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10148 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10149 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10150 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10151 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10152 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10153 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10154 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10155 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10156 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10160 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10161 ALC262_HP_MASTER_SWITCH,
10162 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10163 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10164 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10165 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10166 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10168 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10170 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10171 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10172 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10173 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10174 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10175 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10176 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10180 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10181 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10182 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10183 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10187 /* mute/unmute internal speaker according to the hp jack and mute state */
10188 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10190 struct alc_spec *spec = codec->spec;
10192 spec->autocfg.hp_pins[0] = 0x15;
10193 spec->autocfg.speaker_pins[0] = 0x14;
10196 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10197 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10198 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10199 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10200 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10202 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10203 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10207 static struct hda_verb alc262_hp_t5735_verbs[] = {
10208 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10209 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10211 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10215 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10216 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10217 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10218 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10219 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10220 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10221 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10225 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10226 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10227 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10228 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10229 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10230 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10231 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10232 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10233 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10234 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10235 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10239 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10246 /* bind hp and internal speaker mute (with plug check) as master switch */
10247 static void alc262_hippo_master_update(struct hda_codec *codec)
10249 struct alc_spec *spec = codec->spec;
10250 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10251 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10252 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10256 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10257 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10258 HDA_AMP_MUTE, mute);
10259 /* mute internal speaker per jack sense */
10260 if (spec->jack_present)
10261 mute = HDA_AMP_MUTE;
10263 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10264 HDA_AMP_MUTE, mute);
10265 if (speaker_nid && speaker_nid != line_nid)
10266 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10267 HDA_AMP_MUTE, mute);
10270 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10272 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10273 struct snd_ctl_elem_value *ucontrol)
10275 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10276 struct alc_spec *spec = codec->spec;
10277 int val = !!*ucontrol->value.integer.value;
10279 if (val == spec->master_sw)
10281 spec->master_sw = val;
10282 alc262_hippo_master_update(codec);
10286 #define ALC262_HIPPO_MASTER_SWITCH \
10288 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10289 .name = "Master Playback Switch", \
10290 .info = snd_ctl_boolean_mono_info, \
10291 .get = alc262_hippo_master_sw_get, \
10292 .put = alc262_hippo_master_sw_put, \
10295 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10296 ALC262_HIPPO_MASTER_SWITCH,
10297 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10298 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10299 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10300 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10301 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10302 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10303 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10304 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10305 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10306 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10307 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10308 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10312 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10313 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10314 ALC262_HIPPO_MASTER_SWITCH,
10315 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10316 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10317 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10318 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10319 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10320 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10321 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10322 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10323 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10324 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10328 /* mute/unmute internal speaker according to the hp jack and mute state */
10329 static void alc262_hippo_automute(struct hda_codec *codec)
10331 struct alc_spec *spec = codec->spec;
10332 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10333 unsigned int present;
10335 /* need to execute and sync at first */
10336 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10337 present = snd_hda_codec_read(codec, hp_nid, 0,
10338 AC_VERB_GET_PIN_SENSE, 0);
10339 spec->jack_present = (present & 0x80000000) != 0;
10340 alc262_hippo_master_update(codec);
10343 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10345 if ((res >> 26) != ALC880_HP_EVENT)
10347 alc262_hippo_automute(codec);
10350 static void alc262_hippo_setup(struct hda_codec *codec)
10352 struct alc_spec *spec = codec->spec;
10354 spec->autocfg.hp_pins[0] = 0x15;
10355 spec->autocfg.speaker_pins[0] = 0x14;
10358 static void alc262_hippo1_setup(struct hda_codec *codec)
10360 struct alc_spec *spec = codec->spec;
10362 spec->autocfg.hp_pins[0] = 0x1b;
10363 spec->autocfg.speaker_pins[0] = 0x14;
10367 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10368 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10369 ALC262_HIPPO_MASTER_SWITCH,
10370 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10371 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10372 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10373 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10377 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10378 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10379 ALC262_HIPPO_MASTER_SWITCH,
10380 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10382 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10383 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10384 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10388 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10389 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10390 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10391 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10392 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10393 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10394 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10395 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10396 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10397 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10398 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10399 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10400 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10404 static struct hda_verb alc262_tyan_verbs[] = {
10405 /* Headphone automute */
10406 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10407 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10408 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10410 /* P11 AUX_IN, white 4-pin connector */
10411 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10412 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10413 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10414 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10419 /* unsolicited event for HP jack sensing */
10420 static void alc262_tyan_setup(struct hda_codec *codec)
10422 struct alc_spec *spec = codec->spec;
10424 spec->autocfg.hp_pins[0] = 0x1b;
10425 spec->autocfg.speaker_pins[0] = 0x15;
10429 #define alc262_capture_mixer alc882_capture_mixer
10430 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10433 * generic initialization of ADC, input mixers and output mixers
10435 static struct hda_verb alc262_init_verbs[] = {
10437 * Unmute ADC0-2 and set the default input to mic-in
10439 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10440 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10441 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10442 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10443 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10444 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10446 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10448 * Note: PASD motherboards uses the Line In 2 as the input for
10449 * front panel mic (mic 2)
10451 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10452 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10453 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10454 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10455 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10456 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10459 * Set up output mixers (0x0c - 0x0e)
10461 /* set vol=0 to output mixers */
10462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10463 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10464 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10465 /* set up input amps for analog loopback */
10466 /* Amp Indices: DAC = 0, mixer = 1 */
10467 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10468 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10469 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10470 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10471 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10472 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10474 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10476 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10477 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10478 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10479 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10481 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10482 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10483 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10484 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10485 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10487 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10488 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10490 /* FIXME: use matrix-type input source selection */
10491 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10492 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10493 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10494 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10495 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10496 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10498 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10499 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10500 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10501 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10504 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10505 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10506 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10511 static struct hda_verb alc262_eapd_verbs[] = {
10512 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10513 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10517 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10518 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10519 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10520 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10522 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10523 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10527 static struct hda_verb alc262_sony_unsol_verbs[] = {
10528 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10529 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10530 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10532 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10533 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10537 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10538 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10539 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10540 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10541 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10542 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10546 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10547 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10549 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10550 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10551 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10552 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10553 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10554 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10558 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10560 struct alc_spec *spec = codec->spec;
10562 spec->autocfg.hp_pins[0] = 0x15;
10563 spec->autocfg.speaker_pins[0] = 0x14;
10564 spec->ext_mic.pin = 0x18;
10565 spec->ext_mic.mux_idx = 0;
10566 spec->int_mic.pin = 0x12;
10567 spec->int_mic.mux_idx = 9;
10568 spec->auto_mic = 1;
10574 * 0x16 = internal speaker
10575 * 0x18 = external mic
10578 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10579 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10580 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10582 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10583 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10584 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10586 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10587 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10591 static struct hda_verb alc262_nec_verbs[] = {
10592 /* Unmute Speaker */
10593 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10596 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10597 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10599 /* External mic to headphone */
10600 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10601 /* External mic to speaker */
10602 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10608 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10609 * 0x1b = port replicator headphone out
10612 #define ALC_HP_EVENT 0x37
10614 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10615 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10616 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10617 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10618 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10622 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10623 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10624 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10628 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10629 /* Front Mic pin: input vref at 50% */
10630 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10631 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10635 static struct hda_input_mux alc262_fujitsu_capture_source = {
10639 { "Int Mic", 0x1 },
10644 static struct hda_input_mux alc262_HP_capture_source = {
10648 { "Front Mic", 0x1 },
10655 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10659 { "Front Mic", 0x2 },
10665 /* mute/unmute internal speaker according to the hp jacks and mute state */
10666 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10668 struct alc_spec *spec = codec->spec;
10671 if (force || !spec->sense_updated) {
10672 unsigned int present;
10673 /* need to execute and sync at first */
10674 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10675 /* check laptop HP jack */
10676 present = snd_hda_codec_read(codec, 0x14, 0,
10677 AC_VERB_GET_PIN_SENSE, 0);
10678 /* need to execute and sync at first */
10679 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10680 /* check docking HP jack */
10681 present |= snd_hda_codec_read(codec, 0x1b, 0,
10682 AC_VERB_GET_PIN_SENSE, 0);
10683 if (present & AC_PINSENSE_PRESENCE)
10684 spec->jack_present = 1;
10686 spec->jack_present = 0;
10687 spec->sense_updated = 1;
10689 /* unmute internal speaker only if both HPs are unplugged and
10690 * master switch is on
10692 if (spec->jack_present)
10693 mute = HDA_AMP_MUTE;
10695 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10696 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10697 HDA_AMP_MUTE, mute);
10700 /* unsolicited event for HP jack sensing */
10701 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10704 if ((res >> 26) != ALC_HP_EVENT)
10706 alc262_fujitsu_automute(codec, 1);
10709 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10711 alc262_fujitsu_automute(codec, 1);
10714 /* bind volumes of both NID 0x0c and 0x0d */
10715 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10716 .ops = &snd_hda_bind_vol,
10718 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10719 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10724 /* mute/unmute internal speaker according to the hp jack and mute state */
10725 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10727 struct alc_spec *spec = codec->spec;
10730 if (force || !spec->sense_updated) {
10731 unsigned int present_int_hp;
10732 /* need to execute and sync at first */
10733 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10734 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10735 AC_VERB_GET_PIN_SENSE, 0);
10736 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10737 spec->sense_updated = 1;
10739 if (spec->jack_present) {
10740 /* mute internal speaker */
10741 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10742 HDA_AMP_MUTE, HDA_AMP_MUTE);
10743 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10744 HDA_AMP_MUTE, HDA_AMP_MUTE);
10746 /* unmute internal speaker if necessary */
10747 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10748 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10749 HDA_AMP_MUTE, mute);
10750 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10751 HDA_AMP_MUTE, mute);
10755 /* unsolicited event for HP jack sensing */
10756 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10759 if ((res >> 26) != ALC_HP_EVENT)
10761 alc262_lenovo_3000_automute(codec, 1);
10764 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10765 int dir, int idx, long *valp)
10769 for (i = 0; i < 2; i++, valp++)
10770 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10772 *valp ? 0 : HDA_AMP_MUTE);
10776 /* bind hp and internal speaker mute (with plug check) */
10777 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10778 struct snd_ctl_elem_value *ucontrol)
10780 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10781 long *valp = ucontrol->value.integer.value;
10784 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10785 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10787 alc262_fujitsu_automute(codec, 0);
10791 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10792 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10794 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10795 .name = "Master Playback Switch",
10796 .info = snd_hda_mixer_amp_switch_info,
10797 .get = snd_hda_mixer_amp_switch_get,
10798 .put = alc262_fujitsu_master_sw_put,
10799 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10801 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10802 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10803 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10804 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10805 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10806 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10807 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10808 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10812 /* bind hp and internal speaker mute (with plug check) */
10813 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10814 struct snd_ctl_elem_value *ucontrol)
10816 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10817 long *valp = ucontrol->value.integer.value;
10820 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10822 alc262_lenovo_3000_automute(codec, 0);
10826 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10827 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10829 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10830 .name = "Master Playback Switch",
10831 .info = snd_hda_mixer_amp_switch_info,
10832 .get = snd_hda_mixer_amp_switch_get,
10833 .put = alc262_lenovo_3000_master_sw_put,
10834 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10836 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10837 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10838 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10839 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10840 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10841 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10842 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10843 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10847 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10848 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10849 ALC262_HIPPO_MASTER_SWITCH,
10850 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10851 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10852 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10853 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10854 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10855 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10859 /* additional init verbs for Benq laptops */
10860 static struct hda_verb alc262_EAPD_verbs[] = {
10861 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10862 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10866 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10867 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10868 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10870 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10871 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10875 /* Samsung Q1 Ultra Vista model setup */
10876 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10877 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10878 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10879 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10880 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10881 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10882 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10886 static struct hda_verb alc262_ultra_verbs[] = {
10888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10889 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10890 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10892 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10893 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10894 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10895 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10897 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10898 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10899 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10900 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10901 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10903 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10904 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10905 /* ADC, choose mic */
10906 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10907 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10908 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10909 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10910 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10911 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10912 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10913 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10914 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10915 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10919 /* mute/unmute internal speaker according to the hp jack and mute state */
10920 static void alc262_ultra_automute(struct hda_codec *codec)
10922 struct alc_spec *spec = codec->spec;
10926 /* auto-mute only when HP is used as HP */
10927 if (!spec->cur_mux[0]) {
10928 unsigned int present;
10929 /* need to execute and sync at first */
10930 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10931 present = snd_hda_codec_read(codec, 0x15, 0,
10932 AC_VERB_GET_PIN_SENSE, 0);
10933 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10934 if (spec->jack_present)
10935 mute = HDA_AMP_MUTE;
10937 /* mute/unmute internal speaker */
10938 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10939 HDA_AMP_MUTE, mute);
10940 /* mute/unmute HP */
10941 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10942 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10945 /* unsolicited event for HP jack sensing */
10946 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10949 if ((res >> 26) != ALC880_HP_EVENT)
10951 alc262_ultra_automute(codec);
10954 static struct hda_input_mux alc262_ultra_capture_source = {
10958 { "Headphone", 0x7 },
10962 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10963 struct snd_ctl_elem_value *ucontrol)
10965 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10966 struct alc_spec *spec = codec->spec;
10969 ret = alc_mux_enum_put(kcontrol, ucontrol);
10972 /* reprogram the HP pin as mic or HP according to the input source */
10973 snd_hda_codec_write_cache(codec, 0x15, 0,
10974 AC_VERB_SET_PIN_WIDGET_CONTROL,
10975 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10976 alc262_ultra_automute(codec); /* mute/unmute HP */
10980 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10981 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10982 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10984 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10985 .name = "Capture Source",
10986 .info = alc_mux_enum_info,
10987 .get = alc_mux_enum_get,
10988 .put = alc262_ultra_mux_enum_put,
10993 /* We use two mixers depending on the output pin; 0x16 is a mono output
10994 * and thus it's bound with a different mixer.
10995 * This function returns which mixer amp should be used.
10997 static int alc262_check_volbit(hda_nid_t nid)
11001 else if (nid == 0x16)
11007 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11008 const char *pfx, int *vbits)
11014 vbit = alc262_check_volbit(nid);
11017 if (*vbits & vbit) /* a volume control for this mixer already there */
11020 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
11022 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11024 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11025 return add_control(spec, ALC_CTL_WIDGET_VOL, name, val);
11028 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11036 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
11038 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11040 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11041 return add_control(spec, ALC_CTL_WIDGET_MUTE, name, val);
11044 /* add playback controls from the parsed DAC table */
11045 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11046 const struct auto_pin_cfg *cfg)
11052 spec->multiout.num_dacs = 1; /* only use one dac */
11053 spec->multiout.dac_nids = spec->private_dac_nids;
11054 spec->multiout.dac_nids[0] = 2;
11056 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11058 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11062 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11065 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11068 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11072 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11073 alc262_check_volbit(cfg->speaker_pins[0]) |
11074 alc262_check_volbit(cfg->hp_pins[0]);
11075 if (vbits == 1 || vbits == 2)
11076 pfx = "Master"; /* only one mixer is used */
11077 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11082 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11085 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11089 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11096 #define alc262_auto_create_input_ctls \
11097 alc880_auto_create_input_ctls
11100 * generic initialization of ADC, input mixers and output mixers
11102 static struct hda_verb alc262_volume_init_verbs[] = {
11104 * Unmute ADC0-2 and set the default input to mic-in
11106 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11108 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11109 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11110 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11111 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11113 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11115 * Note: PASD motherboards uses the Line In 2 as the input for
11116 * front panel mic (mic 2)
11118 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11119 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11120 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11121 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11122 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11123 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11126 * Set up output mixers (0x0c - 0x0f)
11128 /* set vol=0 to output mixers */
11129 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11130 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11131 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11133 /* set up input amps for analog loopback */
11134 /* Amp Indices: DAC = 0, mixer = 1 */
11135 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11136 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11137 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11138 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11139 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11140 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11142 /* FIXME: use matrix-type input source selection */
11143 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11144 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11145 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11146 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11147 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11148 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11150 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11151 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11152 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11153 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11155 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11156 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11157 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11158 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11163 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11165 * Unmute ADC0-2 and set the default input to mic-in
11167 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11168 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11169 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11170 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11171 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11172 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11174 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11176 * Note: PASD motherboards uses the Line In 2 as the input for
11177 * front panel mic (mic 2)
11179 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11180 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11181 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11182 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11183 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11184 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11189 * Set up output mixers (0x0c - 0x0e)
11191 /* set vol=0 to output mixers */
11192 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11193 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11194 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11196 /* set up input amps for analog loopback */
11197 /* Amp Indices: DAC = 0, mixer = 1 */
11198 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11199 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11200 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11201 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11202 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11203 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11205 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11206 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11207 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11209 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11210 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11212 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11213 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11215 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11216 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11217 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11218 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11219 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11221 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11222 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11223 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11224 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11225 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11226 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11229 /* FIXME: use matrix-type input source selection */
11230 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11231 /* Input mixer1: only unmute Mic */
11232 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11233 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11234 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11235 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11236 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11237 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11238 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11239 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11240 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11242 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11243 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11244 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11245 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11246 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11247 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11248 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11249 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11250 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11252 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11253 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11254 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11255 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11256 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11257 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11258 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11259 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11260 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11262 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11267 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11269 * Unmute ADC0-2 and set the default input to mic-in
11271 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11272 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11273 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11274 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11275 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11276 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11278 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11280 * Note: PASD motherboards uses the Line In 2 as the input for front
11281 * panel mic (mic 2)
11283 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11284 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11290 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11291 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11293 * Set up output mixers (0x0c - 0x0e)
11295 /* set vol=0 to output mixers */
11296 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11298 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11300 /* set up input amps for analog loopback */
11301 /* Amp Indices: DAC = 0, mixer = 1 */
11302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11303 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11304 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11305 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11306 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11307 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11310 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11311 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11312 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11313 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11314 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11315 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11316 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11318 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11319 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11321 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11322 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11324 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11325 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11326 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11327 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11328 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11329 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11331 /* FIXME: use matrix-type input source selection */
11332 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11333 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11336 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11337 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11338 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11339 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11340 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11342 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11343 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11344 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11345 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11346 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11347 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11350 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11351 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11352 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11353 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11354 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11355 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11356 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11358 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11363 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11365 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11366 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11367 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11369 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11370 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11371 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11372 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11374 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11375 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11376 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11381 #ifdef CONFIG_SND_HDA_POWER_SAVE
11382 #define alc262_loopbacks alc880_loopbacks
11385 /* pcm configuration: identical with ALC880 */
11386 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11387 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11388 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11389 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11392 * BIOS auto configuration
11394 static int alc262_parse_auto_config(struct hda_codec *codec)
11396 struct alc_spec *spec = codec->spec;
11398 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11400 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11404 if (!spec->autocfg.line_outs) {
11405 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11406 spec->multiout.max_channels = 2;
11407 spec->no_analog = 1;
11410 return 0; /* can't find valid BIOS pin config */
11412 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11415 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11419 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11422 if (spec->autocfg.dig_outs) {
11423 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11424 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11426 if (spec->autocfg.dig_in_pin)
11427 spec->dig_in_nid = ALC262_DIGIN_NID;
11429 if (spec->kctls.list)
11430 add_mixer(spec, spec->kctls.list);
11432 add_verb(spec, alc262_volume_init_verbs);
11433 spec->num_mux_defs = 1;
11434 spec->input_mux = &spec->private_imux[0];
11436 err = alc_auto_add_mic_boost(codec);
11440 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11445 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11446 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11447 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11448 #define alc262_auto_init_input_src alc882_auto_init_input_src
11451 /* init callback for auto-configuration model -- overriding the default init */
11452 static void alc262_auto_init(struct hda_codec *codec)
11454 struct alc_spec *spec = codec->spec;
11455 alc262_auto_init_multi_out(codec);
11456 alc262_auto_init_hp_out(codec);
11457 alc262_auto_init_analog_input(codec);
11458 alc262_auto_init_input_src(codec);
11459 if (spec->unsol_event)
11460 alc_inithook(codec);
11464 * configuration and preset
11466 static const char *alc262_models[ALC262_MODEL_LAST] = {
11467 [ALC262_BASIC] = "basic",
11468 [ALC262_HIPPO] = "hippo",
11469 [ALC262_HIPPO_1] = "hippo_1",
11470 [ALC262_FUJITSU] = "fujitsu",
11471 [ALC262_HP_BPC] = "hp-bpc",
11472 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11473 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11474 [ALC262_HP_RP5700] = "hp-rp5700",
11475 [ALC262_BENQ_ED8] = "benq",
11476 [ALC262_BENQ_T31] = "benq-t31",
11477 [ALC262_SONY_ASSAMD] = "sony-assamd",
11478 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11479 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11480 [ALC262_ULTRA] = "ultra",
11481 [ALC262_LENOVO_3000] = "lenovo-3000",
11482 [ALC262_NEC] = "nec",
11483 [ALC262_TYAN] = "tyan",
11484 [ALC262_AUTO] = "auto",
11487 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11488 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11489 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11490 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11492 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11494 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11496 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11497 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11498 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11499 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11500 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11501 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11502 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11503 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11504 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11505 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11506 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11507 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11508 ALC262_HP_TC_T5735),
11509 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11510 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11511 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11512 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11513 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11514 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11515 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11516 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11517 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11518 ALC262_SONY_ASSAMD),
11519 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11520 ALC262_TOSHIBA_RX1),
11521 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11522 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11523 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11524 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11525 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11527 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11528 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11529 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11530 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11531 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11535 static struct alc_config_preset alc262_presets[] = {
11537 .mixers = { alc262_base_mixer },
11538 .init_verbs = { alc262_init_verbs },
11539 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11540 .dac_nids = alc262_dac_nids,
11542 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11543 .channel_mode = alc262_modes,
11544 .input_mux = &alc262_capture_source,
11547 .mixers = { alc262_hippo_mixer },
11548 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11549 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11550 .dac_nids = alc262_dac_nids,
11552 .dig_out_nid = ALC262_DIGOUT_NID,
11553 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11554 .channel_mode = alc262_modes,
11555 .input_mux = &alc262_capture_source,
11556 .unsol_event = alc262_hippo_unsol_event,
11557 .setup = alc262_hippo_setup,
11558 .init_hook = alc262_hippo_automute,
11560 [ALC262_HIPPO_1] = {
11561 .mixers = { alc262_hippo1_mixer },
11562 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11563 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11564 .dac_nids = alc262_dac_nids,
11566 .dig_out_nid = ALC262_DIGOUT_NID,
11567 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11568 .channel_mode = alc262_modes,
11569 .input_mux = &alc262_capture_source,
11570 .unsol_event = alc262_hippo_unsol_event,
11571 .setup = alc262_hippo1_setup,
11572 .init_hook = alc262_hippo_automute,
11574 [ALC262_FUJITSU] = {
11575 .mixers = { alc262_fujitsu_mixer },
11576 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11577 alc262_fujitsu_unsol_verbs },
11578 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11579 .dac_nids = alc262_dac_nids,
11581 .dig_out_nid = ALC262_DIGOUT_NID,
11582 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11583 .channel_mode = alc262_modes,
11584 .input_mux = &alc262_fujitsu_capture_source,
11585 .unsol_event = alc262_fujitsu_unsol_event,
11586 .init_hook = alc262_fujitsu_init_hook,
11588 [ALC262_HP_BPC] = {
11589 .mixers = { alc262_HP_BPC_mixer },
11590 .init_verbs = { alc262_HP_BPC_init_verbs },
11591 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11592 .dac_nids = alc262_dac_nids,
11594 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11595 .channel_mode = alc262_modes,
11596 .input_mux = &alc262_HP_capture_source,
11597 .unsol_event = alc262_hp_bpc_unsol_event,
11598 .init_hook = alc262_hp_bpc_automute,
11600 [ALC262_HP_BPC_D7000_WF] = {
11601 .mixers = { alc262_HP_BPC_WildWest_mixer },
11602 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11603 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11604 .dac_nids = alc262_dac_nids,
11606 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11607 .channel_mode = alc262_modes,
11608 .input_mux = &alc262_HP_D7000_capture_source,
11609 .unsol_event = alc262_hp_wildwest_unsol_event,
11610 .init_hook = alc262_hp_wildwest_automute,
11612 [ALC262_HP_BPC_D7000_WL] = {
11613 .mixers = { alc262_HP_BPC_WildWest_mixer,
11614 alc262_HP_BPC_WildWest_option_mixer },
11615 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11616 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11617 .dac_nids = alc262_dac_nids,
11619 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11620 .channel_mode = alc262_modes,
11621 .input_mux = &alc262_HP_D7000_capture_source,
11622 .unsol_event = alc262_hp_wildwest_unsol_event,
11623 .init_hook = alc262_hp_wildwest_automute,
11625 [ALC262_HP_TC_T5735] = {
11626 .mixers = { alc262_hp_t5735_mixer },
11627 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11628 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11629 .dac_nids = alc262_dac_nids,
11631 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11632 .channel_mode = alc262_modes,
11633 .input_mux = &alc262_capture_source,
11634 .unsol_event = alc_sku_unsol_event,
11635 .setup = alc262_hp_t5735_setup,
11636 .init_hook = alc_inithook,
11638 [ALC262_HP_RP5700] = {
11639 .mixers = { alc262_hp_rp5700_mixer },
11640 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11641 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11642 .dac_nids = alc262_dac_nids,
11643 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11644 .channel_mode = alc262_modes,
11645 .input_mux = &alc262_hp_rp5700_capture_source,
11647 [ALC262_BENQ_ED8] = {
11648 .mixers = { alc262_base_mixer },
11649 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11650 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11651 .dac_nids = alc262_dac_nids,
11653 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11654 .channel_mode = alc262_modes,
11655 .input_mux = &alc262_capture_source,
11657 [ALC262_SONY_ASSAMD] = {
11658 .mixers = { alc262_sony_mixer },
11659 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11660 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11661 .dac_nids = alc262_dac_nids,
11663 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11664 .channel_mode = alc262_modes,
11665 .input_mux = &alc262_capture_source,
11666 .unsol_event = alc262_hippo_unsol_event,
11667 .setup = alc262_hippo_setup,
11668 .init_hook = alc262_hippo_automute,
11670 [ALC262_BENQ_T31] = {
11671 .mixers = { alc262_benq_t31_mixer },
11672 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11673 alc_hp15_unsol_verbs },
11674 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11675 .dac_nids = alc262_dac_nids,
11677 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11678 .channel_mode = alc262_modes,
11679 .input_mux = &alc262_capture_source,
11680 .unsol_event = alc262_hippo_unsol_event,
11681 .setup = alc262_hippo_setup,
11682 .init_hook = alc262_hippo_automute,
11685 .mixers = { alc262_ultra_mixer },
11686 .cap_mixer = alc262_ultra_capture_mixer,
11687 .init_verbs = { alc262_ultra_verbs },
11688 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11689 .dac_nids = alc262_dac_nids,
11690 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11691 .channel_mode = alc262_modes,
11692 .input_mux = &alc262_ultra_capture_source,
11693 .adc_nids = alc262_adc_nids, /* ADC0 */
11694 .capsrc_nids = alc262_capsrc_nids,
11695 .num_adc_nids = 1, /* single ADC */
11696 .unsol_event = alc262_ultra_unsol_event,
11697 .init_hook = alc262_ultra_automute,
11699 [ALC262_LENOVO_3000] = {
11700 .mixers = { alc262_lenovo_3000_mixer },
11701 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11702 alc262_lenovo_3000_unsol_verbs,
11703 alc262_lenovo_3000_init_verbs },
11704 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11705 .dac_nids = alc262_dac_nids,
11707 .dig_out_nid = ALC262_DIGOUT_NID,
11708 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11709 .channel_mode = alc262_modes,
11710 .input_mux = &alc262_fujitsu_capture_source,
11711 .unsol_event = alc262_lenovo_3000_unsol_event,
11714 .mixers = { alc262_nec_mixer },
11715 .init_verbs = { alc262_nec_verbs },
11716 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11717 .dac_nids = alc262_dac_nids,
11719 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11720 .channel_mode = alc262_modes,
11721 .input_mux = &alc262_capture_source,
11723 [ALC262_TOSHIBA_S06] = {
11724 .mixers = { alc262_toshiba_s06_mixer },
11725 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11726 alc262_eapd_verbs },
11727 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11728 .capsrc_nids = alc262_dmic_capsrc_nids,
11729 .dac_nids = alc262_dac_nids,
11730 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11731 .num_adc_nids = 1, /* single ADC */
11732 .dig_out_nid = ALC262_DIGOUT_NID,
11733 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11734 .channel_mode = alc262_modes,
11735 .unsol_event = alc_sku_unsol_event,
11736 .setup = alc262_toshiba_s06_setup,
11737 .init_hook = alc_inithook,
11739 [ALC262_TOSHIBA_RX1] = {
11740 .mixers = { alc262_toshiba_rx1_mixer },
11741 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11742 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11743 .dac_nids = alc262_dac_nids,
11745 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11746 .channel_mode = alc262_modes,
11747 .input_mux = &alc262_capture_source,
11748 .unsol_event = alc262_hippo_unsol_event,
11749 .setup = alc262_hippo_setup,
11750 .init_hook = alc262_hippo_automute,
11753 .mixers = { alc262_tyan_mixer },
11754 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11755 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11756 .dac_nids = alc262_dac_nids,
11758 .dig_out_nid = ALC262_DIGOUT_NID,
11759 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11760 .channel_mode = alc262_modes,
11761 .input_mux = &alc262_capture_source,
11762 .unsol_event = alc_automute_amp_unsol_event,
11763 .setup = alc262_tyan_setup,
11764 .init_hook = alc_automute_amp,
11768 static int patch_alc262(struct hda_codec *codec)
11770 struct alc_spec *spec;
11774 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11778 codec->spec = spec;
11780 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11785 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11786 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11787 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11788 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11792 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11794 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11798 if (board_config < 0) {
11799 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11801 board_config = ALC262_AUTO;
11804 if (board_config == ALC262_AUTO) {
11805 /* automatic parse from the BIOS config */
11806 err = alc262_parse_auto_config(codec);
11812 "hda_codec: Cannot set up configuration "
11813 "from BIOS. Using base mode...\n");
11814 board_config = ALC262_BASIC;
11818 if (!spec->no_analog) {
11819 err = snd_hda_attach_beep_device(codec, 0x1);
11826 if (board_config != ALC262_AUTO)
11827 setup_preset(codec, &alc262_presets[board_config]);
11829 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11830 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11832 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11833 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11835 if (!spec->adc_nids && spec->input_mux) {
11837 /* check whether the digital-mic has to be supported */
11838 for (i = 0; i < spec->input_mux->num_items; i++) {
11839 if (spec->input_mux->items[i].index >= 9)
11842 if (i < spec->input_mux->num_items) {
11843 /* use only ADC0 */
11844 spec->adc_nids = alc262_dmic_adc_nids;
11845 spec->num_adc_nids = 1;
11846 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11848 /* all analog inputs */
11849 /* check whether NID 0x07 is valid */
11850 unsigned int wcap = get_wcaps(codec, 0x07);
11853 wcap = get_wcaps_type(wcap);
11854 if (wcap != AC_WID_AUD_IN) {
11855 spec->adc_nids = alc262_adc_nids_alt;
11856 spec->num_adc_nids =
11857 ARRAY_SIZE(alc262_adc_nids_alt);
11858 spec->capsrc_nids = alc262_capsrc_nids_alt;
11860 spec->adc_nids = alc262_adc_nids;
11861 spec->num_adc_nids =
11862 ARRAY_SIZE(alc262_adc_nids);
11863 spec->capsrc_nids = alc262_capsrc_nids;
11867 if (!spec->cap_mixer && !spec->no_analog)
11868 set_capture_mixer(codec);
11869 if (!spec->no_analog)
11870 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11872 spec->vmaster_nid = 0x0c;
11874 codec->patch_ops = alc_patch_ops;
11875 if (board_config == ALC262_AUTO)
11876 spec->init_hook = alc262_auto_init;
11877 #ifdef CONFIG_SND_HDA_POWER_SAVE
11878 if (!spec->loopback.amplist)
11879 spec->loopback.amplist = alc262_loopbacks;
11881 codec->proc_widget_hook = print_realtek_coef;
11887 * ALC268 channel source setting (2 channel)
11889 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11890 #define alc268_modes alc260_modes
11892 static hda_nid_t alc268_dac_nids[2] = {
11897 static hda_nid_t alc268_adc_nids[2] = {
11902 static hda_nid_t alc268_adc_nids_alt[1] = {
11907 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11909 static struct snd_kcontrol_new alc268_base_mixer[] = {
11910 /* output mixer control */
11911 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11912 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11913 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11914 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11915 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11916 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11917 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11921 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11922 /* output mixer control */
11923 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11924 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11925 ALC262_HIPPO_MASTER_SWITCH,
11926 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11927 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11928 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11932 /* bind Beep switches of both NID 0x0f and 0x10 */
11933 static struct hda_bind_ctls alc268_bind_beep_sw = {
11934 .ops = &snd_hda_bind_sw,
11936 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11937 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11942 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11943 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11944 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11948 static struct hda_verb alc268_eapd_verbs[] = {
11949 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11950 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11954 /* Toshiba specific */
11955 static struct hda_verb alc268_toshiba_verbs[] = {
11956 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11960 /* Acer specific */
11961 /* bind volumes of both NID 0x02 and 0x03 */
11962 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11963 .ops = &snd_hda_bind_vol,
11965 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11966 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11971 /* mute/unmute internal speaker according to the hp jack and mute state */
11972 static void alc268_acer_automute(struct hda_codec *codec, int force)
11974 struct alc_spec *spec = codec->spec;
11977 if (force || !spec->sense_updated) {
11978 unsigned int present;
11979 present = snd_hda_codec_read(codec, 0x14, 0,
11980 AC_VERB_GET_PIN_SENSE, 0);
11981 spec->jack_present = (present & 0x80000000) != 0;
11982 spec->sense_updated = 1;
11984 if (spec->jack_present)
11985 mute = HDA_AMP_MUTE; /* mute internal speaker */
11986 else /* unmute internal speaker if necessary */
11987 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11988 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11989 HDA_AMP_MUTE, mute);
11993 /* bind hp and internal speaker mute (with plug check) */
11994 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11995 struct snd_ctl_elem_value *ucontrol)
11997 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11998 long *valp = ucontrol->value.integer.value;
12001 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12003 alc268_acer_automute(codec, 0);
12007 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12008 /* output mixer control */
12009 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12011 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12012 .name = "Master Playback Switch",
12013 .info = snd_hda_mixer_amp_switch_info,
12014 .get = snd_hda_mixer_amp_switch_get,
12015 .put = alc268_acer_master_sw_put,
12016 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12018 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12022 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12023 /* output mixer control */
12024 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12026 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12027 .name = "Master Playback Switch",
12028 .info = snd_hda_mixer_amp_switch_info,
12029 .get = snd_hda_mixer_amp_switch_get,
12030 .put = alc268_acer_master_sw_put,
12031 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12033 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12034 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12035 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12039 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12040 /* output mixer control */
12041 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12043 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12044 .name = "Master Playback Switch",
12045 .info = snd_hda_mixer_amp_switch_info,
12046 .get = snd_hda_mixer_amp_switch_get,
12047 .put = alc268_acer_master_sw_put,
12048 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12050 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12051 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12055 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12056 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12057 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12058 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12059 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12060 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12061 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12065 static struct hda_verb alc268_acer_verbs[] = {
12066 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12067 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12068 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12069 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12070 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12071 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12072 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12076 /* unsolicited event for HP jack sensing */
12077 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12078 #define alc268_toshiba_setup alc262_hippo_setup
12079 #define alc268_toshiba_automute alc262_hippo_automute
12081 static void alc268_acer_unsol_event(struct hda_codec *codec,
12084 if ((res >> 26) != ALC880_HP_EVENT)
12086 alc268_acer_automute(codec, 1);
12089 static void alc268_acer_init_hook(struct hda_codec *codec)
12091 alc268_acer_automute(codec, 1);
12094 /* toggle speaker-output according to the hp-jack state */
12095 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12097 unsigned int present;
12098 unsigned char bits;
12100 present = snd_hda_codec_read(codec, 0x15, 0,
12101 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12102 bits = present ? AMP_IN_MUTE(0) : 0;
12103 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12104 AMP_IN_MUTE(0), bits);
12105 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12106 AMP_IN_MUTE(0), bits);
12109 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12112 switch (res >> 26) {
12113 case ALC880_HP_EVENT:
12114 alc268_aspire_one_speaker_automute(codec);
12116 case ALC880_MIC_EVENT:
12117 alc_mic_automute(codec);
12122 static void alc268_acer_lc_setup(struct hda_codec *codec)
12124 struct alc_spec *spec = codec->spec;
12125 spec->ext_mic.pin = 0x18;
12126 spec->ext_mic.mux_idx = 0;
12127 spec->int_mic.pin = 0x12;
12128 spec->int_mic.mux_idx = 6;
12129 spec->auto_mic = 1;
12132 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12134 alc268_aspire_one_speaker_automute(codec);
12135 alc_mic_automute(codec);
12138 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12139 /* output mixer control */
12140 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12141 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12142 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12143 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12144 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12145 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12149 static struct hda_verb alc268_dell_verbs[] = {
12150 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12151 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12152 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12153 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12157 /* mute/unmute internal speaker according to the hp jack and mute state */
12158 static void alc268_dell_setup(struct hda_codec *codec)
12160 struct alc_spec *spec = codec->spec;
12162 spec->autocfg.hp_pins[0] = 0x15;
12163 spec->autocfg.speaker_pins[0] = 0x14;
12164 spec->ext_mic.pin = 0x18;
12165 spec->ext_mic.mux_idx = 0;
12166 spec->int_mic.pin = 0x19;
12167 spec->int_mic.mux_idx = 1;
12168 spec->auto_mic = 1;
12171 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12172 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12173 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12174 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12176 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12177 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12178 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12179 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12183 static struct hda_verb alc267_quanta_il1_verbs[] = {
12184 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12185 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12189 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12191 struct alc_spec *spec = codec->spec;
12192 spec->autocfg.hp_pins[0] = 0x15;
12193 spec->autocfg.speaker_pins[0] = 0x14;
12194 spec->ext_mic.pin = 0x18;
12195 spec->ext_mic.mux_idx = 0;
12196 spec->int_mic.pin = 0x19;
12197 spec->int_mic.mux_idx = 1;
12198 spec->auto_mic = 1;
12202 * generic initialization of ADC, input mixers and output mixers
12204 static struct hda_verb alc268_base_init_verbs[] = {
12205 /* Unmute DAC0-1 and set vol = 0 */
12206 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12207 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12210 * Set up output mixers (0x0c - 0x0e)
12212 /* set vol=0 to output mixers */
12213 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12214 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12216 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12217 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12219 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12220 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12221 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12222 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12223 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12224 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12225 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12226 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12228 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12229 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12230 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12231 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12232 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12234 /* set PCBEEP vol = 0, mute connections */
12235 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12236 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12237 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12239 /* Unmute Selector 23h,24h and set the default input to mic-in */
12241 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12242 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12243 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12244 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12250 * generic initialization of ADC, input mixers and output mixers
12252 static struct hda_verb alc268_volume_init_verbs[] = {
12253 /* set output DAC */
12254 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12255 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12257 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12258 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12259 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12260 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12261 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12263 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12264 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12265 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12267 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12268 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12270 /* set PCBEEP vol = 0, mute connections */
12271 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12272 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12273 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12278 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12279 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12280 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12284 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12285 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12286 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12291 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12292 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12293 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12294 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12295 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12300 static struct hda_input_mux alc268_capture_source = {
12304 { "Front Mic", 0x1 },
12310 static struct hda_input_mux alc268_acer_capture_source = {
12314 { "Internal Mic", 0x1 },
12319 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12323 { "Internal Mic", 0x6 },
12328 #ifdef CONFIG_SND_DEBUG
12329 static struct snd_kcontrol_new alc268_test_mixer[] = {
12330 /* Volume widgets */
12331 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12332 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12333 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12334 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12335 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12336 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12337 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12338 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12339 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12340 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12341 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12342 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12343 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12344 /* The below appears problematic on some hardwares */
12345 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12346 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12347 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12348 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12349 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12351 /* Modes for retasking pin widgets */
12352 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12353 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12354 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12355 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12357 /* Controls for GPIO pins, assuming they are configured as outputs */
12358 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12359 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12360 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12361 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12363 /* Switches to allow the digital SPDIF output pin to be enabled.
12364 * The ALC268 does not have an SPDIF input.
12366 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12368 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12369 * this output to turn on an external amplifier.
12371 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12372 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12378 /* create input playback/capture controls for the given pin */
12379 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12380 const char *ctlname, int idx)
12386 sprintf(name, "%s Playback Volume", ctlname);
12393 case 0x1a: /* ALC259/269 only */
12394 case 0x1b: /* ALC259/269 only */
12395 case 0x21: /* ALC269vb has this pin, too */
12401 if (spec->multiout.dac_nids[0] != dac &&
12402 spec->multiout.dac_nids[1] != dac) {
12403 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12404 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12408 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12411 sprintf(name, "%s Playback Switch", ctlname);
12413 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12414 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12416 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12417 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12423 /* add playback controls from the parsed DAC table */
12424 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12425 const struct auto_pin_cfg *cfg)
12430 spec->multiout.dac_nids = spec->private_dac_nids;
12432 nid = cfg->line_out_pins[0];
12435 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12439 err = alc268_new_analog_output(spec, nid, name, 0);
12444 nid = cfg->speaker_pins[0];
12446 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12447 "Speaker Playback Volume",
12448 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12452 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12456 nid = cfg->hp_pins[0];
12458 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12463 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12465 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12466 "Mono Playback Switch",
12467 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12474 /* create playback/capture controls for input pins */
12475 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12476 const struct auto_pin_cfg *cfg)
12478 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12481 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12482 hda_nid_t nid, int pin_type)
12486 alc_set_pin_output(codec, nid, pin_type);
12487 if (nid == 0x14 || nid == 0x16)
12491 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12494 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12496 struct alc_spec *spec = codec->spec;
12497 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12499 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12500 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12504 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12506 struct alc_spec *spec = codec->spec;
12509 pin = spec->autocfg.hp_pins[0];
12511 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12512 pin = spec->autocfg.speaker_pins[0];
12514 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12517 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12519 struct alc_spec *spec = codec->spec;
12520 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12521 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12522 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12523 unsigned int dac_vol1, dac_vol2;
12525 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12526 snd_hda_codec_write(codec, speaker_nid, 0,
12527 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12528 /* mute mixer inputs from 0x1d */
12529 snd_hda_codec_write(codec, 0x0f, 0,
12530 AC_VERB_SET_AMP_GAIN_MUTE,
12532 snd_hda_codec_write(codec, 0x10, 0,
12533 AC_VERB_SET_AMP_GAIN_MUTE,
12536 /* unmute mixer inputs from 0x1d */
12537 snd_hda_codec_write(codec, 0x0f, 0,
12538 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12539 snd_hda_codec_write(codec, 0x10, 0,
12540 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12543 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12544 if (line_nid == 0x14)
12545 dac_vol2 = AMP_OUT_ZERO;
12546 else if (line_nid == 0x15)
12547 dac_vol1 = AMP_OUT_ZERO;
12548 if (hp_nid == 0x14)
12549 dac_vol2 = AMP_OUT_ZERO;
12550 else if (hp_nid == 0x15)
12551 dac_vol1 = AMP_OUT_ZERO;
12552 if (line_nid != 0x16 || hp_nid != 0x16 ||
12553 spec->autocfg.line_out_pins[1] != 0x16 ||
12554 spec->autocfg.line_out_pins[2] != 0x16)
12555 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12557 snd_hda_codec_write(codec, 0x02, 0,
12558 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12559 snd_hda_codec_write(codec, 0x03, 0,
12560 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12563 /* pcm configuration: identical with ALC880 */
12564 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12565 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12566 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12567 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12570 * BIOS auto configuration
12572 static int alc268_parse_auto_config(struct hda_codec *codec)
12574 struct alc_spec *spec = codec->spec;
12576 static hda_nid_t alc268_ignore[] = { 0 };
12578 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12582 if (!spec->autocfg.line_outs) {
12583 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12584 spec->multiout.max_channels = 2;
12585 spec->no_analog = 1;
12588 return 0; /* can't find valid BIOS pin config */
12590 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12593 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12597 spec->multiout.max_channels = 2;
12600 /* digital only support output */
12601 if (spec->autocfg.dig_outs) {
12602 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12603 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12605 if (spec->kctls.list)
12606 add_mixer(spec, spec->kctls.list);
12608 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12609 add_mixer(spec, alc268_beep_mixer);
12611 add_verb(spec, alc268_volume_init_verbs);
12612 spec->num_mux_defs = 2;
12613 spec->input_mux = &spec->private_imux[0];
12615 err = alc_auto_add_mic_boost(codec);
12619 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12624 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12626 /* init callback for auto-configuration model -- overriding the default init */
12627 static void alc268_auto_init(struct hda_codec *codec)
12629 struct alc_spec *spec = codec->spec;
12630 alc268_auto_init_multi_out(codec);
12631 alc268_auto_init_hp_out(codec);
12632 alc268_auto_init_mono_speaker_out(codec);
12633 alc268_auto_init_analog_input(codec);
12634 if (spec->unsol_event)
12635 alc_inithook(codec);
12639 * configuration and preset
12641 static const char *alc268_models[ALC268_MODEL_LAST] = {
12642 [ALC267_QUANTA_IL1] = "quanta-il1",
12643 [ALC268_3ST] = "3stack",
12644 [ALC268_TOSHIBA] = "toshiba",
12645 [ALC268_ACER] = "acer",
12646 [ALC268_ACER_DMIC] = "acer-dmic",
12647 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12648 [ALC268_DELL] = "dell",
12649 [ALC268_ZEPTO] = "zepto",
12650 #ifdef CONFIG_SND_DEBUG
12651 [ALC268_TEST] = "test",
12653 [ALC268_AUTO] = "auto",
12656 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12657 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12658 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12659 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12660 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12661 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12662 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12663 ALC268_ACER_ASPIRE_ONE),
12664 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12665 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron 910", ALC268_AUTO),
12666 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12667 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12668 /* almost compatible with toshiba but with optional digital outs;
12669 * auto-probing seems working fine
12671 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12673 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12674 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12675 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12676 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12677 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12678 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12682 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12683 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12684 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12685 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12686 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12691 static struct alc_config_preset alc268_presets[] = {
12692 [ALC267_QUANTA_IL1] = {
12693 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12694 alc268_capture_nosrc_mixer },
12695 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12696 alc267_quanta_il1_verbs },
12697 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12698 .dac_nids = alc268_dac_nids,
12699 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12700 .adc_nids = alc268_adc_nids_alt,
12702 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12703 .channel_mode = alc268_modes,
12704 .unsol_event = alc_sku_unsol_event,
12705 .setup = alc267_quanta_il1_setup,
12706 .init_hook = alc_inithook,
12709 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12710 alc268_beep_mixer },
12711 .init_verbs = { alc268_base_init_verbs },
12712 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12713 .dac_nids = alc268_dac_nids,
12714 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12715 .adc_nids = alc268_adc_nids_alt,
12716 .capsrc_nids = alc268_capsrc_nids,
12718 .dig_out_nid = ALC268_DIGOUT_NID,
12719 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12720 .channel_mode = alc268_modes,
12721 .input_mux = &alc268_capture_source,
12723 [ALC268_TOSHIBA] = {
12724 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12725 alc268_beep_mixer },
12726 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12727 alc268_toshiba_verbs },
12728 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12729 .dac_nids = alc268_dac_nids,
12730 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12731 .adc_nids = alc268_adc_nids_alt,
12732 .capsrc_nids = alc268_capsrc_nids,
12734 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12735 .channel_mode = alc268_modes,
12736 .input_mux = &alc268_capture_source,
12737 .unsol_event = alc268_toshiba_unsol_event,
12738 .setup = alc268_toshiba_setup,
12739 .init_hook = alc268_toshiba_automute,
12742 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12743 alc268_beep_mixer },
12744 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12745 alc268_acer_verbs },
12746 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12747 .dac_nids = alc268_dac_nids,
12748 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12749 .adc_nids = alc268_adc_nids_alt,
12750 .capsrc_nids = alc268_capsrc_nids,
12752 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12753 .channel_mode = alc268_modes,
12754 .input_mux = &alc268_acer_capture_source,
12755 .unsol_event = alc268_acer_unsol_event,
12756 .init_hook = alc268_acer_init_hook,
12758 [ALC268_ACER_DMIC] = {
12759 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12760 alc268_beep_mixer },
12761 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12762 alc268_acer_verbs },
12763 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12764 .dac_nids = alc268_dac_nids,
12765 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12766 .adc_nids = alc268_adc_nids_alt,
12767 .capsrc_nids = alc268_capsrc_nids,
12769 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12770 .channel_mode = alc268_modes,
12771 .input_mux = &alc268_acer_dmic_capture_source,
12772 .unsol_event = alc268_acer_unsol_event,
12773 .init_hook = alc268_acer_init_hook,
12775 [ALC268_ACER_ASPIRE_ONE] = {
12776 .mixers = { alc268_acer_aspire_one_mixer,
12778 alc268_capture_nosrc_mixer },
12779 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12780 alc268_acer_aspire_one_verbs },
12781 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12782 .dac_nids = alc268_dac_nids,
12783 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12784 .adc_nids = alc268_adc_nids_alt,
12785 .capsrc_nids = alc268_capsrc_nids,
12787 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12788 .channel_mode = alc268_modes,
12789 .unsol_event = alc268_acer_lc_unsol_event,
12790 .setup = alc268_acer_lc_setup,
12791 .init_hook = alc268_acer_lc_init_hook,
12794 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12795 alc268_capture_nosrc_mixer },
12796 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12797 alc268_dell_verbs },
12798 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12799 .dac_nids = alc268_dac_nids,
12800 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12801 .adc_nids = alc268_adc_nids_alt,
12802 .capsrc_nids = alc268_capsrc_nids,
12804 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12805 .channel_mode = alc268_modes,
12806 .unsol_event = alc_sku_unsol_event,
12807 .setup = alc268_dell_setup,
12808 .init_hook = alc_inithook,
12811 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12812 alc268_beep_mixer },
12813 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12814 alc268_toshiba_verbs },
12815 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12816 .dac_nids = alc268_dac_nids,
12817 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12818 .adc_nids = alc268_adc_nids_alt,
12819 .capsrc_nids = alc268_capsrc_nids,
12821 .dig_out_nid = ALC268_DIGOUT_NID,
12822 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12823 .channel_mode = alc268_modes,
12824 .input_mux = &alc268_capture_source,
12825 .setup = alc268_toshiba_setup,
12826 .init_hook = alc268_toshiba_automute,
12828 #ifdef CONFIG_SND_DEBUG
12830 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12831 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12832 alc268_volume_init_verbs },
12833 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12834 .dac_nids = alc268_dac_nids,
12835 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12836 .adc_nids = alc268_adc_nids_alt,
12837 .capsrc_nids = alc268_capsrc_nids,
12839 .dig_out_nid = ALC268_DIGOUT_NID,
12840 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12841 .channel_mode = alc268_modes,
12842 .input_mux = &alc268_capture_source,
12847 static int patch_alc268(struct hda_codec *codec)
12849 struct alc_spec *spec;
12851 int i, has_beep, err;
12853 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12857 codec->spec = spec;
12859 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12863 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12864 board_config = snd_hda_check_board_codec_sid_config(codec,
12865 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12867 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12868 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12870 board_config = ALC268_AUTO;
12873 if (board_config == ALC268_AUTO) {
12874 /* automatic parse from the BIOS config */
12875 err = alc268_parse_auto_config(codec);
12881 "hda_codec: Cannot set up configuration "
12882 "from BIOS. Using base mode...\n");
12883 board_config = ALC268_3ST;
12887 if (board_config != ALC268_AUTO)
12888 setup_preset(codec, &alc268_presets[board_config]);
12890 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12891 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12892 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12894 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12897 for (i = 0; i < spec->num_mixers; i++) {
12898 if (spec->mixers[i] == alc268_beep_mixer) {
12905 err = snd_hda_attach_beep_device(codec, 0x1);
12910 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12911 /* override the amp caps for beep generator */
12912 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12913 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12914 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12915 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12916 (0 << AC_AMPCAP_MUTE_SHIFT));
12919 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12920 /* check whether NID 0x07 is valid */
12921 unsigned int wcap = get_wcaps(codec, 0x07);
12924 spec->capsrc_nids = alc268_capsrc_nids;
12926 wcap = get_wcaps_type(wcap);
12927 if (spec->auto_mic ||
12928 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12929 spec->adc_nids = alc268_adc_nids_alt;
12930 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12931 if (spec->auto_mic)
12932 fixup_automic_adc(codec);
12933 if (spec->auto_mic || spec->input_mux->num_items == 1)
12934 add_mixer(spec, alc268_capture_nosrc_mixer);
12936 add_mixer(spec, alc268_capture_alt_mixer);
12938 spec->adc_nids = alc268_adc_nids;
12939 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12940 add_mixer(spec, alc268_capture_mixer);
12942 /* set default input source */
12943 for (i = 0; i < spec->num_adc_nids; i++)
12944 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12945 0, AC_VERB_SET_CONNECT_SEL,
12946 i < spec->num_mux_defs ?
12947 spec->input_mux[i].items[0].index :
12948 spec->input_mux->items[0].index);
12951 spec->vmaster_nid = 0x02;
12953 codec->patch_ops = alc_patch_ops;
12954 if (board_config == ALC268_AUTO)
12955 spec->init_hook = alc268_auto_init;
12957 codec->proc_widget_hook = print_realtek_coef;
12963 * ALC269 channel source setting (2 channel)
12965 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12967 #define alc269_dac_nids alc260_dac_nids
12969 static hda_nid_t alc269_adc_nids[1] = {
12974 static hda_nid_t alc269_capsrc_nids[1] = {
12978 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12982 #define alc269_modes alc260_modes
12983 #define alc269_capture_source alc880_lg_lw_capture_source
12985 static struct snd_kcontrol_new alc269_base_mixer[] = {
12986 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12987 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12988 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12989 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12990 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12991 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12992 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12993 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12994 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12995 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12996 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12997 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13001 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13002 /* output mixer control */
13003 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13005 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13006 .name = "Master Playback Switch",
13007 .info = snd_hda_mixer_amp_switch_info,
13008 .get = snd_hda_mixer_amp_switch_get,
13009 .put = alc268_acer_master_sw_put,
13010 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13013 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13014 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13015 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13016 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13017 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13021 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13022 /* output mixer control */
13023 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13025 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13026 .name = "Master Playback Switch",
13027 .info = snd_hda_mixer_amp_switch_info,
13028 .get = snd_hda_mixer_amp_switch_get,
13029 .put = alc268_acer_master_sw_put,
13030 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13032 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13033 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13034 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13035 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13036 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13037 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13038 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13039 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13040 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13044 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13045 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13046 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13047 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13048 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13052 /* capture mixer elements */
13053 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13054 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13055 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13056 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13061 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13063 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13064 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13065 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13066 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13067 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13068 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13069 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13073 static struct hda_verb alc269_lifebook_verbs[] = {
13074 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13075 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13076 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13077 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13078 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13079 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13080 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13081 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13082 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13083 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13087 /* toggle speaker-output according to the hp-jack state */
13088 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13090 unsigned int present;
13091 unsigned char bits;
13093 present = snd_hda_codec_read(codec, 0x15, 0,
13094 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13095 bits = present ? AMP_IN_MUTE(0) : 0;
13096 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13097 AMP_IN_MUTE(0), bits);
13098 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13099 AMP_IN_MUTE(0), bits);
13101 snd_hda_codec_write(codec, 0x20, 0,
13102 AC_VERB_SET_COEF_INDEX, 0x0c);
13103 snd_hda_codec_write(codec, 0x20, 0,
13104 AC_VERB_SET_PROC_COEF, 0x680);
13106 snd_hda_codec_write(codec, 0x20, 0,
13107 AC_VERB_SET_COEF_INDEX, 0x0c);
13108 snd_hda_codec_write(codec, 0x20, 0,
13109 AC_VERB_SET_PROC_COEF, 0x480);
13112 /* toggle speaker-output according to the hp-jacks state */
13113 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13115 unsigned int present;
13116 unsigned char bits;
13118 /* Check laptop headphone socket */
13119 present = snd_hda_codec_read(codec, 0x15, 0,
13120 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13122 /* Check port replicator headphone socket */
13123 present |= snd_hda_codec_read(codec, 0x1a, 0,
13124 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13126 bits = present ? AMP_IN_MUTE(0) : 0;
13127 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13128 AMP_IN_MUTE(0), bits);
13129 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13130 AMP_IN_MUTE(0), bits);
13132 snd_hda_codec_write(codec, 0x20, 0,
13133 AC_VERB_SET_COEF_INDEX, 0x0c);
13134 snd_hda_codec_write(codec, 0x20, 0,
13135 AC_VERB_SET_PROC_COEF, 0x680);
13137 snd_hda_codec_write(codec, 0x20, 0,
13138 AC_VERB_SET_COEF_INDEX, 0x0c);
13139 snd_hda_codec_write(codec, 0x20, 0,
13140 AC_VERB_SET_PROC_COEF, 0x480);
13143 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13145 unsigned int present_laptop;
13146 unsigned int present_dock;
13148 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
13149 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13151 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
13152 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13154 /* Laptop mic port overrides dock mic port, design decision */
13156 snd_hda_codec_write(codec, 0x23, 0,
13157 AC_VERB_SET_CONNECT_SEL, 0x3);
13158 if (present_laptop)
13159 snd_hda_codec_write(codec, 0x23, 0,
13160 AC_VERB_SET_CONNECT_SEL, 0x0);
13161 if (!present_dock && !present_laptop)
13162 snd_hda_codec_write(codec, 0x23, 0,
13163 AC_VERB_SET_CONNECT_SEL, 0x1);
13166 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13169 switch (res >> 26) {
13170 case ALC880_HP_EVENT:
13171 alc269_quanta_fl1_speaker_automute(codec);
13173 case ALC880_MIC_EVENT:
13174 alc_mic_automute(codec);
13179 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13182 if ((res >> 26) == ALC880_HP_EVENT)
13183 alc269_lifebook_speaker_automute(codec);
13184 if ((res >> 26) == ALC880_MIC_EVENT)
13185 alc269_lifebook_mic_autoswitch(codec);
13188 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13190 struct alc_spec *spec = codec->spec;
13191 spec->ext_mic.pin = 0x18;
13192 spec->ext_mic.mux_idx = 0;
13193 spec->int_mic.pin = 0x19;
13194 spec->int_mic.mux_idx = 1;
13195 spec->auto_mic = 1;
13198 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13200 alc269_quanta_fl1_speaker_automute(codec);
13201 alc_mic_automute(codec);
13204 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13206 alc269_lifebook_speaker_automute(codec);
13207 alc269_lifebook_mic_autoswitch(codec);
13210 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13211 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13212 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13213 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13214 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13215 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13216 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13217 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13221 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13222 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13223 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13224 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13225 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13226 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13227 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13231 /* toggle speaker-output according to the hp-jack state */
13232 static void alc269_speaker_automute(struct hda_codec *codec)
13234 unsigned int present;
13235 unsigned char bits;
13237 present = snd_hda_codec_read(codec, 0x15, 0,
13238 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13239 bits = present ? AMP_IN_MUTE(0) : 0;
13240 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13241 AMP_IN_MUTE(0), bits);
13242 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13243 AMP_IN_MUTE(0), bits);
13246 /* unsolicited event for HP jack sensing */
13247 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13250 switch (res >> 26) {
13251 case ALC880_HP_EVENT:
13252 alc269_speaker_automute(codec);
13254 case ALC880_MIC_EVENT:
13255 alc_mic_automute(codec);
13260 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13262 struct alc_spec *spec = codec->spec;
13263 spec->ext_mic.pin = 0x18;
13264 spec->ext_mic.mux_idx = 0;
13265 spec->int_mic.pin = 0x12;
13266 spec->int_mic.mux_idx = 5;
13267 spec->auto_mic = 1;
13270 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13272 struct alc_spec *spec = codec->spec;
13273 spec->ext_mic.pin = 0x18;
13274 spec->ext_mic.mux_idx = 0;
13275 spec->int_mic.pin = 0x19;
13276 spec->int_mic.mux_idx = 1;
13277 spec->auto_mic = 1;
13280 static void alc269_eeepc_inithook(struct hda_codec *codec)
13282 alc269_speaker_automute(codec);
13283 alc_mic_automute(codec);
13287 * generic initialization of ADC, input mixers and output mixers
13289 static struct hda_verb alc269_init_verbs[] = {
13291 * Unmute ADC0 and set the default input to mic-in
13293 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13295 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13296 * analog-loopback mixer widget
13297 * Note: PASD motherboards uses the Line In 2 as the input for
13298 * front panel mic (mic 2)
13300 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13301 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13302 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13303 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13304 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13305 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13308 * Set up output mixers (0x0c - 0x0e)
13310 /* set vol=0 to output mixers */
13311 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13312 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13314 /* set up input amps for analog loopback */
13315 /* Amp Indices: DAC = 0, mixer = 1 */
13316 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13317 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13318 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13319 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13320 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13321 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13323 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13324 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13325 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13326 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13327 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13328 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13329 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13331 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13332 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13333 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13334 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13335 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13336 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13337 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13339 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13340 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13342 /* FIXME: use matrix-type input source selection */
13343 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13344 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13345 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13346 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13347 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13348 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13351 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13352 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13356 #define alc269_auto_create_multi_out_ctls \
13357 alc268_auto_create_multi_out_ctls
13358 #define alc269_auto_create_input_ctls \
13359 alc268_auto_create_input_ctls
13361 #ifdef CONFIG_SND_HDA_POWER_SAVE
13362 #define alc269_loopbacks alc880_loopbacks
13365 /* pcm configuration: identical with ALC880 */
13366 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13367 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13368 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13369 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13371 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13375 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13376 /* NID is set in alc_build_pcms */
13378 .open = alc880_playback_pcm_open,
13379 .prepare = alc880_playback_pcm_prepare,
13380 .cleanup = alc880_playback_pcm_cleanup
13384 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13388 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13389 /* NID is set in alc_build_pcms */
13393 * BIOS auto configuration
13395 static int alc269_parse_auto_config(struct hda_codec *codec)
13397 struct alc_spec *spec = codec->spec;
13399 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13401 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13406 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13409 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13413 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13415 if (spec->autocfg.dig_outs)
13416 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13418 if (spec->kctls.list)
13419 add_mixer(spec, spec->kctls.list);
13421 add_verb(spec, alc269_init_verbs);
13422 spec->num_mux_defs = 1;
13423 spec->input_mux = &spec->private_imux[0];
13424 /* set default input source */
13425 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13426 0, AC_VERB_SET_CONNECT_SEL,
13427 spec->input_mux->items[0].index);
13429 err = alc_auto_add_mic_boost(codec);
13433 if (!spec->cap_mixer && !spec->no_analog)
13434 set_capture_mixer(codec);
13436 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13441 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13442 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13443 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13446 /* init callback for auto-configuration model -- overriding the default init */
13447 static void alc269_auto_init(struct hda_codec *codec)
13449 struct alc_spec *spec = codec->spec;
13450 alc269_auto_init_multi_out(codec);
13451 alc269_auto_init_hp_out(codec);
13452 alc269_auto_init_analog_input(codec);
13453 if (spec->unsol_event)
13454 alc_inithook(codec);
13458 * configuration and preset
13460 static const char *alc269_models[ALC269_MODEL_LAST] = {
13461 [ALC269_BASIC] = "basic",
13462 [ALC269_QUANTA_FL1] = "quanta",
13463 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13464 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13465 [ALC269_FUJITSU] = "fujitsu",
13466 [ALC269_LIFEBOOK] = "lifebook",
13467 [ALC269_AUTO] = "auto",
13470 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13471 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13472 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13473 ALC269_ASUS_EEEPC_P703),
13474 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13475 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13476 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13477 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13478 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13479 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13480 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13481 ALC269_ASUS_EEEPC_P901),
13482 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13483 ALC269_ASUS_EEEPC_P901),
13484 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13485 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13486 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13490 static struct alc_config_preset alc269_presets[] = {
13492 .mixers = { alc269_base_mixer },
13493 .init_verbs = { alc269_init_verbs },
13494 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13495 .dac_nids = alc269_dac_nids,
13497 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13498 .channel_mode = alc269_modes,
13499 .input_mux = &alc269_capture_source,
13501 [ALC269_QUANTA_FL1] = {
13502 .mixers = { alc269_quanta_fl1_mixer },
13503 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13504 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13505 .dac_nids = alc269_dac_nids,
13507 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13508 .channel_mode = alc269_modes,
13509 .input_mux = &alc269_capture_source,
13510 .unsol_event = alc269_quanta_fl1_unsol_event,
13511 .setup = alc269_quanta_fl1_setup,
13512 .init_hook = alc269_quanta_fl1_init_hook,
13514 [ALC269_ASUS_EEEPC_P703] = {
13515 .mixers = { alc269_eeepc_mixer },
13516 .cap_mixer = alc269_epc_capture_mixer,
13517 .init_verbs = { alc269_init_verbs,
13518 alc269_eeepc_amic_init_verbs },
13519 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13520 .dac_nids = alc269_dac_nids,
13522 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13523 .channel_mode = alc269_modes,
13524 .unsol_event = alc269_eeepc_unsol_event,
13525 .setup = alc269_eeepc_amic_setup,
13526 .init_hook = alc269_eeepc_inithook,
13528 [ALC269_ASUS_EEEPC_P901] = {
13529 .mixers = { alc269_eeepc_mixer },
13530 .cap_mixer = alc269_epc_capture_mixer,
13531 .init_verbs = { alc269_init_verbs,
13532 alc269_eeepc_dmic_init_verbs },
13533 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13534 .dac_nids = alc269_dac_nids,
13536 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13537 .channel_mode = alc269_modes,
13538 .unsol_event = alc269_eeepc_unsol_event,
13539 .setup = alc269_eeepc_dmic_setup,
13540 .init_hook = alc269_eeepc_inithook,
13542 [ALC269_FUJITSU] = {
13543 .mixers = { alc269_fujitsu_mixer },
13544 .cap_mixer = alc269_epc_capture_mixer,
13545 .init_verbs = { alc269_init_verbs,
13546 alc269_eeepc_dmic_init_verbs },
13547 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13548 .dac_nids = alc269_dac_nids,
13550 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13551 .channel_mode = alc269_modes,
13552 .unsol_event = alc269_eeepc_unsol_event,
13553 .setup = alc269_eeepc_dmic_setup,
13554 .init_hook = alc269_eeepc_inithook,
13556 [ALC269_LIFEBOOK] = {
13557 .mixers = { alc269_lifebook_mixer },
13558 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13559 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13560 .dac_nids = alc269_dac_nids,
13562 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13563 .channel_mode = alc269_modes,
13564 .input_mux = &alc269_capture_source,
13565 .unsol_event = alc269_lifebook_unsol_event,
13566 .init_hook = alc269_lifebook_init_hook,
13570 static int patch_alc269(struct hda_codec *codec)
13572 struct alc_spec *spec;
13576 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13580 codec->spec = spec;
13582 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13584 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13588 if (board_config < 0) {
13589 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13591 board_config = ALC269_AUTO;
13594 if (board_config == ALC269_AUTO) {
13595 /* automatic parse from the BIOS config */
13596 err = alc269_parse_auto_config(codec);
13602 "hda_codec: Cannot set up configuration "
13603 "from BIOS. Using base mode...\n");
13604 board_config = ALC269_BASIC;
13608 err = snd_hda_attach_beep_device(codec, 0x1);
13614 if (board_config != ALC269_AUTO)
13615 setup_preset(codec, &alc269_presets[board_config]);
13617 if (codec->subsystem_id == 0x17aa3bf8) {
13618 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13619 * fix the sample rate of analog I/O to 44.1kHz
13621 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13622 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13624 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13625 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13627 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13628 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13630 spec->adc_nids = alc269_adc_nids;
13631 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13632 spec->capsrc_nids = alc269_capsrc_nids;
13633 if (!spec->cap_mixer)
13634 set_capture_mixer(codec);
13635 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13637 spec->vmaster_nid = 0x02;
13639 codec->patch_ops = alc_patch_ops;
13640 if (board_config == ALC269_AUTO)
13641 spec->init_hook = alc269_auto_init;
13642 #ifdef CONFIG_SND_HDA_POWER_SAVE
13643 if (!spec->loopback.amplist)
13644 spec->loopback.amplist = alc269_loopbacks;
13646 codec->proc_widget_hook = print_realtek_coef;
13652 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13656 * set the path ways for 2 channel output
13657 * need to set the codec line out and mic 1 pin widgets to inputs
13659 static struct hda_verb alc861_threestack_ch2_init[] = {
13660 /* set pin widget 1Ah (line in) for input */
13661 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13662 /* set pin widget 18h (mic1/2) for input, for mic also enable
13665 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13667 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13669 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13670 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13676 * need to set the codec line out and mic 1 pin widgets to outputs
13678 static struct hda_verb alc861_threestack_ch6_init[] = {
13679 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13680 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13681 /* set pin widget 18h (mic1) for output (CLFE)*/
13682 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13684 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13685 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13687 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13689 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13690 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13695 static struct hda_channel_mode alc861_threestack_modes[2] = {
13696 { 2, alc861_threestack_ch2_init },
13697 { 6, alc861_threestack_ch6_init },
13699 /* Set mic1 as input and unmute the mixer */
13700 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13701 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13702 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13705 /* Set mic1 as output and mute mixer */
13706 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13707 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13708 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13712 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13713 { 2, alc861_uniwill_m31_ch2_init },
13714 { 4, alc861_uniwill_m31_ch4_init },
13717 /* Set mic1 and line-in as input and unmute the mixer */
13718 static struct hda_verb alc861_asus_ch2_init[] = {
13719 /* set pin widget 1Ah (line in) for input */
13720 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13721 /* set pin widget 18h (mic1/2) for input, for mic also enable
13724 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13726 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13728 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13729 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13733 /* Set mic1 nad line-in as output and mute mixer */
13734 static struct hda_verb alc861_asus_ch6_init[] = {
13735 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13736 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13737 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13738 /* set pin widget 18h (mic1) for output (CLFE)*/
13739 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13740 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13741 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13742 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13744 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13746 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13747 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13752 static struct hda_channel_mode alc861_asus_modes[2] = {
13753 { 2, alc861_asus_ch2_init },
13754 { 6, alc861_asus_ch6_init },
13759 static struct snd_kcontrol_new alc861_base_mixer[] = {
13760 /* output mixer control */
13761 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13762 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13763 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13764 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13765 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13767 /*Input mixer control */
13768 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13769 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13770 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13771 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13772 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13773 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13774 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13775 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13776 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13777 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13782 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13783 /* output mixer control */
13784 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13785 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13786 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13787 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13788 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13790 /* Input mixer control */
13791 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13792 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13793 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13794 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13795 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13796 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13798 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13799 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13800 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13803 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13804 .name = "Channel Mode",
13805 .info = alc_ch_mode_info,
13806 .get = alc_ch_mode_get,
13807 .put = alc_ch_mode_put,
13808 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13813 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13814 /* output mixer control */
13815 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13816 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13817 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13822 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13823 /* output mixer control */
13824 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13825 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13826 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13827 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13828 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13830 /* Input mixer control */
13831 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13832 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13833 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13834 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13835 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13836 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13838 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13839 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13840 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13843 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13844 .name = "Channel Mode",
13845 .info = alc_ch_mode_info,
13846 .get = alc_ch_mode_get,
13847 .put = alc_ch_mode_put,
13848 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13853 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13854 /* output mixer control */
13855 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13856 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13857 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13858 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13859 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13861 /* Input mixer control */
13862 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13863 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13864 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13865 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13866 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13867 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13868 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13869 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13870 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13871 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13874 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13875 .name = "Channel Mode",
13876 .info = alc_ch_mode_info,
13877 .get = alc_ch_mode_get,
13878 .put = alc_ch_mode_put,
13879 .private_value = ARRAY_SIZE(alc861_asus_modes),
13884 /* additional mixer */
13885 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13886 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13887 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13892 * generic initialization of ADC, input mixers and output mixers
13894 static struct hda_verb alc861_base_init_verbs[] = {
13896 * Unmute ADC0 and set the default input to mic-in
13898 /* port-A for surround (rear panel) */
13899 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13900 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13901 /* port-B for mic-in (rear panel) with vref */
13902 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13903 /* port-C for line-in (rear panel) */
13904 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13905 /* port-D for Front */
13906 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13907 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13908 /* port-E for HP out (front panel) */
13909 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13910 /* route front PCM to HP */
13911 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13912 /* port-F for mic-in (front panel) with vref */
13913 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13914 /* port-G for CLFE (rear panel) */
13915 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13916 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13917 /* port-H for side (rear panel) */
13918 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13919 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13921 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13922 /* route front mic to ADC1*/
13923 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13924 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13926 /* Unmute DAC0~3 & spdif out*/
13927 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13928 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13929 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13930 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13931 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13933 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13934 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13935 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13936 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13937 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13939 /* Unmute Stereo Mixer 15 */
13940 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13941 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13942 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13943 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13945 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13946 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13947 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13948 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13949 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13950 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13951 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13952 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13953 /* hp used DAC 3 (Front) */
13954 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13955 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13960 static struct hda_verb alc861_threestack_init_verbs[] = {
13962 * Unmute ADC0 and set the default input to mic-in
13964 /* port-A for surround (rear panel) */
13965 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13966 /* port-B for mic-in (rear panel) with vref */
13967 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13968 /* port-C for line-in (rear panel) */
13969 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13970 /* port-D for Front */
13971 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13972 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13973 /* port-E for HP out (front panel) */
13974 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13975 /* route front PCM to HP */
13976 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13977 /* port-F for mic-in (front panel) with vref */
13978 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13979 /* port-G for CLFE (rear panel) */
13980 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13981 /* port-H for side (rear panel) */
13982 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13984 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13985 /* route front mic to ADC1*/
13986 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13987 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13988 /* Unmute DAC0~3 & spdif out*/
13989 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13990 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13991 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13992 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13993 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13995 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13996 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13997 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13998 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13999 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14001 /* Unmute Stereo Mixer 15 */
14002 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14003 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14004 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14007 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14008 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14009 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14010 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14011 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14012 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14013 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14014 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14015 /* hp used DAC 3 (Front) */
14016 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14017 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14021 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14023 * Unmute ADC0 and set the default input to mic-in
14025 /* port-A for surround (rear panel) */
14026 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14027 /* port-B for mic-in (rear panel) with vref */
14028 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14029 /* port-C for line-in (rear panel) */
14030 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14031 /* port-D for Front */
14032 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14033 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14034 /* port-E for HP out (front panel) */
14035 /* this has to be set to VREF80 */
14036 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14037 /* route front PCM to HP */
14038 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14039 /* port-F for mic-in (front panel) with vref */
14040 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14041 /* port-G for CLFE (rear panel) */
14042 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14043 /* port-H for side (rear panel) */
14044 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14046 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14047 /* route front mic to ADC1*/
14048 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14049 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14050 /* Unmute DAC0~3 & spdif out*/
14051 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14052 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14053 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14054 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14055 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14057 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14058 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14059 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14060 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14061 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14063 /* Unmute Stereo Mixer 15 */
14064 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14066 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14069 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14070 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14071 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14072 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14073 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14074 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14075 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14076 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14077 /* hp used DAC 3 (Front) */
14078 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14079 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14083 static struct hda_verb alc861_asus_init_verbs[] = {
14085 * Unmute ADC0 and set the default input to mic-in
14087 /* port-A for surround (rear panel)
14088 * according to codec#0 this is the HP jack
14090 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14091 /* route front PCM to HP */
14092 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14093 /* port-B for mic-in (rear panel) with vref */
14094 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14095 /* port-C for line-in (rear panel) */
14096 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14097 /* port-D for Front */
14098 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14099 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14100 /* port-E for HP out (front panel) */
14101 /* this has to be set to VREF80 */
14102 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14103 /* route front PCM to HP */
14104 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14105 /* port-F for mic-in (front panel) with vref */
14106 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14107 /* port-G for CLFE (rear panel) */
14108 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14109 /* port-H for side (rear panel) */
14110 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14112 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14113 /* route front mic to ADC1*/
14114 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14115 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14116 /* Unmute DAC0~3 & spdif out*/
14117 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14118 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14119 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14120 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14121 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14122 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14123 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14124 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14125 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14126 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14128 /* Unmute Stereo Mixer 15 */
14129 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14130 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14131 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14132 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14134 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14135 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14136 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14137 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14138 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14139 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14140 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14141 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14142 /* hp used DAC 3 (Front) */
14143 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14144 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14148 /* additional init verbs for ASUS laptops */
14149 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14150 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14151 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14156 * generic initialization of ADC, input mixers and output mixers
14158 static struct hda_verb alc861_auto_init_verbs[] = {
14160 * Unmute ADC0 and set the default input to mic-in
14162 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14163 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14165 /* Unmute DAC0~3 & spdif out*/
14166 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14167 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14168 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14169 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14170 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14172 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14173 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14174 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14175 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14176 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14178 /* Unmute Stereo Mixer 15 */
14179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14180 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14181 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14182 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14184 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14185 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14186 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14187 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14188 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14189 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14190 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14191 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14193 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14194 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14195 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14196 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14197 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14198 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14199 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14200 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14202 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14207 static struct hda_verb alc861_toshiba_init_verbs[] = {
14208 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14213 /* toggle speaker-output according to the hp-jack state */
14214 static void alc861_toshiba_automute(struct hda_codec *codec)
14216 unsigned int present;
14218 present = snd_hda_codec_read(codec, 0x0f, 0,
14219 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14220 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14221 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14222 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14223 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14226 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14229 if ((res >> 26) == ALC880_HP_EVENT)
14230 alc861_toshiba_automute(codec);
14233 /* pcm configuration: identical with ALC880 */
14234 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14235 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14236 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14237 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14240 #define ALC861_DIGOUT_NID 0x07
14242 static struct hda_channel_mode alc861_8ch_modes[1] = {
14246 static hda_nid_t alc861_dac_nids[4] = {
14247 /* front, surround, clfe, side */
14248 0x03, 0x06, 0x05, 0x04
14251 static hda_nid_t alc660_dac_nids[3] = {
14252 /* front, clfe, surround */
14256 static hda_nid_t alc861_adc_nids[1] = {
14261 static struct hda_input_mux alc861_capture_source = {
14265 { "Front Mic", 0x3 },
14272 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14274 struct alc_spec *spec = codec->spec;
14275 hda_nid_t mix, srcs[5];
14278 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14280 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14283 for (i = 0; i < num; i++) {
14285 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14286 if (type != AC_WID_AUD_OUT)
14288 for (j = 0; j < spec->multiout.num_dacs; j++)
14289 if (spec->multiout.dac_nids[j] == srcs[i])
14291 if (j >= spec->multiout.num_dacs)
14297 /* fill in the dac_nids table from the parsed pin configuration */
14298 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14299 const struct auto_pin_cfg *cfg)
14301 struct alc_spec *spec = codec->spec;
14303 hda_nid_t nid, dac;
14305 spec->multiout.dac_nids = spec->private_dac_nids;
14306 for (i = 0; i < cfg->line_outs; i++) {
14307 nid = cfg->line_out_pins[i];
14308 dac = alc861_look_for_dac(codec, nid);
14311 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14316 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14317 hda_nid_t nid, unsigned int chs)
14320 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
14321 return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name,
14322 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14325 /* add playback controls from the parsed DAC table */
14326 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14327 const struct auto_pin_cfg *cfg)
14329 struct alc_spec *spec = codec->spec;
14330 static const char *chname[4] = {
14331 "Front", "Surround", NULL /*CLFE*/, "Side"
14336 if (cfg->line_outs == 1) {
14337 const char *pfx = NULL;
14340 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14343 nid = spec->multiout.dac_nids[0];
14344 return alc861_create_out_sw(codec, pfx, nid, 3);
14348 for (i = 0; i < cfg->line_outs; i++) {
14349 nid = spec->multiout.dac_nids[i];
14354 err = alc861_create_out_sw(codec, "Center", nid, 1);
14357 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14361 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14369 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14371 struct alc_spec *spec = codec->spec;
14378 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14379 nid = alc861_look_for_dac(codec, pin);
14381 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14384 spec->multiout.hp_nid = nid;
14390 /* create playback/capture controls for input pins */
14391 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14392 const struct auto_pin_cfg *cfg)
14394 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14397 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14399 int pin_type, hda_nid_t dac)
14401 hda_nid_t mix, srcs[5];
14404 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14406 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14408 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14410 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14413 for (i = 0; i < num; i++) {
14415 if (srcs[i] == dac || srcs[i] == 0x15)
14416 mute = AMP_IN_UNMUTE(i);
14418 mute = AMP_IN_MUTE(i);
14419 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14424 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14426 struct alc_spec *spec = codec->spec;
14429 for (i = 0; i < spec->autocfg.line_outs; i++) {
14430 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14431 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14433 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14434 spec->multiout.dac_nids[i]);
14438 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14440 struct alc_spec *spec = codec->spec;
14442 if (spec->autocfg.hp_outs)
14443 alc861_auto_set_output_and_unmute(codec,
14444 spec->autocfg.hp_pins[0],
14446 spec->multiout.hp_nid);
14447 if (spec->autocfg.speaker_outs)
14448 alc861_auto_set_output_and_unmute(codec,
14449 spec->autocfg.speaker_pins[0],
14451 spec->multiout.dac_nids[0]);
14454 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14456 struct alc_spec *spec = codec->spec;
14459 for (i = 0; i < AUTO_PIN_LAST; i++) {
14460 hda_nid_t nid = spec->autocfg.input_pins[i];
14461 if (nid >= 0x0c && nid <= 0x11)
14462 alc_set_input_pin(codec, nid, i);
14466 /* parse the BIOS configuration and set up the alc_spec */
14467 /* return 1 if successful, 0 if the proper config is not found,
14468 * or a negative error code
14470 static int alc861_parse_auto_config(struct hda_codec *codec)
14472 struct alc_spec *spec = codec->spec;
14474 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14476 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14480 if (!spec->autocfg.line_outs)
14481 return 0; /* can't find valid BIOS pin config */
14483 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14486 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14489 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14492 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14496 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14498 if (spec->autocfg.dig_outs)
14499 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14501 if (spec->kctls.list)
14502 add_mixer(spec, spec->kctls.list);
14504 add_verb(spec, alc861_auto_init_verbs);
14506 spec->num_mux_defs = 1;
14507 spec->input_mux = &spec->private_imux[0];
14509 spec->adc_nids = alc861_adc_nids;
14510 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14511 set_capture_mixer(codec);
14513 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14518 /* additional initialization for auto-configuration model */
14519 static void alc861_auto_init(struct hda_codec *codec)
14521 struct alc_spec *spec = codec->spec;
14522 alc861_auto_init_multi_out(codec);
14523 alc861_auto_init_hp_out(codec);
14524 alc861_auto_init_analog_input(codec);
14525 if (spec->unsol_event)
14526 alc_inithook(codec);
14529 #ifdef CONFIG_SND_HDA_POWER_SAVE
14530 static struct hda_amp_list alc861_loopbacks[] = {
14531 { 0x15, HDA_INPUT, 0 },
14532 { 0x15, HDA_INPUT, 1 },
14533 { 0x15, HDA_INPUT, 2 },
14534 { 0x15, HDA_INPUT, 3 },
14541 * configuration and preset
14543 static const char *alc861_models[ALC861_MODEL_LAST] = {
14544 [ALC861_3ST] = "3stack",
14545 [ALC660_3ST] = "3stack-660",
14546 [ALC861_3ST_DIG] = "3stack-dig",
14547 [ALC861_6ST_DIG] = "6stack-dig",
14548 [ALC861_UNIWILL_M31] = "uniwill-m31",
14549 [ALC861_TOSHIBA] = "toshiba",
14550 [ALC861_ASUS] = "asus",
14551 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14552 [ALC861_AUTO] = "auto",
14555 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14556 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14557 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14558 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14559 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14560 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14561 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14562 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14563 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14564 * Any other models that need this preset?
14566 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14567 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14568 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14569 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14570 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14571 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14572 /* FIXME: the below seems conflict */
14573 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14574 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14575 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14579 static struct alc_config_preset alc861_presets[] = {
14581 .mixers = { alc861_3ST_mixer },
14582 .init_verbs = { alc861_threestack_init_verbs },
14583 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14584 .dac_nids = alc861_dac_nids,
14585 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14586 .channel_mode = alc861_threestack_modes,
14588 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14589 .adc_nids = alc861_adc_nids,
14590 .input_mux = &alc861_capture_source,
14592 [ALC861_3ST_DIG] = {
14593 .mixers = { alc861_base_mixer },
14594 .init_verbs = { alc861_threestack_init_verbs },
14595 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14596 .dac_nids = alc861_dac_nids,
14597 .dig_out_nid = ALC861_DIGOUT_NID,
14598 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14599 .channel_mode = alc861_threestack_modes,
14601 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14602 .adc_nids = alc861_adc_nids,
14603 .input_mux = &alc861_capture_source,
14605 [ALC861_6ST_DIG] = {
14606 .mixers = { alc861_base_mixer },
14607 .init_verbs = { alc861_base_init_verbs },
14608 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14609 .dac_nids = alc861_dac_nids,
14610 .dig_out_nid = ALC861_DIGOUT_NID,
14611 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14612 .channel_mode = alc861_8ch_modes,
14613 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14614 .adc_nids = alc861_adc_nids,
14615 .input_mux = &alc861_capture_source,
14618 .mixers = { alc861_3ST_mixer },
14619 .init_verbs = { alc861_threestack_init_verbs },
14620 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14621 .dac_nids = alc660_dac_nids,
14622 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14623 .channel_mode = alc861_threestack_modes,
14625 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14626 .adc_nids = alc861_adc_nids,
14627 .input_mux = &alc861_capture_source,
14629 [ALC861_UNIWILL_M31] = {
14630 .mixers = { alc861_uniwill_m31_mixer },
14631 .init_verbs = { alc861_uniwill_m31_init_verbs },
14632 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14633 .dac_nids = alc861_dac_nids,
14634 .dig_out_nid = ALC861_DIGOUT_NID,
14635 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14636 .channel_mode = alc861_uniwill_m31_modes,
14638 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14639 .adc_nids = alc861_adc_nids,
14640 .input_mux = &alc861_capture_source,
14642 [ALC861_TOSHIBA] = {
14643 .mixers = { alc861_toshiba_mixer },
14644 .init_verbs = { alc861_base_init_verbs,
14645 alc861_toshiba_init_verbs },
14646 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14647 .dac_nids = alc861_dac_nids,
14648 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14649 .channel_mode = alc883_3ST_2ch_modes,
14650 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14651 .adc_nids = alc861_adc_nids,
14652 .input_mux = &alc861_capture_source,
14653 .unsol_event = alc861_toshiba_unsol_event,
14654 .init_hook = alc861_toshiba_automute,
14657 .mixers = { alc861_asus_mixer },
14658 .init_verbs = { alc861_asus_init_verbs },
14659 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14660 .dac_nids = alc861_dac_nids,
14661 .dig_out_nid = ALC861_DIGOUT_NID,
14662 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14663 .channel_mode = alc861_asus_modes,
14666 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14667 .adc_nids = alc861_adc_nids,
14668 .input_mux = &alc861_capture_source,
14670 [ALC861_ASUS_LAPTOP] = {
14671 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14672 .init_verbs = { alc861_asus_init_verbs,
14673 alc861_asus_laptop_init_verbs },
14674 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14675 .dac_nids = alc861_dac_nids,
14676 .dig_out_nid = ALC861_DIGOUT_NID,
14677 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14678 .channel_mode = alc883_3ST_2ch_modes,
14680 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14681 .adc_nids = alc861_adc_nids,
14682 .input_mux = &alc861_capture_source,
14687 static int patch_alc861(struct hda_codec *codec)
14689 struct alc_spec *spec;
14693 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14697 codec->spec = spec;
14699 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14703 if (board_config < 0) {
14704 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14706 board_config = ALC861_AUTO;
14709 if (board_config == ALC861_AUTO) {
14710 /* automatic parse from the BIOS config */
14711 err = alc861_parse_auto_config(codec);
14717 "hda_codec: Cannot set up configuration "
14718 "from BIOS. Using base mode...\n");
14719 board_config = ALC861_3ST_DIG;
14723 err = snd_hda_attach_beep_device(codec, 0x23);
14729 if (board_config != ALC861_AUTO)
14730 setup_preset(codec, &alc861_presets[board_config]);
14732 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14733 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14735 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14736 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14738 if (!spec->cap_mixer)
14739 set_capture_mixer(codec);
14740 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14742 spec->vmaster_nid = 0x03;
14744 codec->patch_ops = alc_patch_ops;
14745 if (board_config == ALC861_AUTO)
14746 spec->init_hook = alc861_auto_init;
14747 #ifdef CONFIG_SND_HDA_POWER_SAVE
14748 if (!spec->loopback.amplist)
14749 spec->loopback.amplist = alc861_loopbacks;
14751 codec->proc_widget_hook = print_realtek_coef;
14757 * ALC861-VD support
14761 * In addition, an independent DAC
14763 #define ALC861VD_DIGOUT_NID 0x06
14765 static hda_nid_t alc861vd_dac_nids[4] = {
14766 /* front, surr, clfe, side surr */
14767 0x02, 0x03, 0x04, 0x05
14770 /* dac_nids for ALC660vd are in a different order - according to
14771 * Realtek's driver.
14772 * This should probably result in a different mixer for 6stack models
14773 * of ALC660vd codecs, but for now there is only 3stack mixer
14774 * - and it is the same as in 861vd.
14775 * adc_nids in ALC660vd are (is) the same as in 861vd
14777 static hda_nid_t alc660vd_dac_nids[3] = {
14778 /* front, rear, clfe, rear_surr */
14782 static hda_nid_t alc861vd_adc_nids[1] = {
14787 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14790 /* FIXME: should be a matrix-type input source selection */
14791 static struct hda_input_mux alc861vd_capture_source = {
14795 { "Front Mic", 0x1 },
14801 static struct hda_input_mux alc861vd_dallas_capture_source = {
14804 { "Ext Mic", 0x0 },
14805 { "Int Mic", 0x1 },
14809 static struct hda_input_mux alc861vd_hp_capture_source = {
14812 { "Front Mic", 0x0 },
14813 { "ATAPI Mic", 0x1 },
14820 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14827 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14828 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14829 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14830 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14831 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14838 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14839 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14840 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14841 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14842 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14846 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14847 { 6, alc861vd_6stack_ch6_init },
14848 { 8, alc861vd_6stack_ch8_init },
14851 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14853 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14854 .name = "Channel Mode",
14855 .info = alc_ch_mode_info,
14856 .get = alc_ch_mode_get,
14857 .put = alc_ch_mode_put,
14862 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14863 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14865 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14866 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14867 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14869 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14870 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14872 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14874 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14876 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14877 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14879 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14880 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14882 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14884 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14885 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14886 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14888 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14889 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14890 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14892 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14893 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14895 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14896 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14901 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14902 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14903 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14905 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14907 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14908 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14909 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14911 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14912 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14913 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14915 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14916 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14918 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14919 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14924 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14925 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14926 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14927 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14929 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14931 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14932 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14933 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14935 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14936 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14937 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14939 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14940 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14945 /* Pin assignment: Speaker=0x14, HP = 0x15,
14946 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14948 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14949 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14950 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14951 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14952 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14953 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14954 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14955 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14956 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14957 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14958 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14962 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14963 * Front Mic=0x18, ATAPI Mic = 0x19,
14965 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14966 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14967 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14968 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14969 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14970 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14971 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14972 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14973 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14979 * generic initialization of ADC, input mixers and output mixers
14981 static struct hda_verb alc861vd_volume_init_verbs[] = {
14983 * Unmute ADC0 and set the default input to mic-in
14985 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14986 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14988 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14989 * the analog-loopback mixer widget
14991 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14992 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14993 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14994 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14995 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14996 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14998 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14999 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15000 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15001 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15002 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15005 * Set up output mixers (0x02 - 0x05)
15007 /* set vol=0 to output mixers */
15008 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15009 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15010 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15011 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15013 /* set up input amps for analog loopback */
15014 /* Amp Indices: DAC = 0, mixer = 1 */
15015 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15016 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15017 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15018 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15019 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15020 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15021 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15022 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15028 * 3-stack pin configuration:
15029 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15031 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15033 * Set pin mode and muting
15035 /* set front pin widgets 0x14 for output */
15036 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15037 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15038 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15040 /* Mic (rear) pin: input vref at 80% */
15041 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15042 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15043 /* Front Mic pin: input vref at 80% */
15044 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15045 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15046 /* Line In pin: input */
15047 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15048 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15049 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15050 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15051 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15052 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15053 /* CD pin widget for input */
15054 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15060 * 6-stack pin configuration:
15062 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15064 * Set pin mode and muting
15066 /* set front pin widgets 0x14 for output */
15067 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15068 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15069 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15071 /* Rear Pin: output 1 (0x0d) */
15072 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15073 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15074 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15075 /* CLFE Pin: output 2 (0x0e) */
15076 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15077 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15078 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15079 /* Side Pin: output 3 (0x0f) */
15080 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15081 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15082 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15084 /* Mic (rear) pin: input vref at 80% */
15085 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15086 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15087 /* Front Mic pin: input vref at 80% */
15088 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15089 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15090 /* Line In pin: input */
15091 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15092 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15093 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15094 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15095 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15096 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15097 /* CD pin widget for input */
15098 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15103 static struct hda_verb alc861vd_eapd_verbs[] = {
15104 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15108 static struct hda_verb alc660vd_eapd_verbs[] = {
15109 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15110 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15114 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15115 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15116 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15118 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15119 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15123 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15125 unsigned int present;
15126 unsigned char bits;
15128 present = snd_hda_codec_read(codec, 0x18, 0,
15129 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15130 bits = present ? HDA_AMP_MUTE : 0;
15131 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15132 HDA_AMP_MUTE, bits);
15135 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15137 struct alc_spec *spec = codec->spec;
15138 spec->autocfg.hp_pins[0] = 0x1b;
15139 spec->autocfg.speaker_pins[0] = 0x14;
15142 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15144 alc_automute_amp(codec);
15145 alc861vd_lenovo_mic_automute(codec);
15148 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15151 switch (res >> 26) {
15152 case ALC880_MIC_EVENT:
15153 alc861vd_lenovo_mic_automute(codec);
15156 alc_automute_amp_unsol_event(codec, res);
15161 static struct hda_verb alc861vd_dallas_verbs[] = {
15162 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15163 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15164 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15165 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15167 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15168 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15169 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15170 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15171 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15172 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15173 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15174 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15176 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15177 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15178 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15180 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15181 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15182 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15183 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15185 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15186 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15187 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15188 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15189 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15190 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15191 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15192 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15194 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15195 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15196 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15197 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15199 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15200 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15201 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15206 /* toggle speaker-output according to the hp-jack state */
15207 static void alc861vd_dallas_setup(struct hda_codec *codec)
15209 struct alc_spec *spec = codec->spec;
15211 spec->autocfg.hp_pins[0] = 0x15;
15212 spec->autocfg.speaker_pins[0] = 0x14;
15215 #ifdef CONFIG_SND_HDA_POWER_SAVE
15216 #define alc861vd_loopbacks alc880_loopbacks
15219 /* pcm configuration: identical with ALC880 */
15220 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15221 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15222 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15223 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15226 * configuration and preset
15228 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15229 [ALC660VD_3ST] = "3stack-660",
15230 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15231 [ALC660VD_ASUS_V1S] = "asus-v1s",
15232 [ALC861VD_3ST] = "3stack",
15233 [ALC861VD_3ST_DIG] = "3stack-digout",
15234 [ALC861VD_6ST_DIG] = "6stack-digout",
15235 [ALC861VD_LENOVO] = "lenovo",
15236 [ALC861VD_DALLAS] = "dallas",
15237 [ALC861VD_HP] = "hp",
15238 [ALC861VD_AUTO] = "auto",
15241 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15242 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15243 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15244 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15245 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15246 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15247 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15248 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15249 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15250 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15251 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15252 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15253 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15254 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15255 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15256 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15260 static struct alc_config_preset alc861vd_presets[] = {
15262 .mixers = { alc861vd_3st_mixer },
15263 .init_verbs = { alc861vd_volume_init_verbs,
15264 alc861vd_3stack_init_verbs },
15265 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15266 .dac_nids = alc660vd_dac_nids,
15267 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15268 .channel_mode = alc861vd_3stack_2ch_modes,
15269 .input_mux = &alc861vd_capture_source,
15271 [ALC660VD_3ST_DIG] = {
15272 .mixers = { alc861vd_3st_mixer },
15273 .init_verbs = { alc861vd_volume_init_verbs,
15274 alc861vd_3stack_init_verbs },
15275 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15276 .dac_nids = alc660vd_dac_nids,
15277 .dig_out_nid = ALC861VD_DIGOUT_NID,
15278 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15279 .channel_mode = alc861vd_3stack_2ch_modes,
15280 .input_mux = &alc861vd_capture_source,
15283 .mixers = { alc861vd_3st_mixer },
15284 .init_verbs = { alc861vd_volume_init_verbs,
15285 alc861vd_3stack_init_verbs },
15286 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15287 .dac_nids = alc861vd_dac_nids,
15288 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15289 .channel_mode = alc861vd_3stack_2ch_modes,
15290 .input_mux = &alc861vd_capture_source,
15292 [ALC861VD_3ST_DIG] = {
15293 .mixers = { alc861vd_3st_mixer },
15294 .init_verbs = { alc861vd_volume_init_verbs,
15295 alc861vd_3stack_init_verbs },
15296 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15297 .dac_nids = alc861vd_dac_nids,
15298 .dig_out_nid = ALC861VD_DIGOUT_NID,
15299 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15300 .channel_mode = alc861vd_3stack_2ch_modes,
15301 .input_mux = &alc861vd_capture_source,
15303 [ALC861VD_6ST_DIG] = {
15304 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15305 .init_verbs = { alc861vd_volume_init_verbs,
15306 alc861vd_6stack_init_verbs },
15307 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15308 .dac_nids = alc861vd_dac_nids,
15309 .dig_out_nid = ALC861VD_DIGOUT_NID,
15310 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15311 .channel_mode = alc861vd_6stack_modes,
15312 .input_mux = &alc861vd_capture_source,
15314 [ALC861VD_LENOVO] = {
15315 .mixers = { alc861vd_lenovo_mixer },
15316 .init_verbs = { alc861vd_volume_init_verbs,
15317 alc861vd_3stack_init_verbs,
15318 alc861vd_eapd_verbs,
15319 alc861vd_lenovo_unsol_verbs },
15320 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15321 .dac_nids = alc660vd_dac_nids,
15322 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15323 .channel_mode = alc861vd_3stack_2ch_modes,
15324 .input_mux = &alc861vd_capture_source,
15325 .unsol_event = alc861vd_lenovo_unsol_event,
15326 .setup = alc861vd_lenovo_setup,
15327 .init_hook = alc861vd_lenovo_init_hook,
15329 [ALC861VD_DALLAS] = {
15330 .mixers = { alc861vd_dallas_mixer },
15331 .init_verbs = { alc861vd_dallas_verbs },
15332 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15333 .dac_nids = alc861vd_dac_nids,
15334 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15335 .channel_mode = alc861vd_3stack_2ch_modes,
15336 .input_mux = &alc861vd_dallas_capture_source,
15337 .unsol_event = alc_automute_amp_unsol_event,
15338 .setup = alc861vd_dallas_setup,
15339 .init_hook = alc_automute_amp,
15342 .mixers = { alc861vd_hp_mixer },
15343 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15344 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15345 .dac_nids = alc861vd_dac_nids,
15346 .dig_out_nid = ALC861VD_DIGOUT_NID,
15347 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15348 .channel_mode = alc861vd_3stack_2ch_modes,
15349 .input_mux = &alc861vd_hp_capture_source,
15350 .unsol_event = alc_automute_amp_unsol_event,
15351 .setup = alc861vd_dallas_setup,
15352 .init_hook = alc_automute_amp,
15354 [ALC660VD_ASUS_V1S] = {
15355 .mixers = { alc861vd_lenovo_mixer },
15356 .init_verbs = { alc861vd_volume_init_verbs,
15357 alc861vd_3stack_init_verbs,
15358 alc861vd_eapd_verbs,
15359 alc861vd_lenovo_unsol_verbs },
15360 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15361 .dac_nids = alc660vd_dac_nids,
15362 .dig_out_nid = ALC861VD_DIGOUT_NID,
15363 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15364 .channel_mode = alc861vd_3stack_2ch_modes,
15365 .input_mux = &alc861vd_capture_source,
15366 .unsol_event = alc861vd_lenovo_unsol_event,
15367 .setup = alc861vd_lenovo_setup,
15368 .init_hook = alc861vd_lenovo_init_hook,
15373 * BIOS auto configuration
15375 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15376 const struct auto_pin_cfg *cfg)
15378 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0);
15382 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15383 hda_nid_t nid, int pin_type, int dac_idx)
15385 alc_set_pin_output(codec, nid, pin_type);
15388 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15390 struct alc_spec *spec = codec->spec;
15393 for (i = 0; i <= HDA_SIDE; i++) {
15394 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15395 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15397 alc861vd_auto_set_output_and_unmute(codec, nid,
15403 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15405 struct alc_spec *spec = codec->spec;
15408 pin = spec->autocfg.hp_pins[0];
15409 if (pin) /* connect to front and use dac 0 */
15410 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15411 pin = spec->autocfg.speaker_pins[0];
15413 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15416 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15418 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15420 struct alc_spec *spec = codec->spec;
15423 for (i = 0; i < AUTO_PIN_LAST; i++) {
15424 hda_nid_t nid = spec->autocfg.input_pins[i];
15425 if (alc_is_input_pin(codec, nid)) {
15426 alc_set_input_pin(codec, nid, i);
15427 if (nid != ALC861VD_PIN_CD_NID &&
15428 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15429 snd_hda_codec_write(codec, nid, 0,
15430 AC_VERB_SET_AMP_GAIN_MUTE,
15436 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15438 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15439 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15441 /* add playback controls from the parsed DAC table */
15442 /* Based on ALC880 version. But ALC861VD has separate,
15443 * different NIDs for mute/unmute switch and volume control */
15444 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15445 const struct auto_pin_cfg *cfg)
15448 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15449 hda_nid_t nid_v, nid_s;
15452 for (i = 0; i < cfg->line_outs; i++) {
15453 if (!spec->multiout.dac_nids[i])
15455 nid_v = alc861vd_idx_to_mixer_vol(
15457 spec->multiout.dac_nids[i]));
15458 nid_s = alc861vd_idx_to_mixer_switch(
15460 spec->multiout.dac_nids[i]));
15464 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15465 "Center Playback Volume",
15466 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15470 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15471 "LFE Playback Volume",
15472 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15476 err = add_control(spec, ALC_CTL_BIND_MUTE,
15477 "Center Playback Switch",
15478 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15482 err = add_control(spec, ALC_CTL_BIND_MUTE,
15483 "LFE Playback Switch",
15484 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15490 if (cfg->line_outs == 1 &&
15491 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15498 sprintf(name, "%s Playback Volume", pfx);
15499 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15500 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15504 if (cfg->line_outs == 1 &&
15505 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15507 sprintf(name, "%s Playback Switch", pfx);
15508 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15509 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15518 /* add playback controls for speaker and HP outputs */
15519 /* Based on ALC880 version. But ALC861VD has separate,
15520 * different NIDs for mute/unmute switch and volume control */
15521 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15522 hda_nid_t pin, const char *pfx)
15524 hda_nid_t nid_v, nid_s;
15531 if (alc880_is_fixed_pin(pin)) {
15532 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15533 /* specify the DAC as the extra output */
15534 if (!spec->multiout.hp_nid)
15535 spec->multiout.hp_nid = nid_v;
15537 spec->multiout.extra_out_nid[0] = nid_v;
15538 /* control HP volume/switch on the output mixer amp */
15539 nid_v = alc861vd_idx_to_mixer_vol(
15540 alc880_fixed_pin_idx(pin));
15541 nid_s = alc861vd_idx_to_mixer_switch(
15542 alc880_fixed_pin_idx(pin));
15544 sprintf(name, "%s Playback Volume", pfx);
15545 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15546 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15549 sprintf(name, "%s Playback Switch", pfx);
15550 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15551 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15554 } else if (alc880_is_multi_pin(pin)) {
15555 /* set manual connection */
15556 /* we have only a switch on HP-out PIN */
15557 sprintf(name, "%s Playback Switch", pfx);
15558 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15559 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15566 /* parse the BIOS configuration and set up the alc_spec
15567 * return 1 if successful, 0 if the proper config is not found,
15568 * or a negative error code
15569 * Based on ALC880 version - had to change it to override
15570 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15571 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15573 struct alc_spec *spec = codec->spec;
15575 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15577 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15581 if (!spec->autocfg.line_outs)
15582 return 0; /* can't find valid BIOS pin config */
15584 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15587 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15590 err = alc861vd_auto_create_extra_out(spec,
15591 spec->autocfg.speaker_pins[0],
15595 err = alc861vd_auto_create_extra_out(spec,
15596 spec->autocfg.hp_pins[0],
15600 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15604 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15606 if (spec->autocfg.dig_outs)
15607 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15609 if (spec->kctls.list)
15610 add_mixer(spec, spec->kctls.list);
15612 add_verb(spec, alc861vd_volume_init_verbs);
15614 spec->num_mux_defs = 1;
15615 spec->input_mux = &spec->private_imux[0];
15617 err = alc_auto_add_mic_boost(codec);
15621 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15626 /* additional initialization for auto-configuration model */
15627 static void alc861vd_auto_init(struct hda_codec *codec)
15629 struct alc_spec *spec = codec->spec;
15630 alc861vd_auto_init_multi_out(codec);
15631 alc861vd_auto_init_hp_out(codec);
15632 alc861vd_auto_init_analog_input(codec);
15633 alc861vd_auto_init_input_src(codec);
15634 if (spec->unsol_event)
15635 alc_inithook(codec);
15639 ALC660VD_FIX_ASUS_GPIO1
15643 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15644 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15645 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15646 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15650 static const struct alc_fixup alc861vd_fixups[] = {
15651 [ALC660VD_FIX_ASUS_GPIO1] = {
15652 .verbs = alc660vd_fix_asus_gpio1_verbs,
15656 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15657 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15661 static int patch_alc861vd(struct hda_codec *codec)
15663 struct alc_spec *spec;
15664 int err, board_config;
15666 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15670 codec->spec = spec;
15672 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15676 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15677 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15679 board_config = ALC861VD_AUTO;
15682 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15684 if (board_config == ALC861VD_AUTO) {
15685 /* automatic parse from the BIOS config */
15686 err = alc861vd_parse_auto_config(codec);
15692 "hda_codec: Cannot set up configuration "
15693 "from BIOS. Using base mode...\n");
15694 board_config = ALC861VD_3ST;
15698 err = snd_hda_attach_beep_device(codec, 0x23);
15704 if (board_config != ALC861VD_AUTO)
15705 setup_preset(codec, &alc861vd_presets[board_config]);
15707 if (codec->vendor_id == 0x10ec0660) {
15708 /* always turn on EAPD */
15709 add_verb(spec, alc660vd_eapd_verbs);
15712 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15713 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15715 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15716 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15718 if (!spec->adc_nids) {
15719 spec->adc_nids = alc861vd_adc_nids;
15720 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15722 if (!spec->capsrc_nids)
15723 spec->capsrc_nids = alc861vd_capsrc_nids;
15725 set_capture_mixer(codec);
15726 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15728 spec->vmaster_nid = 0x02;
15730 codec->patch_ops = alc_patch_ops;
15732 if (board_config == ALC861VD_AUTO)
15733 spec->init_hook = alc861vd_auto_init;
15734 #ifdef CONFIG_SND_HDA_POWER_SAVE
15735 if (!spec->loopback.amplist)
15736 spec->loopback.amplist = alc861vd_loopbacks;
15738 codec->proc_widget_hook = print_realtek_coef;
15746 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15747 * configuration. Each pin widget can choose any input DACs and a mixer.
15748 * Each ADC is connected from a mixer of all inputs. This makes possible
15749 * 6-channel independent captures.
15751 * In addition, an independent DAC for the multi-playback (not used in this
15754 #define ALC662_DIGOUT_NID 0x06
15755 #define ALC662_DIGIN_NID 0x0a
15757 static hda_nid_t alc662_dac_nids[4] = {
15758 /* front, rear, clfe, rear_surr */
15762 static hda_nid_t alc272_dac_nids[2] = {
15766 static hda_nid_t alc662_adc_nids[2] = {
15771 static hda_nid_t alc272_adc_nids[1] = {
15776 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15777 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15781 /* FIXME: should be a matrix-type input source selection */
15782 static struct hda_input_mux alc662_capture_source = {
15786 { "Front Mic", 0x1 },
15792 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15800 static struct hda_input_mux alc663_capture_source = {
15804 { "Front Mic", 0x1 },
15809 #if 0 /* set to 1 for testing other input sources below */
15810 static struct hda_input_mux alc272_nc10_capture_source = {
15813 { "Autoselect Mic", 0x0 },
15814 { "Internal Mic", 0x1 },
15815 { "In-0x02", 0x2 },
15816 { "In-0x03", 0x3 },
15817 { "In-0x04", 0x4 },
15818 { "In-0x05", 0x5 },
15819 { "In-0x06", 0x6 },
15820 { "In-0x07", 0x7 },
15821 { "In-0x08", 0x8 },
15822 { "In-0x09", 0x9 },
15823 { "In-0x0a", 0x0a },
15824 { "In-0x0b", 0x0b },
15825 { "In-0x0c", 0x0c },
15826 { "In-0x0d", 0x0d },
15827 { "In-0x0e", 0x0e },
15828 { "In-0x0f", 0x0f },
15836 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15843 static struct hda_verb alc662_3ST_ch2_init[] = {
15844 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15845 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15846 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15847 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15854 static struct hda_verb alc662_3ST_ch6_init[] = {
15855 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15856 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15857 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15858 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15859 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15860 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15864 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15865 { 2, alc662_3ST_ch2_init },
15866 { 6, alc662_3ST_ch6_init },
15872 static struct hda_verb alc662_sixstack_ch6_init[] = {
15873 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15874 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15875 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15882 static struct hda_verb alc662_sixstack_ch8_init[] = {
15883 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15884 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15885 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15889 static struct hda_channel_mode alc662_5stack_modes[2] = {
15890 { 2, alc662_sixstack_ch6_init },
15891 { 6, alc662_sixstack_ch8_init },
15894 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15895 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15898 static struct snd_kcontrol_new alc662_base_mixer[] = {
15899 /* output mixer control */
15900 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15901 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15902 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15903 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15904 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15905 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15906 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15907 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15908 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15910 /*Input mixer control */
15911 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15912 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15913 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15914 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15915 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15916 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15917 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15918 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15922 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15923 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15924 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15926 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15927 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15928 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15929 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15930 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15931 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15932 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15933 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15937 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15938 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15939 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15940 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15941 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15942 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15943 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15944 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15945 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15946 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15947 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15948 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15949 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15950 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15951 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15952 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15953 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15954 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15958 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15959 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15960 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15961 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15962 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15963 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15964 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15965 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15966 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15967 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15971 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15972 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15973 ALC262_HIPPO_MASTER_SWITCH,
15975 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15976 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15977 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15979 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15980 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15981 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15985 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15986 ALC262_HIPPO_MASTER_SWITCH,
15987 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15988 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15989 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15990 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15991 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15992 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15993 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15994 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15995 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15999 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16000 .ops = &snd_hda_bind_vol,
16002 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16003 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16008 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16009 .ops = &snd_hda_bind_sw,
16011 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16012 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16017 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16018 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16019 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16025 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16026 .ops = &snd_hda_bind_sw,
16028 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16029 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16030 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16035 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16036 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16037 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16038 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16039 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16040 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16041 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16046 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16047 .ops = &snd_hda_bind_sw,
16049 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16050 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16051 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16056 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16057 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16058 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16059 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16060 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16061 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16062 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16066 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16067 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16068 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16069 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16070 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16071 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16072 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16073 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16077 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16078 .ops = &snd_hda_bind_vol,
16080 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16081 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16086 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16087 .ops = &snd_hda_bind_sw,
16089 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16090 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16095 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16096 HDA_BIND_VOL("Master Playback Volume",
16097 &alc663_asus_two_bind_master_vol),
16098 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16099 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16100 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16102 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16106 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16107 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16108 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16109 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16110 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16111 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16116 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16117 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16118 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16119 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16120 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16121 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16124 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16125 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16126 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16130 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16131 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16132 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16133 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16135 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16136 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16137 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16138 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16139 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16140 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16144 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16146 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16147 .name = "Channel Mode",
16148 .info = alc_ch_mode_info,
16149 .get = alc_ch_mode_get,
16150 .put = alc_ch_mode_put,
16155 static struct hda_verb alc662_init_verbs[] = {
16156 /* ADC: mute amp left and right */
16157 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16158 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16159 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16161 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16162 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16163 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16164 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16165 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16167 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16168 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16169 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16170 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16171 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16172 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16174 /* Front Pin: output 0 (0x0c) */
16175 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16176 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16178 /* Rear Pin: output 1 (0x0d) */
16179 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16180 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16182 /* CLFE Pin: output 2 (0x0e) */
16183 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16184 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16186 /* Mic (rear) pin: input vref at 80% */
16187 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16188 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16189 /* Front Mic pin: input vref at 80% */
16190 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16191 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16192 /* Line In pin: input */
16193 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16194 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16195 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16196 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16197 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16198 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16199 /* CD pin widget for input */
16200 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16202 /* FIXME: use matrix-type input source selection */
16203 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16206 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16208 /* always trun on EAPD */
16209 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16210 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16215 static struct hda_verb alc662_sue_init_verbs[] = {
16216 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16217 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16221 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16222 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16223 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16227 /* Set Unsolicited Event*/
16228 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16229 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16230 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16235 * generic initialization of ADC, input mixers and output mixers
16237 static struct hda_verb alc662_auto_init_verbs[] = {
16239 * Unmute ADC and set the default input to mic-in
16241 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16242 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16244 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16246 * Note: PASD motherboards uses the Line In 2 as the input for front
16247 * panel mic (mic 2)
16249 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16254 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16257 * Set up output mixers (0x0c - 0x0f)
16259 /* set vol=0 to output mixers */
16260 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16261 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16262 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16264 /* set up input amps for analog loopback */
16265 /* Amp Indices: DAC = 0, mixer = 1 */
16266 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16267 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16268 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16269 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16270 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16271 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16274 /* FIXME: use matrix-type input source selection */
16275 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16277 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16278 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16282 /* additional verbs for ALC663 */
16283 static struct hda_verb alc663_auto_init_verbs[] = {
16284 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16285 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16289 static struct hda_verb alc663_m51va_init_verbs[] = {
16290 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16291 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16292 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16293 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16294 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16295 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16296 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16297 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16298 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16302 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16303 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16304 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16305 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16306 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16307 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16308 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16309 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16313 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16314 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16315 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16316 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16317 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16318 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16319 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16320 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16321 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16325 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16327 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16328 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16329 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16330 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16331 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16332 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16336 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16337 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16338 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16339 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16340 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16341 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16342 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16343 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16345 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16346 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16347 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16348 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16352 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16353 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16354 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16355 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16356 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16357 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16358 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16359 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16360 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16361 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16362 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16363 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16364 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16368 static struct hda_verb alc663_g71v_init_verbs[] = {
16369 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16370 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16371 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16373 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16374 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16375 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16377 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16378 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16379 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16383 static struct hda_verb alc663_g50v_init_verbs[] = {
16384 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16385 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16386 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16388 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16389 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16393 static struct hda_verb alc662_ecs_init_verbs[] = {
16394 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16395 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16396 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16397 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16401 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16402 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16403 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16404 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16405 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16406 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16407 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16408 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16409 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16411 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16412 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16416 static struct hda_verb alc272_dell_init_verbs[] = {
16417 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16418 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16419 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16420 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16421 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16422 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16423 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16424 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16425 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16426 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16427 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16431 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16432 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16433 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16437 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16438 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16439 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16443 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16445 unsigned int present;
16446 unsigned char bits;
16448 present = snd_hda_codec_read(codec, 0x14, 0,
16449 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16450 bits = present ? HDA_AMP_MUTE : 0;
16451 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16452 HDA_AMP_MUTE, bits);
16455 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16457 unsigned int present;
16458 unsigned char bits;
16460 present = snd_hda_codec_read(codec, 0x1b, 0,
16461 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16462 bits = present ? HDA_AMP_MUTE : 0;
16463 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16464 HDA_AMP_MUTE, bits);
16465 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16466 HDA_AMP_MUTE, bits);
16469 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16472 if ((res >> 26) == ALC880_HP_EVENT)
16473 alc662_lenovo_101e_all_automute(codec);
16474 if ((res >> 26) == ALC880_FRONT_EVENT)
16475 alc662_lenovo_101e_ispeaker_automute(codec);
16478 /* unsolicited event for HP jack sensing */
16479 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16482 if ((res >> 26) == ALC880_MIC_EVENT)
16483 alc_mic_automute(codec);
16485 alc262_hippo_unsol_event(codec, res);
16488 static void alc662_eeepc_setup(struct hda_codec *codec)
16490 struct alc_spec *spec = codec->spec;
16492 alc262_hippo1_setup(codec);
16493 spec->ext_mic.pin = 0x18;
16494 spec->ext_mic.mux_idx = 0;
16495 spec->int_mic.pin = 0x19;
16496 spec->int_mic.mux_idx = 1;
16497 spec->auto_mic = 1;
16500 static void alc662_eeepc_inithook(struct hda_codec *codec)
16502 alc262_hippo_automute(codec);
16503 alc_mic_automute(codec);
16506 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16508 struct alc_spec *spec = codec->spec;
16510 spec->autocfg.hp_pins[0] = 0x14;
16511 spec->autocfg.speaker_pins[0] = 0x1b;
16514 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16516 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16518 unsigned int present;
16519 unsigned char bits;
16521 present = snd_hda_codec_read(codec, 0x21, 0,
16522 AC_VERB_GET_PIN_SENSE, 0)
16523 & AC_PINSENSE_PRESENCE;
16524 bits = present ? HDA_AMP_MUTE : 0;
16525 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16526 AMP_IN_MUTE(0), bits);
16527 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16528 AMP_IN_MUTE(0), bits);
16531 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16533 unsigned int present;
16534 unsigned char bits;
16536 present = snd_hda_codec_read(codec, 0x21, 0,
16537 AC_VERB_GET_PIN_SENSE, 0)
16538 & AC_PINSENSE_PRESENCE;
16539 bits = present ? HDA_AMP_MUTE : 0;
16540 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16541 AMP_IN_MUTE(0), bits);
16542 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16543 AMP_IN_MUTE(0), bits);
16544 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16545 AMP_IN_MUTE(0), bits);
16546 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16547 AMP_IN_MUTE(0), bits);
16550 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16552 unsigned int present;
16553 unsigned char bits;
16555 present = snd_hda_codec_read(codec, 0x15, 0,
16556 AC_VERB_GET_PIN_SENSE, 0)
16557 & AC_PINSENSE_PRESENCE;
16558 bits = present ? HDA_AMP_MUTE : 0;
16559 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16560 AMP_IN_MUTE(0), bits);
16561 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16562 AMP_IN_MUTE(0), bits);
16563 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16564 AMP_IN_MUTE(0), bits);
16565 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16566 AMP_IN_MUTE(0), bits);
16569 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16571 unsigned int present;
16572 unsigned char bits;
16574 present = snd_hda_codec_read(codec, 0x1b, 0,
16575 AC_VERB_GET_PIN_SENSE, 0)
16576 & AC_PINSENSE_PRESENCE;
16577 bits = present ? 0 : PIN_OUT;
16578 snd_hda_codec_write(codec, 0x14, 0,
16579 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16582 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16584 unsigned int present1, present2;
16586 present1 = snd_hda_codec_read(codec, 0x21, 0,
16587 AC_VERB_GET_PIN_SENSE, 0)
16588 & AC_PINSENSE_PRESENCE;
16589 present2 = snd_hda_codec_read(codec, 0x15, 0,
16590 AC_VERB_GET_PIN_SENSE, 0)
16591 & AC_PINSENSE_PRESENCE;
16593 if (present1 || present2) {
16594 snd_hda_codec_write_cache(codec, 0x14, 0,
16595 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16597 snd_hda_codec_write_cache(codec, 0x14, 0,
16598 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16602 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16604 unsigned int present1, present2;
16606 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16607 AC_VERB_GET_PIN_SENSE, 0)
16608 & AC_PINSENSE_PRESENCE;
16609 present2 = snd_hda_codec_read(codec, 0x15, 0,
16610 AC_VERB_GET_PIN_SENSE, 0)
16611 & AC_PINSENSE_PRESENCE;
16613 if (present1 || present2) {
16614 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16615 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16616 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16617 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16619 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16620 AMP_IN_MUTE(0), 0);
16621 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16622 AMP_IN_MUTE(0), 0);
16626 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16629 switch (res >> 26) {
16630 case ALC880_HP_EVENT:
16631 alc663_m51va_speaker_automute(codec);
16633 case ALC880_MIC_EVENT:
16634 alc_mic_automute(codec);
16639 static void alc663_m51va_setup(struct hda_codec *codec)
16641 struct alc_spec *spec = codec->spec;
16642 spec->ext_mic.pin = 0x18;
16643 spec->ext_mic.mux_idx = 0;
16644 spec->int_mic.pin = 0x12;
16645 spec->int_mic.mux_idx = 1;
16646 spec->auto_mic = 1;
16649 static void alc663_m51va_inithook(struct hda_codec *codec)
16651 alc663_m51va_speaker_automute(codec);
16652 alc_mic_automute(codec);
16655 /* ***************** Mode1 ******************************/
16656 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16657 #define alc663_mode1_setup alc663_m51va_setup
16658 #define alc663_mode1_inithook alc663_m51va_inithook
16660 /* ***************** Mode2 ******************************/
16661 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16664 switch (res >> 26) {
16665 case ALC880_HP_EVENT:
16666 alc662_f5z_speaker_automute(codec);
16668 case ALC880_MIC_EVENT:
16669 alc_mic_automute(codec);
16674 #define alc662_mode2_setup alc663_m51va_setup
16676 static void alc662_mode2_inithook(struct hda_codec *codec)
16678 alc662_f5z_speaker_automute(codec);
16679 alc_mic_automute(codec);
16681 /* ***************** Mode3 ******************************/
16682 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16685 switch (res >> 26) {
16686 case ALC880_HP_EVENT:
16687 alc663_two_hp_m1_speaker_automute(codec);
16689 case ALC880_MIC_EVENT:
16690 alc_mic_automute(codec);
16695 #define alc663_mode3_setup alc663_m51va_setup
16697 static void alc663_mode3_inithook(struct hda_codec *codec)
16699 alc663_two_hp_m1_speaker_automute(codec);
16700 alc_mic_automute(codec);
16702 /* ***************** Mode4 ******************************/
16703 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16706 switch (res >> 26) {
16707 case ALC880_HP_EVENT:
16708 alc663_21jd_two_speaker_automute(codec);
16710 case ALC880_MIC_EVENT:
16711 alc_mic_automute(codec);
16716 #define alc663_mode4_setup alc663_m51va_setup
16718 static void alc663_mode4_inithook(struct hda_codec *codec)
16720 alc663_21jd_two_speaker_automute(codec);
16721 alc_mic_automute(codec);
16723 /* ***************** Mode5 ******************************/
16724 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16727 switch (res >> 26) {
16728 case ALC880_HP_EVENT:
16729 alc663_15jd_two_speaker_automute(codec);
16731 case ALC880_MIC_EVENT:
16732 alc_mic_automute(codec);
16737 #define alc663_mode5_setup alc663_m51va_setup
16739 static void alc663_mode5_inithook(struct hda_codec *codec)
16741 alc663_15jd_two_speaker_automute(codec);
16742 alc_mic_automute(codec);
16744 /* ***************** Mode6 ******************************/
16745 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16748 switch (res >> 26) {
16749 case ALC880_HP_EVENT:
16750 alc663_two_hp_m2_speaker_automute(codec);
16752 case ALC880_MIC_EVENT:
16753 alc_mic_automute(codec);
16758 #define alc663_mode6_setup alc663_m51va_setup
16760 static void alc663_mode6_inithook(struct hda_codec *codec)
16762 alc663_two_hp_m2_speaker_automute(codec);
16763 alc_mic_automute(codec);
16766 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16768 unsigned int present;
16769 unsigned char bits;
16771 present = snd_hda_codec_read(codec, 0x21, 0,
16772 AC_VERB_GET_PIN_SENSE, 0)
16773 & AC_PINSENSE_PRESENCE;
16774 bits = present ? HDA_AMP_MUTE : 0;
16775 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16776 HDA_AMP_MUTE, bits);
16777 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16778 HDA_AMP_MUTE, bits);
16781 static void alc663_g71v_front_automute(struct hda_codec *codec)
16783 unsigned int present;
16784 unsigned char bits;
16786 present = snd_hda_codec_read(codec, 0x15, 0,
16787 AC_VERB_GET_PIN_SENSE, 0)
16788 & AC_PINSENSE_PRESENCE;
16789 bits = present ? HDA_AMP_MUTE : 0;
16790 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16791 HDA_AMP_MUTE, bits);
16794 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16797 switch (res >> 26) {
16798 case ALC880_HP_EVENT:
16799 alc663_g71v_hp_automute(codec);
16801 case ALC880_FRONT_EVENT:
16802 alc663_g71v_front_automute(codec);
16804 case ALC880_MIC_EVENT:
16805 alc_mic_automute(codec);
16810 #define alc663_g71v_setup alc663_m51va_setup
16812 static void alc663_g71v_inithook(struct hda_codec *codec)
16814 alc663_g71v_front_automute(codec);
16815 alc663_g71v_hp_automute(codec);
16816 alc_mic_automute(codec);
16819 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16822 switch (res >> 26) {
16823 case ALC880_HP_EVENT:
16824 alc663_m51va_speaker_automute(codec);
16826 case ALC880_MIC_EVENT:
16827 alc_mic_automute(codec);
16832 #define alc663_g50v_setup alc663_m51va_setup
16834 static void alc663_g50v_inithook(struct hda_codec *codec)
16836 alc663_m51va_speaker_automute(codec);
16837 alc_mic_automute(codec);
16840 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16841 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16842 ALC262_HIPPO_MASTER_SWITCH,
16844 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16845 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16846 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16848 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16849 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16850 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16854 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16855 /* Master Playback automatically created from Speaker and Headphone */
16856 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16857 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16858 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16859 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16861 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16862 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16863 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16865 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16866 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16867 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16871 #ifdef CONFIG_SND_HDA_POWER_SAVE
16872 #define alc662_loopbacks alc880_loopbacks
16876 /* pcm configuration: identical with ALC880 */
16877 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16878 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16879 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16880 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16883 * configuration and preset
16885 static const char *alc662_models[ALC662_MODEL_LAST] = {
16886 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16887 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16888 [ALC662_3ST_6ch] = "3stack-6ch",
16889 [ALC662_5ST_DIG] = "6stack-dig",
16890 [ALC662_LENOVO_101E] = "lenovo-101e",
16891 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16892 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16893 [ALC662_ECS] = "ecs",
16894 [ALC663_ASUS_M51VA] = "m51va",
16895 [ALC663_ASUS_G71V] = "g71v",
16896 [ALC663_ASUS_H13] = "h13",
16897 [ALC663_ASUS_G50V] = "g50v",
16898 [ALC663_ASUS_MODE1] = "asus-mode1",
16899 [ALC662_ASUS_MODE2] = "asus-mode2",
16900 [ALC663_ASUS_MODE3] = "asus-mode3",
16901 [ALC663_ASUS_MODE4] = "asus-mode4",
16902 [ALC663_ASUS_MODE5] = "asus-mode5",
16903 [ALC663_ASUS_MODE6] = "asus-mode6",
16904 [ALC272_DELL] = "dell",
16905 [ALC272_DELL_ZM1] = "dell-zm1",
16906 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16907 [ALC662_AUTO] = "auto",
16910 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16911 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16912 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16913 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16914 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16915 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16916 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16917 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16918 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16919 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16920 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16921 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16922 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16923 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16924 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16925 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16926 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16927 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16928 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16929 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16930 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16931 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16932 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16933 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16934 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16935 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16936 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16937 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16938 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16939 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16940 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16941 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16942 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16943 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16944 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16945 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16946 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16947 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16948 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16949 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16950 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16951 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16952 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16953 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16954 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16955 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16956 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16957 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16958 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16959 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16960 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16961 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16962 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16963 ALC662_3ST_6ch_DIG),
16964 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
16965 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16966 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16967 ALC662_3ST_6ch_DIG),
16968 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16969 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16970 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16971 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16972 ALC662_3ST_6ch_DIG),
16973 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16978 static struct alc_config_preset alc662_presets[] = {
16979 [ALC662_3ST_2ch_DIG] = {
16980 .mixers = { alc662_3ST_2ch_mixer },
16981 .init_verbs = { alc662_init_verbs },
16982 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16983 .dac_nids = alc662_dac_nids,
16984 .dig_out_nid = ALC662_DIGOUT_NID,
16985 .dig_in_nid = ALC662_DIGIN_NID,
16986 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16987 .channel_mode = alc662_3ST_2ch_modes,
16988 .input_mux = &alc662_capture_source,
16990 [ALC662_3ST_6ch_DIG] = {
16991 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16992 .init_verbs = { alc662_init_verbs },
16993 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16994 .dac_nids = alc662_dac_nids,
16995 .dig_out_nid = ALC662_DIGOUT_NID,
16996 .dig_in_nid = ALC662_DIGIN_NID,
16997 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16998 .channel_mode = alc662_3ST_6ch_modes,
17000 .input_mux = &alc662_capture_source,
17002 [ALC662_3ST_6ch] = {
17003 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17004 .init_verbs = { alc662_init_verbs },
17005 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17006 .dac_nids = alc662_dac_nids,
17007 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17008 .channel_mode = alc662_3ST_6ch_modes,
17010 .input_mux = &alc662_capture_source,
17012 [ALC662_5ST_DIG] = {
17013 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17014 .init_verbs = { alc662_init_verbs },
17015 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17016 .dac_nids = alc662_dac_nids,
17017 .dig_out_nid = ALC662_DIGOUT_NID,
17018 .dig_in_nid = ALC662_DIGIN_NID,
17019 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17020 .channel_mode = alc662_5stack_modes,
17021 .input_mux = &alc662_capture_source,
17023 [ALC662_LENOVO_101E] = {
17024 .mixers = { alc662_lenovo_101e_mixer },
17025 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17026 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17027 .dac_nids = alc662_dac_nids,
17028 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17029 .channel_mode = alc662_3ST_2ch_modes,
17030 .input_mux = &alc662_lenovo_101e_capture_source,
17031 .unsol_event = alc662_lenovo_101e_unsol_event,
17032 .init_hook = alc662_lenovo_101e_all_automute,
17034 [ALC662_ASUS_EEEPC_P701] = {
17035 .mixers = { alc662_eeepc_p701_mixer },
17036 .init_verbs = { alc662_init_verbs,
17037 alc662_eeepc_sue_init_verbs },
17038 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17039 .dac_nids = alc662_dac_nids,
17040 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17041 .channel_mode = alc662_3ST_2ch_modes,
17042 .unsol_event = alc662_eeepc_unsol_event,
17043 .setup = alc662_eeepc_setup,
17044 .init_hook = alc662_eeepc_inithook,
17046 [ALC662_ASUS_EEEPC_EP20] = {
17047 .mixers = { alc662_eeepc_ep20_mixer,
17048 alc662_chmode_mixer },
17049 .init_verbs = { alc662_init_verbs,
17050 alc662_eeepc_ep20_sue_init_verbs },
17051 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17052 .dac_nids = alc662_dac_nids,
17053 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17054 .channel_mode = alc662_3ST_6ch_modes,
17055 .input_mux = &alc662_lenovo_101e_capture_source,
17056 .unsol_event = alc662_eeepc_unsol_event,
17057 .setup = alc662_eeepc_ep20_setup,
17058 .init_hook = alc662_eeepc_ep20_inithook,
17061 .mixers = { alc662_ecs_mixer },
17062 .init_verbs = { alc662_init_verbs,
17063 alc662_ecs_init_verbs },
17064 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17065 .dac_nids = alc662_dac_nids,
17066 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17067 .channel_mode = alc662_3ST_2ch_modes,
17068 .unsol_event = alc662_eeepc_unsol_event,
17069 .setup = alc662_eeepc_setup,
17070 .init_hook = alc662_eeepc_inithook,
17072 [ALC663_ASUS_M51VA] = {
17073 .mixers = { alc663_m51va_mixer },
17074 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17075 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17076 .dac_nids = alc662_dac_nids,
17077 .dig_out_nid = ALC662_DIGOUT_NID,
17078 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17079 .channel_mode = alc662_3ST_2ch_modes,
17080 .unsol_event = alc663_m51va_unsol_event,
17081 .setup = alc663_m51va_setup,
17082 .init_hook = alc663_m51va_inithook,
17084 [ALC663_ASUS_G71V] = {
17085 .mixers = { alc663_g71v_mixer },
17086 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17087 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17088 .dac_nids = alc662_dac_nids,
17089 .dig_out_nid = ALC662_DIGOUT_NID,
17090 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17091 .channel_mode = alc662_3ST_2ch_modes,
17092 .unsol_event = alc663_g71v_unsol_event,
17093 .setup = alc663_g71v_setup,
17094 .init_hook = alc663_g71v_inithook,
17096 [ALC663_ASUS_H13] = {
17097 .mixers = { alc663_m51va_mixer },
17098 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17099 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17100 .dac_nids = alc662_dac_nids,
17101 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17102 .channel_mode = alc662_3ST_2ch_modes,
17103 .unsol_event = alc663_m51va_unsol_event,
17104 .init_hook = alc663_m51va_inithook,
17106 [ALC663_ASUS_G50V] = {
17107 .mixers = { alc663_g50v_mixer },
17108 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17109 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17110 .dac_nids = alc662_dac_nids,
17111 .dig_out_nid = ALC662_DIGOUT_NID,
17112 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17113 .channel_mode = alc662_3ST_6ch_modes,
17114 .input_mux = &alc663_capture_source,
17115 .unsol_event = alc663_g50v_unsol_event,
17116 .setup = alc663_g50v_setup,
17117 .init_hook = alc663_g50v_inithook,
17119 [ALC663_ASUS_MODE1] = {
17120 .mixers = { alc663_m51va_mixer },
17121 .cap_mixer = alc662_auto_capture_mixer,
17122 .init_verbs = { alc662_init_verbs,
17123 alc663_21jd_amic_init_verbs },
17124 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17126 .dac_nids = alc662_dac_nids,
17127 .dig_out_nid = ALC662_DIGOUT_NID,
17128 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17129 .channel_mode = alc662_3ST_2ch_modes,
17130 .unsol_event = alc663_mode1_unsol_event,
17131 .setup = alc663_mode1_setup,
17132 .init_hook = alc663_mode1_inithook,
17134 [ALC662_ASUS_MODE2] = {
17135 .mixers = { alc662_1bjd_mixer },
17136 .cap_mixer = alc662_auto_capture_mixer,
17137 .init_verbs = { alc662_init_verbs,
17138 alc662_1bjd_amic_init_verbs },
17139 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17140 .dac_nids = alc662_dac_nids,
17141 .dig_out_nid = ALC662_DIGOUT_NID,
17142 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17143 .channel_mode = alc662_3ST_2ch_modes,
17144 .unsol_event = alc662_mode2_unsol_event,
17145 .setup = alc662_mode2_setup,
17146 .init_hook = alc662_mode2_inithook,
17148 [ALC663_ASUS_MODE3] = {
17149 .mixers = { alc663_two_hp_m1_mixer },
17150 .cap_mixer = alc662_auto_capture_mixer,
17151 .init_verbs = { alc662_init_verbs,
17152 alc663_two_hp_amic_m1_init_verbs },
17153 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17155 .dac_nids = alc662_dac_nids,
17156 .dig_out_nid = ALC662_DIGOUT_NID,
17157 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17158 .channel_mode = alc662_3ST_2ch_modes,
17159 .unsol_event = alc663_mode3_unsol_event,
17160 .setup = alc663_mode3_setup,
17161 .init_hook = alc663_mode3_inithook,
17163 [ALC663_ASUS_MODE4] = {
17164 .mixers = { alc663_asus_21jd_clfe_mixer },
17165 .cap_mixer = alc662_auto_capture_mixer,
17166 .init_verbs = { alc662_init_verbs,
17167 alc663_21jd_amic_init_verbs},
17168 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17170 .dac_nids = alc662_dac_nids,
17171 .dig_out_nid = ALC662_DIGOUT_NID,
17172 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17173 .channel_mode = alc662_3ST_2ch_modes,
17174 .unsol_event = alc663_mode4_unsol_event,
17175 .setup = alc663_mode4_setup,
17176 .init_hook = alc663_mode4_inithook,
17178 [ALC663_ASUS_MODE5] = {
17179 .mixers = { alc663_asus_15jd_clfe_mixer },
17180 .cap_mixer = alc662_auto_capture_mixer,
17181 .init_verbs = { alc662_init_verbs,
17182 alc663_15jd_amic_init_verbs },
17183 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17185 .dac_nids = alc662_dac_nids,
17186 .dig_out_nid = ALC662_DIGOUT_NID,
17187 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17188 .channel_mode = alc662_3ST_2ch_modes,
17189 .unsol_event = alc663_mode5_unsol_event,
17190 .setup = alc663_mode5_setup,
17191 .init_hook = alc663_mode5_inithook,
17193 [ALC663_ASUS_MODE6] = {
17194 .mixers = { alc663_two_hp_m2_mixer },
17195 .cap_mixer = alc662_auto_capture_mixer,
17196 .init_verbs = { alc662_init_verbs,
17197 alc663_two_hp_amic_m2_init_verbs },
17198 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17200 .dac_nids = alc662_dac_nids,
17201 .dig_out_nid = ALC662_DIGOUT_NID,
17202 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17203 .channel_mode = alc662_3ST_2ch_modes,
17204 .unsol_event = alc663_mode6_unsol_event,
17205 .setup = alc663_mode6_setup,
17206 .init_hook = alc663_mode6_inithook,
17209 .mixers = { alc663_m51va_mixer },
17210 .cap_mixer = alc272_auto_capture_mixer,
17211 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17212 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17213 .dac_nids = alc662_dac_nids,
17214 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17215 .adc_nids = alc272_adc_nids,
17216 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17217 .capsrc_nids = alc272_capsrc_nids,
17218 .channel_mode = alc662_3ST_2ch_modes,
17219 .unsol_event = alc663_m51va_unsol_event,
17220 .setup = alc663_m51va_setup,
17221 .init_hook = alc663_m51va_inithook,
17223 [ALC272_DELL_ZM1] = {
17224 .mixers = { alc663_m51va_mixer },
17225 .cap_mixer = alc662_auto_capture_mixer,
17226 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17227 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17228 .dac_nids = alc662_dac_nids,
17229 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17230 .adc_nids = alc662_adc_nids,
17232 .capsrc_nids = alc662_capsrc_nids,
17233 .channel_mode = alc662_3ST_2ch_modes,
17234 .unsol_event = alc663_m51va_unsol_event,
17235 .setup = alc663_m51va_setup,
17236 .init_hook = alc663_m51va_inithook,
17238 [ALC272_SAMSUNG_NC10] = {
17239 .mixers = { alc272_nc10_mixer },
17240 .init_verbs = { alc662_init_verbs,
17241 alc663_21jd_amic_init_verbs },
17242 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17243 .dac_nids = alc272_dac_nids,
17244 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17245 .channel_mode = alc662_3ST_2ch_modes,
17246 /*.input_mux = &alc272_nc10_capture_source,*/
17247 .unsol_event = alc663_mode4_unsol_event,
17248 .setup = alc663_mode4_setup,
17249 .init_hook = alc663_mode4_inithook,
17255 * BIOS auto configuration
17258 /* convert from MIX nid to DAC */
17259 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17263 else if (nid >= 0x0c && nid <= 0x0e)
17264 return nid - 0x0c + 0x02;
17265 else if (nid == 0x26) /* ALC887-VD has this DAC too */
17271 /* get MIX nid connected to the given pin targeted to DAC */
17272 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17278 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17279 for (i = 0; i < num; i++) {
17280 if (alc662_mix_to_dac(mix[i]) == dac)
17286 /* look for an empty DAC slot */
17287 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17289 struct alc_spec *spec = codec->spec;
17293 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17296 for (i = 0; i < num; i++) {
17297 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17300 for (j = 0; j < spec->multiout.num_dacs; j++)
17301 if (spec->multiout.dac_nids[j] == nid)
17303 if (j >= spec->multiout.num_dacs)
17309 /* fill in the dac_nids table from the parsed pin configuration */
17310 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17311 const struct auto_pin_cfg *cfg)
17313 struct alc_spec *spec = codec->spec;
17317 spec->multiout.dac_nids = spec->private_dac_nids;
17318 for (i = 0; i < cfg->line_outs; i++) {
17319 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17322 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17327 static int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17328 hda_nid_t nid, unsigned int chs)
17331 sprintf(name, "%s Playback Volume", pfx);
17332 return add_control(spec, ALC_CTL_WIDGET_VOL, name,
17333 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17336 static int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17337 hda_nid_t nid, unsigned int chs)
17340 sprintf(name, "%s Playback Switch", pfx);
17341 return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17342 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17345 #define alc662_add_stereo_vol(spec, pfx, nid) \
17346 alc662_add_vol_ctl(spec, pfx, nid, 3)
17347 #define alc662_add_stereo_sw(spec, pfx, nid) \
17348 alc662_add_sw_ctl(spec, pfx, nid, 3)
17350 /* add playback controls from the parsed DAC table */
17351 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17352 const struct auto_pin_cfg *cfg)
17354 struct alc_spec *spec = codec->spec;
17355 static const char *chname[4] = {
17356 "Front", "Surround", NULL /*CLFE*/, "Side"
17358 hda_nid_t nid, mix;
17361 for (i = 0; i < cfg->line_outs; i++) {
17362 nid = spec->multiout.dac_nids[i];
17365 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17370 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17373 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17376 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17379 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17384 if (cfg->line_outs == 1 &&
17385 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17392 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17395 if (cfg->line_outs == 1 &&
17396 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17398 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17406 /* add playback controls for speaker and HP outputs */
17407 /* return DAC nid if any new DAC is assigned */
17408 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17411 struct alc_spec *spec = codec->spec;
17412 hda_nid_t nid, mix;
17417 nid = alc662_look_for_dac(codec, pin);
17420 /* the corresponding DAC is already occupied */
17421 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17422 return 0; /* no way */
17423 /* create a switch only */
17424 sprintf(name, "%s Playback Switch", pfx);
17425 return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17426 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17429 mix = alc662_dac_to_mix(codec, pin, nid);
17432 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17435 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17441 /* create playback/capture controls for input pins */
17442 #define alc662_auto_create_input_ctls \
17443 alc882_auto_create_input_ctls
17445 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17446 hda_nid_t nid, int pin_type,
17452 alc_set_pin_output(codec, nid, pin_type);
17453 /* need the manual connection? */
17454 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17457 for (i = 0; i < num; i++) {
17458 if (alc662_mix_to_dac(srcs[i]) != dac)
17460 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17465 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17467 struct alc_spec *spec = codec->spec;
17468 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17471 for (i = 0; i <= HDA_SIDE; i++) {
17472 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17474 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17475 spec->multiout.dac_nids[i]);
17479 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17481 struct alc_spec *spec = codec->spec;
17484 pin = spec->autocfg.hp_pins[0];
17486 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17487 spec->multiout.hp_nid);
17488 pin = spec->autocfg.speaker_pins[0];
17490 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17491 spec->multiout.extra_out_nid[0]);
17494 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17496 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17498 struct alc_spec *spec = codec->spec;
17501 for (i = 0; i < AUTO_PIN_LAST; i++) {
17502 hda_nid_t nid = spec->autocfg.input_pins[i];
17503 if (alc_is_input_pin(codec, nid)) {
17504 alc_set_input_pin(codec, nid, i);
17505 if (nid != ALC662_PIN_CD_NID &&
17506 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17507 snd_hda_codec_write(codec, nid, 0,
17508 AC_VERB_SET_AMP_GAIN_MUTE,
17514 #define alc662_auto_init_input_src alc882_auto_init_input_src
17516 static int alc662_parse_auto_config(struct hda_codec *codec)
17518 struct alc_spec *spec = codec->spec;
17520 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17522 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17526 if (!spec->autocfg.line_outs)
17527 return 0; /* can't find valid BIOS pin config */
17529 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17532 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17535 err = alc662_auto_create_extra_out(codec,
17536 spec->autocfg.speaker_pins[0],
17541 spec->multiout.extra_out_nid[0] = err;
17542 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17547 spec->multiout.hp_nid = err;
17548 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17552 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17554 if (spec->autocfg.dig_outs)
17555 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17557 if (spec->kctls.list)
17558 add_mixer(spec, spec->kctls.list);
17560 spec->num_mux_defs = 1;
17561 spec->input_mux = &spec->private_imux[0];
17563 add_verb(spec, alc662_auto_init_verbs);
17564 if (codec->vendor_id == 0x10ec0663)
17565 add_verb(spec, alc663_auto_init_verbs);
17567 err = alc_auto_add_mic_boost(codec);
17571 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17576 /* additional initialization for auto-configuration model */
17577 static void alc662_auto_init(struct hda_codec *codec)
17579 struct alc_spec *spec = codec->spec;
17580 alc662_auto_init_multi_out(codec);
17581 alc662_auto_init_hp_out(codec);
17582 alc662_auto_init_analog_input(codec);
17583 alc662_auto_init_input_src(codec);
17584 if (spec->unsol_event)
17585 alc_inithook(codec);
17588 static int patch_alc662(struct hda_codec *codec)
17590 struct alc_spec *spec;
17591 int err, board_config;
17593 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17597 codec->spec = spec;
17599 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17601 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17604 if (board_config < 0) {
17605 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17607 board_config = ALC662_AUTO;
17610 if (board_config == ALC662_AUTO) {
17611 /* automatic parse from the BIOS config */
17612 err = alc662_parse_auto_config(codec);
17618 "hda_codec: Cannot set up configuration "
17619 "from BIOS. Using base mode...\n");
17620 board_config = ALC662_3ST_2ch_DIG;
17624 err = snd_hda_attach_beep_device(codec, 0x1);
17630 if (board_config != ALC662_AUTO)
17631 setup_preset(codec, &alc662_presets[board_config]);
17633 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17634 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17636 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17637 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17639 if (!spec->adc_nids) {
17640 spec->adc_nids = alc662_adc_nids;
17641 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17643 if (!spec->capsrc_nids)
17644 spec->capsrc_nids = alc662_capsrc_nids;
17646 if (!spec->cap_mixer)
17647 set_capture_mixer(codec);
17648 if (codec->vendor_id == 0x10ec0662)
17649 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17651 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17653 spec->vmaster_nid = 0x02;
17655 codec->patch_ops = alc_patch_ops;
17656 if (board_config == ALC662_AUTO)
17657 spec->init_hook = alc662_auto_init;
17658 #ifdef CONFIG_SND_HDA_POWER_SAVE
17659 if (!spec->loopback.amplist)
17660 spec->loopback.amplist = alc662_loopbacks;
17662 codec->proc_widget_hook = print_realtek_coef;
17670 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17671 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17672 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17673 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17674 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17675 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17676 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17677 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17678 .patch = patch_alc861 },
17679 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17680 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17681 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17682 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17683 .patch = patch_alc882 },
17684 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17685 .patch = patch_alc662 },
17686 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17687 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17688 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17689 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17690 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17691 .patch = patch_alc882 },
17692 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17693 .patch = patch_alc882 },
17694 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17695 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17696 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17697 .patch = patch_alc882 },
17698 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17699 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17700 {} /* terminator */
17703 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17705 MODULE_LICENSE("GPL");
17706 MODULE_DESCRIPTION("Realtek HD-audio codec");
17708 static struct hda_codec_preset_list realtek_list = {
17709 .preset = snd_hda_preset_realtek,
17710 .owner = THIS_MODULE,
17713 static int __init patch_realtek_init(void)
17715 return snd_hda_add_codec_preset(&realtek_list);
17718 static void __exit patch_realtek_exit(void)
17720 snd_hda_delete_codec_preset(&realtek_list);
17723 module_init(patch_realtek_init)
17724 module_exit(patch_realtek_exit)