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,
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, 0x0068, "LG w1", ALC880_LG),
3979 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3980 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3981 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3982 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3983 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3984 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3985 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3986 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3987 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3988 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3989 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3990 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3991 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3992 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3994 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3995 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3996 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4001 * ALC880 codec presets
4003 static struct alc_config_preset alc880_presets[] = {
4005 .mixers = { alc880_three_stack_mixer },
4006 .init_verbs = { alc880_volume_init_verbs,
4007 alc880_pin_3stack_init_verbs },
4008 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4009 .dac_nids = alc880_dac_nids,
4010 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4011 .channel_mode = alc880_threestack_modes,
4013 .input_mux = &alc880_capture_source,
4015 [ALC880_3ST_DIG] = {
4016 .mixers = { alc880_three_stack_mixer },
4017 .init_verbs = { alc880_volume_init_verbs,
4018 alc880_pin_3stack_init_verbs },
4019 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4020 .dac_nids = alc880_dac_nids,
4021 .dig_out_nid = ALC880_DIGOUT_NID,
4022 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4023 .channel_mode = alc880_threestack_modes,
4025 .input_mux = &alc880_capture_source,
4027 [ALC880_TCL_S700] = {
4028 .mixers = { alc880_tcl_s700_mixer },
4029 .init_verbs = { alc880_volume_init_verbs,
4030 alc880_pin_tcl_S700_init_verbs,
4031 alc880_gpio2_init_verbs },
4032 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4033 .dac_nids = alc880_dac_nids,
4034 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4035 .num_adc_nids = 1, /* single ADC */
4037 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4038 .channel_mode = alc880_2_jack_modes,
4039 .input_mux = &alc880_capture_source,
4042 .mixers = { alc880_three_stack_mixer,
4043 alc880_five_stack_mixer},
4044 .init_verbs = { alc880_volume_init_verbs,
4045 alc880_pin_5stack_init_verbs },
4046 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4047 .dac_nids = alc880_dac_nids,
4048 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4049 .channel_mode = alc880_fivestack_modes,
4050 .input_mux = &alc880_capture_source,
4052 [ALC880_5ST_DIG] = {
4053 .mixers = { alc880_three_stack_mixer,
4054 alc880_five_stack_mixer },
4055 .init_verbs = { alc880_volume_init_verbs,
4056 alc880_pin_5stack_init_verbs },
4057 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4058 .dac_nids = alc880_dac_nids,
4059 .dig_out_nid = ALC880_DIGOUT_NID,
4060 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4061 .channel_mode = alc880_fivestack_modes,
4062 .input_mux = &alc880_capture_source,
4065 .mixers = { alc880_six_stack_mixer },
4066 .init_verbs = { alc880_volume_init_verbs,
4067 alc880_pin_6stack_init_verbs },
4068 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4069 .dac_nids = alc880_6st_dac_nids,
4070 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4071 .channel_mode = alc880_sixstack_modes,
4072 .input_mux = &alc880_6stack_capture_source,
4074 [ALC880_6ST_DIG] = {
4075 .mixers = { alc880_six_stack_mixer },
4076 .init_verbs = { alc880_volume_init_verbs,
4077 alc880_pin_6stack_init_verbs },
4078 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4079 .dac_nids = alc880_6st_dac_nids,
4080 .dig_out_nid = ALC880_DIGOUT_NID,
4081 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4082 .channel_mode = alc880_sixstack_modes,
4083 .input_mux = &alc880_6stack_capture_source,
4086 .mixers = { alc880_w810_base_mixer },
4087 .init_verbs = { alc880_volume_init_verbs,
4088 alc880_pin_w810_init_verbs,
4089 alc880_gpio2_init_verbs },
4090 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4091 .dac_nids = alc880_w810_dac_nids,
4092 .dig_out_nid = ALC880_DIGOUT_NID,
4093 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4094 .channel_mode = alc880_w810_modes,
4095 .input_mux = &alc880_capture_source,
4098 .mixers = { alc880_z71v_mixer },
4099 .init_verbs = { alc880_volume_init_verbs,
4100 alc880_pin_z71v_init_verbs },
4101 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4102 .dac_nids = alc880_z71v_dac_nids,
4103 .dig_out_nid = ALC880_DIGOUT_NID,
4105 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4106 .channel_mode = alc880_2_jack_modes,
4107 .input_mux = &alc880_capture_source,
4110 .mixers = { alc880_f1734_mixer },
4111 .init_verbs = { alc880_volume_init_verbs,
4112 alc880_pin_f1734_init_verbs },
4113 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4114 .dac_nids = alc880_f1734_dac_nids,
4116 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4117 .channel_mode = alc880_2_jack_modes,
4118 .input_mux = &alc880_f1734_capture_source,
4119 .unsol_event = alc880_uniwill_p53_unsol_event,
4120 .setup = alc880_uniwill_p53_setup,
4121 .init_hook = alc_automute_amp,
4124 .mixers = { alc880_asus_mixer },
4125 .init_verbs = { alc880_volume_init_verbs,
4126 alc880_pin_asus_init_verbs,
4127 alc880_gpio1_init_verbs },
4128 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4129 .dac_nids = alc880_asus_dac_nids,
4130 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4131 .channel_mode = alc880_asus_modes,
4133 .input_mux = &alc880_capture_source,
4135 [ALC880_ASUS_DIG] = {
4136 .mixers = { alc880_asus_mixer },
4137 .init_verbs = { alc880_volume_init_verbs,
4138 alc880_pin_asus_init_verbs,
4139 alc880_gpio1_init_verbs },
4140 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4141 .dac_nids = alc880_asus_dac_nids,
4142 .dig_out_nid = ALC880_DIGOUT_NID,
4143 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4144 .channel_mode = alc880_asus_modes,
4146 .input_mux = &alc880_capture_source,
4148 [ALC880_ASUS_DIG2] = {
4149 .mixers = { alc880_asus_mixer },
4150 .init_verbs = { alc880_volume_init_verbs,
4151 alc880_pin_asus_init_verbs,
4152 alc880_gpio2_init_verbs }, /* use GPIO2 */
4153 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4154 .dac_nids = alc880_asus_dac_nids,
4155 .dig_out_nid = ALC880_DIGOUT_NID,
4156 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4157 .channel_mode = alc880_asus_modes,
4159 .input_mux = &alc880_capture_source,
4161 [ALC880_ASUS_W1V] = {
4162 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4163 .init_verbs = { alc880_volume_init_verbs,
4164 alc880_pin_asus_init_verbs,
4165 alc880_gpio1_init_verbs },
4166 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4167 .dac_nids = alc880_asus_dac_nids,
4168 .dig_out_nid = ALC880_DIGOUT_NID,
4169 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4170 .channel_mode = alc880_asus_modes,
4172 .input_mux = &alc880_capture_source,
4174 [ALC880_UNIWILL_DIG] = {
4175 .mixers = { alc880_asus_mixer },
4176 .init_verbs = { alc880_volume_init_verbs,
4177 alc880_pin_asus_init_verbs },
4178 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4179 .dac_nids = alc880_asus_dac_nids,
4180 .dig_out_nid = ALC880_DIGOUT_NID,
4181 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4182 .channel_mode = alc880_asus_modes,
4184 .input_mux = &alc880_capture_source,
4186 [ALC880_UNIWILL] = {
4187 .mixers = { alc880_uniwill_mixer },
4188 .init_verbs = { alc880_volume_init_verbs,
4189 alc880_uniwill_init_verbs },
4190 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4191 .dac_nids = alc880_asus_dac_nids,
4192 .dig_out_nid = ALC880_DIGOUT_NID,
4193 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4194 .channel_mode = alc880_threestack_modes,
4196 .input_mux = &alc880_capture_source,
4197 .unsol_event = alc880_uniwill_unsol_event,
4198 .setup = alc880_uniwill_setup,
4199 .init_hook = alc880_uniwill_init_hook,
4201 [ALC880_UNIWILL_P53] = {
4202 .mixers = { alc880_uniwill_p53_mixer },
4203 .init_verbs = { alc880_volume_init_verbs,
4204 alc880_uniwill_p53_init_verbs },
4205 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4206 .dac_nids = alc880_asus_dac_nids,
4207 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4208 .channel_mode = alc880_threestack_modes,
4209 .input_mux = &alc880_capture_source,
4210 .unsol_event = alc880_uniwill_p53_unsol_event,
4211 .setup = alc880_uniwill_p53_setup,
4212 .init_hook = alc_automute_amp,
4214 [ALC880_FUJITSU] = {
4215 .mixers = { alc880_fujitsu_mixer },
4216 .init_verbs = { alc880_volume_init_verbs,
4217 alc880_uniwill_p53_init_verbs,
4218 alc880_beep_init_verbs },
4219 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4220 .dac_nids = alc880_dac_nids,
4221 .dig_out_nid = ALC880_DIGOUT_NID,
4222 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4223 .channel_mode = alc880_2_jack_modes,
4224 .input_mux = &alc880_capture_source,
4225 .unsol_event = alc880_uniwill_p53_unsol_event,
4226 .setup = alc880_uniwill_p53_setup,
4227 .init_hook = alc_automute_amp,
4230 .mixers = { alc880_three_stack_mixer },
4231 .init_verbs = { alc880_volume_init_verbs,
4232 alc880_pin_clevo_init_verbs },
4233 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4234 .dac_nids = alc880_dac_nids,
4236 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4237 .channel_mode = alc880_threestack_modes,
4239 .input_mux = &alc880_capture_source,
4242 .mixers = { alc880_lg_mixer },
4243 .init_verbs = { alc880_volume_init_verbs,
4244 alc880_lg_init_verbs },
4245 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4246 .dac_nids = alc880_lg_dac_nids,
4247 .dig_out_nid = ALC880_DIGOUT_NID,
4248 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4249 .channel_mode = alc880_lg_ch_modes,
4251 .input_mux = &alc880_lg_capture_source,
4252 .unsol_event = alc_automute_amp_unsol_event,
4253 .setup = alc880_lg_setup,
4254 .init_hook = alc_automute_amp,
4255 #ifdef CONFIG_SND_HDA_POWER_SAVE
4256 .loopbacks = alc880_lg_loopbacks,
4260 .mixers = { alc880_lg_lw_mixer },
4261 .init_verbs = { alc880_volume_init_verbs,
4262 alc880_lg_lw_init_verbs },
4263 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4264 .dac_nids = alc880_dac_nids,
4265 .dig_out_nid = ALC880_DIGOUT_NID,
4266 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4267 .channel_mode = alc880_lg_lw_modes,
4268 .input_mux = &alc880_lg_lw_capture_source,
4269 .unsol_event = alc_automute_amp_unsol_event,
4270 .setup = alc880_lg_lw_setup,
4271 .init_hook = alc_automute_amp,
4273 [ALC880_MEDION_RIM] = {
4274 .mixers = { alc880_medion_rim_mixer },
4275 .init_verbs = { alc880_volume_init_verbs,
4276 alc880_medion_rim_init_verbs,
4277 alc_gpio2_init_verbs },
4278 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4279 .dac_nids = alc880_dac_nids,
4280 .dig_out_nid = ALC880_DIGOUT_NID,
4281 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4282 .channel_mode = alc880_2_jack_modes,
4283 .input_mux = &alc880_medion_rim_capture_source,
4284 .unsol_event = alc880_medion_rim_unsol_event,
4285 .setup = alc880_medion_rim_setup,
4286 .init_hook = alc880_medion_rim_automute,
4288 #ifdef CONFIG_SND_DEBUG
4290 .mixers = { alc880_test_mixer },
4291 .init_verbs = { alc880_test_init_verbs },
4292 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4293 .dac_nids = alc880_test_dac_nids,
4294 .dig_out_nid = ALC880_DIGOUT_NID,
4295 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4296 .channel_mode = alc880_test_modes,
4297 .input_mux = &alc880_test_capture_source,
4303 * Automatic parse of I/O pins from the BIOS configuration
4308 ALC_CTL_WIDGET_MUTE,
4311 static struct snd_kcontrol_new alc880_control_templates[] = {
4312 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4313 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4314 HDA_BIND_MUTE(NULL, 0, 0, 0),
4317 /* add dynamic controls */
4318 static int add_control(struct alc_spec *spec, int type, const char *name,
4321 struct snd_kcontrol_new *knew;
4323 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4324 knew = snd_array_new(&spec->kctls);
4327 *knew = alc880_control_templates[type];
4328 knew->name = kstrdup(name, GFP_KERNEL);
4331 knew->private_value = val;
4335 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4336 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4337 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4338 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4339 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4340 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4341 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4342 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4343 #define ALC880_PIN_CD_NID 0x1c
4345 /* fill in the dac_nids table from the parsed pin configuration */
4346 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4347 const struct auto_pin_cfg *cfg)
4353 memset(assigned, 0, sizeof(assigned));
4354 spec->multiout.dac_nids = spec->private_dac_nids;
4356 /* check the pins hardwired to audio widget */
4357 for (i = 0; i < cfg->line_outs; i++) {
4358 nid = cfg->line_out_pins[i];
4359 if (alc880_is_fixed_pin(nid)) {
4360 int idx = alc880_fixed_pin_idx(nid);
4361 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4365 /* left pins can be connect to any audio widget */
4366 for (i = 0; i < cfg->line_outs; i++) {
4367 nid = cfg->line_out_pins[i];
4368 if (alc880_is_fixed_pin(nid))
4370 /* search for an empty channel */
4371 for (j = 0; j < cfg->line_outs; j++) {
4373 spec->multiout.dac_nids[i] =
4374 alc880_idx_to_dac(j);
4380 spec->multiout.num_dacs = cfg->line_outs;
4384 /* add playback controls from the parsed DAC table */
4385 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4386 const struct auto_pin_cfg *cfg)
4389 static const char *chname[4] = {
4390 "Front", "Surround", NULL /*CLFE*/, "Side"
4395 for (i = 0; i < cfg->line_outs; i++) {
4396 if (!spec->multiout.dac_nids[i])
4398 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4401 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4402 "Center Playback Volume",
4403 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4407 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4408 "LFE Playback Volume",
4409 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4413 err = add_control(spec, ALC_CTL_BIND_MUTE,
4414 "Center Playback Switch",
4415 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4419 err = add_control(spec, ALC_CTL_BIND_MUTE,
4420 "LFE Playback Switch",
4421 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4427 if (cfg->line_outs == 1 &&
4428 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4432 sprintf(name, "%s Playback Volume", pfx);
4433 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4434 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4438 sprintf(name, "%s Playback Switch", pfx);
4439 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4440 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4449 /* add playback controls for speaker and HP outputs */
4450 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4460 if (alc880_is_fixed_pin(pin)) {
4461 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4462 /* specify the DAC as the extra output */
4463 if (!spec->multiout.hp_nid)
4464 spec->multiout.hp_nid = nid;
4466 spec->multiout.extra_out_nid[0] = nid;
4467 /* control HP volume/switch on the output mixer amp */
4468 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4469 sprintf(name, "%s Playback Volume", pfx);
4470 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4471 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4474 sprintf(name, "%s Playback Switch", pfx);
4475 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4476 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4479 } else if (alc880_is_multi_pin(pin)) {
4480 /* set manual connection */
4481 /* we have only a switch on HP-out PIN */
4482 sprintf(name, "%s Playback Switch", pfx);
4483 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4484 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4491 /* create input playback/capture controls for the given pin */
4492 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4493 const char *ctlname,
4494 int idx, hda_nid_t mix_nid)
4499 sprintf(name, "%s Playback Volume", ctlname);
4500 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4501 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4504 sprintf(name, "%s Playback Switch", ctlname);
4505 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4506 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4512 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4514 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4515 return (pincap & AC_PINCAP_IN) != 0;
4518 /* create playback/capture controls for input pins */
4519 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4520 const struct auto_pin_cfg *cfg,
4522 hda_nid_t cap1, hda_nid_t cap2)
4524 struct alc_spec *spec = codec->spec;
4525 struct hda_input_mux *imux = &spec->private_imux[0];
4528 for (i = 0; i < AUTO_PIN_LAST; i++) {
4531 pin = cfg->input_pins[i];
4532 if (!alc_is_input_pin(codec, pin))
4536 idx = get_connection_index(codec, mixer, pin);
4538 err = new_analog_input(spec, pin,
4539 auto_pin_cfg_labels[i],
4548 idx = get_connection_index(codec, cap1, pin);
4549 if (idx < 0 && cap2)
4550 idx = get_connection_index(codec, cap2, pin);
4552 imux->items[imux->num_items].label =
4553 auto_pin_cfg_labels[i];
4554 imux->items[imux->num_items].index = idx;
4561 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4562 const struct auto_pin_cfg *cfg)
4564 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4567 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4568 unsigned int pin_type)
4570 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4573 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4577 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4578 hda_nid_t nid, int pin_type,
4581 alc_set_pin_output(codec, nid, pin_type);
4582 /* need the manual connection? */
4583 if (alc880_is_multi_pin(nid)) {
4584 struct alc_spec *spec = codec->spec;
4585 int idx = alc880_multi_pin_idx(nid);
4586 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4587 AC_VERB_SET_CONNECT_SEL,
4588 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4592 static int get_pin_type(int line_out_type)
4594 if (line_out_type == AUTO_PIN_HP_OUT)
4600 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4602 struct alc_spec *spec = codec->spec;
4605 for (i = 0; i < spec->autocfg.line_outs; i++) {
4606 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4607 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4608 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4612 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4614 struct alc_spec *spec = codec->spec;
4617 pin = spec->autocfg.speaker_pins[0];
4618 if (pin) /* connect to front */
4619 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4620 pin = spec->autocfg.hp_pins[0];
4621 if (pin) /* connect to front */
4622 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4625 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4627 struct alc_spec *spec = codec->spec;
4630 for (i = 0; i < AUTO_PIN_LAST; i++) {
4631 hda_nid_t nid = spec->autocfg.input_pins[i];
4632 if (alc_is_input_pin(codec, nid)) {
4633 alc_set_input_pin(codec, nid, i);
4634 if (nid != ALC880_PIN_CD_NID &&
4635 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4636 snd_hda_codec_write(codec, nid, 0,
4637 AC_VERB_SET_AMP_GAIN_MUTE,
4643 /* parse the BIOS configuration and set up the alc_spec */
4644 /* return 1 if successful, 0 if the proper config is not found,
4645 * or a negative error code
4647 static int alc880_parse_auto_config(struct hda_codec *codec)
4649 struct alc_spec *spec = codec->spec;
4651 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4653 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4657 if (!spec->autocfg.line_outs)
4658 return 0; /* can't find valid BIOS pin config */
4660 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4663 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4666 err = alc880_auto_create_extra_out(spec,
4667 spec->autocfg.speaker_pins[0],
4671 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4675 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4679 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4681 /* check multiple SPDIF-out (for recent codecs) */
4682 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4684 err = snd_hda_get_connections(codec,
4685 spec->autocfg.dig_out_pins[i],
4690 spec->multiout.dig_out_nid = dig_nid;
4692 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4693 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4695 spec->slave_dig_outs[i - 1] = dig_nid;
4698 if (spec->autocfg.dig_in_pin)
4699 spec->dig_in_nid = ALC880_DIGIN_NID;
4701 if (spec->kctls.list)
4702 add_mixer(spec, spec->kctls.list);
4704 add_verb(spec, alc880_volume_init_verbs);
4706 spec->num_mux_defs = 1;
4707 spec->input_mux = &spec->private_imux[0];
4709 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4714 /* additional initialization for auto-configuration model */
4715 static void alc880_auto_init(struct hda_codec *codec)
4717 struct alc_spec *spec = codec->spec;
4718 alc880_auto_init_multi_out(codec);
4719 alc880_auto_init_extra_out(codec);
4720 alc880_auto_init_analog_input(codec);
4721 if (spec->unsol_event)
4722 alc_inithook(codec);
4725 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4726 * one of two digital mic pins, e.g. on ALC272
4728 static void fixup_automic_adc(struct hda_codec *codec)
4730 struct alc_spec *spec = codec->spec;
4733 for (i = 0; i < spec->num_adc_nids; i++) {
4734 hda_nid_t cap = spec->capsrc_nids ?
4735 spec->capsrc_nids[i] : spec->adc_nids[i];
4738 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4741 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4744 spec->int_mic.mux_idx = iidx;
4745 spec->ext_mic.mux_idx = eidx;
4746 if (spec->capsrc_nids)
4747 spec->capsrc_nids += i;
4748 spec->adc_nids += i;
4749 spec->num_adc_nids = 1;
4752 snd_printd(KERN_INFO "hda_codec: %s: "
4753 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4754 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4755 spec->auto_mic = 0; /* disable auto-mic to be sure */
4758 static void set_capture_mixer(struct hda_codec *codec)
4760 struct alc_spec *spec = codec->spec;
4761 static struct snd_kcontrol_new *caps[2][3] = {
4762 { alc_capture_mixer_nosrc1,
4763 alc_capture_mixer_nosrc2,
4764 alc_capture_mixer_nosrc3 },
4765 { alc_capture_mixer1,
4767 alc_capture_mixer3 },
4769 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4771 if (spec->auto_mic) {
4773 fixup_automic_adc(codec);
4774 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4778 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4782 #define set_beep_amp(spec, nid, idx, dir) \
4783 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4786 * OK, here we have finally the patch for ALC880
4789 static int patch_alc880(struct hda_codec *codec)
4791 struct alc_spec *spec;
4795 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4801 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4804 if (board_config < 0) {
4805 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4807 board_config = ALC880_AUTO;
4810 if (board_config == ALC880_AUTO) {
4811 /* automatic parse from the BIOS config */
4812 err = alc880_parse_auto_config(codec);
4818 "hda_codec: Cannot set up configuration "
4819 "from BIOS. Using 3-stack mode...\n");
4820 board_config = ALC880_3ST;
4824 err = snd_hda_attach_beep_device(codec, 0x1);
4830 if (board_config != ALC880_AUTO)
4831 setup_preset(codec, &alc880_presets[board_config]);
4833 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4834 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4835 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4837 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4838 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4840 if (!spec->adc_nids && spec->input_mux) {
4841 /* check whether NID 0x07 is valid */
4842 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4844 wcap = get_wcaps_type(wcap);
4845 if (wcap != AC_WID_AUD_IN) {
4846 spec->adc_nids = alc880_adc_nids_alt;
4847 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4849 spec->adc_nids = alc880_adc_nids;
4850 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4853 set_capture_mixer(codec);
4854 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4856 spec->vmaster_nid = 0x0c;
4858 codec->patch_ops = alc_patch_ops;
4859 if (board_config == ALC880_AUTO)
4860 spec->init_hook = alc880_auto_init;
4861 #ifdef CONFIG_SND_HDA_POWER_SAVE
4862 if (!spec->loopback.amplist)
4863 spec->loopback.amplist = alc880_loopbacks;
4865 codec->proc_widget_hook = print_realtek_coef;
4875 static hda_nid_t alc260_dac_nids[1] = {
4880 static hda_nid_t alc260_adc_nids[1] = {
4885 static hda_nid_t alc260_adc_nids_alt[1] = {
4890 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4891 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4893 static hda_nid_t alc260_dual_adc_nids[2] = {
4898 #define ALC260_DIGOUT_NID 0x03
4899 #define ALC260_DIGIN_NID 0x06
4901 static struct hda_input_mux alc260_capture_source = {
4905 { "Front Mic", 0x1 },
4911 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4912 * headphone jack and the internal CD lines since these are the only pins at
4913 * which audio can appear. For flexibility, also allow the option of
4914 * recording the mixer output on the second ADC (ADC0 doesn't have a
4915 * connection to the mixer output).
4917 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4921 { "Mic/Line", 0x0 },
4923 { "Headphone", 0x2 },
4929 { "Mic/Line", 0x0 },
4931 { "Headphone", 0x2 },
4938 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4939 * the Fujitsu S702x, but jacks are marked differently.
4941 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4948 { "Headphone", 0x5 },
4957 { "Headphone", 0x6 },
4963 /* Maxdata Favorit 100XS */
4964 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4968 { "Line/Mic", 0x0 },
4975 { "Line/Mic", 0x0 },
4983 * This is just place-holder, so there's something for alc_build_pcms to look
4984 * at when it calculates the maximum number of channels. ALC260 has no mixer
4985 * element which allows changing the channel mode, so the verb list is
4988 static struct hda_channel_mode alc260_modes[1] = {
4993 /* Mixer combinations
4995 * basic: base_output + input + pc_beep + capture
4996 * HP: base_output + input + capture_alt
4997 * HP_3013: hp_3013 + input + capture
4998 * fujitsu: fujitsu + capture
4999 * acer: acer + capture
5002 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5003 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5004 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5005 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5006 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5007 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5008 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5012 static struct snd_kcontrol_new alc260_input_mixer[] = {
5013 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5014 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5015 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5016 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5017 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5018 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5019 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5020 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5024 /* update HP, line and mono out pins according to the master switch */
5025 static void alc260_hp_master_update(struct hda_codec *codec,
5026 hda_nid_t hp, hda_nid_t line,
5029 struct alc_spec *spec = codec->spec;
5030 unsigned int val = spec->master_sw ? PIN_HP : 0;
5031 /* change HP and line-out pins */
5032 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5034 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5036 /* mono (speaker) depending on the HP jack sense */
5037 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5038 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5042 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5043 struct snd_ctl_elem_value *ucontrol)
5045 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5046 struct alc_spec *spec = codec->spec;
5047 *ucontrol->value.integer.value = spec->master_sw;
5051 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5052 struct snd_ctl_elem_value *ucontrol)
5054 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5055 struct alc_spec *spec = codec->spec;
5056 int val = !!*ucontrol->value.integer.value;
5057 hda_nid_t hp, line, mono;
5059 if (val == spec->master_sw)
5061 spec->master_sw = val;
5062 hp = (kcontrol->private_value >> 16) & 0xff;
5063 line = (kcontrol->private_value >> 8) & 0xff;
5064 mono = kcontrol->private_value & 0xff;
5065 alc260_hp_master_update(codec, hp, line, mono);
5069 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5071 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5072 .name = "Master Playback Switch",
5073 .info = snd_ctl_boolean_mono_info,
5074 .get = alc260_hp_master_sw_get,
5075 .put = alc260_hp_master_sw_put,
5076 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5078 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5079 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5080 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5081 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5082 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5084 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5088 static struct hda_verb alc260_hp_unsol_verbs[] = {
5089 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5093 static void alc260_hp_automute(struct hda_codec *codec)
5095 struct alc_spec *spec = codec->spec;
5096 unsigned int present;
5098 present = snd_hda_codec_read(codec, 0x10, 0,
5099 AC_VERB_GET_PIN_SENSE, 0);
5100 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5101 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5104 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5106 if ((res >> 26) == ALC880_HP_EVENT)
5107 alc260_hp_automute(codec);
5110 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5112 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5113 .name = "Master Playback Switch",
5114 .info = snd_ctl_boolean_mono_info,
5115 .get = alc260_hp_master_sw_get,
5116 .put = alc260_hp_master_sw_put,
5117 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5119 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5120 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5121 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5122 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5123 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5124 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5125 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5126 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5130 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5131 .ops = &snd_hda_bind_vol,
5133 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5134 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5135 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5140 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5141 .ops = &snd_hda_bind_sw,
5143 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5144 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5149 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5150 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5151 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5152 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5153 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5157 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5158 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5162 static void alc260_hp_3013_automute(struct hda_codec *codec)
5164 struct alc_spec *spec = codec->spec;
5165 unsigned int present;
5167 present = snd_hda_codec_read(codec, 0x15, 0,
5168 AC_VERB_GET_PIN_SENSE, 0);
5169 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5170 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5173 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5176 if ((res >> 26) == ALC880_HP_EVENT)
5177 alc260_hp_3013_automute(codec);
5180 static void alc260_hp_3012_automute(struct hda_codec *codec)
5182 unsigned int present, bits;
5184 present = snd_hda_codec_read(codec, 0x10, 0,
5185 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
5187 bits = present ? 0 : PIN_OUT;
5188 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5190 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5192 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5196 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5199 if ((res >> 26) == ALC880_HP_EVENT)
5200 alc260_hp_3012_automute(codec);
5203 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5204 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5206 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5207 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5208 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5209 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5210 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5211 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5212 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5213 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5214 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5215 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5216 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5220 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5221 * versions of the ALC260 don't act on requests to enable mic bias from NID
5222 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5223 * datasheet doesn't mention this restriction. At this stage it's not clear
5224 * whether this behaviour is intentional or is a hardware bug in chip
5225 * revisions available in early 2006. Therefore for now allow the
5226 * "Headphone Jack Mode" control to span all choices, but if it turns out
5227 * that the lack of mic bias for this NID is intentional we could change the
5228 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5230 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5231 * don't appear to make the mic bias available from the "line" jack, even
5232 * though the NID used for this jack (0x14) can supply it. The theory is
5233 * that perhaps Acer have included blocking capacitors between the ALC260
5234 * and the output jack. If this turns out to be the case for all such
5235 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5236 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5238 * The C20x Tablet series have a mono internal speaker which is controlled
5239 * via the chip's Mono sum widget and pin complex, so include the necessary
5240 * controls for such models. On models without a "mono speaker" the control
5241 * won't do anything.
5243 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5244 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5245 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5246 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5247 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5249 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5251 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5252 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5254 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5255 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5256 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5257 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5258 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5262 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5264 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5265 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5266 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5267 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5268 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5269 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5270 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5274 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5275 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5277 static struct snd_kcontrol_new alc260_will_mixer[] = {
5278 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5279 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5280 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5281 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5282 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5283 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5284 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5285 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5286 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5287 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5291 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5292 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5294 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5295 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5296 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5297 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5298 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5299 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5300 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5301 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5302 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5303 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5304 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5309 * initialization verbs
5311 static struct hda_verb alc260_init_verbs[] = {
5312 /* Line In pin widget for input */
5313 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5314 /* CD pin widget for input */
5315 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5316 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5317 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5318 /* Mic2 (front panel) pin widget for input and vref at 80% */
5319 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5320 /* LINE-2 is used for line-out in rear */
5321 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5322 /* select line-out */
5323 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5325 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5327 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5329 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5330 /* mute capture amp left and right */
5331 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5332 /* set connection select to line in (default select for this ADC) */
5333 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5334 /* mute capture amp left and right */
5335 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5336 /* set connection select to line in (default select for this ADC) */
5337 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5338 /* set vol=0 Line-Out mixer amp left and right */
5339 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5340 /* unmute pin widget amp left and right (no gain on this amp) */
5341 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5342 /* set vol=0 HP mixer amp left and right */
5343 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5344 /* unmute pin widget amp left and right (no gain on this amp) */
5345 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5346 /* set vol=0 Mono mixer amp left and right */
5347 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5348 /* unmute pin widget amp left and right (no gain on this amp) */
5349 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5350 /* unmute LINE-2 out pin */
5351 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5352 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5355 /* mute analog inputs */
5356 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5357 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5358 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5359 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5360 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5361 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5362 /* mute Front out path */
5363 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5364 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5365 /* mute Headphone out path */
5366 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5367 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5368 /* mute Mono out path */
5369 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5370 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5374 #if 0 /* should be identical with alc260_init_verbs? */
5375 static struct hda_verb alc260_hp_init_verbs[] = {
5376 /* Headphone and output */
5377 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5379 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5380 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5381 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5382 /* Mic2 (front panel) pin widget for input and vref at 80% */
5383 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5384 /* Line In pin widget for input */
5385 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5386 /* Line-2 pin widget for output */
5387 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5388 /* CD pin widget for input */
5389 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5390 /* unmute amp left and right */
5391 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5392 /* set connection select to line in (default select for this ADC) */
5393 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5394 /* unmute Line-Out mixer amp left and right (volume = 0) */
5395 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5396 /* mute pin widget amp left and right (no gain on this amp) */
5397 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5398 /* unmute HP mixer amp left and right (volume = 0) */
5399 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5400 /* mute pin widget amp left and right (no gain on this amp) */
5401 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5402 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5405 /* mute analog inputs */
5406 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5409 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5410 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5411 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5412 /* Unmute Front out path */
5413 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5414 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5415 /* Unmute Headphone out path */
5416 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5417 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5418 /* Unmute Mono out path */
5419 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5420 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5425 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5426 /* Line out and output */
5427 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5429 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5430 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5431 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5432 /* Mic2 (front panel) pin widget for input and vref at 80% */
5433 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5434 /* Line In pin widget for input */
5435 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5436 /* Headphone pin widget for output */
5437 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5438 /* CD pin widget for input */
5439 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5440 /* unmute amp left and right */
5441 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5442 /* set connection select to line in (default select for this ADC) */
5443 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5444 /* unmute Line-Out mixer amp left and right (volume = 0) */
5445 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5446 /* mute pin widget amp left and right (no gain on this amp) */
5447 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5448 /* unmute HP mixer amp left and right (volume = 0) */
5449 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5450 /* mute pin widget amp left and right (no gain on this amp) */
5451 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5452 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5455 /* mute analog inputs */
5456 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5461 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5462 /* Unmute Front out path */
5463 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5464 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5465 /* Unmute Headphone out path */
5466 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5467 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5468 /* Unmute Mono out path */
5469 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5470 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5474 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5475 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5476 * audio = 0x16, internal speaker = 0x10.
5478 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5479 /* Disable all GPIOs */
5480 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5481 /* Internal speaker is connected to headphone pin */
5482 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5483 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5484 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5485 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5486 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5487 /* Ensure all other unused pins are disabled and muted. */
5488 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5489 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5490 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5491 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5492 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5493 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5494 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5495 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5497 /* Disable digital (SPDIF) pins */
5498 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5499 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5501 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5502 * when acting as an output.
5504 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5506 /* Start with output sum widgets muted and their output gains at min */
5507 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5509 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5511 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5512 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5513 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5514 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5515 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5517 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5518 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5519 /* Unmute Line1 pin widget output buffer since it starts as an output.
5520 * If the pin mode is changed by the user the pin mode control will
5521 * take care of enabling the pin's input/output buffers as needed.
5522 * Therefore there's no need to enable the input buffer at this
5525 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5526 /* Unmute input buffer of pin widget used for Line-in (no equiv
5529 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5531 /* Mute capture amp left and right */
5532 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5533 /* Set ADC connection select to match default mixer setting - line
5536 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5538 /* Do the same for the second ADC: mute capture input amp and
5539 * set ADC connection to line in (on mic1 pin)
5541 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5542 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5544 /* Mute all inputs to mixer widget (even unconnected ones) */
5545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5557 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5558 * similar laptops (adapted from Fujitsu init verbs).
5560 static struct hda_verb alc260_acer_init_verbs[] = {
5561 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5562 * the headphone jack. Turn this on and rely on the standard mute
5563 * methods whenever the user wants to turn these outputs off.
5565 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5566 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5567 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5568 /* Internal speaker/Headphone jack is connected to Line-out pin */
5569 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5570 /* Internal microphone/Mic jack is connected to Mic1 pin */
5571 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5572 /* Line In jack is connected to Line1 pin */
5573 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5574 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5575 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5576 /* Ensure all other unused pins are disabled and muted. */
5577 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5578 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5579 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5580 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5581 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5582 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5583 /* Disable digital (SPDIF) pins */
5584 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5585 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5587 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5588 * bus when acting as outputs.
5590 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5591 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5593 /* Start with output sum widgets muted and their output gains at min */
5594 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5596 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5598 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5599 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5600 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5601 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5602 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5604 /* Unmute Line-out pin widget amp left and right
5605 * (no equiv mixer ctrl)
5607 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5608 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5609 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5610 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5611 * inputs. If the pin mode is changed by the user the pin mode control
5612 * will take care of enabling the pin's input/output buffers as needed.
5613 * Therefore there's no need to enable the input buffer at this
5616 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5617 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5619 /* Mute capture amp left and right */
5620 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5621 /* Set ADC connection select to match default mixer setting - mic
5624 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5626 /* Do similar with the second ADC: mute capture input amp and
5627 * set ADC connection to mic to match ALSA's default state.
5629 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5630 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5632 /* Mute all inputs to mixer widget (even unconnected ones) */
5633 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5638 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5639 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5640 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5645 /* Initialisation sequence for Maxdata Favorit 100XS
5646 * (adapted from Acer init verbs).
5648 static struct hda_verb alc260_favorit100_init_verbs[] = {
5649 /* GPIO 0 enables the output jack.
5650 * Turn this on and rely on the standard mute
5651 * methods whenever the user wants to turn these outputs off.
5653 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5654 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5655 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5656 /* Line/Mic input jack is connected to Mic1 pin */
5657 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5658 /* Ensure all other unused pins are disabled and muted. */
5659 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5660 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5661 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5662 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5663 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5664 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5665 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5666 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5667 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5668 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5669 /* Disable digital (SPDIF) pins */
5670 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5671 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5673 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5674 * bus when acting as outputs.
5676 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5677 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5679 /* Start with output sum widgets muted and their output gains at min */
5680 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5681 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5682 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5683 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5684 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5685 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5686 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5687 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5688 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5690 /* Unmute Line-out pin widget amp left and right
5691 * (no equiv mixer ctrl)
5693 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5694 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5695 * inputs. If the pin mode is changed by the user the pin mode control
5696 * will take care of enabling the pin's input/output buffers as needed.
5697 * Therefore there's no need to enable the input buffer at this
5700 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5702 /* Mute capture amp left and right */
5703 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5704 /* Set ADC connection select to match default mixer setting - mic
5707 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5709 /* Do similar with the second ADC: mute capture input amp and
5710 * set ADC connection to mic to match ALSA's default state.
5712 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5713 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5715 /* Mute all inputs to mixer widget (even unconnected ones) */
5716 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5717 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5718 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5719 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5720 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5722 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5728 static struct hda_verb alc260_will_verbs[] = {
5729 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5730 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5731 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5732 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5733 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5734 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5738 static struct hda_verb alc260_replacer_672v_verbs[] = {
5739 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5740 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5741 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5743 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5744 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5745 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5747 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5751 /* toggle speaker-output according to the hp-jack state */
5752 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5754 unsigned int present;
5756 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5757 present = snd_hda_codec_read(codec, 0x0f, 0,
5758 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5760 snd_hda_codec_write_cache(codec, 0x01, 0,
5761 AC_VERB_SET_GPIO_DATA, 1);
5762 snd_hda_codec_write_cache(codec, 0x0f, 0,
5763 AC_VERB_SET_PIN_WIDGET_CONTROL,
5766 snd_hda_codec_write_cache(codec, 0x01, 0,
5767 AC_VERB_SET_GPIO_DATA, 0);
5768 snd_hda_codec_write_cache(codec, 0x0f, 0,
5769 AC_VERB_SET_PIN_WIDGET_CONTROL,
5774 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5777 if ((res >> 26) == ALC880_HP_EVENT)
5778 alc260_replacer_672v_automute(codec);
5781 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5782 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5783 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5784 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5785 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5786 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5787 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5788 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5789 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5790 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5791 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5795 /* Test configuration for debugging, modelled after the ALC880 test
5798 #ifdef CONFIG_SND_DEBUG
5799 static hda_nid_t alc260_test_dac_nids[1] = {
5802 static hda_nid_t alc260_test_adc_nids[2] = {
5805 /* For testing the ALC260, each input MUX needs its own definition since
5806 * the signal assignments are different. This assumes that the first ADC
5809 static struct hda_input_mux alc260_test_capture_sources[2] = {
5813 { "MIC1 pin", 0x0 },
5814 { "MIC2 pin", 0x1 },
5815 { "LINE1 pin", 0x2 },
5816 { "LINE2 pin", 0x3 },
5818 { "LINE-OUT pin", 0x5 },
5819 { "HP-OUT pin", 0x6 },
5825 { "MIC1 pin", 0x0 },
5826 { "MIC2 pin", 0x1 },
5827 { "LINE1 pin", 0x2 },
5828 { "LINE2 pin", 0x3 },
5831 { "LINE-OUT pin", 0x6 },
5832 { "HP-OUT pin", 0x7 },
5836 static struct snd_kcontrol_new alc260_test_mixer[] = {
5837 /* Output driver widgets */
5838 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5839 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5840 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5841 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5842 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5843 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5845 /* Modes for retasking pin widgets
5846 * Note: the ALC260 doesn't seem to act on requests to enable mic
5847 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5848 * mention this restriction. At this stage it's not clear whether
5849 * this behaviour is intentional or is a hardware bug in chip
5850 * revisions available at least up until early 2006. Therefore for
5851 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5852 * choices, but if it turns out that the lack of mic bias for these
5853 * NIDs is intentional we could change their modes from
5854 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5856 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5857 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5858 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5859 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5860 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5861 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5863 /* Loopback mixer controls */
5864 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5865 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5866 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5867 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5868 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5869 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5870 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5871 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5872 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5873 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5874 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5875 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5876 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5877 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5879 /* Controls for GPIO pins, assuming they are configured as outputs */
5880 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5881 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5882 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5883 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5885 /* Switches to allow the digital IO pins to be enabled. The datasheet
5886 * is ambigious as to which NID is which; testing on laptops which
5887 * make this output available should provide clarification.
5889 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5890 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5892 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5893 * this output to turn on an external amplifier.
5895 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5896 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5900 static struct hda_verb alc260_test_init_verbs[] = {
5901 /* Enable all GPIOs as outputs with an initial value of 0 */
5902 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5903 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5904 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5906 /* Enable retasking pins as output, initially without power amp */
5907 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5908 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5909 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5910 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5911 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5912 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5914 /* Disable digital (SPDIF) pins initially, but users can enable
5915 * them via a mixer switch. In the case of SPDIF-out, this initverb
5916 * payload also sets the generation to 0, output to be in "consumer"
5917 * PCM format, copyright asserted, no pre-emphasis and no validity
5920 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5921 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5923 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5924 * OUT1 sum bus when acting as an output.
5926 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5927 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5928 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5929 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5931 /* Start with output sum widgets muted and their output gains at min */
5932 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5933 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5934 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5935 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5936 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5937 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5938 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5939 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5940 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5942 /* Unmute retasking pin widget output buffers since the default
5943 * state appears to be output. As the pin mode is changed by the
5944 * user the pin mode control will take care of enabling the pin's
5945 * input/output buffers as needed.
5947 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5948 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5949 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5950 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5951 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5952 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5953 /* Also unmute the mono-out pin widget */
5954 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5956 /* Mute capture amp left and right */
5957 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5958 /* Set ADC connection select to match default mixer setting (mic1
5961 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5963 /* Do the same for the second ADC: mute capture input amp and
5964 * set ADC connection to mic1 pin
5966 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5967 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5969 /* Mute all inputs to mixer widget (even unconnected ones) */
5970 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5971 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5972 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5973 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5974 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5975 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5976 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5977 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5983 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5984 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5986 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5987 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5990 * for BIOS auto-configuration
5993 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5994 const char *pfx, int *vol_bits)
5997 unsigned long vol_val, sw_val;
6001 if (nid >= 0x0f && nid < 0x11) {
6002 nid_vol = nid - 0x7;
6003 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6004 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6005 } else if (nid == 0x11) {
6006 nid_vol = nid - 0x7;
6007 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6008 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6009 } else if (nid >= 0x12 && nid <= 0x15) {
6011 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6012 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6016 if (!(*vol_bits & (1 << nid_vol))) {
6017 /* first control for the volume widget */
6018 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
6019 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
6022 *vol_bits |= (1 << nid_vol);
6024 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
6025 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
6031 /* add playback controls from the parsed DAC table */
6032 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6033 const struct auto_pin_cfg *cfg)
6039 spec->multiout.num_dacs = 1;
6040 spec->multiout.dac_nids = spec->private_dac_nids;
6041 spec->multiout.dac_nids[0] = 0x02;
6043 nid = cfg->line_out_pins[0];
6046 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6048 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6052 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6057 nid = cfg->speaker_pins[0];
6059 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6064 nid = cfg->hp_pins[0];
6066 err = alc260_add_playback_controls(spec, nid, "Headphone",
6074 /* create playback/capture controls for input pins */
6075 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6076 const struct auto_pin_cfg *cfg)
6078 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6081 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6082 hda_nid_t nid, int pin_type,
6085 alc_set_pin_output(codec, nid, pin_type);
6086 /* need the manual connection? */
6088 int idx = nid - 0x12;
6089 snd_hda_codec_write(codec, idx + 0x0b, 0,
6090 AC_VERB_SET_CONNECT_SEL, sel_idx);
6094 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6096 struct alc_spec *spec = codec->spec;
6099 nid = spec->autocfg.line_out_pins[0];
6101 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6102 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6105 nid = spec->autocfg.speaker_pins[0];
6107 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6109 nid = spec->autocfg.hp_pins[0];
6111 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6114 #define ALC260_PIN_CD_NID 0x16
6115 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6117 struct alc_spec *spec = codec->spec;
6120 for (i = 0; i < AUTO_PIN_LAST; i++) {
6121 hda_nid_t nid = spec->autocfg.input_pins[i];
6123 alc_set_input_pin(codec, nid, i);
6124 if (nid != ALC260_PIN_CD_NID &&
6125 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6126 snd_hda_codec_write(codec, nid, 0,
6127 AC_VERB_SET_AMP_GAIN_MUTE,
6134 * generic initialization of ADC, input mixers and output mixers
6136 static struct hda_verb alc260_volume_init_verbs[] = {
6138 * Unmute ADC0-1 and set the default input to mic-in
6140 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6141 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6142 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6143 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6145 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6147 * Note: PASD motherboards uses the Line In 2 as the input for
6148 * front panel mic (mic 2)
6150 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6151 /* mute analog inputs */
6152 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6153 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6154 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6155 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6156 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6159 * Set up output mixers (0x08 - 0x0a)
6161 /* set vol=0 to output mixers */
6162 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6163 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6164 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6165 /* set up input amps for analog loopback */
6166 /* Amp Indices: DAC = 0, mixer = 1 */
6167 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6168 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6169 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6170 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6171 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6172 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6177 static int alc260_parse_auto_config(struct hda_codec *codec)
6179 struct alc_spec *spec = codec->spec;
6181 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6183 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6187 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6190 if (!spec->kctls.list)
6191 return 0; /* can't find valid BIOS pin config */
6192 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6196 spec->multiout.max_channels = 2;
6198 if (spec->autocfg.dig_outs)
6199 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6200 if (spec->kctls.list)
6201 add_mixer(spec, spec->kctls.list);
6203 add_verb(spec, alc260_volume_init_verbs);
6205 spec->num_mux_defs = 1;
6206 spec->input_mux = &spec->private_imux[0];
6208 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6213 /* additional initialization for auto-configuration model */
6214 static void alc260_auto_init(struct hda_codec *codec)
6216 struct alc_spec *spec = codec->spec;
6217 alc260_auto_init_multi_out(codec);
6218 alc260_auto_init_analog_input(codec);
6219 if (spec->unsol_event)
6220 alc_inithook(codec);
6223 #ifdef CONFIG_SND_HDA_POWER_SAVE
6224 static struct hda_amp_list alc260_loopbacks[] = {
6225 { 0x07, HDA_INPUT, 0 },
6226 { 0x07, HDA_INPUT, 1 },
6227 { 0x07, HDA_INPUT, 2 },
6228 { 0x07, HDA_INPUT, 3 },
6229 { 0x07, HDA_INPUT, 4 },
6235 * ALC260 configurations
6237 static const char *alc260_models[ALC260_MODEL_LAST] = {
6238 [ALC260_BASIC] = "basic",
6240 [ALC260_HP_3013] = "hp-3013",
6241 [ALC260_HP_DC7600] = "hp-dc7600",
6242 [ALC260_FUJITSU_S702X] = "fujitsu",
6243 [ALC260_ACER] = "acer",
6244 [ALC260_WILL] = "will",
6245 [ALC260_REPLACER_672V] = "replacer",
6246 [ALC260_FAVORIT100] = "favorit100",
6247 #ifdef CONFIG_SND_DEBUG
6248 [ALC260_TEST] = "test",
6250 [ALC260_AUTO] = "auto",
6253 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6254 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6255 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6256 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6257 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6258 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6259 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6260 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6261 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6262 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6263 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6264 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6265 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6266 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6267 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6268 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6269 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6270 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6271 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6272 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6273 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6277 static struct alc_config_preset alc260_presets[] = {
6279 .mixers = { alc260_base_output_mixer,
6280 alc260_input_mixer },
6281 .init_verbs = { alc260_init_verbs },
6282 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6283 .dac_nids = alc260_dac_nids,
6284 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6285 .adc_nids = alc260_dual_adc_nids,
6286 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6287 .channel_mode = alc260_modes,
6288 .input_mux = &alc260_capture_source,
6291 .mixers = { alc260_hp_output_mixer,
6292 alc260_input_mixer },
6293 .init_verbs = { alc260_init_verbs,
6294 alc260_hp_unsol_verbs },
6295 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6296 .dac_nids = alc260_dac_nids,
6297 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6298 .adc_nids = alc260_adc_nids_alt,
6299 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6300 .channel_mode = alc260_modes,
6301 .input_mux = &alc260_capture_source,
6302 .unsol_event = alc260_hp_unsol_event,
6303 .init_hook = alc260_hp_automute,
6305 [ALC260_HP_DC7600] = {
6306 .mixers = { alc260_hp_dc7600_mixer,
6307 alc260_input_mixer },
6308 .init_verbs = { alc260_init_verbs,
6309 alc260_hp_dc7600_verbs },
6310 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6311 .dac_nids = alc260_dac_nids,
6312 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6313 .adc_nids = alc260_adc_nids_alt,
6314 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6315 .channel_mode = alc260_modes,
6316 .input_mux = &alc260_capture_source,
6317 .unsol_event = alc260_hp_3012_unsol_event,
6318 .init_hook = alc260_hp_3012_automute,
6320 [ALC260_HP_3013] = {
6321 .mixers = { alc260_hp_3013_mixer,
6322 alc260_input_mixer },
6323 .init_verbs = { alc260_hp_3013_init_verbs,
6324 alc260_hp_3013_unsol_verbs },
6325 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6326 .dac_nids = alc260_dac_nids,
6327 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6328 .adc_nids = alc260_adc_nids_alt,
6329 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6330 .channel_mode = alc260_modes,
6331 .input_mux = &alc260_capture_source,
6332 .unsol_event = alc260_hp_3013_unsol_event,
6333 .init_hook = alc260_hp_3013_automute,
6335 [ALC260_FUJITSU_S702X] = {
6336 .mixers = { alc260_fujitsu_mixer },
6337 .init_verbs = { alc260_fujitsu_init_verbs },
6338 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6339 .dac_nids = alc260_dac_nids,
6340 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6341 .adc_nids = alc260_dual_adc_nids,
6342 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6343 .channel_mode = alc260_modes,
6344 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6345 .input_mux = alc260_fujitsu_capture_sources,
6348 .mixers = { alc260_acer_mixer },
6349 .init_verbs = { alc260_acer_init_verbs },
6350 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6351 .dac_nids = alc260_dac_nids,
6352 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6353 .adc_nids = alc260_dual_adc_nids,
6354 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6355 .channel_mode = alc260_modes,
6356 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6357 .input_mux = alc260_acer_capture_sources,
6359 [ALC260_FAVORIT100] = {
6360 .mixers = { alc260_favorit100_mixer },
6361 .init_verbs = { alc260_favorit100_init_verbs },
6362 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6363 .dac_nids = alc260_dac_nids,
6364 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6365 .adc_nids = alc260_dual_adc_nids,
6366 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6367 .channel_mode = alc260_modes,
6368 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6369 .input_mux = alc260_favorit100_capture_sources,
6372 .mixers = { alc260_will_mixer },
6373 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6374 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6375 .dac_nids = alc260_dac_nids,
6376 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6377 .adc_nids = alc260_adc_nids,
6378 .dig_out_nid = ALC260_DIGOUT_NID,
6379 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6380 .channel_mode = alc260_modes,
6381 .input_mux = &alc260_capture_source,
6383 [ALC260_REPLACER_672V] = {
6384 .mixers = { alc260_replacer_672v_mixer },
6385 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6386 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6387 .dac_nids = alc260_dac_nids,
6388 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6389 .adc_nids = alc260_adc_nids,
6390 .dig_out_nid = ALC260_DIGOUT_NID,
6391 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6392 .channel_mode = alc260_modes,
6393 .input_mux = &alc260_capture_source,
6394 .unsol_event = alc260_replacer_672v_unsol_event,
6395 .init_hook = alc260_replacer_672v_automute,
6397 #ifdef CONFIG_SND_DEBUG
6399 .mixers = { alc260_test_mixer },
6400 .init_verbs = { alc260_test_init_verbs },
6401 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6402 .dac_nids = alc260_test_dac_nids,
6403 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6404 .adc_nids = alc260_test_adc_nids,
6405 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6406 .channel_mode = alc260_modes,
6407 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6408 .input_mux = alc260_test_capture_sources,
6413 static int patch_alc260(struct hda_codec *codec)
6415 struct alc_spec *spec;
6416 int err, board_config;
6418 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6424 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6427 if (board_config < 0) {
6428 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6430 board_config = ALC260_AUTO;
6433 if (board_config == ALC260_AUTO) {
6434 /* automatic parse from the BIOS config */
6435 err = alc260_parse_auto_config(codec);
6441 "hda_codec: Cannot set up configuration "
6442 "from BIOS. Using base mode...\n");
6443 board_config = ALC260_BASIC;
6447 err = snd_hda_attach_beep_device(codec, 0x1);
6453 if (board_config != ALC260_AUTO)
6454 setup_preset(codec, &alc260_presets[board_config]);
6456 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6457 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6459 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6460 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6462 if (!spec->adc_nids && spec->input_mux) {
6463 /* check whether NID 0x04 is valid */
6464 unsigned int wcap = get_wcaps(codec, 0x04);
6465 wcap = get_wcaps_type(wcap);
6467 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6468 spec->adc_nids = alc260_adc_nids_alt;
6469 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6471 spec->adc_nids = alc260_adc_nids;
6472 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6475 set_capture_mixer(codec);
6476 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6478 spec->vmaster_nid = 0x08;
6480 codec->patch_ops = alc_patch_ops;
6481 if (board_config == ALC260_AUTO)
6482 spec->init_hook = alc260_auto_init;
6483 #ifdef CONFIG_SND_HDA_POWER_SAVE
6484 if (!spec->loopback.amplist)
6485 spec->loopback.amplist = alc260_loopbacks;
6487 codec->proc_widget_hook = print_realtek_coef;
6494 * ALC882/883/885/888/889 support
6496 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6497 * configuration. Each pin widget can choose any input DACs and a mixer.
6498 * Each ADC is connected from a mixer of all inputs. This makes possible
6499 * 6-channel independent captures.
6501 * In addition, an independent DAC for the multi-playback (not used in this
6504 #define ALC882_DIGOUT_NID 0x06
6505 #define ALC882_DIGIN_NID 0x0a
6506 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6507 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6508 #define ALC1200_DIGOUT_NID 0x10
6511 static struct hda_channel_mode alc882_ch_modes[1] = {
6516 static hda_nid_t alc882_dac_nids[4] = {
6517 /* front, rear, clfe, rear_surr */
6518 0x02, 0x03, 0x04, 0x05
6520 #define alc883_dac_nids alc882_dac_nids
6523 #define alc882_adc_nids alc880_adc_nids
6524 #define alc882_adc_nids_alt alc880_adc_nids_alt
6525 #define alc883_adc_nids alc882_adc_nids_alt
6526 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6527 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6528 #define alc889_adc_nids alc880_adc_nids
6530 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6531 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6532 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6533 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6534 #define alc889_capsrc_nids alc882_capsrc_nids
6537 /* FIXME: should be a matrix-type input source selection */
6539 static struct hda_input_mux alc882_capture_source = {
6543 { "Front Mic", 0x1 },
6549 #define alc883_capture_source alc882_capture_source
6551 static struct hda_input_mux alc889_capture_source = {
6554 { "Front Mic", 0x0 },
6560 static struct hda_input_mux mb5_capture_source = {
6569 static struct hda_input_mux alc883_3stack_6ch_intel = {
6573 { "Front Mic", 0x0 },
6579 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6587 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6597 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6605 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6609 { "Front Mic", 0x1 },
6614 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6622 static struct hda_input_mux alc889A_mb31_capture_source = {
6626 /* Front Mic (0x01) unused */
6628 /* Line 2 (0x03) unused */
6629 /* CD (0x04) unsused? */
6636 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6643 static struct hda_verb alc882_3ST_ch2_init[] = {
6644 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6645 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6646 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6647 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6654 static struct hda_verb alc882_3ST_ch4_init[] = {
6655 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6656 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6657 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6658 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6659 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6666 static struct hda_verb alc882_3ST_ch6_init[] = {
6667 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6668 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6669 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6670 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6671 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6672 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6676 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6677 { 2, alc882_3ST_ch2_init },
6678 { 4, alc882_3ST_ch4_init },
6679 { 6, alc882_3ST_ch6_init },
6682 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6687 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6688 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6689 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6690 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6691 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6692 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6699 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6700 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6701 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6702 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6703 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6704 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6705 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6712 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6713 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6714 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6715 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6716 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6717 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6718 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6719 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6723 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6724 { 2, alc883_3ST_ch2_clevo_init },
6725 { 4, alc883_3ST_ch4_clevo_init },
6726 { 6, alc883_3ST_ch6_clevo_init },
6733 static struct hda_verb alc882_sixstack_ch6_init[] = {
6734 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6735 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6736 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6737 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6744 static struct hda_verb alc882_sixstack_ch8_init[] = {
6745 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6746 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6747 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6748 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6752 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6753 { 6, alc882_sixstack_ch6_init },
6754 { 8, alc882_sixstack_ch8_init },
6758 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6764 static struct hda_verb alc885_mbp_ch2_init[] = {
6765 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6766 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6767 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6774 static struct hda_verb alc885_mbp_ch4_init[] = {
6775 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6776 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6777 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6778 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6779 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6783 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6784 { 2, alc885_mbp_ch2_init },
6785 { 4, alc885_mbp_ch4_init },
6790 * Speakers/Woofer/HP = Front
6793 static struct hda_verb alc885_mb5_ch2_init[] = {
6794 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6795 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6801 * Speakers/HP = Front
6805 static struct hda_verb alc885_mb5_ch6_init[] = {
6806 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6807 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6808 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6812 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6813 { 2, alc885_mb5_ch2_init },
6814 { 6, alc885_mb5_ch6_init },
6821 static struct hda_verb alc883_4ST_ch2_init[] = {
6822 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6823 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6824 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6825 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6826 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6827 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6834 static struct hda_verb alc883_4ST_ch4_init[] = {
6835 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6836 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6837 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6838 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6839 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6840 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6841 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6848 static struct hda_verb alc883_4ST_ch6_init[] = {
6849 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6850 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6851 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6852 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6853 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6854 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6855 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6856 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6863 static struct hda_verb alc883_4ST_ch8_init[] = {
6864 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6865 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6866 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6867 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6868 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6869 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6870 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6871 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6872 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6876 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6877 { 2, alc883_4ST_ch2_init },
6878 { 4, alc883_4ST_ch4_init },
6879 { 6, alc883_4ST_ch6_init },
6880 { 8, alc883_4ST_ch8_init },
6887 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6888 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6889 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6890 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6891 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6898 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6899 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6900 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6901 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6902 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6903 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6910 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6911 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6912 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6913 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6914 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6915 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6916 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6920 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6921 { 2, alc883_3ST_ch2_intel_init },
6922 { 4, alc883_3ST_ch4_intel_init },
6923 { 6, alc883_3ST_ch6_intel_init },
6929 static struct hda_verb alc889_ch2_intel_init[] = {
6930 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6931 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6932 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6933 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6934 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6935 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6942 static struct hda_verb alc889_ch6_intel_init[] = {
6943 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6944 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6945 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6946 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6947 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6948 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6955 static struct hda_verb alc889_ch8_intel_init[] = {
6956 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6957 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6958 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6959 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6960 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6961 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6962 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6966 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6967 { 2, alc889_ch2_intel_init },
6968 { 6, alc889_ch6_intel_init },
6969 { 8, alc889_ch8_intel_init },
6975 static struct hda_verb alc883_sixstack_ch6_init[] = {
6976 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6977 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6978 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6979 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6986 static struct hda_verb alc883_sixstack_ch8_init[] = {
6987 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6988 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6989 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6990 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6994 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6995 { 6, alc883_sixstack_ch6_init },
6996 { 8, alc883_sixstack_ch8_init },
7000 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7001 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7003 static struct snd_kcontrol_new alc882_base_mixer[] = {
7004 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7005 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7006 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7007 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7008 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7009 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7010 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7011 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7012 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7013 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7014 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7015 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7016 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7017 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7018 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7019 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7020 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7022 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7023 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7024 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7028 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7029 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7030 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7031 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7032 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7033 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7034 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7035 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7036 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7037 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7038 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7039 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7043 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7044 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7045 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7046 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7047 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7048 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7049 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7050 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7051 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7052 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7053 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7054 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7055 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7056 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7057 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7061 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7062 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7063 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7064 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7065 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7066 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7067 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7068 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7069 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7070 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7074 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7075 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7076 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7077 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7078 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7079 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7080 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7081 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7082 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7083 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7084 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7085 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7086 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7087 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7091 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7092 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7094 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7095 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7096 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7097 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7098 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7099 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7100 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7101 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7102 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7103 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7104 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7105 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7106 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7107 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7111 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7112 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7113 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7114 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7115 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7116 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7117 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7118 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7120 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7121 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7125 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7127 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7128 .name = "Channel Mode",
7129 .info = alc_ch_mode_info,
7130 .get = alc_ch_mode_get,
7131 .put = alc_ch_mode_put,
7136 static struct hda_verb alc882_base_init_verbs[] = {
7137 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7138 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7139 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7140 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7142 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7143 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7144 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7146 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7147 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7148 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7150 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7151 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7152 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7154 /* mute analog input loopbacks */
7155 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7156 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7157 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7158 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7159 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7161 /* Front Pin: output 0 (0x0c) */
7162 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7163 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7164 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7165 /* Rear Pin: output 1 (0x0d) */
7166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7167 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7168 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7169 /* CLFE Pin: output 2 (0x0e) */
7170 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7171 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7172 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7173 /* Side Pin: output 3 (0x0f) */
7174 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7175 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7176 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7177 /* Mic (rear) pin: input vref at 80% */
7178 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7179 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7180 /* Front Mic pin: input vref at 80% */
7181 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7182 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7183 /* Line In pin: input */
7184 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7185 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7186 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7187 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7188 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7189 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7190 /* CD pin widget for input */
7191 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7193 /* FIXME: use matrix-type input source selection */
7194 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7196 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7197 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7198 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7199 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7201 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7202 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7205 /* ADC2: mute amp left and right */
7206 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7207 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7208 /* ADC3: mute amp left and right */
7209 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7210 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7215 static struct hda_verb alc882_adc1_init_verbs[] = {
7216 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7217 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7218 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7219 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7220 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7221 /* ADC1: mute amp left and right */
7222 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7223 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7227 static struct hda_verb alc882_eapd_verbs[] = {
7228 /* change to EAPD mode */
7229 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7230 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7234 static struct hda_verb alc889_eapd_verbs[] = {
7235 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7236 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7240 static struct hda_verb alc_hp15_unsol_verbs[] = {
7241 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7242 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7246 static struct hda_verb alc885_init_verbs[] = {
7247 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7248 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7250 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7252 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7253 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7254 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7256 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7257 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7258 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7260 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7261 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7262 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7264 /* mute analog input loopbacks */
7265 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7266 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7267 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7269 /* Front HP Pin: output 0 (0x0c) */
7270 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7271 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7272 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7273 /* Front Pin: output 0 (0x0c) */
7274 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7275 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7276 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7277 /* Rear Pin: output 1 (0x0d) */
7278 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7279 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7280 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7281 /* CLFE Pin: output 2 (0x0e) */
7282 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7283 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7284 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7285 /* Side Pin: output 3 (0x0f) */
7286 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7287 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7288 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7289 /* Mic (rear) pin: input vref at 80% */
7290 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7291 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7292 /* Front Mic pin: input vref at 80% */
7293 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7294 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7295 /* Line In pin: input */
7296 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7297 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7299 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7302 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7303 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7312 /* ADC2: mute amp left and right */
7313 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7314 /* ADC3: mute amp left and right */
7315 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7320 static struct hda_verb alc885_init_input_verbs[] = {
7321 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7322 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7323 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7328 /* Unmute Selector 24h and set the default input to front mic */
7329 static struct hda_verb alc889_init_input_verbs[] = {
7330 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7331 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7336 #define alc883_init_verbs alc882_base_init_verbs
7339 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7340 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7341 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7342 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7343 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7344 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7345 /* FIXME: this looks suspicious...
7346 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7347 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7352 static struct hda_verb alc882_macpro_init_verbs[] = {
7353 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7355 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7356 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7357 /* Front Pin: output 0 (0x0c) */
7358 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7359 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7360 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7361 /* Front Mic pin: input vref at 80% */
7362 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7363 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7364 /* Speaker: output */
7365 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7366 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7367 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7368 /* Headphone output (output 0 - 0x0c) */
7369 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7370 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7371 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7373 /* FIXME: use matrix-type input source selection */
7374 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7375 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7376 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7377 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7378 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7379 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7381 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7382 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7383 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7384 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7387 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7388 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7389 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7390 /* ADC1: mute amp left and right */
7391 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7392 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7393 /* ADC2: mute amp left and right */
7394 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7395 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7396 /* ADC3: mute amp left and right */
7397 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7398 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7404 static struct hda_verb alc885_mb5_init_verbs[] = {
7406 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7407 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7408 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7409 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7411 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7412 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7413 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7414 /* Surround mixer */
7415 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7416 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7417 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7419 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7420 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7421 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7423 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7424 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7425 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7426 /* Front Pin (0x0c) */
7427 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7428 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7429 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7430 /* LFE Pin (0x0e) */
7431 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7432 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7433 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7435 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7436 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7437 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7438 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7439 /* Front Mic pin: input vref at 80% */
7440 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7441 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7443 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7444 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7446 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7447 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7448 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7453 /* Macbook Pro rev3 */
7454 static struct hda_verb alc885_mbp3_init_verbs[] = {
7455 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7456 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7457 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7458 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7460 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7461 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7462 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7464 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7465 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7466 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7467 /* Front Pin: output 0 (0x0c) */
7468 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7469 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7470 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7471 /* HP Pin: output 0 (0x0e) */
7472 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7473 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7474 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7475 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7476 /* Mic (rear) pin: input vref at 80% */
7477 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7478 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7479 /* Front Mic pin: input vref at 80% */
7480 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7481 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7482 /* Line In pin: use output 1 when in LineOut mode */
7483 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7484 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7485 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7487 /* FIXME: use matrix-type input source selection */
7488 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7489 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7490 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7491 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7492 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7493 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7495 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7496 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7497 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7498 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7500 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7501 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7502 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7504 /* ADC1: mute amp left and right */
7505 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7506 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7507 /* ADC2: mute amp left and right */
7508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7509 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7510 /* ADC3: mute amp left and right */
7511 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7512 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7517 /* iMac 24 mixer. */
7518 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7519 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7520 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7524 /* iMac 24 init verbs. */
7525 static struct hda_verb alc885_imac24_init_verbs[] = {
7526 /* Internal speakers: output 0 (0x0c) */
7527 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7528 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7529 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7530 /* Internal speakers: output 0 (0x0c) */
7531 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7532 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7533 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7534 /* Headphone: output 0 (0x0c) */
7535 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7536 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7537 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7538 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7539 /* Front Mic: input vref at 80% */
7540 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7541 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7545 /* Toggle speaker-output according to the hp-jack state */
7546 static void alc885_imac24_setup(struct hda_codec *codec)
7548 struct alc_spec *spec = codec->spec;
7550 spec->autocfg.hp_pins[0] = 0x14;
7551 spec->autocfg.speaker_pins[0] = 0x18;
7552 spec->autocfg.speaker_pins[1] = 0x1a;
7555 static void alc885_mbp3_setup(struct hda_codec *codec)
7557 struct alc_spec *spec = codec->spec;
7559 spec->autocfg.hp_pins[0] = 0x15;
7560 spec->autocfg.speaker_pins[0] = 0x14;
7563 static void alc885_mb5_automute(struct hda_codec *codec)
7565 unsigned int present;
7567 present = snd_hda_codec_read(codec, 0x14, 0,
7568 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7569 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7570 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7571 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7572 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7576 static void alc885_mb5_unsol_event(struct hda_codec *codec,
7579 /* Headphone insertion or removal. */
7580 if ((res >> 26) == ALC880_HP_EVENT)
7581 alc885_mb5_automute(codec);
7585 static struct hda_verb alc882_targa_verbs[] = {
7586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7589 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7590 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7592 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7593 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7594 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7596 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7600 /* toggle speaker-output according to the hp-jack state */
7601 static void alc882_targa_automute(struct hda_codec *codec)
7603 struct alc_spec *spec = codec->spec;
7604 alc_automute_amp(codec);
7605 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7606 spec->jack_present ? 1 : 3);
7609 static void alc882_targa_setup(struct hda_codec *codec)
7611 struct alc_spec *spec = codec->spec;
7613 spec->autocfg.hp_pins[0] = 0x14;
7614 spec->autocfg.speaker_pins[0] = 0x1b;
7617 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7619 if ((res >> 26) == ALC880_HP_EVENT)
7620 alc882_targa_automute(codec);
7623 static struct hda_verb alc882_asus_a7j_verbs[] = {
7624 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7625 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7627 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7628 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7629 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7631 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7632 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7633 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7635 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7636 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7637 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7641 static struct hda_verb alc882_asus_a7m_verbs[] = {
7642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7643 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7645 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7646 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7647 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7649 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7650 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7651 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7653 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7654 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7655 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7659 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7661 unsigned int gpiostate, gpiomask, gpiodir;
7663 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7664 AC_VERB_GET_GPIO_DATA, 0);
7667 gpiostate |= (1 << pin);
7669 gpiostate &= ~(1 << pin);
7671 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7672 AC_VERB_GET_GPIO_MASK, 0);
7673 gpiomask |= (1 << pin);
7675 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7676 AC_VERB_GET_GPIO_DIRECTION, 0);
7677 gpiodir |= (1 << pin);
7680 snd_hda_codec_write(codec, codec->afg, 0,
7681 AC_VERB_SET_GPIO_MASK, gpiomask);
7682 snd_hda_codec_write(codec, codec->afg, 0,
7683 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7687 snd_hda_codec_write(codec, codec->afg, 0,
7688 AC_VERB_SET_GPIO_DATA, gpiostate);
7691 /* set up GPIO at initialization */
7692 static void alc885_macpro_init_hook(struct hda_codec *codec)
7694 alc882_gpio_mute(codec, 0, 0);
7695 alc882_gpio_mute(codec, 1, 0);
7698 /* set up GPIO and update auto-muting at initialization */
7699 static void alc885_imac24_init_hook(struct hda_codec *codec)
7701 alc885_macpro_init_hook(codec);
7702 alc_automute_amp(codec);
7706 * generic initialization of ADC, input mixers and output mixers
7708 static struct hda_verb alc883_auto_init_verbs[] = {
7710 * Unmute ADC0-2 and set the default input to mic-in
7712 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7713 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7714 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7715 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7717 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7719 * Note: PASD motherboards uses the Line In 2 as the input for
7720 * front panel mic (mic 2)
7722 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7727 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7730 * Set up output mixers (0x0c - 0x0f)
7732 /* set vol=0 to output mixers */
7733 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7734 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7735 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7736 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7737 /* set up input amps for analog loopback */
7738 /* Amp Indices: DAC = 0, mixer = 1 */
7739 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7740 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7741 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7742 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7743 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7744 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7745 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7746 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7747 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7748 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7750 /* FIXME: use matrix-type input source selection */
7751 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7753 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7754 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7755 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7756 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7758 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7759 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7760 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7761 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7766 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7767 static struct hda_verb alc889A_mb31_ch2_init[] = {
7768 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7769 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7770 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7771 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7775 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7776 static struct hda_verb alc889A_mb31_ch4_init[] = {
7777 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7778 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7779 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7780 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7784 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7785 static struct hda_verb alc889A_mb31_ch5_init[] = {
7786 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7787 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7788 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7789 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7793 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7794 static struct hda_verb alc889A_mb31_ch6_init[] = {
7795 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7796 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7797 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7798 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7802 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7803 { 2, alc889A_mb31_ch2_init },
7804 { 4, alc889A_mb31_ch4_init },
7805 { 5, alc889A_mb31_ch5_init },
7806 { 6, alc889A_mb31_ch6_init },
7809 static struct hda_verb alc883_medion_eapd_verbs[] = {
7810 /* eanable EAPD on medion laptop */
7811 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7812 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7816 #define alc883_base_mixer alc882_base_mixer
7818 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7819 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7820 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7821 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7822 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7823 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7824 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7825 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7826 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7827 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7828 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7829 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7830 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7831 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7835 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7836 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7837 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7838 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7839 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7840 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7841 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7842 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7843 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7844 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7845 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7849 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7850 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7851 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7852 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7853 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7854 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7855 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7856 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7857 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7858 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7859 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7863 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7864 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7865 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7866 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7867 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7868 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7869 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7870 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7871 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7872 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7873 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7874 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7875 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7876 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7880 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7881 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7882 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7883 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7884 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7885 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7886 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7887 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7888 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7889 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7890 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7891 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7892 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7893 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7894 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7895 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7897 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7898 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7899 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7903 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7904 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7905 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7906 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7907 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7908 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7910 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7911 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7912 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7913 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7914 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7915 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7916 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7917 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7918 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7919 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7920 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7921 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7922 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7923 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7927 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7928 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7929 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7930 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7931 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7932 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7934 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7935 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7936 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7937 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7938 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7939 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7940 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7941 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7942 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7943 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7944 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7945 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7946 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7947 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7951 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7952 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7953 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7954 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7955 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7956 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7957 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7958 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7959 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7960 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7961 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7962 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7963 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7964 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7965 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7966 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7967 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7968 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7969 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7970 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7974 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7975 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7976 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7977 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7978 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7979 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7980 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7981 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7982 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7983 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7984 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7985 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7986 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7987 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7988 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7989 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7990 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7991 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7995 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7996 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7997 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7998 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7999 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8000 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8001 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8002 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8003 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8004 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8005 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8006 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8007 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8011 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8012 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8013 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8014 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8015 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8016 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8020 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8021 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8022 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8023 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8024 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8025 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8026 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8027 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8028 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8032 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8033 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8034 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8035 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8036 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8037 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8038 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8039 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8040 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8041 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8045 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8046 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8047 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8048 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8049 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8050 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8051 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8052 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8053 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8054 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8058 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8059 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8060 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8061 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8062 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8063 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8064 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8065 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8066 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8070 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8071 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8072 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8073 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8074 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8075 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8076 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8077 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8078 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8079 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8080 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8081 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8085 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8086 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8087 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8088 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8089 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8090 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8091 0x0d, 1, 0x0, HDA_OUTPUT),
8092 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8093 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8094 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8095 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8096 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8097 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8098 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8100 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8102 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8103 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8104 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8105 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8106 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8110 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8112 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8113 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8114 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8115 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8116 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8118 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8119 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8120 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8121 /* Output switches */
8122 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8123 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8124 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8126 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8127 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8131 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8132 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8136 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8137 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8138 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8139 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8141 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8142 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8146 static struct hda_bind_ctls alc883_bind_cap_vol = {
8147 .ops = &snd_hda_bind_vol,
8149 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8150 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8155 static struct hda_bind_ctls alc883_bind_cap_switch = {
8156 .ops = &snd_hda_bind_sw,
8158 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8159 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8164 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8165 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8166 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8167 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8168 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8169 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8170 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8171 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8172 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8176 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8177 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8178 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8180 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8181 /* .name = "Capture Source", */
8182 .name = "Input Source",
8184 .info = alc_mux_enum_info,
8185 .get = alc_mux_enum_get,
8186 .put = alc_mux_enum_put,
8191 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8193 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8194 .name = "Channel Mode",
8195 .info = alc_ch_mode_info,
8196 .get = alc_ch_mode_get,
8197 .put = alc_ch_mode_put,
8202 /* toggle speaker-output according to the hp-jack state */
8203 static void alc883_mitac_setup(struct hda_codec *codec)
8205 struct alc_spec *spec = codec->spec;
8207 spec->autocfg.hp_pins[0] = 0x15;
8208 spec->autocfg.speaker_pins[0] = 0x14;
8209 spec->autocfg.speaker_pins[1] = 0x17;
8212 /* auto-toggle front mic */
8214 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8216 unsigned int present;
8219 present = snd_hda_codec_read(codec, 0x18, 0,
8220 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8221 bits = present ? HDA_AMP_MUTE : 0;
8222 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8226 static struct hda_verb alc883_mitac_verbs[] = {
8228 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8229 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8231 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8232 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8234 /* enable unsolicited event */
8235 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8236 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8241 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8243 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8244 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8246 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8248 /* enable unsolicited event */
8250 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8251 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8257 static struct hda_verb alc883_clevo_m720_verbs[] = {
8259 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8260 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8262 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8263 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8265 /* enable unsolicited event */
8266 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8267 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8272 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8274 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8275 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8277 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8278 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8280 /* enable unsolicited event */
8281 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8286 static struct hda_verb alc883_targa_verbs[] = {
8287 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8290 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8291 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8293 /* Connect Line-Out side jack (SPDIF) to Side */
8294 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8295 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8296 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8297 /* Connect Mic jack to CLFE */
8298 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8299 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8300 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8301 /* Connect Line-in jack to Surround */
8302 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8303 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8304 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8305 /* Connect HP out jack to Front */
8306 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8307 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8308 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8310 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8315 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8316 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8317 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8318 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8322 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8323 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8324 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8325 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8330 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8331 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8333 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8334 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8335 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8339 static struct hda_verb alc883_haier_w66_verbs[] = {
8340 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8341 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8343 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8345 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8346 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8347 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8348 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8352 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8355 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8356 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8357 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8358 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8359 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8360 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8364 static struct hda_verb alc888_6st_dell_verbs[] = {
8365 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8369 static struct hda_verb alc883_vaiott_verbs[] = {
8371 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8372 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8374 /* enable unsolicited event */
8375 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8380 static void alc888_3st_hp_setup(struct hda_codec *codec)
8382 struct alc_spec *spec = codec->spec;
8384 spec->autocfg.hp_pins[0] = 0x1b;
8385 spec->autocfg.speaker_pins[0] = 0x14;
8386 spec->autocfg.speaker_pins[1] = 0x16;
8387 spec->autocfg.speaker_pins[2] = 0x18;
8390 static struct hda_verb alc888_3st_hp_verbs[] = {
8391 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8392 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8393 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8394 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8401 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8402 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8403 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8404 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8405 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8412 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8413 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8414 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8415 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8416 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8417 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8424 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8425 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8426 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8427 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8428 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8429 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8430 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8434 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8435 { 2, alc888_3st_hp_2ch_init },
8436 { 4, alc888_3st_hp_4ch_init },
8437 { 6, alc888_3st_hp_6ch_init },
8440 /* toggle front-jack and RCA according to the hp-jack state */
8441 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8443 unsigned int present;
8445 present = snd_hda_codec_read(codec, 0x1b, 0,
8446 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8447 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8448 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8449 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8450 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8453 /* toggle RCA according to the front-jack state */
8454 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8456 unsigned int present;
8458 present = snd_hda_codec_read(codec, 0x14, 0,
8459 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8460 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8461 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8464 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8467 if ((res >> 26) == ALC880_HP_EVENT)
8468 alc888_lenovo_ms7195_front_automute(codec);
8469 if ((res >> 26) == ALC880_FRONT_EVENT)
8470 alc888_lenovo_ms7195_rca_automute(codec);
8473 static struct hda_verb alc883_medion_md2_verbs[] = {
8474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8477 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8479 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8483 /* toggle speaker-output according to the hp-jack state */
8484 static void alc883_medion_md2_setup(struct hda_codec *codec)
8486 struct alc_spec *spec = codec->spec;
8488 spec->autocfg.hp_pins[0] = 0x14;
8489 spec->autocfg.speaker_pins[0] = 0x15;
8492 /* toggle speaker-output according to the hp-jack state */
8493 #define alc883_targa_init_hook alc882_targa_init_hook
8494 #define alc883_targa_unsol_event alc882_targa_unsol_event
8496 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8498 unsigned int present;
8500 present = snd_hda_codec_read(codec, 0x18, 0,
8501 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8502 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8503 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8506 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8508 struct alc_spec *spec = codec->spec;
8510 spec->autocfg.hp_pins[0] = 0x15;
8511 spec->autocfg.speaker_pins[0] = 0x14;
8514 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8516 alc_automute_amp(codec);
8517 alc883_clevo_m720_mic_automute(codec);
8520 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8523 switch (res >> 26) {
8524 case ALC880_MIC_EVENT:
8525 alc883_clevo_m720_mic_automute(codec);
8528 alc_automute_amp_unsol_event(codec, res);
8533 /* toggle speaker-output according to the hp-jack state */
8534 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8536 struct alc_spec *spec = codec->spec;
8538 spec->autocfg.hp_pins[0] = 0x14;
8539 spec->autocfg.speaker_pins[0] = 0x15;
8542 static void alc883_haier_w66_setup(struct hda_codec *codec)
8544 struct alc_spec *spec = codec->spec;
8546 spec->autocfg.hp_pins[0] = 0x1b;
8547 spec->autocfg.speaker_pins[0] = 0x14;
8550 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8552 unsigned int present;
8555 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8556 & AC_PINSENSE_PRESENCE;
8557 bits = present ? HDA_AMP_MUTE : 0;
8558 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8559 HDA_AMP_MUTE, bits);
8562 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8564 unsigned int present;
8567 present = snd_hda_codec_read(codec, 0x1b, 0,
8568 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8569 bits = present ? HDA_AMP_MUTE : 0;
8570 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8571 HDA_AMP_MUTE, bits);
8572 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8573 HDA_AMP_MUTE, bits);
8576 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8579 if ((res >> 26) == ALC880_HP_EVENT)
8580 alc883_lenovo_101e_all_automute(codec);
8581 if ((res >> 26) == ALC880_FRONT_EVENT)
8582 alc883_lenovo_101e_ispeaker_automute(codec);
8585 /* toggle speaker-output according to the hp-jack state */
8586 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8588 struct alc_spec *spec = codec->spec;
8590 spec->autocfg.hp_pins[0] = 0x14;
8591 spec->autocfg.speaker_pins[0] = 0x15;
8592 spec->autocfg.speaker_pins[1] = 0x16;
8595 static struct hda_verb alc883_acer_eapd_verbs[] = {
8596 /* HP Pin: output 0 (0x0c) */
8597 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8598 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8599 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8600 /* Front Pin: output 0 (0x0c) */
8601 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8602 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8603 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8604 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8605 /* eanable EAPD on medion laptop */
8606 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8607 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8608 /* enable unsolicited event */
8609 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8613 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8614 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8615 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8616 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8620 static void alc888_6st_dell_setup(struct hda_codec *codec)
8622 struct alc_spec *spec = codec->spec;
8624 spec->autocfg.hp_pins[0] = 0x1b;
8625 spec->autocfg.speaker_pins[0] = 0x14;
8626 spec->autocfg.speaker_pins[1] = 0x15;
8627 spec->autocfg.speaker_pins[2] = 0x16;
8628 spec->autocfg.speaker_pins[3] = 0x17;
8631 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8633 struct alc_spec *spec = codec->spec;
8635 spec->autocfg.hp_pins[0] = 0x1b;
8636 spec->autocfg.speaker_pins[0] = 0x14;
8637 spec->autocfg.speaker_pins[1] = 0x15;
8638 spec->autocfg.speaker_pins[2] = 0x16;
8639 spec->autocfg.speaker_pins[3] = 0x17;
8640 spec->autocfg.speaker_pins[4] = 0x1a;
8643 static void alc883_vaiott_setup(struct hda_codec *codec)
8645 struct alc_spec *spec = codec->spec;
8647 spec->autocfg.hp_pins[0] = 0x15;
8648 spec->autocfg.speaker_pins[0] = 0x14;
8649 spec->autocfg.speaker_pins[1] = 0x17;
8652 static struct hda_verb alc888_asus_m90v_verbs[] = {
8653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8655 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8656 /* enable unsolicited event */
8657 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8658 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8662 static void alc883_mode2_setup(struct hda_codec *codec)
8664 struct alc_spec *spec = codec->spec;
8666 spec->autocfg.hp_pins[0] = 0x1b;
8667 spec->autocfg.speaker_pins[0] = 0x14;
8668 spec->autocfg.speaker_pins[1] = 0x15;
8669 spec->autocfg.speaker_pins[2] = 0x16;
8670 spec->ext_mic.pin = 0x18;
8671 spec->int_mic.pin = 0x19;
8672 spec->ext_mic.mux_idx = 0;
8673 spec->int_mic.mux_idx = 1;
8677 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8678 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8679 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8681 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8682 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8683 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8684 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8685 /* enable unsolicited event */
8686 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8690 static void alc883_eee1601_inithook(struct hda_codec *codec)
8692 struct alc_spec *spec = codec->spec;
8694 spec->autocfg.hp_pins[0] = 0x14;
8695 spec->autocfg.speaker_pins[0] = 0x1b;
8696 alc_automute_pin(codec);
8699 static struct hda_verb alc889A_mb31_verbs[] = {
8700 /* Init rear pin (used as headphone output) */
8701 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8702 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8703 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8704 /* Init line pin (used as output in 4ch and 6ch mode) */
8705 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8706 /* Init line 2 pin (used as headphone out by default) */
8707 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8708 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8712 /* Mute speakers according to the headphone jack state */
8713 static void alc889A_mb31_automute(struct hda_codec *codec)
8715 unsigned int present;
8717 /* Mute only in 2ch or 4ch mode */
8718 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8720 present = snd_hda_codec_read(codec, 0x15, 0,
8721 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8722 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8723 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8724 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8725 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8729 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8731 if ((res >> 26) == ALC880_HP_EVENT)
8732 alc889A_mb31_automute(codec);
8736 #ifdef CONFIG_SND_HDA_POWER_SAVE
8737 #define alc882_loopbacks alc880_loopbacks
8740 /* pcm configuration: identical with ALC880 */
8741 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8742 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8743 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8744 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8746 static hda_nid_t alc883_slave_dig_outs[] = {
8747 ALC1200_DIGOUT_NID, 0,
8750 static hda_nid_t alc1200_slave_dig_outs[] = {
8751 ALC883_DIGOUT_NID, 0,
8755 * configuration and preset
8757 static const char *alc882_models[ALC882_MODEL_LAST] = {
8758 [ALC882_3ST_DIG] = "3stack-dig",
8759 [ALC882_6ST_DIG] = "6stack-dig",
8760 [ALC882_ARIMA] = "arima",
8761 [ALC882_W2JC] = "w2jc",
8762 [ALC882_TARGA] = "targa",
8763 [ALC882_ASUS_A7J] = "asus-a7j",
8764 [ALC882_ASUS_A7M] = "asus-a7m",
8765 [ALC885_MACPRO] = "macpro",
8766 [ALC885_MB5] = "mb5",
8767 [ALC885_MBP3] = "mbp3",
8768 [ALC885_IMAC24] = "imac24",
8769 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8770 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8771 [ALC883_3ST_6ch] = "3stack-6ch",
8772 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8773 [ALC883_TARGA_DIG] = "targa-dig",
8774 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8775 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8776 [ALC883_ACER] = "acer",
8777 [ALC883_ACER_ASPIRE] = "acer-aspire",
8778 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8779 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8780 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8781 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8782 [ALC883_MEDION] = "medion",
8783 [ALC883_MEDION_MD2] = "medion-md2",
8784 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8785 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8786 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8787 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8788 [ALC888_LENOVO_SKY] = "lenovo-sky",
8789 [ALC883_HAIER_W66] = "haier-w66",
8790 [ALC888_3ST_HP] = "3stack-hp",
8791 [ALC888_6ST_DELL] = "6stack-dell",
8792 [ALC883_MITAC] = "mitac",
8793 [ALC883_CLEVO_M540R] = "clevo-m540r",
8794 [ALC883_CLEVO_M720] = "clevo-m720",
8795 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8796 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8797 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8798 [ALC889A_INTEL] = "intel-alc889a",
8799 [ALC889_INTEL] = "intel-x58",
8800 [ALC1200_ASUS_P5Q] = "asus-p5q",
8801 [ALC889A_MB31] = "mb31",
8802 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8803 [ALC882_AUTO] = "auto",
8806 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8807 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8809 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8810 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8811 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8812 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8813 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8814 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8815 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8816 ALC888_ACER_ASPIRE_4930G),
8817 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8818 ALC888_ACER_ASPIRE_4930G),
8819 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8820 ALC888_ACER_ASPIRE_8930G),
8821 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8822 ALC888_ACER_ASPIRE_8930G),
8823 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8824 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8825 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8826 ALC888_ACER_ASPIRE_6530G),
8827 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8828 ALC888_ACER_ASPIRE_6530G),
8829 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
8830 ALC888_ACER_ASPIRE_7730G),
8831 /* default Acer -- disabled as it causes more problems.
8832 * model=auto should work fine now
8834 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8836 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8838 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8839 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8840 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8841 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8842 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8843 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8845 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8846 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8847 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8848 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8849 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8850 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8851 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8852 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8853 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8854 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8855 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8857 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8858 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8859 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8860 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8861 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8862 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8863 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8864 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8865 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8867 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8868 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8869 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8870 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8871 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
8872 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8873 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8874 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8875 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8876 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8877 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8878 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8879 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8880 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8881 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8882 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8883 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8884 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8885 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8886 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8887 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8888 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8889 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8890 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8891 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8892 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8893 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8894 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8895 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8897 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8898 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
8899 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8900 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8901 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
8902 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8903 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8904 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8905 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8906 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8907 ALC883_FUJITSU_PI2515),
8908 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8909 ALC888_FUJITSU_XA3530),
8910 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8911 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8912 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8913 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8914 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8915 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8916 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8917 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8918 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8920 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8921 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8922 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8923 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8924 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8925 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8926 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
8931 /* codec SSID table for Intel Mac */
8932 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8933 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8934 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8935 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8936 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8937 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8938 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8939 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8940 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
8941 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8942 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8943 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8944 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8945 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
8946 * so apparently no perfect solution yet
8948 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8949 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
8953 static struct alc_config_preset alc882_presets[] = {
8954 [ALC882_3ST_DIG] = {
8955 .mixers = { alc882_base_mixer },
8956 .init_verbs = { alc882_base_init_verbs,
8957 alc882_adc1_init_verbs },
8958 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8959 .dac_nids = alc882_dac_nids,
8960 .dig_out_nid = ALC882_DIGOUT_NID,
8961 .dig_in_nid = ALC882_DIGIN_NID,
8962 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8963 .channel_mode = alc882_ch_modes,
8965 .input_mux = &alc882_capture_source,
8967 [ALC882_6ST_DIG] = {
8968 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8969 .init_verbs = { alc882_base_init_verbs,
8970 alc882_adc1_init_verbs },
8971 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8972 .dac_nids = alc882_dac_nids,
8973 .dig_out_nid = ALC882_DIGOUT_NID,
8974 .dig_in_nid = ALC882_DIGIN_NID,
8975 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8976 .channel_mode = alc882_sixstack_modes,
8977 .input_mux = &alc882_capture_source,
8980 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8981 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8982 alc882_eapd_verbs },
8983 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8984 .dac_nids = alc882_dac_nids,
8985 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8986 .channel_mode = alc882_sixstack_modes,
8987 .input_mux = &alc882_capture_source,
8990 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8991 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8992 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8993 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8994 .dac_nids = alc882_dac_nids,
8995 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8996 .channel_mode = alc880_threestack_modes,
8998 .input_mux = &alc882_capture_source,
8999 .dig_out_nid = ALC882_DIGOUT_NID,
9002 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9003 .init_verbs = { alc885_mbp3_init_verbs,
9004 alc880_gpio1_init_verbs },
9006 .dac_nids = alc882_dac_nids,
9008 .channel_mode = alc885_mbp_4ch_modes,
9009 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9010 .input_mux = &alc882_capture_source,
9011 .dig_out_nid = ALC882_DIGOUT_NID,
9012 .dig_in_nid = ALC882_DIGIN_NID,
9013 .unsol_event = alc_automute_amp_unsol_event,
9014 .setup = alc885_mbp3_setup,
9015 .init_hook = alc_automute_amp,
9018 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9019 .init_verbs = { alc885_mb5_init_verbs,
9020 alc880_gpio1_init_verbs },
9021 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9022 .dac_nids = alc882_dac_nids,
9023 .channel_mode = alc885_mb5_6ch_modes,
9024 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9025 .input_mux = &mb5_capture_source,
9026 .dig_out_nid = ALC882_DIGOUT_NID,
9027 .dig_in_nid = ALC882_DIGIN_NID,
9028 .unsol_event = alc885_mb5_unsol_event,
9029 .init_hook = alc885_mb5_automute,
9032 .mixers = { alc882_macpro_mixer },
9033 .init_verbs = { alc882_macpro_init_verbs },
9034 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9035 .dac_nids = alc882_dac_nids,
9036 .dig_out_nid = ALC882_DIGOUT_NID,
9037 .dig_in_nid = ALC882_DIGIN_NID,
9038 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9039 .channel_mode = alc882_ch_modes,
9040 .input_mux = &alc882_capture_source,
9041 .init_hook = alc885_macpro_init_hook,
9044 .mixers = { alc885_imac24_mixer },
9045 .init_verbs = { alc885_imac24_init_verbs },
9046 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9047 .dac_nids = alc882_dac_nids,
9048 .dig_out_nid = ALC882_DIGOUT_NID,
9049 .dig_in_nid = ALC882_DIGIN_NID,
9050 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9051 .channel_mode = alc882_ch_modes,
9052 .input_mux = &alc882_capture_source,
9053 .unsol_event = alc_automute_amp_unsol_event,
9054 .setup = alc885_imac24_setup,
9055 .init_hook = alc885_imac24_init_hook,
9058 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9059 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9060 alc880_gpio3_init_verbs, alc882_targa_verbs},
9061 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9062 .dac_nids = alc882_dac_nids,
9063 .dig_out_nid = ALC882_DIGOUT_NID,
9064 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9065 .adc_nids = alc882_adc_nids,
9066 .capsrc_nids = alc882_capsrc_nids,
9067 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9068 .channel_mode = alc882_3ST_6ch_modes,
9070 .input_mux = &alc882_capture_source,
9071 .unsol_event = alc882_targa_unsol_event,
9072 .setup = alc882_targa_setup,
9073 .init_hook = alc882_targa_automute,
9075 [ALC882_ASUS_A7J] = {
9076 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9077 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9078 alc882_asus_a7j_verbs},
9079 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9080 .dac_nids = alc882_dac_nids,
9081 .dig_out_nid = ALC882_DIGOUT_NID,
9082 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9083 .adc_nids = alc882_adc_nids,
9084 .capsrc_nids = alc882_capsrc_nids,
9085 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9086 .channel_mode = alc882_3ST_6ch_modes,
9088 .input_mux = &alc882_capture_source,
9090 [ALC882_ASUS_A7M] = {
9091 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9092 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9093 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9094 alc882_asus_a7m_verbs },
9095 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9096 .dac_nids = alc882_dac_nids,
9097 .dig_out_nid = ALC882_DIGOUT_NID,
9098 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9099 .channel_mode = alc880_threestack_modes,
9101 .input_mux = &alc882_capture_source,
9103 [ALC883_3ST_2ch_DIG] = {
9104 .mixers = { alc883_3ST_2ch_mixer },
9105 .init_verbs = { alc883_init_verbs },
9106 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9107 .dac_nids = alc883_dac_nids,
9108 .dig_out_nid = ALC883_DIGOUT_NID,
9109 .dig_in_nid = ALC883_DIGIN_NID,
9110 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9111 .channel_mode = alc883_3ST_2ch_modes,
9112 .input_mux = &alc883_capture_source,
9114 [ALC883_3ST_6ch_DIG] = {
9115 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9116 .init_verbs = { alc883_init_verbs },
9117 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9118 .dac_nids = alc883_dac_nids,
9119 .dig_out_nid = ALC883_DIGOUT_NID,
9120 .dig_in_nid = ALC883_DIGIN_NID,
9121 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9122 .channel_mode = alc883_3ST_6ch_modes,
9124 .input_mux = &alc883_capture_source,
9126 [ALC883_3ST_6ch] = {
9127 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9128 .init_verbs = { alc883_init_verbs },
9129 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9130 .dac_nids = alc883_dac_nids,
9131 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9132 .channel_mode = alc883_3ST_6ch_modes,
9134 .input_mux = &alc883_capture_source,
9136 [ALC883_3ST_6ch_INTEL] = {
9137 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9138 .init_verbs = { alc883_init_verbs },
9139 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9140 .dac_nids = alc883_dac_nids,
9141 .dig_out_nid = ALC883_DIGOUT_NID,
9142 .dig_in_nid = ALC883_DIGIN_NID,
9143 .slave_dig_outs = alc883_slave_dig_outs,
9144 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9145 .channel_mode = alc883_3ST_6ch_intel_modes,
9147 .input_mux = &alc883_3stack_6ch_intel,
9150 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9151 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9152 alc_hp15_unsol_verbs },
9153 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9154 .dac_nids = alc883_dac_nids,
9155 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9156 .adc_nids = alc889_adc_nids,
9157 .dig_out_nid = ALC883_DIGOUT_NID,
9158 .dig_in_nid = ALC883_DIGIN_NID,
9159 .slave_dig_outs = alc883_slave_dig_outs,
9160 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9161 .channel_mode = alc889_8ch_intel_modes,
9162 .capsrc_nids = alc889_capsrc_nids,
9163 .input_mux = &alc889_capture_source,
9164 .setup = alc889_automute_setup,
9165 .init_hook = alc_automute_amp,
9166 .unsol_event = alc_automute_amp_unsol_event,
9170 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9171 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9172 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9173 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9174 .dac_nids = alc883_dac_nids,
9175 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9176 .adc_nids = alc889_adc_nids,
9177 .capsrc_nids = alc889_capsrc_nids,
9178 .capsrc_nids = alc889_capsrc_nids,
9179 .dig_out_nid = ALC883_DIGOUT_NID,
9180 .dig_in_nid = ALC883_DIGIN_NID,
9181 .slave_dig_outs = alc883_slave_dig_outs,
9182 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9183 .channel_mode = alc889_8ch_intel_modes,
9184 .capsrc_nids = alc889_capsrc_nids,
9185 .input_mux = &alc889_capture_source,
9186 .setup = alc889_automute_setup,
9187 .init_hook = alc889_intel_init_hook,
9188 .unsol_event = alc_automute_amp_unsol_event,
9191 [ALC883_6ST_DIG] = {
9192 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9193 .init_verbs = { alc883_init_verbs },
9194 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9195 .dac_nids = alc883_dac_nids,
9196 .dig_out_nid = ALC883_DIGOUT_NID,
9197 .dig_in_nid = ALC883_DIGIN_NID,
9198 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9199 .channel_mode = alc883_sixstack_modes,
9200 .input_mux = &alc883_capture_source,
9202 [ALC883_TARGA_DIG] = {
9203 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9204 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9205 alc883_targa_verbs},
9206 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9207 .dac_nids = alc883_dac_nids,
9208 .dig_out_nid = ALC883_DIGOUT_NID,
9209 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9210 .channel_mode = alc883_3ST_6ch_modes,
9212 .input_mux = &alc883_capture_source,
9213 .unsol_event = alc883_targa_unsol_event,
9214 .setup = alc882_targa_setup,
9215 .init_hook = alc882_targa_automute,
9217 [ALC883_TARGA_2ch_DIG] = {
9218 .mixers = { alc883_targa_2ch_mixer},
9219 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9220 alc883_targa_verbs},
9221 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9222 .dac_nids = alc883_dac_nids,
9223 .adc_nids = alc883_adc_nids_alt,
9224 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9225 .capsrc_nids = alc883_capsrc_nids,
9226 .dig_out_nid = ALC883_DIGOUT_NID,
9227 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9228 .channel_mode = alc883_3ST_2ch_modes,
9229 .input_mux = &alc883_capture_source,
9230 .unsol_event = alc883_targa_unsol_event,
9231 .setup = alc882_targa_setup,
9232 .init_hook = alc882_targa_automute,
9234 [ALC883_TARGA_8ch_DIG] = {
9235 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9236 alc883_chmode_mixer },
9237 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9238 alc883_targa_verbs },
9239 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9240 .dac_nids = alc883_dac_nids,
9241 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9242 .adc_nids = alc883_adc_nids_rev,
9243 .capsrc_nids = alc883_capsrc_nids_rev,
9244 .dig_out_nid = ALC883_DIGOUT_NID,
9245 .dig_in_nid = ALC883_DIGIN_NID,
9246 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9247 .channel_mode = alc883_4ST_8ch_modes,
9249 .input_mux = &alc883_capture_source,
9250 .unsol_event = alc883_targa_unsol_event,
9251 .setup = alc882_targa_setup,
9252 .init_hook = alc882_targa_automute,
9255 .mixers = { alc883_base_mixer },
9256 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9257 * and the headphone jack. Turn this on and rely on the
9258 * standard mute methods whenever the user wants to turn
9259 * these outputs off.
9261 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9262 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9263 .dac_nids = alc883_dac_nids,
9264 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9265 .channel_mode = alc883_3ST_2ch_modes,
9266 .input_mux = &alc883_capture_source,
9268 [ALC883_ACER_ASPIRE] = {
9269 .mixers = { alc883_acer_aspire_mixer },
9270 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9271 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9272 .dac_nids = alc883_dac_nids,
9273 .dig_out_nid = ALC883_DIGOUT_NID,
9274 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9275 .channel_mode = alc883_3ST_2ch_modes,
9276 .input_mux = &alc883_capture_source,
9277 .unsol_event = alc_automute_amp_unsol_event,
9278 .setup = alc883_acer_aspire_setup,
9279 .init_hook = alc_automute_amp,
9281 [ALC888_ACER_ASPIRE_4930G] = {
9282 .mixers = { alc888_base_mixer,
9283 alc883_chmode_mixer },
9284 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9285 alc888_acer_aspire_4930g_verbs },
9286 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9287 .dac_nids = alc883_dac_nids,
9288 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9289 .adc_nids = alc883_adc_nids_rev,
9290 .capsrc_nids = alc883_capsrc_nids_rev,
9291 .dig_out_nid = ALC883_DIGOUT_NID,
9292 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9293 .channel_mode = alc883_3ST_6ch_modes,
9296 ARRAY_SIZE(alc888_2_capture_sources),
9297 .input_mux = alc888_2_capture_sources,
9298 .unsol_event = alc_automute_amp_unsol_event,
9299 .setup = alc888_acer_aspire_4930g_setup,
9300 .init_hook = alc_automute_amp,
9302 [ALC888_ACER_ASPIRE_6530G] = {
9303 .mixers = { alc888_acer_aspire_6530_mixer },
9304 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9305 alc888_acer_aspire_6530g_verbs },
9306 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9307 .dac_nids = alc883_dac_nids,
9308 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9309 .adc_nids = alc883_adc_nids_rev,
9310 .capsrc_nids = alc883_capsrc_nids_rev,
9311 .dig_out_nid = ALC883_DIGOUT_NID,
9312 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9313 .channel_mode = alc883_3ST_2ch_modes,
9315 ARRAY_SIZE(alc888_2_capture_sources),
9316 .input_mux = alc888_acer_aspire_6530_sources,
9317 .unsol_event = alc_automute_amp_unsol_event,
9318 .setup = alc888_acer_aspire_6530g_setup,
9319 .init_hook = alc_automute_amp,
9321 [ALC888_ACER_ASPIRE_8930G] = {
9322 .mixers = { alc888_base_mixer,
9323 alc883_chmode_mixer },
9324 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9325 alc889_acer_aspire_8930g_verbs },
9326 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9327 .dac_nids = alc883_dac_nids,
9328 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9329 .adc_nids = alc889_adc_nids,
9330 .capsrc_nids = alc889_capsrc_nids,
9331 .dig_out_nid = ALC883_DIGOUT_NID,
9332 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9333 .channel_mode = alc883_3ST_6ch_modes,
9335 .const_channel_count = 6,
9337 ARRAY_SIZE(alc889_capture_sources),
9338 .input_mux = alc889_capture_sources,
9339 .unsol_event = alc_automute_amp_unsol_event,
9340 .setup = alc889_acer_aspire_8930g_setup,
9341 .init_hook = alc_automute_amp,
9343 [ALC888_ACER_ASPIRE_7730G] = {
9344 .mixers = { alc883_3ST_6ch_mixer,
9345 alc883_chmode_mixer },
9346 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9347 alc888_acer_aspire_7730G_verbs },
9348 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9349 .dac_nids = alc883_dac_nids,
9350 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9351 .adc_nids = alc883_adc_nids_rev,
9352 .capsrc_nids = alc883_capsrc_nids_rev,
9353 .dig_out_nid = ALC883_DIGOUT_NID,
9354 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9355 .channel_mode = alc883_3ST_6ch_modes,
9357 .const_channel_count = 6,
9358 .input_mux = &alc883_capture_source,
9359 .unsol_event = alc_automute_amp_unsol_event,
9360 .setup = alc888_acer_aspire_6530g_setup,
9361 .init_hook = alc_automute_amp,
9364 .mixers = { alc883_fivestack_mixer,
9365 alc883_chmode_mixer },
9366 .init_verbs = { alc883_init_verbs,
9367 alc883_medion_eapd_verbs },
9368 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9369 .dac_nids = alc883_dac_nids,
9370 .adc_nids = alc883_adc_nids_alt,
9371 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9372 .capsrc_nids = alc883_capsrc_nids,
9373 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9374 .channel_mode = alc883_sixstack_modes,
9375 .input_mux = &alc883_capture_source,
9377 [ALC883_MEDION_MD2] = {
9378 .mixers = { alc883_medion_md2_mixer},
9379 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9380 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9381 .dac_nids = alc883_dac_nids,
9382 .dig_out_nid = ALC883_DIGOUT_NID,
9383 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9384 .channel_mode = alc883_3ST_2ch_modes,
9385 .input_mux = &alc883_capture_source,
9386 .unsol_event = alc_automute_amp_unsol_event,
9387 .setup = alc883_medion_md2_setup,
9388 .init_hook = alc_automute_amp,
9390 [ALC883_LAPTOP_EAPD] = {
9391 .mixers = { alc883_base_mixer },
9392 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9393 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9394 .dac_nids = alc883_dac_nids,
9395 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9396 .channel_mode = alc883_3ST_2ch_modes,
9397 .input_mux = &alc883_capture_source,
9399 [ALC883_CLEVO_M540R] = {
9400 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9401 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9402 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9403 .dac_nids = alc883_dac_nids,
9404 .dig_out_nid = ALC883_DIGOUT_NID,
9405 .dig_in_nid = ALC883_DIGIN_NID,
9406 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9407 .channel_mode = alc883_3ST_6ch_clevo_modes,
9409 .input_mux = &alc883_capture_source,
9410 /* This machine has the hardware HP auto-muting, thus
9411 * we need no software mute via unsol event
9414 [ALC883_CLEVO_M720] = {
9415 .mixers = { alc883_clevo_m720_mixer },
9416 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9417 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9418 .dac_nids = alc883_dac_nids,
9419 .dig_out_nid = ALC883_DIGOUT_NID,
9420 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9421 .channel_mode = alc883_3ST_2ch_modes,
9422 .input_mux = &alc883_capture_source,
9423 .unsol_event = alc883_clevo_m720_unsol_event,
9424 .setup = alc883_clevo_m720_setup,
9425 .init_hook = alc883_clevo_m720_init_hook,
9427 [ALC883_LENOVO_101E_2ch] = {
9428 .mixers = { alc883_lenovo_101e_2ch_mixer},
9429 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9430 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9431 .dac_nids = alc883_dac_nids,
9432 .adc_nids = alc883_adc_nids_alt,
9433 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9434 .capsrc_nids = alc883_capsrc_nids,
9435 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9436 .channel_mode = alc883_3ST_2ch_modes,
9437 .input_mux = &alc883_lenovo_101e_capture_source,
9438 .unsol_event = alc883_lenovo_101e_unsol_event,
9439 .init_hook = alc883_lenovo_101e_all_automute,
9441 [ALC883_LENOVO_NB0763] = {
9442 .mixers = { alc883_lenovo_nb0763_mixer },
9443 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9444 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9445 .dac_nids = alc883_dac_nids,
9446 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9447 .channel_mode = alc883_3ST_2ch_modes,
9449 .input_mux = &alc883_lenovo_nb0763_capture_source,
9450 .unsol_event = alc_automute_amp_unsol_event,
9451 .setup = alc883_medion_md2_setup,
9452 .init_hook = alc_automute_amp,
9454 [ALC888_LENOVO_MS7195_DIG] = {
9455 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9456 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9457 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9458 .dac_nids = alc883_dac_nids,
9459 .dig_out_nid = ALC883_DIGOUT_NID,
9460 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9461 .channel_mode = alc883_3ST_6ch_modes,
9463 .input_mux = &alc883_capture_source,
9464 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9465 .init_hook = alc888_lenovo_ms7195_front_automute,
9467 [ALC883_HAIER_W66] = {
9468 .mixers = { alc883_targa_2ch_mixer},
9469 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9470 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9471 .dac_nids = alc883_dac_nids,
9472 .dig_out_nid = ALC883_DIGOUT_NID,
9473 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9474 .channel_mode = alc883_3ST_2ch_modes,
9475 .input_mux = &alc883_capture_source,
9476 .unsol_event = alc_automute_amp_unsol_event,
9477 .setup = alc883_haier_w66_setup,
9478 .init_hook = alc_automute_amp,
9481 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9482 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9483 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9484 .dac_nids = alc883_dac_nids,
9485 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9486 .channel_mode = alc888_3st_hp_modes,
9488 .input_mux = &alc883_capture_source,
9489 .unsol_event = alc_automute_amp_unsol_event,
9490 .setup = alc888_3st_hp_setup,
9491 .init_hook = alc_automute_amp,
9493 [ALC888_6ST_DELL] = {
9494 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9495 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9496 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9497 .dac_nids = alc883_dac_nids,
9498 .dig_out_nid = ALC883_DIGOUT_NID,
9499 .dig_in_nid = ALC883_DIGIN_NID,
9500 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9501 .channel_mode = alc883_sixstack_modes,
9502 .input_mux = &alc883_capture_source,
9503 .unsol_event = alc_automute_amp_unsol_event,
9504 .setup = alc888_6st_dell_setup,
9505 .init_hook = alc_automute_amp,
9508 .mixers = { alc883_mitac_mixer },
9509 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9510 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9511 .dac_nids = alc883_dac_nids,
9512 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9513 .channel_mode = alc883_3ST_2ch_modes,
9514 .input_mux = &alc883_capture_source,
9515 .unsol_event = alc_automute_amp_unsol_event,
9516 .setup = alc883_mitac_setup,
9517 .init_hook = alc_automute_amp,
9519 [ALC883_FUJITSU_PI2515] = {
9520 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9521 .init_verbs = { alc883_init_verbs,
9522 alc883_2ch_fujitsu_pi2515_verbs},
9523 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9524 .dac_nids = alc883_dac_nids,
9525 .dig_out_nid = ALC883_DIGOUT_NID,
9526 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9527 .channel_mode = alc883_3ST_2ch_modes,
9528 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9529 .unsol_event = alc_automute_amp_unsol_event,
9530 .setup = alc883_2ch_fujitsu_pi2515_setup,
9531 .init_hook = alc_automute_amp,
9533 [ALC888_FUJITSU_XA3530] = {
9534 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9535 .init_verbs = { alc883_init_verbs,
9536 alc888_fujitsu_xa3530_verbs },
9537 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9538 .dac_nids = alc883_dac_nids,
9539 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9540 .adc_nids = alc883_adc_nids_rev,
9541 .capsrc_nids = alc883_capsrc_nids_rev,
9542 .dig_out_nid = ALC883_DIGOUT_NID,
9543 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9544 .channel_mode = alc888_4ST_8ch_intel_modes,
9546 ARRAY_SIZE(alc888_2_capture_sources),
9547 .input_mux = alc888_2_capture_sources,
9548 .unsol_event = alc_automute_amp_unsol_event,
9549 .setup = alc888_fujitsu_xa3530_setup,
9550 .init_hook = alc_automute_amp,
9552 [ALC888_LENOVO_SKY] = {
9553 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9554 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9555 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9556 .dac_nids = alc883_dac_nids,
9557 .dig_out_nid = ALC883_DIGOUT_NID,
9558 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9559 .channel_mode = alc883_sixstack_modes,
9561 .input_mux = &alc883_lenovo_sky_capture_source,
9562 .unsol_event = alc_automute_amp_unsol_event,
9563 .setup = alc888_lenovo_sky_setup,
9564 .init_hook = alc_automute_amp,
9566 [ALC888_ASUS_M90V] = {
9567 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9568 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9569 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9570 .dac_nids = alc883_dac_nids,
9571 .dig_out_nid = ALC883_DIGOUT_NID,
9572 .dig_in_nid = ALC883_DIGIN_NID,
9573 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9574 .channel_mode = alc883_3ST_6ch_modes,
9576 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9577 .unsol_event = alc_sku_unsol_event,
9578 .setup = alc883_mode2_setup,
9579 .init_hook = alc_inithook,
9581 [ALC888_ASUS_EEE1601] = {
9582 .mixers = { alc883_asus_eee1601_mixer },
9583 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9584 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9585 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9586 .dac_nids = alc883_dac_nids,
9587 .dig_out_nid = ALC883_DIGOUT_NID,
9588 .dig_in_nid = ALC883_DIGIN_NID,
9589 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9590 .channel_mode = alc883_3ST_2ch_modes,
9592 .input_mux = &alc883_asus_eee1601_capture_source,
9593 .unsol_event = alc_sku_unsol_event,
9594 .init_hook = alc883_eee1601_inithook,
9596 [ALC1200_ASUS_P5Q] = {
9597 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9598 .init_verbs = { alc883_init_verbs },
9599 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9600 .dac_nids = alc883_dac_nids,
9601 .dig_out_nid = ALC1200_DIGOUT_NID,
9602 .dig_in_nid = ALC883_DIGIN_NID,
9603 .slave_dig_outs = alc1200_slave_dig_outs,
9604 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9605 .channel_mode = alc883_sixstack_modes,
9606 .input_mux = &alc883_capture_source,
9609 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9610 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9611 alc880_gpio1_init_verbs },
9612 .adc_nids = alc883_adc_nids,
9613 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9614 .capsrc_nids = alc883_capsrc_nids,
9615 .dac_nids = alc883_dac_nids,
9616 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9617 .channel_mode = alc889A_mb31_6ch_modes,
9618 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9619 .input_mux = &alc889A_mb31_capture_source,
9620 .dig_out_nid = ALC883_DIGOUT_NID,
9621 .unsol_event = alc889A_mb31_unsol_event,
9622 .init_hook = alc889A_mb31_automute,
9624 [ALC883_SONY_VAIO_TT] = {
9625 .mixers = { alc883_vaiott_mixer },
9626 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9627 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9628 .dac_nids = alc883_dac_nids,
9629 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9630 .channel_mode = alc883_3ST_2ch_modes,
9631 .input_mux = &alc883_capture_source,
9632 .unsol_event = alc_automute_amp_unsol_event,
9633 .setup = alc883_vaiott_setup,
9634 .init_hook = alc_automute_amp,
9643 PINFIX_ABIT_AW9D_MAX
9646 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9647 { 0x15, 0x01080104 }, /* side */
9648 { 0x16, 0x01011012 }, /* rear */
9649 { 0x17, 0x01016011 }, /* clfe */
9653 static const struct alc_fixup alc882_fixups[] = {
9654 [PINFIX_ABIT_AW9D_MAX] = {
9655 .pins = alc882_abit_aw9d_pinfix
9659 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9660 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9665 * BIOS auto configuration
9667 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9668 const struct auto_pin_cfg *cfg)
9670 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9673 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9674 hda_nid_t nid, int pin_type,
9678 struct alc_spec *spec = codec->spec;
9681 alc_set_pin_output(codec, nid, pin_type);
9682 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9685 idx = spec->multiout.dac_nids[dac_idx] - 2;
9686 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9690 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9692 struct alc_spec *spec = codec->spec;
9695 for (i = 0; i <= HDA_SIDE; i++) {
9696 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9697 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9699 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9704 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9706 struct alc_spec *spec = codec->spec;
9709 pin = spec->autocfg.hp_pins[0];
9710 if (pin) /* connect to front */
9712 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9713 pin = spec->autocfg.speaker_pins[0];
9715 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9718 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9720 struct alc_spec *spec = codec->spec;
9723 for (i = 0; i < AUTO_PIN_LAST; i++) {
9724 hda_nid_t nid = spec->autocfg.input_pins[i];
9727 alc_set_input_pin(codec, nid, i);
9728 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9729 snd_hda_codec_write(codec, nid, 0,
9730 AC_VERB_SET_AMP_GAIN_MUTE,
9735 static void alc882_auto_init_input_src(struct hda_codec *codec)
9737 struct alc_spec *spec = codec->spec;
9740 for (c = 0; c < spec->num_adc_nids; c++) {
9741 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9742 hda_nid_t nid = spec->capsrc_nids[c];
9743 unsigned int mux_idx;
9744 const struct hda_input_mux *imux;
9745 int conns, mute, idx, item;
9747 conns = snd_hda_get_connections(codec, nid, conn_list,
9748 ARRAY_SIZE(conn_list));
9751 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9752 imux = &spec->input_mux[mux_idx];
9753 if (!imux->num_items && mux_idx > 0)
9754 imux = &spec->input_mux[0];
9755 for (idx = 0; idx < conns; idx++) {
9756 /* if the current connection is the selected one,
9757 * unmute it as default - otherwise mute it
9759 mute = AMP_IN_MUTE(idx);
9760 for (item = 0; item < imux->num_items; item++) {
9761 if (imux->items[item].index == idx) {
9762 if (spec->cur_mux[c] == item)
9763 mute = AMP_IN_UNMUTE(idx);
9767 /* check if we have a selector or mixer
9768 * we could check for the widget type instead, but
9769 * just check for Amp-In presence (in case of mixer
9770 * without amp-in there is something wrong, this
9771 * function shouldn't be used or capsrc nid is wrong)
9773 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9774 snd_hda_codec_write(codec, nid, 0,
9775 AC_VERB_SET_AMP_GAIN_MUTE,
9777 else if (mute != AMP_IN_MUTE(idx))
9778 snd_hda_codec_write(codec, nid, 0,
9779 AC_VERB_SET_CONNECT_SEL,
9785 /* add mic boosts if needed */
9786 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9788 struct alc_spec *spec = codec->spec;
9792 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9793 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9794 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9796 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9800 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9801 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9802 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9804 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9811 /* almost identical with ALC880 parser... */
9812 static int alc882_parse_auto_config(struct hda_codec *codec)
9814 struct alc_spec *spec = codec->spec;
9815 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9818 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9822 if (!spec->autocfg.line_outs)
9823 return 0; /* can't find valid BIOS pin config */
9825 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9828 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9831 err = alc880_auto_create_extra_out(spec,
9832 spec->autocfg.speaker_pins[0],
9836 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9840 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9844 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9846 /* check multiple SPDIF-out (for recent codecs) */
9847 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9849 err = snd_hda_get_connections(codec,
9850 spec->autocfg.dig_out_pins[i],
9855 spec->multiout.dig_out_nid = dig_nid;
9857 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9858 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
9860 spec->slave_dig_outs[i - 1] = dig_nid;
9863 if (spec->autocfg.dig_in_pin)
9864 spec->dig_in_nid = ALC880_DIGIN_NID;
9866 if (spec->kctls.list)
9867 add_mixer(spec, spec->kctls.list);
9869 add_verb(spec, alc883_auto_init_verbs);
9870 /* if ADC 0x07 is available, initialize it, too */
9871 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9872 add_verb(spec, alc882_adc1_init_verbs);
9874 spec->num_mux_defs = 1;
9875 spec->input_mux = &spec->private_imux[0];
9877 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9879 err = alc_auto_add_mic_boost(codec);
9883 return 1; /* config found */
9886 /* additional initialization for auto-configuration model */
9887 static void alc882_auto_init(struct hda_codec *codec)
9889 struct alc_spec *spec = codec->spec;
9890 alc882_auto_init_multi_out(codec);
9891 alc882_auto_init_hp_out(codec);
9892 alc882_auto_init_analog_input(codec);
9893 alc882_auto_init_input_src(codec);
9894 if (spec->unsol_event)
9895 alc_inithook(codec);
9898 static int patch_alc882(struct hda_codec *codec)
9900 struct alc_spec *spec;
9901 int err, board_config;
9903 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9909 switch (codec->vendor_id) {
9914 /* ALC883 and variants */
9915 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9919 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9923 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9924 board_config = snd_hda_check_board_codec_sid_config(codec,
9925 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9927 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9928 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9930 board_config = ALC882_AUTO;
9933 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
9935 if (board_config == ALC882_AUTO) {
9936 /* automatic parse from the BIOS config */
9937 err = alc882_parse_auto_config(codec);
9943 "hda_codec: Cannot set up configuration "
9944 "from BIOS. Using base mode...\n");
9945 board_config = ALC882_3ST_DIG;
9949 err = snd_hda_attach_beep_device(codec, 0x1);
9955 if (board_config != ALC882_AUTO)
9956 setup_preset(codec, &alc882_presets[board_config]);
9958 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9959 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9960 /* FIXME: setup DAC5 */
9961 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9962 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9964 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9965 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9967 if (codec->vendor_id == 0x10ec0888)
9968 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9970 if (!spec->adc_nids && spec->input_mux) {
9972 spec->num_adc_nids = 0;
9973 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9975 hda_nid_t nid = alc882_adc_nids[i];
9976 unsigned int wcap = get_wcaps(codec, nid);
9978 wcap = get_wcaps_type(wcap);
9979 if (wcap != AC_WID_AUD_IN)
9981 spec->private_adc_nids[spec->num_adc_nids] = nid;
9982 err = snd_hda_get_connections(codec, nid, &cap, 1);
9985 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9986 spec->num_adc_nids++;
9988 spec->adc_nids = spec->private_adc_nids;
9989 spec->capsrc_nids = spec->private_capsrc_nids;
9992 set_capture_mixer(codec);
9993 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9995 spec->vmaster_nid = 0x0c;
9997 codec->patch_ops = alc_patch_ops;
9998 if (board_config == ALC882_AUTO)
9999 spec->init_hook = alc882_auto_init;
10000 #ifdef CONFIG_SND_HDA_POWER_SAVE
10001 if (!spec->loopback.amplist)
10002 spec->loopback.amplist = alc882_loopbacks;
10004 codec->proc_widget_hook = print_realtek_coef;
10014 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10015 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10017 #define alc262_dac_nids alc260_dac_nids
10018 #define alc262_adc_nids alc882_adc_nids
10019 #define alc262_adc_nids_alt alc882_adc_nids_alt
10020 #define alc262_capsrc_nids alc882_capsrc_nids
10021 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10023 #define alc262_modes alc260_modes
10024 #define alc262_capture_source alc882_capture_source
10026 static hda_nid_t alc262_dmic_adc_nids[1] = {
10031 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10033 static struct snd_kcontrol_new alc262_base_mixer[] = {
10034 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10035 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10036 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10037 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10038 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10039 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10040 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10041 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10042 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10043 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10044 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10045 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10046 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10047 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10048 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10049 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10053 /* update HP, line and mono-out pins according to the master switch */
10054 static void alc262_hp_master_update(struct hda_codec *codec)
10056 struct alc_spec *spec = codec->spec;
10057 int val = spec->master_sw;
10059 /* HP & line-out */
10060 snd_hda_codec_write_cache(codec, 0x1b, 0,
10061 AC_VERB_SET_PIN_WIDGET_CONTROL,
10063 snd_hda_codec_write_cache(codec, 0x15, 0,
10064 AC_VERB_SET_PIN_WIDGET_CONTROL,
10066 /* mono (speaker) depending on the HP jack sense */
10067 val = val && !spec->jack_present;
10068 snd_hda_codec_write_cache(codec, 0x16, 0,
10069 AC_VERB_SET_PIN_WIDGET_CONTROL,
10070 val ? PIN_OUT : 0);
10073 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10075 struct alc_spec *spec = codec->spec;
10076 unsigned int presence;
10077 presence = snd_hda_codec_read(codec, 0x1b, 0,
10078 AC_VERB_GET_PIN_SENSE, 0);
10079 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
10080 alc262_hp_master_update(codec);
10083 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10085 if ((res >> 26) != ALC880_HP_EVENT)
10087 alc262_hp_bpc_automute(codec);
10090 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10092 struct alc_spec *spec = codec->spec;
10093 unsigned int presence;
10094 presence = snd_hda_codec_read(codec, 0x15, 0,
10095 AC_VERB_GET_PIN_SENSE, 0);
10096 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
10097 alc262_hp_master_update(codec);
10100 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10103 if ((res >> 26) != ALC880_HP_EVENT)
10105 alc262_hp_wildwest_automute(codec);
10108 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10110 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10111 struct snd_ctl_elem_value *ucontrol)
10113 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10114 struct alc_spec *spec = codec->spec;
10115 int val = !!*ucontrol->value.integer.value;
10117 if (val == spec->master_sw)
10119 spec->master_sw = val;
10120 alc262_hp_master_update(codec);
10124 #define ALC262_HP_MASTER_SWITCH \
10126 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10127 .name = "Master Playback Switch", \
10128 .info = snd_ctl_boolean_mono_info, \
10129 .get = alc262_hp_master_sw_get, \
10130 .put = alc262_hp_master_sw_put, \
10133 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10134 ALC262_HP_MASTER_SWITCH,
10135 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10136 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10137 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10138 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10140 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10143 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10144 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10145 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10146 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10147 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10148 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10149 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10150 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10151 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10152 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10153 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10157 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10158 ALC262_HP_MASTER_SWITCH,
10159 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10160 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10161 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10162 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10163 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10165 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10167 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10168 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10169 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10170 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10171 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10172 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10173 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10177 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10178 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10179 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10180 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10184 /* mute/unmute internal speaker according to the hp jack and mute state */
10185 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10187 struct alc_spec *spec = codec->spec;
10189 spec->autocfg.hp_pins[0] = 0x15;
10190 spec->autocfg.speaker_pins[0] = 0x14;
10193 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10194 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10195 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10196 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10197 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10199 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10200 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10204 static struct hda_verb alc262_hp_t5735_verbs[] = {
10205 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10206 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10208 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10212 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10213 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10214 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10215 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10216 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10218 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10222 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10223 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10224 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10225 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10226 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10227 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10228 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10229 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10230 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10231 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10232 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10236 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10243 /* bind hp and internal speaker mute (with plug check) as master switch */
10244 static void alc262_hippo_master_update(struct hda_codec *codec)
10246 struct alc_spec *spec = codec->spec;
10247 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10248 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10249 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10253 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10254 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10255 HDA_AMP_MUTE, mute);
10256 /* mute internal speaker per jack sense */
10257 if (spec->jack_present)
10258 mute = HDA_AMP_MUTE;
10260 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10261 HDA_AMP_MUTE, mute);
10262 if (speaker_nid && speaker_nid != line_nid)
10263 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10264 HDA_AMP_MUTE, mute);
10267 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10269 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10270 struct snd_ctl_elem_value *ucontrol)
10272 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10273 struct alc_spec *spec = codec->spec;
10274 int val = !!*ucontrol->value.integer.value;
10276 if (val == spec->master_sw)
10278 spec->master_sw = val;
10279 alc262_hippo_master_update(codec);
10283 #define ALC262_HIPPO_MASTER_SWITCH \
10285 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10286 .name = "Master Playback Switch", \
10287 .info = snd_ctl_boolean_mono_info, \
10288 .get = alc262_hippo_master_sw_get, \
10289 .put = alc262_hippo_master_sw_put, \
10292 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10293 ALC262_HIPPO_MASTER_SWITCH,
10294 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10295 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10296 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10297 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10298 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10299 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10300 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10301 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10302 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10303 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10304 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10305 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10309 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10310 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10311 ALC262_HIPPO_MASTER_SWITCH,
10312 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10313 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10314 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10315 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10316 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10317 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10318 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10319 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10320 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10321 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10325 /* mute/unmute internal speaker according to the hp jack and mute state */
10326 static void alc262_hippo_automute(struct hda_codec *codec)
10328 struct alc_spec *spec = codec->spec;
10329 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10330 unsigned int present;
10332 /* need to execute and sync at first */
10333 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10334 present = snd_hda_codec_read(codec, hp_nid, 0,
10335 AC_VERB_GET_PIN_SENSE, 0);
10336 spec->jack_present = (present & 0x80000000) != 0;
10337 alc262_hippo_master_update(codec);
10340 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10342 if ((res >> 26) != ALC880_HP_EVENT)
10344 alc262_hippo_automute(codec);
10347 static void alc262_hippo_setup(struct hda_codec *codec)
10349 struct alc_spec *spec = codec->spec;
10351 spec->autocfg.hp_pins[0] = 0x15;
10352 spec->autocfg.speaker_pins[0] = 0x14;
10355 static void alc262_hippo1_setup(struct hda_codec *codec)
10357 struct alc_spec *spec = codec->spec;
10359 spec->autocfg.hp_pins[0] = 0x1b;
10360 spec->autocfg.speaker_pins[0] = 0x14;
10364 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10365 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10366 ALC262_HIPPO_MASTER_SWITCH,
10367 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10368 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10369 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10370 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10374 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10375 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10376 ALC262_HIPPO_MASTER_SWITCH,
10377 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10378 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10379 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10380 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10381 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10385 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10386 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10387 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10388 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10389 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10390 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10391 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10392 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10393 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10394 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10395 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10396 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10397 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10401 static struct hda_verb alc262_tyan_verbs[] = {
10402 /* Headphone automute */
10403 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10404 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10405 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10407 /* P11 AUX_IN, white 4-pin connector */
10408 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10409 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10410 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10411 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10416 /* unsolicited event for HP jack sensing */
10417 static void alc262_tyan_setup(struct hda_codec *codec)
10419 struct alc_spec *spec = codec->spec;
10421 spec->autocfg.hp_pins[0] = 0x1b;
10422 spec->autocfg.speaker_pins[0] = 0x15;
10426 #define alc262_capture_mixer alc882_capture_mixer
10427 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10430 * generic initialization of ADC, input mixers and output mixers
10432 static struct hda_verb alc262_init_verbs[] = {
10434 * Unmute ADC0-2 and set the default input to mic-in
10436 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10437 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10438 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10439 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10440 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10441 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10443 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10445 * Note: PASD motherboards uses the Line In 2 as the input for
10446 * front panel mic (mic 2)
10448 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10449 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10450 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10451 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10452 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10453 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10456 * Set up output mixers (0x0c - 0x0e)
10458 /* set vol=0 to output mixers */
10459 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10460 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10461 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10462 /* set up input amps for analog loopback */
10463 /* Amp Indices: DAC = 0, mixer = 1 */
10464 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10465 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10466 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10467 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10468 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10469 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10471 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10472 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10473 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10474 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10475 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10476 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10478 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10479 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10480 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10481 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10482 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10484 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10485 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10487 /* FIXME: use matrix-type input source selection */
10488 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10489 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10490 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10491 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10492 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10493 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10495 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10496 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10497 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10498 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10500 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10501 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10502 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10508 static struct hda_verb alc262_eapd_verbs[] = {
10509 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10510 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10514 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10515 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10516 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10517 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10519 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10520 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10524 static struct hda_verb alc262_sony_unsol_verbs[] = {
10525 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10526 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10527 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10529 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10530 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10534 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10535 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10536 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10537 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10538 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10539 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10543 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10544 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10545 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10546 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10547 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10548 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10549 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10550 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10551 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10555 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10557 struct alc_spec *spec = codec->spec;
10559 spec->autocfg.hp_pins[0] = 0x15;
10560 spec->autocfg.speaker_pins[0] = 0x14;
10561 spec->ext_mic.pin = 0x18;
10562 spec->ext_mic.mux_idx = 0;
10563 spec->int_mic.pin = 0x12;
10564 spec->int_mic.mux_idx = 9;
10565 spec->auto_mic = 1;
10571 * 0x16 = internal speaker
10572 * 0x18 = external mic
10575 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10576 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10577 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10579 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10580 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10581 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10583 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10584 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10588 static struct hda_verb alc262_nec_verbs[] = {
10589 /* Unmute Speaker */
10590 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10593 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10594 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10596 /* External mic to headphone */
10597 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10598 /* External mic to speaker */
10599 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10605 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10606 * 0x1b = port replicator headphone out
10609 #define ALC_HP_EVENT 0x37
10611 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10612 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10613 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10614 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10615 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10619 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10620 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10621 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10625 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10626 /* Front Mic pin: input vref at 50% */
10627 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10628 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10632 static struct hda_input_mux alc262_fujitsu_capture_source = {
10636 { "Int Mic", 0x1 },
10641 static struct hda_input_mux alc262_HP_capture_source = {
10645 { "Front Mic", 0x1 },
10652 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10656 { "Front Mic", 0x2 },
10662 /* mute/unmute internal speaker according to the hp jacks and mute state */
10663 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10665 struct alc_spec *spec = codec->spec;
10668 if (force || !spec->sense_updated) {
10669 unsigned int present;
10670 /* need to execute and sync at first */
10671 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10672 /* check laptop HP jack */
10673 present = snd_hda_codec_read(codec, 0x14, 0,
10674 AC_VERB_GET_PIN_SENSE, 0);
10675 /* need to execute and sync at first */
10676 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10677 /* check docking HP jack */
10678 present |= snd_hda_codec_read(codec, 0x1b, 0,
10679 AC_VERB_GET_PIN_SENSE, 0);
10680 if (present & AC_PINSENSE_PRESENCE)
10681 spec->jack_present = 1;
10683 spec->jack_present = 0;
10684 spec->sense_updated = 1;
10686 /* unmute internal speaker only if both HPs are unplugged and
10687 * master switch is on
10689 if (spec->jack_present)
10690 mute = HDA_AMP_MUTE;
10692 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10693 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10694 HDA_AMP_MUTE, mute);
10697 /* unsolicited event for HP jack sensing */
10698 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10701 if ((res >> 26) != ALC_HP_EVENT)
10703 alc262_fujitsu_automute(codec, 1);
10706 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10708 alc262_fujitsu_automute(codec, 1);
10711 /* bind volumes of both NID 0x0c and 0x0d */
10712 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10713 .ops = &snd_hda_bind_vol,
10715 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10716 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10721 /* mute/unmute internal speaker according to the hp jack and mute state */
10722 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10724 struct alc_spec *spec = codec->spec;
10727 if (force || !spec->sense_updated) {
10728 unsigned int present_int_hp;
10729 /* need to execute and sync at first */
10730 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10731 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10732 AC_VERB_GET_PIN_SENSE, 0);
10733 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10734 spec->sense_updated = 1;
10736 if (spec->jack_present) {
10737 /* mute internal speaker */
10738 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10739 HDA_AMP_MUTE, HDA_AMP_MUTE);
10740 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10741 HDA_AMP_MUTE, HDA_AMP_MUTE);
10743 /* unmute internal speaker if necessary */
10744 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10745 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10746 HDA_AMP_MUTE, mute);
10747 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10748 HDA_AMP_MUTE, mute);
10752 /* unsolicited event for HP jack sensing */
10753 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10756 if ((res >> 26) != ALC_HP_EVENT)
10758 alc262_lenovo_3000_automute(codec, 1);
10761 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10762 int dir, int idx, long *valp)
10766 for (i = 0; i < 2; i++, valp++)
10767 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10769 *valp ? 0 : HDA_AMP_MUTE);
10773 /* bind hp and internal speaker mute (with plug check) */
10774 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10775 struct snd_ctl_elem_value *ucontrol)
10777 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10778 long *valp = ucontrol->value.integer.value;
10781 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10782 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10784 alc262_fujitsu_automute(codec, 0);
10788 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10789 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10791 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10792 .name = "Master Playback Switch",
10793 .info = snd_hda_mixer_amp_switch_info,
10794 .get = snd_hda_mixer_amp_switch_get,
10795 .put = alc262_fujitsu_master_sw_put,
10796 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10798 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10799 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10800 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10801 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10802 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10803 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10804 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10805 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10809 /* bind hp and internal speaker mute (with plug check) */
10810 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10811 struct snd_ctl_elem_value *ucontrol)
10813 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10814 long *valp = ucontrol->value.integer.value;
10817 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10819 alc262_lenovo_3000_automute(codec, 0);
10823 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10824 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10826 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10827 .name = "Master Playback Switch",
10828 .info = snd_hda_mixer_amp_switch_info,
10829 .get = snd_hda_mixer_amp_switch_get,
10830 .put = alc262_lenovo_3000_master_sw_put,
10831 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10833 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10834 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10835 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10836 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10837 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10838 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10839 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10840 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10844 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10845 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10846 ALC262_HIPPO_MASTER_SWITCH,
10847 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10848 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10849 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10850 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10851 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10852 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10856 /* additional init verbs for Benq laptops */
10857 static struct hda_verb alc262_EAPD_verbs[] = {
10858 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10859 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10863 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10864 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10865 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10867 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10868 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10872 /* Samsung Q1 Ultra Vista model setup */
10873 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10874 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10875 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10876 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10877 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10878 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10879 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10883 static struct hda_verb alc262_ultra_verbs[] = {
10885 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10886 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10889 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10890 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10891 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10892 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10894 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10895 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10896 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10897 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10898 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10900 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10901 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10902 /* ADC, choose mic */
10903 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10904 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10905 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10906 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10907 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10908 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10909 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10910 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10911 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10912 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10916 /* mute/unmute internal speaker according to the hp jack and mute state */
10917 static void alc262_ultra_automute(struct hda_codec *codec)
10919 struct alc_spec *spec = codec->spec;
10923 /* auto-mute only when HP is used as HP */
10924 if (!spec->cur_mux[0]) {
10925 unsigned int present;
10926 /* need to execute and sync at first */
10927 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10928 present = snd_hda_codec_read(codec, 0x15, 0,
10929 AC_VERB_GET_PIN_SENSE, 0);
10930 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10931 if (spec->jack_present)
10932 mute = HDA_AMP_MUTE;
10934 /* mute/unmute internal speaker */
10935 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10936 HDA_AMP_MUTE, mute);
10937 /* mute/unmute HP */
10938 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10939 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10942 /* unsolicited event for HP jack sensing */
10943 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10946 if ((res >> 26) != ALC880_HP_EVENT)
10948 alc262_ultra_automute(codec);
10951 static struct hda_input_mux alc262_ultra_capture_source = {
10955 { "Headphone", 0x7 },
10959 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10960 struct snd_ctl_elem_value *ucontrol)
10962 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10963 struct alc_spec *spec = codec->spec;
10966 ret = alc_mux_enum_put(kcontrol, ucontrol);
10969 /* reprogram the HP pin as mic or HP according to the input source */
10970 snd_hda_codec_write_cache(codec, 0x15, 0,
10971 AC_VERB_SET_PIN_WIDGET_CONTROL,
10972 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10973 alc262_ultra_automute(codec); /* mute/unmute HP */
10977 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10978 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10979 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10981 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10982 .name = "Capture Source",
10983 .info = alc_mux_enum_info,
10984 .get = alc_mux_enum_get,
10985 .put = alc262_ultra_mux_enum_put,
10990 /* We use two mixers depending on the output pin; 0x16 is a mono output
10991 * and thus it's bound with a different mixer.
10992 * This function returns which mixer amp should be used.
10994 static int alc262_check_volbit(hda_nid_t nid)
10998 else if (nid == 0x16)
11004 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11005 const char *pfx, int *vbits)
11011 vbit = alc262_check_volbit(nid);
11014 if (*vbits & vbit) /* a volume control for this mixer already there */
11017 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
11019 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11021 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11022 return add_control(spec, ALC_CTL_WIDGET_VOL, name, val);
11025 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11033 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
11035 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11037 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11038 return add_control(spec, ALC_CTL_WIDGET_MUTE, name, val);
11041 /* add playback controls from the parsed DAC table */
11042 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11043 const struct auto_pin_cfg *cfg)
11049 spec->multiout.num_dacs = 1; /* only use one dac */
11050 spec->multiout.dac_nids = spec->private_dac_nids;
11051 spec->multiout.dac_nids[0] = 2;
11053 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11055 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11059 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11062 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11065 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11069 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11070 alc262_check_volbit(cfg->speaker_pins[0]) |
11071 alc262_check_volbit(cfg->hp_pins[0]);
11072 if (vbits == 1 || vbits == 2)
11073 pfx = "Master"; /* only one mixer is used */
11074 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11079 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11082 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11086 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11093 #define alc262_auto_create_input_ctls \
11094 alc880_auto_create_input_ctls
11097 * generic initialization of ADC, input mixers and output mixers
11099 static struct hda_verb alc262_volume_init_verbs[] = {
11101 * Unmute ADC0-2 and set the default input to mic-in
11103 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11104 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11105 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11106 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11107 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11108 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11110 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11112 * Note: PASD motherboards uses the Line In 2 as the input for
11113 * front panel mic (mic 2)
11115 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11116 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11118 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11119 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11120 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11123 * Set up output mixers (0x0c - 0x0f)
11125 /* set vol=0 to output mixers */
11126 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11127 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11128 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11130 /* set up input amps for analog loopback */
11131 /* Amp Indices: DAC = 0, mixer = 1 */
11132 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11133 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11134 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11135 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11136 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11137 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11139 /* FIXME: use matrix-type input source selection */
11140 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11141 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11142 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11143 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11144 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11145 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11147 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11148 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11149 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11150 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11152 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11153 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11154 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11155 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11160 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11162 * Unmute ADC0-2 and set the default input to mic-in
11164 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11165 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11166 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11167 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11168 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11169 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11171 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11173 * Note: PASD motherboards uses the Line In 2 as the input for
11174 * front panel mic (mic 2)
11176 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11177 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11178 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11179 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11180 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11181 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11182 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11183 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11186 * Set up output mixers (0x0c - 0x0e)
11188 /* set vol=0 to output mixers */
11189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11190 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11191 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11193 /* set up input amps for analog loopback */
11194 /* Amp Indices: DAC = 0, mixer = 1 */
11195 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11196 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11197 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11198 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11199 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11200 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11202 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11203 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11204 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11206 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11207 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11209 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11210 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11212 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11213 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11214 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11215 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11216 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11218 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11219 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11220 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11221 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11222 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11223 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11226 /* FIXME: use matrix-type input source selection */
11227 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11228 /* Input mixer1: only unmute Mic */
11229 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11230 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11231 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11232 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11233 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11234 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11235 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11236 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11237 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11239 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11240 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11241 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11242 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11243 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11244 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11245 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11246 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11247 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11249 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11250 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11251 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11252 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11253 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11254 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11255 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11256 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11257 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11259 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11264 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11266 * Unmute ADC0-2 and set the default input to mic-in
11268 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11269 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11270 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11271 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11272 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11273 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11275 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11277 * Note: PASD motherboards uses the Line In 2 as the input for front
11278 * panel mic (mic 2)
11280 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11281 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11282 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11283 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11284 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11290 * Set up output mixers (0x0c - 0x0e)
11292 /* set vol=0 to output mixers */
11293 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11294 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11295 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11297 /* set up input amps for analog loopback */
11298 /* Amp Indices: DAC = 0, mixer = 1 */
11299 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11300 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11301 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11302 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11303 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11304 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11307 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11308 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11309 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11310 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11311 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11312 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11313 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11315 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11316 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11318 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11319 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11321 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11322 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11323 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11324 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11325 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11326 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11328 /* FIXME: use matrix-type input source selection */
11329 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11330 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11331 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11332 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11333 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11336 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11337 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11339 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11340 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11341 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11342 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11343 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11344 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11345 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11348 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11349 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11350 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11351 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11352 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11353 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11355 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11360 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11362 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11363 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11364 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11366 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11367 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11368 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11369 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11371 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11372 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11373 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11378 #ifdef CONFIG_SND_HDA_POWER_SAVE
11379 #define alc262_loopbacks alc880_loopbacks
11382 /* pcm configuration: identical with ALC880 */
11383 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11384 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11385 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11386 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11389 * BIOS auto configuration
11391 static int alc262_parse_auto_config(struct hda_codec *codec)
11393 struct alc_spec *spec = codec->spec;
11395 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11397 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11401 if (!spec->autocfg.line_outs) {
11402 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11403 spec->multiout.max_channels = 2;
11404 spec->no_analog = 1;
11407 return 0; /* can't find valid BIOS pin config */
11409 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11412 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11416 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11419 if (spec->autocfg.dig_outs) {
11420 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11421 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11423 if (spec->autocfg.dig_in_pin)
11424 spec->dig_in_nid = ALC262_DIGIN_NID;
11426 if (spec->kctls.list)
11427 add_mixer(spec, spec->kctls.list);
11429 add_verb(spec, alc262_volume_init_verbs);
11430 spec->num_mux_defs = 1;
11431 spec->input_mux = &spec->private_imux[0];
11433 err = alc_auto_add_mic_boost(codec);
11437 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11442 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11443 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11444 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11445 #define alc262_auto_init_input_src alc882_auto_init_input_src
11448 /* init callback for auto-configuration model -- overriding the default init */
11449 static void alc262_auto_init(struct hda_codec *codec)
11451 struct alc_spec *spec = codec->spec;
11452 alc262_auto_init_multi_out(codec);
11453 alc262_auto_init_hp_out(codec);
11454 alc262_auto_init_analog_input(codec);
11455 alc262_auto_init_input_src(codec);
11456 if (spec->unsol_event)
11457 alc_inithook(codec);
11461 * configuration and preset
11463 static const char *alc262_models[ALC262_MODEL_LAST] = {
11464 [ALC262_BASIC] = "basic",
11465 [ALC262_HIPPO] = "hippo",
11466 [ALC262_HIPPO_1] = "hippo_1",
11467 [ALC262_FUJITSU] = "fujitsu",
11468 [ALC262_HP_BPC] = "hp-bpc",
11469 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11470 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11471 [ALC262_HP_RP5700] = "hp-rp5700",
11472 [ALC262_BENQ_ED8] = "benq",
11473 [ALC262_BENQ_T31] = "benq-t31",
11474 [ALC262_SONY_ASSAMD] = "sony-assamd",
11475 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11476 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11477 [ALC262_ULTRA] = "ultra",
11478 [ALC262_LENOVO_3000] = "lenovo-3000",
11479 [ALC262_NEC] = "nec",
11480 [ALC262_TYAN] = "tyan",
11481 [ALC262_AUTO] = "auto",
11484 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11485 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11486 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11487 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11489 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11491 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11493 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11494 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11495 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11496 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11497 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11498 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11499 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11500 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11501 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11502 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11503 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11504 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11505 ALC262_HP_TC_T5735),
11506 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11507 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11508 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11509 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11510 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11511 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11512 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11513 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11514 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11515 ALC262_SONY_ASSAMD),
11516 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11517 ALC262_TOSHIBA_RX1),
11518 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11519 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11520 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11521 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11522 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11524 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11525 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11526 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11527 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11528 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11532 static struct alc_config_preset alc262_presets[] = {
11534 .mixers = { alc262_base_mixer },
11535 .init_verbs = { alc262_init_verbs },
11536 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11537 .dac_nids = alc262_dac_nids,
11539 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11540 .channel_mode = alc262_modes,
11541 .input_mux = &alc262_capture_source,
11544 .mixers = { alc262_hippo_mixer },
11545 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11546 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11547 .dac_nids = alc262_dac_nids,
11549 .dig_out_nid = ALC262_DIGOUT_NID,
11550 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11551 .channel_mode = alc262_modes,
11552 .input_mux = &alc262_capture_source,
11553 .unsol_event = alc262_hippo_unsol_event,
11554 .setup = alc262_hippo_setup,
11555 .init_hook = alc262_hippo_automute,
11557 [ALC262_HIPPO_1] = {
11558 .mixers = { alc262_hippo1_mixer },
11559 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11560 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11561 .dac_nids = alc262_dac_nids,
11563 .dig_out_nid = ALC262_DIGOUT_NID,
11564 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11565 .channel_mode = alc262_modes,
11566 .input_mux = &alc262_capture_source,
11567 .unsol_event = alc262_hippo_unsol_event,
11568 .setup = alc262_hippo1_setup,
11569 .init_hook = alc262_hippo_automute,
11571 [ALC262_FUJITSU] = {
11572 .mixers = { alc262_fujitsu_mixer },
11573 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11574 alc262_fujitsu_unsol_verbs },
11575 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11576 .dac_nids = alc262_dac_nids,
11578 .dig_out_nid = ALC262_DIGOUT_NID,
11579 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11580 .channel_mode = alc262_modes,
11581 .input_mux = &alc262_fujitsu_capture_source,
11582 .unsol_event = alc262_fujitsu_unsol_event,
11583 .init_hook = alc262_fujitsu_init_hook,
11585 [ALC262_HP_BPC] = {
11586 .mixers = { alc262_HP_BPC_mixer },
11587 .init_verbs = { alc262_HP_BPC_init_verbs },
11588 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11589 .dac_nids = alc262_dac_nids,
11591 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11592 .channel_mode = alc262_modes,
11593 .input_mux = &alc262_HP_capture_source,
11594 .unsol_event = alc262_hp_bpc_unsol_event,
11595 .init_hook = alc262_hp_bpc_automute,
11597 [ALC262_HP_BPC_D7000_WF] = {
11598 .mixers = { alc262_HP_BPC_WildWest_mixer },
11599 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11600 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11601 .dac_nids = alc262_dac_nids,
11603 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11604 .channel_mode = alc262_modes,
11605 .input_mux = &alc262_HP_D7000_capture_source,
11606 .unsol_event = alc262_hp_wildwest_unsol_event,
11607 .init_hook = alc262_hp_wildwest_automute,
11609 [ALC262_HP_BPC_D7000_WL] = {
11610 .mixers = { alc262_HP_BPC_WildWest_mixer,
11611 alc262_HP_BPC_WildWest_option_mixer },
11612 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11613 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11614 .dac_nids = alc262_dac_nids,
11616 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11617 .channel_mode = alc262_modes,
11618 .input_mux = &alc262_HP_D7000_capture_source,
11619 .unsol_event = alc262_hp_wildwest_unsol_event,
11620 .init_hook = alc262_hp_wildwest_automute,
11622 [ALC262_HP_TC_T5735] = {
11623 .mixers = { alc262_hp_t5735_mixer },
11624 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11625 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11626 .dac_nids = alc262_dac_nids,
11628 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11629 .channel_mode = alc262_modes,
11630 .input_mux = &alc262_capture_source,
11631 .unsol_event = alc_sku_unsol_event,
11632 .setup = alc262_hp_t5735_setup,
11633 .init_hook = alc_inithook,
11635 [ALC262_HP_RP5700] = {
11636 .mixers = { alc262_hp_rp5700_mixer },
11637 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11638 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11639 .dac_nids = alc262_dac_nids,
11640 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11641 .channel_mode = alc262_modes,
11642 .input_mux = &alc262_hp_rp5700_capture_source,
11644 [ALC262_BENQ_ED8] = {
11645 .mixers = { alc262_base_mixer },
11646 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11647 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11648 .dac_nids = alc262_dac_nids,
11650 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11651 .channel_mode = alc262_modes,
11652 .input_mux = &alc262_capture_source,
11654 [ALC262_SONY_ASSAMD] = {
11655 .mixers = { alc262_sony_mixer },
11656 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11657 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11658 .dac_nids = alc262_dac_nids,
11660 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11661 .channel_mode = alc262_modes,
11662 .input_mux = &alc262_capture_source,
11663 .unsol_event = alc262_hippo_unsol_event,
11664 .setup = alc262_hippo_setup,
11665 .init_hook = alc262_hippo_automute,
11667 [ALC262_BENQ_T31] = {
11668 .mixers = { alc262_benq_t31_mixer },
11669 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11670 alc_hp15_unsol_verbs },
11671 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11672 .dac_nids = alc262_dac_nids,
11674 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11675 .channel_mode = alc262_modes,
11676 .input_mux = &alc262_capture_source,
11677 .unsol_event = alc262_hippo_unsol_event,
11678 .setup = alc262_hippo_setup,
11679 .init_hook = alc262_hippo_automute,
11682 .mixers = { alc262_ultra_mixer },
11683 .cap_mixer = alc262_ultra_capture_mixer,
11684 .init_verbs = { alc262_ultra_verbs },
11685 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11686 .dac_nids = alc262_dac_nids,
11687 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11688 .channel_mode = alc262_modes,
11689 .input_mux = &alc262_ultra_capture_source,
11690 .adc_nids = alc262_adc_nids, /* ADC0 */
11691 .capsrc_nids = alc262_capsrc_nids,
11692 .num_adc_nids = 1, /* single ADC */
11693 .unsol_event = alc262_ultra_unsol_event,
11694 .init_hook = alc262_ultra_automute,
11696 [ALC262_LENOVO_3000] = {
11697 .mixers = { alc262_lenovo_3000_mixer },
11698 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11699 alc262_lenovo_3000_unsol_verbs,
11700 alc262_lenovo_3000_init_verbs },
11701 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11702 .dac_nids = alc262_dac_nids,
11704 .dig_out_nid = ALC262_DIGOUT_NID,
11705 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11706 .channel_mode = alc262_modes,
11707 .input_mux = &alc262_fujitsu_capture_source,
11708 .unsol_event = alc262_lenovo_3000_unsol_event,
11711 .mixers = { alc262_nec_mixer },
11712 .init_verbs = { alc262_nec_verbs },
11713 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11714 .dac_nids = alc262_dac_nids,
11716 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11717 .channel_mode = alc262_modes,
11718 .input_mux = &alc262_capture_source,
11720 [ALC262_TOSHIBA_S06] = {
11721 .mixers = { alc262_toshiba_s06_mixer },
11722 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11723 alc262_eapd_verbs },
11724 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11725 .capsrc_nids = alc262_dmic_capsrc_nids,
11726 .dac_nids = alc262_dac_nids,
11727 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11728 .num_adc_nids = 1, /* single ADC */
11729 .dig_out_nid = ALC262_DIGOUT_NID,
11730 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11731 .channel_mode = alc262_modes,
11732 .unsol_event = alc_sku_unsol_event,
11733 .setup = alc262_toshiba_s06_setup,
11734 .init_hook = alc_inithook,
11736 [ALC262_TOSHIBA_RX1] = {
11737 .mixers = { alc262_toshiba_rx1_mixer },
11738 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11739 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11740 .dac_nids = alc262_dac_nids,
11742 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11743 .channel_mode = alc262_modes,
11744 .input_mux = &alc262_capture_source,
11745 .unsol_event = alc262_hippo_unsol_event,
11746 .setup = alc262_hippo_setup,
11747 .init_hook = alc262_hippo_automute,
11750 .mixers = { alc262_tyan_mixer },
11751 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11752 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11753 .dac_nids = alc262_dac_nids,
11755 .dig_out_nid = ALC262_DIGOUT_NID,
11756 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11757 .channel_mode = alc262_modes,
11758 .input_mux = &alc262_capture_source,
11759 .unsol_event = alc_automute_amp_unsol_event,
11760 .setup = alc262_tyan_setup,
11761 .init_hook = alc_automute_amp,
11765 static int patch_alc262(struct hda_codec *codec)
11767 struct alc_spec *spec;
11771 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11775 codec->spec = spec;
11777 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11782 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11783 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11784 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11785 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11789 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11791 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11795 if (board_config < 0) {
11796 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11798 board_config = ALC262_AUTO;
11801 if (board_config == ALC262_AUTO) {
11802 /* automatic parse from the BIOS config */
11803 err = alc262_parse_auto_config(codec);
11809 "hda_codec: Cannot set up configuration "
11810 "from BIOS. Using base mode...\n");
11811 board_config = ALC262_BASIC;
11815 if (!spec->no_analog) {
11816 err = snd_hda_attach_beep_device(codec, 0x1);
11823 if (board_config != ALC262_AUTO)
11824 setup_preset(codec, &alc262_presets[board_config]);
11826 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11827 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11829 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11830 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11832 if (!spec->adc_nids && spec->input_mux) {
11834 /* check whether the digital-mic has to be supported */
11835 for (i = 0; i < spec->input_mux->num_items; i++) {
11836 if (spec->input_mux->items[i].index >= 9)
11839 if (i < spec->input_mux->num_items) {
11840 /* use only ADC0 */
11841 spec->adc_nids = alc262_dmic_adc_nids;
11842 spec->num_adc_nids = 1;
11843 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11845 /* all analog inputs */
11846 /* check whether NID 0x07 is valid */
11847 unsigned int wcap = get_wcaps(codec, 0x07);
11850 wcap = get_wcaps_type(wcap);
11851 if (wcap != AC_WID_AUD_IN) {
11852 spec->adc_nids = alc262_adc_nids_alt;
11853 spec->num_adc_nids =
11854 ARRAY_SIZE(alc262_adc_nids_alt);
11855 spec->capsrc_nids = alc262_capsrc_nids_alt;
11857 spec->adc_nids = alc262_adc_nids;
11858 spec->num_adc_nids =
11859 ARRAY_SIZE(alc262_adc_nids);
11860 spec->capsrc_nids = alc262_capsrc_nids;
11864 if (!spec->cap_mixer && !spec->no_analog)
11865 set_capture_mixer(codec);
11866 if (!spec->no_analog)
11867 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11869 spec->vmaster_nid = 0x0c;
11871 codec->patch_ops = alc_patch_ops;
11872 if (board_config == ALC262_AUTO)
11873 spec->init_hook = alc262_auto_init;
11874 #ifdef CONFIG_SND_HDA_POWER_SAVE
11875 if (!spec->loopback.amplist)
11876 spec->loopback.amplist = alc262_loopbacks;
11878 codec->proc_widget_hook = print_realtek_coef;
11884 * ALC268 channel source setting (2 channel)
11886 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11887 #define alc268_modes alc260_modes
11889 static hda_nid_t alc268_dac_nids[2] = {
11894 static hda_nid_t alc268_adc_nids[2] = {
11899 static hda_nid_t alc268_adc_nids_alt[1] = {
11904 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11906 static struct snd_kcontrol_new alc268_base_mixer[] = {
11907 /* output mixer control */
11908 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11909 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11910 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11911 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11912 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11913 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11914 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11918 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11919 /* output mixer control */
11920 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11921 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11922 ALC262_HIPPO_MASTER_SWITCH,
11923 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11924 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11925 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11929 /* bind Beep switches of both NID 0x0f and 0x10 */
11930 static struct hda_bind_ctls alc268_bind_beep_sw = {
11931 .ops = &snd_hda_bind_sw,
11933 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11934 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11939 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11940 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11941 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11945 static struct hda_verb alc268_eapd_verbs[] = {
11946 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11947 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11951 /* Toshiba specific */
11952 static struct hda_verb alc268_toshiba_verbs[] = {
11953 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11957 /* Acer specific */
11958 /* bind volumes of both NID 0x02 and 0x03 */
11959 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11960 .ops = &snd_hda_bind_vol,
11962 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11963 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11968 /* mute/unmute internal speaker according to the hp jack and mute state */
11969 static void alc268_acer_automute(struct hda_codec *codec, int force)
11971 struct alc_spec *spec = codec->spec;
11974 if (force || !spec->sense_updated) {
11975 unsigned int present;
11976 present = snd_hda_codec_read(codec, 0x14, 0,
11977 AC_VERB_GET_PIN_SENSE, 0);
11978 spec->jack_present = (present & 0x80000000) != 0;
11979 spec->sense_updated = 1;
11981 if (spec->jack_present)
11982 mute = HDA_AMP_MUTE; /* mute internal speaker */
11983 else /* unmute internal speaker if necessary */
11984 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11985 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11986 HDA_AMP_MUTE, mute);
11990 /* bind hp and internal speaker mute (with plug check) */
11991 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11992 struct snd_ctl_elem_value *ucontrol)
11994 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11995 long *valp = ucontrol->value.integer.value;
11998 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12000 alc268_acer_automute(codec, 0);
12004 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12005 /* output mixer control */
12006 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12008 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12009 .name = "Master Playback Switch",
12010 .info = snd_hda_mixer_amp_switch_info,
12011 .get = snd_hda_mixer_amp_switch_get,
12012 .put = alc268_acer_master_sw_put,
12013 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12015 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12019 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12020 /* output mixer control */
12021 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12023 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12024 .name = "Master Playback Switch",
12025 .info = snd_hda_mixer_amp_switch_info,
12026 .get = snd_hda_mixer_amp_switch_get,
12027 .put = alc268_acer_master_sw_put,
12028 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12030 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12031 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12032 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12036 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12037 /* output mixer control */
12038 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12040 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12041 .name = "Master Playback Switch",
12042 .info = snd_hda_mixer_amp_switch_info,
12043 .get = snd_hda_mixer_amp_switch_get,
12044 .put = alc268_acer_master_sw_put,
12045 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12047 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12048 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12052 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12053 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12054 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12055 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12056 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12057 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12058 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12062 static struct hda_verb alc268_acer_verbs[] = {
12063 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12064 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12065 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12066 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12067 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12068 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12069 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12073 /* unsolicited event for HP jack sensing */
12074 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12075 #define alc268_toshiba_setup alc262_hippo_setup
12076 #define alc268_toshiba_automute alc262_hippo_automute
12078 static void alc268_acer_unsol_event(struct hda_codec *codec,
12081 if ((res >> 26) != ALC880_HP_EVENT)
12083 alc268_acer_automute(codec, 1);
12086 static void alc268_acer_init_hook(struct hda_codec *codec)
12088 alc268_acer_automute(codec, 1);
12091 /* toggle speaker-output according to the hp-jack state */
12092 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12094 unsigned int present;
12095 unsigned char bits;
12097 present = snd_hda_codec_read(codec, 0x15, 0,
12098 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12099 bits = present ? AMP_IN_MUTE(0) : 0;
12100 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12101 AMP_IN_MUTE(0), bits);
12102 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12103 AMP_IN_MUTE(0), bits);
12106 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12109 switch (res >> 26) {
12110 case ALC880_HP_EVENT:
12111 alc268_aspire_one_speaker_automute(codec);
12113 case ALC880_MIC_EVENT:
12114 alc_mic_automute(codec);
12119 static void alc268_acer_lc_setup(struct hda_codec *codec)
12121 struct alc_spec *spec = codec->spec;
12122 spec->ext_mic.pin = 0x18;
12123 spec->ext_mic.mux_idx = 0;
12124 spec->int_mic.pin = 0x12;
12125 spec->int_mic.mux_idx = 6;
12126 spec->auto_mic = 1;
12129 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12131 alc268_aspire_one_speaker_automute(codec);
12132 alc_mic_automute(codec);
12135 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12136 /* output mixer control */
12137 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12138 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12139 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12140 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12141 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12142 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12146 static struct hda_verb alc268_dell_verbs[] = {
12147 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12148 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12149 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12150 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12154 /* mute/unmute internal speaker according to the hp jack and mute state */
12155 static void alc268_dell_setup(struct hda_codec *codec)
12157 struct alc_spec *spec = codec->spec;
12159 spec->autocfg.hp_pins[0] = 0x15;
12160 spec->autocfg.speaker_pins[0] = 0x14;
12161 spec->ext_mic.pin = 0x18;
12162 spec->ext_mic.mux_idx = 0;
12163 spec->int_mic.pin = 0x19;
12164 spec->int_mic.mux_idx = 1;
12165 spec->auto_mic = 1;
12168 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12169 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12170 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12171 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12172 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12173 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12174 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12175 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12176 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12180 static struct hda_verb alc267_quanta_il1_verbs[] = {
12181 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12182 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12186 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12188 struct alc_spec *spec = codec->spec;
12189 spec->autocfg.hp_pins[0] = 0x15;
12190 spec->autocfg.speaker_pins[0] = 0x14;
12191 spec->ext_mic.pin = 0x18;
12192 spec->ext_mic.mux_idx = 0;
12193 spec->int_mic.pin = 0x19;
12194 spec->int_mic.mux_idx = 1;
12195 spec->auto_mic = 1;
12199 * generic initialization of ADC, input mixers and output mixers
12201 static struct hda_verb alc268_base_init_verbs[] = {
12202 /* Unmute DAC0-1 and set vol = 0 */
12203 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12204 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12207 * Set up output mixers (0x0c - 0x0e)
12209 /* set vol=0 to output mixers */
12210 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12211 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12213 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12214 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12216 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12217 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12218 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12219 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12220 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12221 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12222 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12223 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12225 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12226 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12227 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12228 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12229 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12231 /* set PCBEEP vol = 0, mute connections */
12232 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12233 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12234 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12236 /* Unmute Selector 23h,24h and set the default input to mic-in */
12238 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12239 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12240 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12241 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12247 * generic initialization of ADC, input mixers and output mixers
12249 static struct hda_verb alc268_volume_init_verbs[] = {
12250 /* set output DAC */
12251 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12252 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12254 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12255 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12256 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12257 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12258 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12260 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12261 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12262 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12264 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12265 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12267 /* set PCBEEP vol = 0, mute connections */
12268 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12269 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12270 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12275 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12276 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12277 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12281 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12282 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12283 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12288 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12289 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12290 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12291 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12292 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12297 static struct hda_input_mux alc268_capture_source = {
12301 { "Front Mic", 0x1 },
12307 static struct hda_input_mux alc268_acer_capture_source = {
12311 { "Internal Mic", 0x1 },
12316 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12320 { "Internal Mic", 0x6 },
12325 #ifdef CONFIG_SND_DEBUG
12326 static struct snd_kcontrol_new alc268_test_mixer[] = {
12327 /* Volume widgets */
12328 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12329 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12330 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12331 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12332 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12333 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12334 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12335 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12336 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12337 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12338 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12339 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12340 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12341 /* The below appears problematic on some hardwares */
12342 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12343 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12344 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12345 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12346 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12348 /* Modes for retasking pin widgets */
12349 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12350 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12351 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12352 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12354 /* Controls for GPIO pins, assuming they are configured as outputs */
12355 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12356 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12357 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12358 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12360 /* Switches to allow the digital SPDIF output pin to be enabled.
12361 * The ALC268 does not have an SPDIF input.
12363 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12365 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12366 * this output to turn on an external amplifier.
12368 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12369 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12375 /* create input playback/capture controls for the given pin */
12376 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12377 const char *ctlname, int idx)
12383 sprintf(name, "%s Playback Volume", ctlname);
12395 if (spec->multiout.dac_nids[0] != dac &&
12396 spec->multiout.dac_nids[1] != dac) {
12397 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12398 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12402 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12405 sprintf(name, "%s Playback Switch", ctlname);
12407 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12408 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12410 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12411 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12417 /* add playback controls from the parsed DAC table */
12418 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12419 const struct auto_pin_cfg *cfg)
12424 spec->multiout.dac_nids = spec->private_dac_nids;
12426 nid = cfg->line_out_pins[0];
12429 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12433 err = alc268_new_analog_output(spec, nid, name, 0);
12438 nid = cfg->speaker_pins[0];
12440 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12441 "Speaker Playback Volume",
12442 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12446 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12450 nid = cfg->hp_pins[0];
12452 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12457 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12459 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12460 "Mono Playback Switch",
12461 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12468 /* create playback/capture controls for input pins */
12469 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12470 const struct auto_pin_cfg *cfg)
12472 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12475 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12476 hda_nid_t nid, int pin_type)
12480 alc_set_pin_output(codec, nid, pin_type);
12481 if (nid == 0x14 || nid == 0x16)
12485 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12488 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12490 struct alc_spec *spec = codec->spec;
12491 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12493 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12494 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12498 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12500 struct alc_spec *spec = codec->spec;
12503 pin = spec->autocfg.hp_pins[0];
12505 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12506 pin = spec->autocfg.speaker_pins[0];
12508 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12511 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12513 struct alc_spec *spec = codec->spec;
12514 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12515 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12516 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12517 unsigned int dac_vol1, dac_vol2;
12519 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12520 snd_hda_codec_write(codec, speaker_nid, 0,
12521 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12522 /* mute mixer inputs from 0x1d */
12523 snd_hda_codec_write(codec, 0x0f, 0,
12524 AC_VERB_SET_AMP_GAIN_MUTE,
12526 snd_hda_codec_write(codec, 0x10, 0,
12527 AC_VERB_SET_AMP_GAIN_MUTE,
12530 /* unmute mixer inputs from 0x1d */
12531 snd_hda_codec_write(codec, 0x0f, 0,
12532 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12533 snd_hda_codec_write(codec, 0x10, 0,
12534 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12537 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12538 if (line_nid == 0x14)
12539 dac_vol2 = AMP_OUT_ZERO;
12540 else if (line_nid == 0x15)
12541 dac_vol1 = AMP_OUT_ZERO;
12542 if (hp_nid == 0x14)
12543 dac_vol2 = AMP_OUT_ZERO;
12544 else if (hp_nid == 0x15)
12545 dac_vol1 = AMP_OUT_ZERO;
12546 if (line_nid != 0x16 || hp_nid != 0x16 ||
12547 spec->autocfg.line_out_pins[1] != 0x16 ||
12548 spec->autocfg.line_out_pins[2] != 0x16)
12549 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12551 snd_hda_codec_write(codec, 0x02, 0,
12552 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12553 snd_hda_codec_write(codec, 0x03, 0,
12554 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12557 /* pcm configuration: identical with ALC880 */
12558 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12559 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12560 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12561 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12564 * BIOS auto configuration
12566 static int alc268_parse_auto_config(struct hda_codec *codec)
12568 struct alc_spec *spec = codec->spec;
12570 static hda_nid_t alc268_ignore[] = { 0 };
12572 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12576 if (!spec->autocfg.line_outs) {
12577 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12578 spec->multiout.max_channels = 2;
12579 spec->no_analog = 1;
12582 return 0; /* can't find valid BIOS pin config */
12584 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12587 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12591 spec->multiout.max_channels = 2;
12594 /* digital only support output */
12595 if (spec->autocfg.dig_outs) {
12596 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12597 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12599 if (spec->kctls.list)
12600 add_mixer(spec, spec->kctls.list);
12602 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12603 add_mixer(spec, alc268_beep_mixer);
12605 add_verb(spec, alc268_volume_init_verbs);
12606 spec->num_mux_defs = 2;
12607 spec->input_mux = &spec->private_imux[0];
12609 err = alc_auto_add_mic_boost(codec);
12613 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12618 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12620 /* init callback for auto-configuration model -- overriding the default init */
12621 static void alc268_auto_init(struct hda_codec *codec)
12623 struct alc_spec *spec = codec->spec;
12624 alc268_auto_init_multi_out(codec);
12625 alc268_auto_init_hp_out(codec);
12626 alc268_auto_init_mono_speaker_out(codec);
12627 alc268_auto_init_analog_input(codec);
12628 if (spec->unsol_event)
12629 alc_inithook(codec);
12633 * configuration and preset
12635 static const char *alc268_models[ALC268_MODEL_LAST] = {
12636 [ALC267_QUANTA_IL1] = "quanta-il1",
12637 [ALC268_3ST] = "3stack",
12638 [ALC268_TOSHIBA] = "toshiba",
12639 [ALC268_ACER] = "acer",
12640 [ALC268_ACER_DMIC] = "acer-dmic",
12641 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12642 [ALC268_DELL] = "dell",
12643 [ALC268_ZEPTO] = "zepto",
12644 #ifdef CONFIG_SND_DEBUG
12645 [ALC268_TEST] = "test",
12647 [ALC268_AUTO] = "auto",
12650 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12651 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12652 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12653 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12654 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12655 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12656 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12657 ALC268_ACER_ASPIRE_ONE),
12658 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12659 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12660 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12661 /* almost compatible with toshiba but with optional digital outs;
12662 * auto-probing seems working fine
12664 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12666 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12667 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12668 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12669 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12670 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12671 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12675 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12676 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12677 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12678 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12679 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12684 static struct alc_config_preset alc268_presets[] = {
12685 [ALC267_QUANTA_IL1] = {
12686 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12687 alc268_capture_nosrc_mixer },
12688 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12689 alc267_quanta_il1_verbs },
12690 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12691 .dac_nids = alc268_dac_nids,
12692 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12693 .adc_nids = alc268_adc_nids_alt,
12695 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12696 .channel_mode = alc268_modes,
12697 .unsol_event = alc_sku_unsol_event,
12698 .setup = alc267_quanta_il1_setup,
12699 .init_hook = alc_inithook,
12702 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12703 alc268_beep_mixer },
12704 .init_verbs = { alc268_base_init_verbs },
12705 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12706 .dac_nids = alc268_dac_nids,
12707 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12708 .adc_nids = alc268_adc_nids_alt,
12709 .capsrc_nids = alc268_capsrc_nids,
12711 .dig_out_nid = ALC268_DIGOUT_NID,
12712 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12713 .channel_mode = alc268_modes,
12714 .input_mux = &alc268_capture_source,
12716 [ALC268_TOSHIBA] = {
12717 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12718 alc268_beep_mixer },
12719 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12720 alc268_toshiba_verbs },
12721 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12722 .dac_nids = alc268_dac_nids,
12723 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12724 .adc_nids = alc268_adc_nids_alt,
12725 .capsrc_nids = alc268_capsrc_nids,
12727 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12728 .channel_mode = alc268_modes,
12729 .input_mux = &alc268_capture_source,
12730 .unsol_event = alc268_toshiba_unsol_event,
12731 .setup = alc268_toshiba_setup,
12732 .init_hook = alc268_toshiba_automute,
12735 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12736 alc268_beep_mixer },
12737 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12738 alc268_acer_verbs },
12739 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12740 .dac_nids = alc268_dac_nids,
12741 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12742 .adc_nids = alc268_adc_nids_alt,
12743 .capsrc_nids = alc268_capsrc_nids,
12745 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12746 .channel_mode = alc268_modes,
12747 .input_mux = &alc268_acer_capture_source,
12748 .unsol_event = alc268_acer_unsol_event,
12749 .init_hook = alc268_acer_init_hook,
12751 [ALC268_ACER_DMIC] = {
12752 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12753 alc268_beep_mixer },
12754 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12755 alc268_acer_verbs },
12756 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12757 .dac_nids = alc268_dac_nids,
12758 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12759 .adc_nids = alc268_adc_nids_alt,
12760 .capsrc_nids = alc268_capsrc_nids,
12762 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12763 .channel_mode = alc268_modes,
12764 .input_mux = &alc268_acer_dmic_capture_source,
12765 .unsol_event = alc268_acer_unsol_event,
12766 .init_hook = alc268_acer_init_hook,
12768 [ALC268_ACER_ASPIRE_ONE] = {
12769 .mixers = { alc268_acer_aspire_one_mixer,
12771 alc268_capture_nosrc_mixer },
12772 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12773 alc268_acer_aspire_one_verbs },
12774 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12775 .dac_nids = alc268_dac_nids,
12776 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12777 .adc_nids = alc268_adc_nids_alt,
12778 .capsrc_nids = alc268_capsrc_nids,
12780 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12781 .channel_mode = alc268_modes,
12782 .unsol_event = alc268_acer_lc_unsol_event,
12783 .setup = alc268_acer_lc_setup,
12784 .init_hook = alc268_acer_lc_init_hook,
12787 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12788 alc268_capture_nosrc_mixer },
12789 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12790 alc268_dell_verbs },
12791 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12792 .dac_nids = alc268_dac_nids,
12793 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12794 .adc_nids = alc268_adc_nids_alt,
12795 .capsrc_nids = alc268_capsrc_nids,
12797 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12798 .channel_mode = alc268_modes,
12799 .unsol_event = alc_sku_unsol_event,
12800 .setup = alc268_dell_setup,
12801 .init_hook = alc_inithook,
12804 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12805 alc268_beep_mixer },
12806 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12807 alc268_toshiba_verbs },
12808 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12809 .dac_nids = alc268_dac_nids,
12810 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12811 .adc_nids = alc268_adc_nids_alt,
12812 .capsrc_nids = alc268_capsrc_nids,
12814 .dig_out_nid = ALC268_DIGOUT_NID,
12815 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12816 .channel_mode = alc268_modes,
12817 .input_mux = &alc268_capture_source,
12818 .setup = alc268_toshiba_setup,
12819 .init_hook = alc268_toshiba_automute,
12821 #ifdef CONFIG_SND_DEBUG
12823 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12824 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12825 alc268_volume_init_verbs },
12826 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12827 .dac_nids = alc268_dac_nids,
12828 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12829 .adc_nids = alc268_adc_nids_alt,
12830 .capsrc_nids = alc268_capsrc_nids,
12832 .dig_out_nid = ALC268_DIGOUT_NID,
12833 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12834 .channel_mode = alc268_modes,
12835 .input_mux = &alc268_capture_source,
12840 static int patch_alc268(struct hda_codec *codec)
12842 struct alc_spec *spec;
12844 int i, has_beep, err;
12846 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12850 codec->spec = spec;
12852 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12856 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12857 board_config = snd_hda_check_board_codec_sid_config(codec,
12858 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12860 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12861 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12863 board_config = ALC268_AUTO;
12866 if (board_config == ALC268_AUTO) {
12867 /* automatic parse from the BIOS config */
12868 err = alc268_parse_auto_config(codec);
12874 "hda_codec: Cannot set up configuration "
12875 "from BIOS. Using base mode...\n");
12876 board_config = ALC268_3ST;
12880 if (board_config != ALC268_AUTO)
12881 setup_preset(codec, &alc268_presets[board_config]);
12883 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12884 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12885 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12887 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12890 for (i = 0; i < spec->num_mixers; i++) {
12891 if (spec->mixers[i] == alc268_beep_mixer) {
12898 err = snd_hda_attach_beep_device(codec, 0x1);
12903 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12904 /* override the amp caps for beep generator */
12905 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12906 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12907 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12908 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12909 (0 << AC_AMPCAP_MUTE_SHIFT));
12912 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12913 /* check whether NID 0x07 is valid */
12914 unsigned int wcap = get_wcaps(codec, 0x07);
12917 spec->capsrc_nids = alc268_capsrc_nids;
12919 wcap = get_wcaps_type(wcap);
12920 if (spec->auto_mic ||
12921 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12922 spec->adc_nids = alc268_adc_nids_alt;
12923 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12924 if (spec->auto_mic)
12925 fixup_automic_adc(codec);
12926 if (spec->auto_mic || spec->input_mux->num_items == 1)
12927 add_mixer(spec, alc268_capture_nosrc_mixer);
12929 add_mixer(spec, alc268_capture_alt_mixer);
12931 spec->adc_nids = alc268_adc_nids;
12932 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12933 add_mixer(spec, alc268_capture_mixer);
12935 /* set default input source */
12936 for (i = 0; i < spec->num_adc_nids; i++)
12937 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12938 0, AC_VERB_SET_CONNECT_SEL,
12939 i < spec->num_mux_defs ?
12940 spec->input_mux[i].items[0].index :
12941 spec->input_mux->items[0].index);
12944 spec->vmaster_nid = 0x02;
12946 codec->patch_ops = alc_patch_ops;
12947 if (board_config == ALC268_AUTO)
12948 spec->init_hook = alc268_auto_init;
12950 codec->proc_widget_hook = print_realtek_coef;
12956 * ALC269 channel source setting (2 channel)
12958 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12960 #define alc269_dac_nids alc260_dac_nids
12962 static hda_nid_t alc269_adc_nids[1] = {
12967 static hda_nid_t alc269_capsrc_nids[1] = {
12971 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12975 #define alc269_modes alc260_modes
12976 #define alc269_capture_source alc880_lg_lw_capture_source
12978 static struct snd_kcontrol_new alc269_base_mixer[] = {
12979 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12980 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12981 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12982 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12983 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12985 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12986 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12987 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12988 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12989 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12990 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12994 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12995 /* output mixer control */
12996 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12998 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12999 .name = "Master Playback Switch",
13000 .info = snd_hda_mixer_amp_switch_info,
13001 .get = snd_hda_mixer_amp_switch_get,
13002 .put = alc268_acer_master_sw_put,
13003 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13005 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13006 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13007 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13008 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13009 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13010 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13014 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13015 /* output mixer control */
13016 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13018 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13019 .name = "Master Playback Switch",
13020 .info = snd_hda_mixer_amp_switch_info,
13021 .get = snd_hda_mixer_amp_switch_get,
13022 .put = alc268_acer_master_sw_put,
13023 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13025 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13026 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13027 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13028 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13029 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13030 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13031 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13032 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13033 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13037 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13038 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13039 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13040 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13041 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13045 /* capture mixer elements */
13046 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13047 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13048 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13049 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13054 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13056 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13057 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13058 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13059 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13060 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13061 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13062 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13066 static struct hda_verb alc269_lifebook_verbs[] = {
13067 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13068 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13069 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13070 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13071 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13072 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13073 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13074 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13075 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13076 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13080 /* toggle speaker-output according to the hp-jack state */
13081 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13083 unsigned int present;
13084 unsigned char bits;
13086 present = snd_hda_codec_read(codec, 0x15, 0,
13087 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13088 bits = present ? AMP_IN_MUTE(0) : 0;
13089 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13090 AMP_IN_MUTE(0), bits);
13091 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13092 AMP_IN_MUTE(0), bits);
13094 snd_hda_codec_write(codec, 0x20, 0,
13095 AC_VERB_SET_COEF_INDEX, 0x0c);
13096 snd_hda_codec_write(codec, 0x20, 0,
13097 AC_VERB_SET_PROC_COEF, 0x680);
13099 snd_hda_codec_write(codec, 0x20, 0,
13100 AC_VERB_SET_COEF_INDEX, 0x0c);
13101 snd_hda_codec_write(codec, 0x20, 0,
13102 AC_VERB_SET_PROC_COEF, 0x480);
13105 /* toggle speaker-output according to the hp-jacks state */
13106 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13108 unsigned int present;
13109 unsigned char bits;
13111 /* Check laptop headphone socket */
13112 present = snd_hda_codec_read(codec, 0x15, 0,
13113 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13115 /* Check port replicator headphone socket */
13116 present |= snd_hda_codec_read(codec, 0x1a, 0,
13117 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13119 bits = present ? AMP_IN_MUTE(0) : 0;
13120 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13121 AMP_IN_MUTE(0), bits);
13122 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13123 AMP_IN_MUTE(0), bits);
13125 snd_hda_codec_write(codec, 0x20, 0,
13126 AC_VERB_SET_COEF_INDEX, 0x0c);
13127 snd_hda_codec_write(codec, 0x20, 0,
13128 AC_VERB_SET_PROC_COEF, 0x680);
13130 snd_hda_codec_write(codec, 0x20, 0,
13131 AC_VERB_SET_COEF_INDEX, 0x0c);
13132 snd_hda_codec_write(codec, 0x20, 0,
13133 AC_VERB_SET_PROC_COEF, 0x480);
13136 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13138 unsigned int present_laptop;
13139 unsigned int present_dock;
13141 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
13142 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13144 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
13145 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13147 /* Laptop mic port overrides dock mic port, design decision */
13149 snd_hda_codec_write(codec, 0x23, 0,
13150 AC_VERB_SET_CONNECT_SEL, 0x3);
13151 if (present_laptop)
13152 snd_hda_codec_write(codec, 0x23, 0,
13153 AC_VERB_SET_CONNECT_SEL, 0x0);
13154 if (!present_dock && !present_laptop)
13155 snd_hda_codec_write(codec, 0x23, 0,
13156 AC_VERB_SET_CONNECT_SEL, 0x1);
13159 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13162 switch (res >> 26) {
13163 case ALC880_HP_EVENT:
13164 alc269_quanta_fl1_speaker_automute(codec);
13166 case ALC880_MIC_EVENT:
13167 alc_mic_automute(codec);
13172 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13175 if ((res >> 26) == ALC880_HP_EVENT)
13176 alc269_lifebook_speaker_automute(codec);
13177 if ((res >> 26) == ALC880_MIC_EVENT)
13178 alc269_lifebook_mic_autoswitch(codec);
13181 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13183 struct alc_spec *spec = codec->spec;
13184 spec->ext_mic.pin = 0x18;
13185 spec->ext_mic.mux_idx = 0;
13186 spec->int_mic.pin = 0x19;
13187 spec->int_mic.mux_idx = 1;
13188 spec->auto_mic = 1;
13191 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13193 alc269_quanta_fl1_speaker_automute(codec);
13194 alc_mic_automute(codec);
13197 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13199 alc269_lifebook_speaker_automute(codec);
13200 alc269_lifebook_mic_autoswitch(codec);
13203 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13204 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13205 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13206 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13207 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13208 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13209 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13210 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13214 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13215 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13216 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13217 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13218 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13219 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13220 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13224 /* toggle speaker-output according to the hp-jack state */
13225 static void alc269_speaker_automute(struct hda_codec *codec)
13227 unsigned int present;
13228 unsigned char bits;
13230 present = snd_hda_codec_read(codec, 0x15, 0,
13231 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13232 bits = present ? AMP_IN_MUTE(0) : 0;
13233 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13234 AMP_IN_MUTE(0), bits);
13235 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13236 AMP_IN_MUTE(0), bits);
13239 /* unsolicited event for HP jack sensing */
13240 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13243 switch (res >> 26) {
13244 case ALC880_HP_EVENT:
13245 alc269_speaker_automute(codec);
13247 case ALC880_MIC_EVENT:
13248 alc_mic_automute(codec);
13253 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13255 struct alc_spec *spec = codec->spec;
13256 spec->ext_mic.pin = 0x18;
13257 spec->ext_mic.mux_idx = 0;
13258 spec->int_mic.pin = 0x12;
13259 spec->int_mic.mux_idx = 5;
13260 spec->auto_mic = 1;
13263 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13265 struct alc_spec *spec = codec->spec;
13266 spec->ext_mic.pin = 0x18;
13267 spec->ext_mic.mux_idx = 0;
13268 spec->int_mic.pin = 0x19;
13269 spec->int_mic.mux_idx = 1;
13270 spec->auto_mic = 1;
13273 static void alc269_eeepc_inithook(struct hda_codec *codec)
13275 alc269_speaker_automute(codec);
13276 alc_mic_automute(codec);
13280 * generic initialization of ADC, input mixers and output mixers
13282 static struct hda_verb alc269_init_verbs[] = {
13284 * Unmute ADC0 and set the default input to mic-in
13286 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13288 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13289 * analog-loopback mixer widget
13290 * Note: PASD motherboards uses the Line In 2 as the input for
13291 * front panel mic (mic 2)
13293 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13294 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13296 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13297 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13298 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13301 * Set up output mixers (0x0c - 0x0e)
13303 /* set vol=0 to output mixers */
13304 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13305 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13307 /* set up input amps for analog loopback */
13308 /* Amp Indices: DAC = 0, mixer = 1 */
13309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13310 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13311 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13312 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13313 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13314 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13316 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13317 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13318 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13319 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13320 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13321 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13322 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13324 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13325 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13326 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13327 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13328 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13329 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13330 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13332 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13333 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13335 /* FIXME: use matrix-type input source selection */
13336 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13337 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13338 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13339 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13340 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13341 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13344 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13345 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13349 #define alc269_auto_create_multi_out_ctls \
13350 alc268_auto_create_multi_out_ctls
13351 #define alc269_auto_create_input_ctls \
13352 alc268_auto_create_input_ctls
13354 #ifdef CONFIG_SND_HDA_POWER_SAVE
13355 #define alc269_loopbacks alc880_loopbacks
13358 /* pcm configuration: identical with ALC880 */
13359 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13360 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13361 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13362 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13364 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13368 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13369 /* NID is set in alc_build_pcms */
13371 .open = alc880_playback_pcm_open,
13372 .prepare = alc880_playback_pcm_prepare,
13373 .cleanup = alc880_playback_pcm_cleanup
13377 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13381 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13382 /* NID is set in alc_build_pcms */
13386 * BIOS auto configuration
13388 static int alc269_parse_auto_config(struct hda_codec *codec)
13390 struct alc_spec *spec = codec->spec;
13392 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13394 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13399 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13402 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13406 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13408 if (spec->autocfg.dig_outs)
13409 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13411 if (spec->kctls.list)
13412 add_mixer(spec, spec->kctls.list);
13414 add_verb(spec, alc269_init_verbs);
13415 spec->num_mux_defs = 1;
13416 spec->input_mux = &spec->private_imux[0];
13417 /* set default input source */
13418 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13419 0, AC_VERB_SET_CONNECT_SEL,
13420 spec->input_mux->items[0].index);
13422 err = alc_auto_add_mic_boost(codec);
13426 if (!spec->cap_mixer && !spec->no_analog)
13427 set_capture_mixer(codec);
13429 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13434 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13435 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13436 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13439 /* init callback for auto-configuration model -- overriding the default init */
13440 static void alc269_auto_init(struct hda_codec *codec)
13442 struct alc_spec *spec = codec->spec;
13443 alc269_auto_init_multi_out(codec);
13444 alc269_auto_init_hp_out(codec);
13445 alc269_auto_init_analog_input(codec);
13446 if (spec->unsol_event)
13447 alc_inithook(codec);
13451 * configuration and preset
13453 static const char *alc269_models[ALC269_MODEL_LAST] = {
13454 [ALC269_BASIC] = "basic",
13455 [ALC269_QUANTA_FL1] = "quanta",
13456 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13457 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13458 [ALC269_FUJITSU] = "fujitsu",
13459 [ALC269_LIFEBOOK] = "lifebook",
13460 [ALC269_AUTO] = "auto",
13463 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13464 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13465 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13466 ALC269_ASUS_EEEPC_P703),
13467 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13468 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13469 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13470 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13471 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13472 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13473 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13474 ALC269_ASUS_EEEPC_P901),
13475 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13476 ALC269_ASUS_EEEPC_P901),
13477 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13478 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13479 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13483 static struct alc_config_preset alc269_presets[] = {
13485 .mixers = { alc269_base_mixer },
13486 .init_verbs = { alc269_init_verbs },
13487 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13488 .dac_nids = alc269_dac_nids,
13490 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13491 .channel_mode = alc269_modes,
13492 .input_mux = &alc269_capture_source,
13494 [ALC269_QUANTA_FL1] = {
13495 .mixers = { alc269_quanta_fl1_mixer },
13496 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13497 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13498 .dac_nids = alc269_dac_nids,
13500 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13501 .channel_mode = alc269_modes,
13502 .input_mux = &alc269_capture_source,
13503 .unsol_event = alc269_quanta_fl1_unsol_event,
13504 .setup = alc269_quanta_fl1_setup,
13505 .init_hook = alc269_quanta_fl1_init_hook,
13507 [ALC269_ASUS_EEEPC_P703] = {
13508 .mixers = { alc269_eeepc_mixer },
13509 .cap_mixer = alc269_epc_capture_mixer,
13510 .init_verbs = { alc269_init_verbs,
13511 alc269_eeepc_amic_init_verbs },
13512 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13513 .dac_nids = alc269_dac_nids,
13515 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13516 .channel_mode = alc269_modes,
13517 .unsol_event = alc269_eeepc_unsol_event,
13518 .setup = alc269_eeepc_amic_setup,
13519 .init_hook = alc269_eeepc_inithook,
13521 [ALC269_ASUS_EEEPC_P901] = {
13522 .mixers = { alc269_eeepc_mixer },
13523 .cap_mixer = alc269_epc_capture_mixer,
13524 .init_verbs = { alc269_init_verbs,
13525 alc269_eeepc_dmic_init_verbs },
13526 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13527 .dac_nids = alc269_dac_nids,
13529 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13530 .channel_mode = alc269_modes,
13531 .unsol_event = alc269_eeepc_unsol_event,
13532 .setup = alc269_eeepc_dmic_setup,
13533 .init_hook = alc269_eeepc_inithook,
13535 [ALC269_FUJITSU] = {
13536 .mixers = { alc269_fujitsu_mixer },
13537 .cap_mixer = alc269_epc_capture_mixer,
13538 .init_verbs = { alc269_init_verbs,
13539 alc269_eeepc_dmic_init_verbs },
13540 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13541 .dac_nids = alc269_dac_nids,
13543 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13544 .channel_mode = alc269_modes,
13545 .unsol_event = alc269_eeepc_unsol_event,
13546 .setup = alc269_eeepc_dmic_setup,
13547 .init_hook = alc269_eeepc_inithook,
13549 [ALC269_LIFEBOOK] = {
13550 .mixers = { alc269_lifebook_mixer },
13551 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13552 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13553 .dac_nids = alc269_dac_nids,
13555 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13556 .channel_mode = alc269_modes,
13557 .input_mux = &alc269_capture_source,
13558 .unsol_event = alc269_lifebook_unsol_event,
13559 .init_hook = alc269_lifebook_init_hook,
13563 static int patch_alc269(struct hda_codec *codec)
13565 struct alc_spec *spec;
13569 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13573 codec->spec = spec;
13575 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13577 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13581 if (board_config < 0) {
13582 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13584 board_config = ALC269_AUTO;
13587 if (board_config == ALC269_AUTO) {
13588 /* automatic parse from the BIOS config */
13589 err = alc269_parse_auto_config(codec);
13595 "hda_codec: Cannot set up configuration "
13596 "from BIOS. Using base mode...\n");
13597 board_config = ALC269_BASIC;
13601 err = snd_hda_attach_beep_device(codec, 0x1);
13607 if (board_config != ALC269_AUTO)
13608 setup_preset(codec, &alc269_presets[board_config]);
13610 if (codec->subsystem_id == 0x17aa3bf8) {
13611 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13612 * fix the sample rate of analog I/O to 44.1kHz
13614 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13615 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13617 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13618 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13620 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13621 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13623 spec->adc_nids = alc269_adc_nids;
13624 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13625 spec->capsrc_nids = alc269_capsrc_nids;
13626 if (!spec->cap_mixer)
13627 set_capture_mixer(codec);
13628 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13630 spec->vmaster_nid = 0x02;
13632 codec->patch_ops = alc_patch_ops;
13633 if (board_config == ALC269_AUTO)
13634 spec->init_hook = alc269_auto_init;
13635 #ifdef CONFIG_SND_HDA_POWER_SAVE
13636 if (!spec->loopback.amplist)
13637 spec->loopback.amplist = alc269_loopbacks;
13639 codec->proc_widget_hook = print_realtek_coef;
13645 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13649 * set the path ways for 2 channel output
13650 * need to set the codec line out and mic 1 pin widgets to inputs
13652 static struct hda_verb alc861_threestack_ch2_init[] = {
13653 /* set pin widget 1Ah (line in) for input */
13654 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13655 /* set pin widget 18h (mic1/2) for input, for mic also enable
13658 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13660 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13662 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13663 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13669 * need to set the codec line out and mic 1 pin widgets to outputs
13671 static struct hda_verb alc861_threestack_ch6_init[] = {
13672 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13673 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13674 /* set pin widget 18h (mic1) for output (CLFE)*/
13675 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13677 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13678 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13680 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13682 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13683 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13688 static struct hda_channel_mode alc861_threestack_modes[2] = {
13689 { 2, alc861_threestack_ch2_init },
13690 { 6, alc861_threestack_ch6_init },
13692 /* Set mic1 as input and unmute the mixer */
13693 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13694 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13695 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13698 /* Set mic1 as output and mute mixer */
13699 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13700 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13701 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13705 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13706 { 2, alc861_uniwill_m31_ch2_init },
13707 { 4, alc861_uniwill_m31_ch4_init },
13710 /* Set mic1 and line-in as input and unmute the mixer */
13711 static struct hda_verb alc861_asus_ch2_init[] = {
13712 /* set pin widget 1Ah (line in) for input */
13713 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13714 /* set pin widget 18h (mic1/2) for input, for mic also enable
13717 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13719 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13721 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13722 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13726 /* Set mic1 nad line-in as output and mute mixer */
13727 static struct hda_verb alc861_asus_ch6_init[] = {
13728 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13729 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13730 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13731 /* set pin widget 18h (mic1) for output (CLFE)*/
13732 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13733 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13734 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13735 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13737 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13739 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13740 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13745 static struct hda_channel_mode alc861_asus_modes[2] = {
13746 { 2, alc861_asus_ch2_init },
13747 { 6, alc861_asus_ch6_init },
13752 static struct snd_kcontrol_new alc861_base_mixer[] = {
13753 /* output mixer control */
13754 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13755 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13756 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13757 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13758 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13760 /*Input mixer control */
13761 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13762 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13763 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13764 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13765 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13766 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13767 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13768 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13769 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13770 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13775 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13776 /* output mixer control */
13777 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13778 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13779 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13780 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13781 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13783 /* Input mixer control */
13784 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13785 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13786 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13787 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13788 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13789 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13790 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13791 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13792 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13793 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13796 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13797 .name = "Channel Mode",
13798 .info = alc_ch_mode_info,
13799 .get = alc_ch_mode_get,
13800 .put = alc_ch_mode_put,
13801 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13806 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13807 /* output mixer control */
13808 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13809 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13810 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13815 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13816 /* output mixer control */
13817 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13818 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13819 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13820 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13821 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13823 /* Input mixer control */
13824 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13825 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13826 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13827 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13828 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13829 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13830 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13831 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13832 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13833 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13836 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13837 .name = "Channel Mode",
13838 .info = alc_ch_mode_info,
13839 .get = alc_ch_mode_get,
13840 .put = alc_ch_mode_put,
13841 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13846 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13847 /* output mixer control */
13848 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13849 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13850 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13851 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13852 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13854 /* Input mixer control */
13855 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13856 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13857 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13858 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13859 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13860 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13861 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13862 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13863 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13864 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13867 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13868 .name = "Channel Mode",
13869 .info = alc_ch_mode_info,
13870 .get = alc_ch_mode_get,
13871 .put = alc_ch_mode_put,
13872 .private_value = ARRAY_SIZE(alc861_asus_modes),
13877 /* additional mixer */
13878 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13879 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13880 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13885 * generic initialization of ADC, input mixers and output mixers
13887 static struct hda_verb alc861_base_init_verbs[] = {
13889 * Unmute ADC0 and set the default input to mic-in
13891 /* port-A for surround (rear panel) */
13892 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13893 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13894 /* port-B for mic-in (rear panel) with vref */
13895 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13896 /* port-C for line-in (rear panel) */
13897 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13898 /* port-D for Front */
13899 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13900 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13901 /* port-E for HP out (front panel) */
13902 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13903 /* route front PCM to HP */
13904 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13905 /* port-F for mic-in (front panel) with vref */
13906 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13907 /* port-G for CLFE (rear panel) */
13908 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13909 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13910 /* port-H for side (rear panel) */
13911 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13912 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13914 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13915 /* route front mic to ADC1*/
13916 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13917 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13919 /* Unmute DAC0~3 & spdif out*/
13920 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13921 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13922 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13923 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13924 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13926 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13927 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13928 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13929 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13930 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13932 /* Unmute Stereo Mixer 15 */
13933 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13934 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13935 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13936 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13938 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13939 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13940 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13941 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13942 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13943 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13944 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13945 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13946 /* hp used DAC 3 (Front) */
13947 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13948 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13953 static struct hda_verb alc861_threestack_init_verbs[] = {
13955 * Unmute ADC0 and set the default input to mic-in
13957 /* port-A for surround (rear panel) */
13958 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13959 /* port-B for mic-in (rear panel) with vref */
13960 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13961 /* port-C for line-in (rear panel) */
13962 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13963 /* port-D for Front */
13964 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13965 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13966 /* port-E for HP out (front panel) */
13967 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13968 /* route front PCM to HP */
13969 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13970 /* port-F for mic-in (front panel) with vref */
13971 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13972 /* port-G for CLFE (rear panel) */
13973 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13974 /* port-H for side (rear panel) */
13975 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13977 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13978 /* route front mic to ADC1*/
13979 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13980 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13981 /* Unmute DAC0~3 & spdif out*/
13982 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13983 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13984 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13985 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13986 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13988 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13989 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13990 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13991 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13992 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13994 /* Unmute Stereo Mixer 15 */
13995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13996 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13997 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13998 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14000 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14001 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14002 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14003 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14004 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14005 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14006 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14007 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14008 /* hp used DAC 3 (Front) */
14009 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14010 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14014 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14016 * Unmute ADC0 and set the default input to mic-in
14018 /* port-A for surround (rear panel) */
14019 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14020 /* port-B for mic-in (rear panel) with vref */
14021 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14022 /* port-C for line-in (rear panel) */
14023 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14024 /* port-D for Front */
14025 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14026 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14027 /* port-E for HP out (front panel) */
14028 /* this has to be set to VREF80 */
14029 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14030 /* route front PCM to HP */
14031 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14032 /* port-F for mic-in (front panel) with vref */
14033 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14034 /* port-G for CLFE (rear panel) */
14035 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14036 /* port-H for side (rear panel) */
14037 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14039 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14040 /* route front mic to ADC1*/
14041 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14042 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14043 /* Unmute DAC0~3 & spdif out*/
14044 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14045 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14046 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14047 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14048 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14050 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14051 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14052 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14053 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14054 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14056 /* Unmute Stereo Mixer 15 */
14057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14058 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14059 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14060 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14062 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14063 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14064 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14065 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14066 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14067 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14068 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14069 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14070 /* hp used DAC 3 (Front) */
14071 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14072 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14076 static struct hda_verb alc861_asus_init_verbs[] = {
14078 * Unmute ADC0 and set the default input to mic-in
14080 /* port-A for surround (rear panel)
14081 * according to codec#0 this is the HP jack
14083 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14084 /* route front PCM to HP */
14085 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14086 /* port-B for mic-in (rear panel) with vref */
14087 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14088 /* port-C for line-in (rear panel) */
14089 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14090 /* port-D for Front */
14091 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14092 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14093 /* port-E for HP out (front panel) */
14094 /* this has to be set to VREF80 */
14095 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14096 /* route front PCM to HP */
14097 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14098 /* port-F for mic-in (front panel) with vref */
14099 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14100 /* port-G for CLFE (rear panel) */
14101 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14102 /* port-H for side (rear panel) */
14103 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14105 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14106 /* route front mic to ADC1*/
14107 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14108 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14109 /* Unmute DAC0~3 & spdif out*/
14110 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14111 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14112 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14113 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14114 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14115 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14116 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14117 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14118 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14119 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14121 /* Unmute Stereo Mixer 15 */
14122 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14123 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14124 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14125 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14127 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14128 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14129 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14130 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14131 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14132 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14133 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14134 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14135 /* hp used DAC 3 (Front) */
14136 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14137 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14141 /* additional init verbs for ASUS laptops */
14142 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14143 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14144 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14149 * generic initialization of ADC, input mixers and output mixers
14151 static struct hda_verb alc861_auto_init_verbs[] = {
14153 * Unmute ADC0 and set the default input to mic-in
14155 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14156 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14158 /* Unmute DAC0~3 & spdif out*/
14159 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14160 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14161 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14162 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14163 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14165 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14166 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14167 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14168 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14169 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14171 /* Unmute Stereo Mixer 15 */
14172 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14173 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14174 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14175 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14177 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14178 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14179 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14180 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14181 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14182 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14183 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14184 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14186 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14187 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14188 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14189 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14190 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14191 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14192 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14193 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14195 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14200 static struct hda_verb alc861_toshiba_init_verbs[] = {
14201 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14206 /* toggle speaker-output according to the hp-jack state */
14207 static void alc861_toshiba_automute(struct hda_codec *codec)
14209 unsigned int present;
14211 present = snd_hda_codec_read(codec, 0x0f, 0,
14212 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14213 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14214 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14215 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14216 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14219 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14222 if ((res >> 26) == ALC880_HP_EVENT)
14223 alc861_toshiba_automute(codec);
14226 /* pcm configuration: identical with ALC880 */
14227 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14228 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14229 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14230 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14233 #define ALC861_DIGOUT_NID 0x07
14235 static struct hda_channel_mode alc861_8ch_modes[1] = {
14239 static hda_nid_t alc861_dac_nids[4] = {
14240 /* front, surround, clfe, side */
14241 0x03, 0x06, 0x05, 0x04
14244 static hda_nid_t alc660_dac_nids[3] = {
14245 /* front, clfe, surround */
14249 static hda_nid_t alc861_adc_nids[1] = {
14254 static struct hda_input_mux alc861_capture_source = {
14258 { "Front Mic", 0x3 },
14265 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14267 struct alc_spec *spec = codec->spec;
14268 hda_nid_t mix, srcs[5];
14271 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14273 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14276 for (i = 0; i < num; i++) {
14278 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14279 if (type != AC_WID_AUD_OUT)
14281 for (j = 0; j < spec->multiout.num_dacs; j++)
14282 if (spec->multiout.dac_nids[j] == srcs[i])
14284 if (j >= spec->multiout.num_dacs)
14290 /* fill in the dac_nids table from the parsed pin configuration */
14291 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14292 const struct auto_pin_cfg *cfg)
14294 struct alc_spec *spec = codec->spec;
14296 hda_nid_t nid, dac;
14298 spec->multiout.dac_nids = spec->private_dac_nids;
14299 for (i = 0; i < cfg->line_outs; i++) {
14300 nid = cfg->line_out_pins[i];
14301 dac = alc861_look_for_dac(codec, nid);
14304 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14309 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14310 hda_nid_t nid, unsigned int chs)
14313 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
14314 return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name,
14315 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14318 /* add playback controls from the parsed DAC table */
14319 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14320 const struct auto_pin_cfg *cfg)
14322 struct alc_spec *spec = codec->spec;
14323 static const char *chname[4] = {
14324 "Front", "Surround", NULL /*CLFE*/, "Side"
14329 if (cfg->line_outs == 1) {
14330 const char *pfx = NULL;
14333 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14336 nid = spec->multiout.dac_nids[0];
14337 return alc861_create_out_sw(codec, pfx, nid, 3);
14341 for (i = 0; i < cfg->line_outs; i++) {
14342 nid = spec->multiout.dac_nids[i];
14347 err = alc861_create_out_sw(codec, "Center", nid, 1);
14350 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14354 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14362 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14364 struct alc_spec *spec = codec->spec;
14371 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14372 nid = alc861_look_for_dac(codec, pin);
14374 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14377 spec->multiout.hp_nid = nid;
14383 /* create playback/capture controls for input pins */
14384 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14385 const struct auto_pin_cfg *cfg)
14387 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14390 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14392 int pin_type, hda_nid_t dac)
14394 hda_nid_t mix, srcs[5];
14397 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14399 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14401 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14403 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14406 for (i = 0; i < num; i++) {
14408 if (srcs[i] == dac || srcs[i] == 0x15)
14409 mute = AMP_IN_UNMUTE(i);
14411 mute = AMP_IN_MUTE(i);
14412 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14417 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14419 struct alc_spec *spec = codec->spec;
14422 for (i = 0; i < spec->autocfg.line_outs; i++) {
14423 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14424 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14426 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14427 spec->multiout.dac_nids[i]);
14431 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14433 struct alc_spec *spec = codec->spec;
14435 if (spec->autocfg.hp_outs)
14436 alc861_auto_set_output_and_unmute(codec,
14437 spec->autocfg.hp_pins[0],
14439 spec->multiout.hp_nid);
14440 if (spec->autocfg.speaker_outs)
14441 alc861_auto_set_output_and_unmute(codec,
14442 spec->autocfg.speaker_pins[0],
14444 spec->multiout.dac_nids[0]);
14447 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14449 struct alc_spec *spec = codec->spec;
14452 for (i = 0; i < AUTO_PIN_LAST; i++) {
14453 hda_nid_t nid = spec->autocfg.input_pins[i];
14454 if (nid >= 0x0c && nid <= 0x11)
14455 alc_set_input_pin(codec, nid, i);
14459 /* parse the BIOS configuration and set up the alc_spec */
14460 /* return 1 if successful, 0 if the proper config is not found,
14461 * or a negative error code
14463 static int alc861_parse_auto_config(struct hda_codec *codec)
14465 struct alc_spec *spec = codec->spec;
14467 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14469 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14473 if (!spec->autocfg.line_outs)
14474 return 0; /* can't find valid BIOS pin config */
14476 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14479 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14482 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14485 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14489 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14491 if (spec->autocfg.dig_outs)
14492 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14494 if (spec->kctls.list)
14495 add_mixer(spec, spec->kctls.list);
14497 add_verb(spec, alc861_auto_init_verbs);
14499 spec->num_mux_defs = 1;
14500 spec->input_mux = &spec->private_imux[0];
14502 spec->adc_nids = alc861_adc_nids;
14503 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14504 set_capture_mixer(codec);
14506 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14511 /* additional initialization for auto-configuration model */
14512 static void alc861_auto_init(struct hda_codec *codec)
14514 struct alc_spec *spec = codec->spec;
14515 alc861_auto_init_multi_out(codec);
14516 alc861_auto_init_hp_out(codec);
14517 alc861_auto_init_analog_input(codec);
14518 if (spec->unsol_event)
14519 alc_inithook(codec);
14522 #ifdef CONFIG_SND_HDA_POWER_SAVE
14523 static struct hda_amp_list alc861_loopbacks[] = {
14524 { 0x15, HDA_INPUT, 0 },
14525 { 0x15, HDA_INPUT, 1 },
14526 { 0x15, HDA_INPUT, 2 },
14527 { 0x15, HDA_INPUT, 3 },
14534 * configuration and preset
14536 static const char *alc861_models[ALC861_MODEL_LAST] = {
14537 [ALC861_3ST] = "3stack",
14538 [ALC660_3ST] = "3stack-660",
14539 [ALC861_3ST_DIG] = "3stack-dig",
14540 [ALC861_6ST_DIG] = "6stack-dig",
14541 [ALC861_UNIWILL_M31] = "uniwill-m31",
14542 [ALC861_TOSHIBA] = "toshiba",
14543 [ALC861_ASUS] = "asus",
14544 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14545 [ALC861_AUTO] = "auto",
14548 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14549 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14550 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14551 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14552 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14553 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14554 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14555 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14556 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14557 * Any other models that need this preset?
14559 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14560 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14561 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14562 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14563 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14564 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14565 /* FIXME: the below seems conflict */
14566 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14567 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14568 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14572 static struct alc_config_preset alc861_presets[] = {
14574 .mixers = { alc861_3ST_mixer },
14575 .init_verbs = { alc861_threestack_init_verbs },
14576 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14577 .dac_nids = alc861_dac_nids,
14578 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14579 .channel_mode = alc861_threestack_modes,
14581 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14582 .adc_nids = alc861_adc_nids,
14583 .input_mux = &alc861_capture_source,
14585 [ALC861_3ST_DIG] = {
14586 .mixers = { alc861_base_mixer },
14587 .init_verbs = { alc861_threestack_init_verbs },
14588 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14589 .dac_nids = alc861_dac_nids,
14590 .dig_out_nid = ALC861_DIGOUT_NID,
14591 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14592 .channel_mode = alc861_threestack_modes,
14594 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14595 .adc_nids = alc861_adc_nids,
14596 .input_mux = &alc861_capture_source,
14598 [ALC861_6ST_DIG] = {
14599 .mixers = { alc861_base_mixer },
14600 .init_verbs = { alc861_base_init_verbs },
14601 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14602 .dac_nids = alc861_dac_nids,
14603 .dig_out_nid = ALC861_DIGOUT_NID,
14604 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14605 .channel_mode = alc861_8ch_modes,
14606 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14607 .adc_nids = alc861_adc_nids,
14608 .input_mux = &alc861_capture_source,
14611 .mixers = { alc861_3ST_mixer },
14612 .init_verbs = { alc861_threestack_init_verbs },
14613 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14614 .dac_nids = alc660_dac_nids,
14615 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14616 .channel_mode = alc861_threestack_modes,
14618 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14619 .adc_nids = alc861_adc_nids,
14620 .input_mux = &alc861_capture_source,
14622 [ALC861_UNIWILL_M31] = {
14623 .mixers = { alc861_uniwill_m31_mixer },
14624 .init_verbs = { alc861_uniwill_m31_init_verbs },
14625 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14626 .dac_nids = alc861_dac_nids,
14627 .dig_out_nid = ALC861_DIGOUT_NID,
14628 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14629 .channel_mode = alc861_uniwill_m31_modes,
14631 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14632 .adc_nids = alc861_adc_nids,
14633 .input_mux = &alc861_capture_source,
14635 [ALC861_TOSHIBA] = {
14636 .mixers = { alc861_toshiba_mixer },
14637 .init_verbs = { alc861_base_init_verbs,
14638 alc861_toshiba_init_verbs },
14639 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14640 .dac_nids = alc861_dac_nids,
14641 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14642 .channel_mode = alc883_3ST_2ch_modes,
14643 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14644 .adc_nids = alc861_adc_nids,
14645 .input_mux = &alc861_capture_source,
14646 .unsol_event = alc861_toshiba_unsol_event,
14647 .init_hook = alc861_toshiba_automute,
14650 .mixers = { alc861_asus_mixer },
14651 .init_verbs = { alc861_asus_init_verbs },
14652 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14653 .dac_nids = alc861_dac_nids,
14654 .dig_out_nid = ALC861_DIGOUT_NID,
14655 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14656 .channel_mode = alc861_asus_modes,
14659 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14660 .adc_nids = alc861_adc_nids,
14661 .input_mux = &alc861_capture_source,
14663 [ALC861_ASUS_LAPTOP] = {
14664 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14665 .init_verbs = { alc861_asus_init_verbs,
14666 alc861_asus_laptop_init_verbs },
14667 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14668 .dac_nids = alc861_dac_nids,
14669 .dig_out_nid = ALC861_DIGOUT_NID,
14670 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14671 .channel_mode = alc883_3ST_2ch_modes,
14673 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14674 .adc_nids = alc861_adc_nids,
14675 .input_mux = &alc861_capture_source,
14680 static int patch_alc861(struct hda_codec *codec)
14682 struct alc_spec *spec;
14686 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14690 codec->spec = spec;
14692 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14696 if (board_config < 0) {
14697 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14699 board_config = ALC861_AUTO;
14702 if (board_config == ALC861_AUTO) {
14703 /* automatic parse from the BIOS config */
14704 err = alc861_parse_auto_config(codec);
14710 "hda_codec: Cannot set up configuration "
14711 "from BIOS. Using base mode...\n");
14712 board_config = ALC861_3ST_DIG;
14716 err = snd_hda_attach_beep_device(codec, 0x23);
14722 if (board_config != ALC861_AUTO)
14723 setup_preset(codec, &alc861_presets[board_config]);
14725 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14726 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14728 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14729 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14731 if (!spec->cap_mixer)
14732 set_capture_mixer(codec);
14733 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14735 spec->vmaster_nid = 0x03;
14737 codec->patch_ops = alc_patch_ops;
14738 if (board_config == ALC861_AUTO)
14739 spec->init_hook = alc861_auto_init;
14740 #ifdef CONFIG_SND_HDA_POWER_SAVE
14741 if (!spec->loopback.amplist)
14742 spec->loopback.amplist = alc861_loopbacks;
14744 codec->proc_widget_hook = print_realtek_coef;
14750 * ALC861-VD support
14754 * In addition, an independent DAC
14756 #define ALC861VD_DIGOUT_NID 0x06
14758 static hda_nid_t alc861vd_dac_nids[4] = {
14759 /* front, surr, clfe, side surr */
14760 0x02, 0x03, 0x04, 0x05
14763 /* dac_nids for ALC660vd are in a different order - according to
14764 * Realtek's driver.
14765 * This should probably result in a different mixer for 6stack models
14766 * of ALC660vd codecs, but for now there is only 3stack mixer
14767 * - and it is the same as in 861vd.
14768 * adc_nids in ALC660vd are (is) the same as in 861vd
14770 static hda_nid_t alc660vd_dac_nids[3] = {
14771 /* front, rear, clfe, rear_surr */
14775 static hda_nid_t alc861vd_adc_nids[1] = {
14780 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14783 /* FIXME: should be a matrix-type input source selection */
14784 static struct hda_input_mux alc861vd_capture_source = {
14788 { "Front Mic", 0x1 },
14794 static struct hda_input_mux alc861vd_dallas_capture_source = {
14797 { "Ext Mic", 0x0 },
14798 { "Int Mic", 0x1 },
14802 static struct hda_input_mux alc861vd_hp_capture_source = {
14805 { "Front Mic", 0x0 },
14806 { "ATAPI Mic", 0x1 },
14813 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14820 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14821 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14822 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14823 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14824 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14831 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14832 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14833 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14834 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14835 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14839 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14840 { 6, alc861vd_6stack_ch6_init },
14841 { 8, alc861vd_6stack_ch8_init },
14844 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14846 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14847 .name = "Channel Mode",
14848 .info = alc_ch_mode_info,
14849 .get = alc_ch_mode_get,
14850 .put = alc_ch_mode_put,
14855 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14856 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14858 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14859 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14860 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14862 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14863 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14865 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14867 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14869 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14870 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14872 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14873 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14875 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14877 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14881 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14882 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14883 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14885 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14886 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14888 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14889 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14894 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14895 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14896 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14898 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14900 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14901 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14902 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14904 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14905 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14906 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14908 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14909 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14911 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14912 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14917 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14918 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14919 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14920 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14922 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14924 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14925 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14926 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14928 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14929 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14930 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14932 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14933 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14938 /* Pin assignment: Speaker=0x14, HP = 0x15,
14939 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14941 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14942 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14943 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14944 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14945 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14946 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14947 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14948 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14949 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14950 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14951 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14955 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14956 * Front Mic=0x18, ATAPI Mic = 0x19,
14958 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14959 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14960 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14961 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14962 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14963 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14964 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14965 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14966 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14972 * generic initialization of ADC, input mixers and output mixers
14974 static struct hda_verb alc861vd_volume_init_verbs[] = {
14976 * Unmute ADC0 and set the default input to mic-in
14978 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14979 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14981 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14982 * the analog-loopback mixer widget
14984 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14985 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14986 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14987 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14988 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14989 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14991 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14992 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14993 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14994 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14995 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14998 * Set up output mixers (0x02 - 0x05)
15000 /* set vol=0 to output mixers */
15001 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15002 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15003 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15004 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15006 /* set up input amps for analog loopback */
15007 /* Amp Indices: DAC = 0, mixer = 1 */
15008 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15009 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15010 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15011 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15012 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15013 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15014 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15015 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15021 * 3-stack pin configuration:
15022 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15024 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15026 * Set pin mode and muting
15028 /* set front pin widgets 0x14 for output */
15029 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15030 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15031 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15033 /* Mic (rear) pin: input vref at 80% */
15034 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15035 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15036 /* Front Mic pin: input vref at 80% */
15037 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15038 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15039 /* Line In pin: input */
15040 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15041 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15042 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15043 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15044 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15045 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15046 /* CD pin widget for input */
15047 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15053 * 6-stack pin configuration:
15055 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15057 * Set pin mode and muting
15059 /* set front pin widgets 0x14 for output */
15060 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15061 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15062 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15064 /* Rear Pin: output 1 (0x0d) */
15065 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15066 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15067 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15068 /* CLFE Pin: output 2 (0x0e) */
15069 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15070 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15071 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15072 /* Side Pin: output 3 (0x0f) */
15073 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15074 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15075 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15077 /* Mic (rear) pin: input vref at 80% */
15078 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15079 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15080 /* Front Mic pin: input vref at 80% */
15081 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15082 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15083 /* Line In pin: input */
15084 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15085 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15086 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15087 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15088 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15089 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15090 /* CD pin widget for input */
15091 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15096 static struct hda_verb alc861vd_eapd_verbs[] = {
15097 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15101 static struct hda_verb alc660vd_eapd_verbs[] = {
15102 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15103 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15107 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15108 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15109 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15110 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15111 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15112 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15116 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15118 unsigned int present;
15119 unsigned char bits;
15121 present = snd_hda_codec_read(codec, 0x18, 0,
15122 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15123 bits = present ? HDA_AMP_MUTE : 0;
15124 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15125 HDA_AMP_MUTE, bits);
15128 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15130 struct alc_spec *spec = codec->spec;
15131 spec->autocfg.hp_pins[0] = 0x1b;
15132 spec->autocfg.speaker_pins[0] = 0x14;
15135 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15137 alc_automute_amp(codec);
15138 alc861vd_lenovo_mic_automute(codec);
15141 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15144 switch (res >> 26) {
15145 case ALC880_MIC_EVENT:
15146 alc861vd_lenovo_mic_automute(codec);
15149 alc_automute_amp_unsol_event(codec, res);
15154 static struct hda_verb alc861vd_dallas_verbs[] = {
15155 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15156 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15157 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15158 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15160 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15161 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15162 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15163 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15164 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15165 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15166 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15167 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15169 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15170 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15171 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15172 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15173 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15174 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15175 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15176 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15178 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15179 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15180 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15181 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15182 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15183 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15184 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15185 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15187 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15188 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15189 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15190 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15192 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15193 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15194 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15199 /* toggle speaker-output according to the hp-jack state */
15200 static void alc861vd_dallas_setup(struct hda_codec *codec)
15202 struct alc_spec *spec = codec->spec;
15204 spec->autocfg.hp_pins[0] = 0x15;
15205 spec->autocfg.speaker_pins[0] = 0x14;
15208 #ifdef CONFIG_SND_HDA_POWER_SAVE
15209 #define alc861vd_loopbacks alc880_loopbacks
15212 /* pcm configuration: identical with ALC880 */
15213 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15214 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15215 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15216 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15219 * configuration and preset
15221 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15222 [ALC660VD_3ST] = "3stack-660",
15223 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15224 [ALC660VD_ASUS_V1S] = "asus-v1s",
15225 [ALC861VD_3ST] = "3stack",
15226 [ALC861VD_3ST_DIG] = "3stack-digout",
15227 [ALC861VD_6ST_DIG] = "6stack-digout",
15228 [ALC861VD_LENOVO] = "lenovo",
15229 [ALC861VD_DALLAS] = "dallas",
15230 [ALC861VD_HP] = "hp",
15231 [ALC861VD_AUTO] = "auto",
15234 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15235 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15236 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15237 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15238 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15239 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15240 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15241 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15242 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15243 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15244 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15245 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15246 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15247 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15248 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15249 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15253 static struct alc_config_preset alc861vd_presets[] = {
15255 .mixers = { alc861vd_3st_mixer },
15256 .init_verbs = { alc861vd_volume_init_verbs,
15257 alc861vd_3stack_init_verbs },
15258 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15259 .dac_nids = alc660vd_dac_nids,
15260 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15261 .channel_mode = alc861vd_3stack_2ch_modes,
15262 .input_mux = &alc861vd_capture_source,
15264 [ALC660VD_3ST_DIG] = {
15265 .mixers = { alc861vd_3st_mixer },
15266 .init_verbs = { alc861vd_volume_init_verbs,
15267 alc861vd_3stack_init_verbs },
15268 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15269 .dac_nids = alc660vd_dac_nids,
15270 .dig_out_nid = ALC861VD_DIGOUT_NID,
15271 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15272 .channel_mode = alc861vd_3stack_2ch_modes,
15273 .input_mux = &alc861vd_capture_source,
15276 .mixers = { alc861vd_3st_mixer },
15277 .init_verbs = { alc861vd_volume_init_verbs,
15278 alc861vd_3stack_init_verbs },
15279 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15280 .dac_nids = alc861vd_dac_nids,
15281 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15282 .channel_mode = alc861vd_3stack_2ch_modes,
15283 .input_mux = &alc861vd_capture_source,
15285 [ALC861VD_3ST_DIG] = {
15286 .mixers = { alc861vd_3st_mixer },
15287 .init_verbs = { alc861vd_volume_init_verbs,
15288 alc861vd_3stack_init_verbs },
15289 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15290 .dac_nids = alc861vd_dac_nids,
15291 .dig_out_nid = ALC861VD_DIGOUT_NID,
15292 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15293 .channel_mode = alc861vd_3stack_2ch_modes,
15294 .input_mux = &alc861vd_capture_source,
15296 [ALC861VD_6ST_DIG] = {
15297 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15298 .init_verbs = { alc861vd_volume_init_verbs,
15299 alc861vd_6stack_init_verbs },
15300 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15301 .dac_nids = alc861vd_dac_nids,
15302 .dig_out_nid = ALC861VD_DIGOUT_NID,
15303 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15304 .channel_mode = alc861vd_6stack_modes,
15305 .input_mux = &alc861vd_capture_source,
15307 [ALC861VD_LENOVO] = {
15308 .mixers = { alc861vd_lenovo_mixer },
15309 .init_verbs = { alc861vd_volume_init_verbs,
15310 alc861vd_3stack_init_verbs,
15311 alc861vd_eapd_verbs,
15312 alc861vd_lenovo_unsol_verbs },
15313 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15314 .dac_nids = alc660vd_dac_nids,
15315 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15316 .channel_mode = alc861vd_3stack_2ch_modes,
15317 .input_mux = &alc861vd_capture_source,
15318 .unsol_event = alc861vd_lenovo_unsol_event,
15319 .setup = alc861vd_lenovo_setup,
15320 .init_hook = alc861vd_lenovo_init_hook,
15322 [ALC861VD_DALLAS] = {
15323 .mixers = { alc861vd_dallas_mixer },
15324 .init_verbs = { alc861vd_dallas_verbs },
15325 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15326 .dac_nids = alc861vd_dac_nids,
15327 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15328 .channel_mode = alc861vd_3stack_2ch_modes,
15329 .input_mux = &alc861vd_dallas_capture_source,
15330 .unsol_event = alc_automute_amp_unsol_event,
15331 .setup = alc861vd_dallas_setup,
15332 .init_hook = alc_automute_amp,
15335 .mixers = { alc861vd_hp_mixer },
15336 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15337 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15338 .dac_nids = alc861vd_dac_nids,
15339 .dig_out_nid = ALC861VD_DIGOUT_NID,
15340 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15341 .channel_mode = alc861vd_3stack_2ch_modes,
15342 .input_mux = &alc861vd_hp_capture_source,
15343 .unsol_event = alc_automute_amp_unsol_event,
15344 .setup = alc861vd_dallas_setup,
15345 .init_hook = alc_automute_amp,
15347 [ALC660VD_ASUS_V1S] = {
15348 .mixers = { alc861vd_lenovo_mixer },
15349 .init_verbs = { alc861vd_volume_init_verbs,
15350 alc861vd_3stack_init_verbs,
15351 alc861vd_eapd_verbs,
15352 alc861vd_lenovo_unsol_verbs },
15353 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15354 .dac_nids = alc660vd_dac_nids,
15355 .dig_out_nid = ALC861VD_DIGOUT_NID,
15356 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15357 .channel_mode = alc861vd_3stack_2ch_modes,
15358 .input_mux = &alc861vd_capture_source,
15359 .unsol_event = alc861vd_lenovo_unsol_event,
15360 .setup = alc861vd_lenovo_setup,
15361 .init_hook = alc861vd_lenovo_init_hook,
15366 * BIOS auto configuration
15368 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15369 const struct auto_pin_cfg *cfg)
15371 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0);
15375 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15376 hda_nid_t nid, int pin_type, int dac_idx)
15378 alc_set_pin_output(codec, nid, pin_type);
15381 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15383 struct alc_spec *spec = codec->spec;
15386 for (i = 0; i <= HDA_SIDE; i++) {
15387 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15388 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15390 alc861vd_auto_set_output_and_unmute(codec, nid,
15396 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15398 struct alc_spec *spec = codec->spec;
15401 pin = spec->autocfg.hp_pins[0];
15402 if (pin) /* connect to front and use dac 0 */
15403 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15404 pin = spec->autocfg.speaker_pins[0];
15406 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15409 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15411 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15413 struct alc_spec *spec = codec->spec;
15416 for (i = 0; i < AUTO_PIN_LAST; i++) {
15417 hda_nid_t nid = spec->autocfg.input_pins[i];
15418 if (alc_is_input_pin(codec, nid)) {
15419 alc_set_input_pin(codec, nid, i);
15420 if (nid != ALC861VD_PIN_CD_NID &&
15421 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15422 snd_hda_codec_write(codec, nid, 0,
15423 AC_VERB_SET_AMP_GAIN_MUTE,
15429 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15431 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15432 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15434 /* add playback controls from the parsed DAC table */
15435 /* Based on ALC880 version. But ALC861VD has separate,
15436 * different NIDs for mute/unmute switch and volume control */
15437 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15438 const struct auto_pin_cfg *cfg)
15441 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15442 hda_nid_t nid_v, nid_s;
15445 for (i = 0; i < cfg->line_outs; i++) {
15446 if (!spec->multiout.dac_nids[i])
15448 nid_v = alc861vd_idx_to_mixer_vol(
15450 spec->multiout.dac_nids[i]));
15451 nid_s = alc861vd_idx_to_mixer_switch(
15453 spec->multiout.dac_nids[i]));
15457 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15458 "Center Playback Volume",
15459 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15463 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15464 "LFE Playback Volume",
15465 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15469 err = add_control(spec, ALC_CTL_BIND_MUTE,
15470 "Center Playback Switch",
15471 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15475 err = add_control(spec, ALC_CTL_BIND_MUTE,
15476 "LFE Playback Switch",
15477 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15483 if (cfg->line_outs == 1 &&
15484 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15491 sprintf(name, "%s Playback Volume", pfx);
15492 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15493 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15497 if (cfg->line_outs == 1 &&
15498 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15500 sprintf(name, "%s Playback Switch", pfx);
15501 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15502 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15511 /* add playback controls for speaker and HP outputs */
15512 /* Based on ALC880 version. But ALC861VD has separate,
15513 * different NIDs for mute/unmute switch and volume control */
15514 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15515 hda_nid_t pin, const char *pfx)
15517 hda_nid_t nid_v, nid_s;
15524 if (alc880_is_fixed_pin(pin)) {
15525 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15526 /* specify the DAC as the extra output */
15527 if (!spec->multiout.hp_nid)
15528 spec->multiout.hp_nid = nid_v;
15530 spec->multiout.extra_out_nid[0] = nid_v;
15531 /* control HP volume/switch on the output mixer amp */
15532 nid_v = alc861vd_idx_to_mixer_vol(
15533 alc880_fixed_pin_idx(pin));
15534 nid_s = alc861vd_idx_to_mixer_switch(
15535 alc880_fixed_pin_idx(pin));
15537 sprintf(name, "%s Playback Volume", pfx);
15538 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15539 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15542 sprintf(name, "%s Playback Switch", pfx);
15543 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15544 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15547 } else if (alc880_is_multi_pin(pin)) {
15548 /* set manual connection */
15549 /* we have only a switch on HP-out PIN */
15550 sprintf(name, "%s Playback Switch", pfx);
15551 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15552 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15559 /* parse the BIOS configuration and set up the alc_spec
15560 * return 1 if successful, 0 if the proper config is not found,
15561 * or a negative error code
15562 * Based on ALC880 version - had to change it to override
15563 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15564 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15566 struct alc_spec *spec = codec->spec;
15568 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15570 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15574 if (!spec->autocfg.line_outs)
15575 return 0; /* can't find valid BIOS pin config */
15577 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15580 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15583 err = alc861vd_auto_create_extra_out(spec,
15584 spec->autocfg.speaker_pins[0],
15588 err = alc861vd_auto_create_extra_out(spec,
15589 spec->autocfg.hp_pins[0],
15593 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15597 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15599 if (spec->autocfg.dig_outs)
15600 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15602 if (spec->kctls.list)
15603 add_mixer(spec, spec->kctls.list);
15605 add_verb(spec, alc861vd_volume_init_verbs);
15607 spec->num_mux_defs = 1;
15608 spec->input_mux = &spec->private_imux[0];
15610 err = alc_auto_add_mic_boost(codec);
15614 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15619 /* additional initialization for auto-configuration model */
15620 static void alc861vd_auto_init(struct hda_codec *codec)
15622 struct alc_spec *spec = codec->spec;
15623 alc861vd_auto_init_multi_out(codec);
15624 alc861vd_auto_init_hp_out(codec);
15625 alc861vd_auto_init_analog_input(codec);
15626 alc861vd_auto_init_input_src(codec);
15627 if (spec->unsol_event)
15628 alc_inithook(codec);
15632 ALC660VD_FIX_ASUS_GPIO1
15636 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15637 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15638 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15639 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15643 static const struct alc_fixup alc861vd_fixups[] = {
15644 [ALC660VD_FIX_ASUS_GPIO1] = {
15645 .verbs = alc660vd_fix_asus_gpio1_verbs,
15649 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15650 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15654 static int patch_alc861vd(struct hda_codec *codec)
15656 struct alc_spec *spec;
15657 int err, board_config;
15659 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15663 codec->spec = spec;
15665 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15669 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15670 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15672 board_config = ALC861VD_AUTO;
15675 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15677 if (board_config == ALC861VD_AUTO) {
15678 /* automatic parse from the BIOS config */
15679 err = alc861vd_parse_auto_config(codec);
15685 "hda_codec: Cannot set up configuration "
15686 "from BIOS. Using base mode...\n");
15687 board_config = ALC861VD_3ST;
15691 err = snd_hda_attach_beep_device(codec, 0x23);
15697 if (board_config != ALC861VD_AUTO)
15698 setup_preset(codec, &alc861vd_presets[board_config]);
15700 if (codec->vendor_id == 0x10ec0660) {
15701 /* always turn on EAPD */
15702 add_verb(spec, alc660vd_eapd_verbs);
15705 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15706 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15708 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15709 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15711 if (!spec->adc_nids) {
15712 spec->adc_nids = alc861vd_adc_nids;
15713 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15715 if (!spec->capsrc_nids)
15716 spec->capsrc_nids = alc861vd_capsrc_nids;
15718 set_capture_mixer(codec);
15719 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15721 spec->vmaster_nid = 0x02;
15723 codec->patch_ops = alc_patch_ops;
15725 if (board_config == ALC861VD_AUTO)
15726 spec->init_hook = alc861vd_auto_init;
15727 #ifdef CONFIG_SND_HDA_POWER_SAVE
15728 if (!spec->loopback.amplist)
15729 spec->loopback.amplist = alc861vd_loopbacks;
15731 codec->proc_widget_hook = print_realtek_coef;
15739 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15740 * configuration. Each pin widget can choose any input DACs and a mixer.
15741 * Each ADC is connected from a mixer of all inputs. This makes possible
15742 * 6-channel independent captures.
15744 * In addition, an independent DAC for the multi-playback (not used in this
15747 #define ALC662_DIGOUT_NID 0x06
15748 #define ALC662_DIGIN_NID 0x0a
15750 static hda_nid_t alc662_dac_nids[4] = {
15751 /* front, rear, clfe, rear_surr */
15755 static hda_nid_t alc272_dac_nids[2] = {
15759 static hda_nid_t alc662_adc_nids[2] = {
15764 static hda_nid_t alc272_adc_nids[1] = {
15769 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15770 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15774 /* FIXME: should be a matrix-type input source selection */
15775 static struct hda_input_mux alc662_capture_source = {
15779 { "Front Mic", 0x1 },
15785 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15793 static struct hda_input_mux alc663_capture_source = {
15797 { "Front Mic", 0x1 },
15802 #if 0 /* set to 1 for testing other input sources below */
15803 static struct hda_input_mux alc272_nc10_capture_source = {
15806 { "Autoselect Mic", 0x0 },
15807 { "Internal Mic", 0x1 },
15808 { "In-0x02", 0x2 },
15809 { "In-0x03", 0x3 },
15810 { "In-0x04", 0x4 },
15811 { "In-0x05", 0x5 },
15812 { "In-0x06", 0x6 },
15813 { "In-0x07", 0x7 },
15814 { "In-0x08", 0x8 },
15815 { "In-0x09", 0x9 },
15816 { "In-0x0a", 0x0a },
15817 { "In-0x0b", 0x0b },
15818 { "In-0x0c", 0x0c },
15819 { "In-0x0d", 0x0d },
15820 { "In-0x0e", 0x0e },
15821 { "In-0x0f", 0x0f },
15829 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15836 static struct hda_verb alc662_3ST_ch2_init[] = {
15837 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15838 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15839 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15840 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15847 static struct hda_verb alc662_3ST_ch6_init[] = {
15848 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15849 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15850 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15851 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15852 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15853 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15857 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15858 { 2, alc662_3ST_ch2_init },
15859 { 6, alc662_3ST_ch6_init },
15865 static struct hda_verb alc662_sixstack_ch6_init[] = {
15866 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15867 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15868 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15875 static struct hda_verb alc662_sixstack_ch8_init[] = {
15876 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15877 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15878 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15882 static struct hda_channel_mode alc662_5stack_modes[2] = {
15883 { 2, alc662_sixstack_ch6_init },
15884 { 6, alc662_sixstack_ch8_init },
15887 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15888 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15891 static struct snd_kcontrol_new alc662_base_mixer[] = {
15892 /* output mixer control */
15893 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15894 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15895 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15896 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15897 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15898 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15899 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15900 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15901 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15903 /*Input mixer control */
15904 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15905 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15906 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15907 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15908 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15909 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15910 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15911 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15915 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15916 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15917 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15918 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15919 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15920 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15921 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15922 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15923 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15924 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15925 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15926 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15930 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15931 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15932 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15933 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15934 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15935 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15936 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15937 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15938 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15939 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15940 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15941 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15942 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15943 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15944 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15945 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15946 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15947 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15951 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15952 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15953 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15954 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15955 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15956 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15957 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15958 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15959 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15960 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15964 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15965 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15966 ALC262_HIPPO_MASTER_SWITCH,
15968 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15969 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15970 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15972 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15973 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15974 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15978 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15979 ALC262_HIPPO_MASTER_SWITCH,
15980 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15981 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15982 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15983 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15984 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15985 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15986 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15987 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15988 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15992 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15993 .ops = &snd_hda_bind_vol,
15995 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15996 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16001 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16002 .ops = &snd_hda_bind_sw,
16004 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16005 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16010 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16011 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16012 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16013 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16014 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16018 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16019 .ops = &snd_hda_bind_sw,
16021 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16022 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16023 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16028 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16029 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16030 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16032 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16033 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16034 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16039 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16040 .ops = &snd_hda_bind_sw,
16042 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16043 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16044 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16049 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16050 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16051 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16053 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16054 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16055 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16059 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16060 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16061 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16062 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16063 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16064 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16065 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16066 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16070 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16071 .ops = &snd_hda_bind_vol,
16073 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16074 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16079 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16080 .ops = &snd_hda_bind_sw,
16082 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16083 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16088 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16089 HDA_BIND_VOL("Master Playback Volume",
16090 &alc663_asus_two_bind_master_vol),
16091 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16092 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16093 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16099 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16100 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16101 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16102 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16103 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16104 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16105 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16109 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16110 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16111 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16112 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16113 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16114 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16116 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16117 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16118 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16119 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16123 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16124 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16125 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16126 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16129 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16130 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16131 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16132 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16133 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16137 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16139 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16140 .name = "Channel Mode",
16141 .info = alc_ch_mode_info,
16142 .get = alc_ch_mode_get,
16143 .put = alc_ch_mode_put,
16148 static struct hda_verb alc662_init_verbs[] = {
16149 /* ADC: mute amp left and right */
16150 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16151 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16152 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16154 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16155 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16156 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16157 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16158 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16160 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16161 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16162 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16163 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16164 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16165 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16167 /* Front Pin: output 0 (0x0c) */
16168 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16169 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16171 /* Rear Pin: output 1 (0x0d) */
16172 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16173 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16175 /* CLFE Pin: output 2 (0x0e) */
16176 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16177 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16179 /* Mic (rear) pin: input vref at 80% */
16180 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16181 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16182 /* Front Mic pin: input vref at 80% */
16183 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16184 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16185 /* Line In pin: input */
16186 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16187 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16188 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16189 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16190 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16191 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16192 /* CD pin widget for input */
16193 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16195 /* FIXME: use matrix-type input source selection */
16196 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16198 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16199 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16201 /* always trun on EAPD */
16202 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16203 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16208 static struct hda_verb alc662_sue_init_verbs[] = {
16209 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16210 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16214 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16215 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16216 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16220 /* Set Unsolicited Event*/
16221 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16222 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16223 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16228 * generic initialization of ADC, input mixers and output mixers
16230 static struct hda_verb alc662_auto_init_verbs[] = {
16232 * Unmute ADC and set the default input to mic-in
16234 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16235 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16237 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16239 * Note: PASD motherboards uses the Line In 2 as the input for front
16240 * panel mic (mic 2)
16242 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16243 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16244 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16245 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16246 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16247 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16250 * Set up output mixers (0x0c - 0x0f)
16252 /* set vol=0 to output mixers */
16253 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16254 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16255 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16257 /* set up input amps for analog loopback */
16258 /* Amp Indices: DAC = 0, mixer = 1 */
16259 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16260 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16261 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16262 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16263 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16264 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16267 /* FIXME: use matrix-type input source selection */
16268 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16270 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16271 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16275 /* additional verbs for ALC663 */
16276 static struct hda_verb alc663_auto_init_verbs[] = {
16277 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16278 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16282 static struct hda_verb alc663_m51va_init_verbs[] = {
16283 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16284 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16285 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16286 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16287 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16289 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16290 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16291 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16295 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16296 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16297 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16298 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16299 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16300 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16301 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16302 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16306 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16307 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16308 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16309 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16310 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16313 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16314 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16318 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16319 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16320 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16321 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16324 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16325 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16329 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16330 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16331 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16332 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16333 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16334 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16335 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16336 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16337 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16338 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16339 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16340 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16341 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16345 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16346 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16347 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16348 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16349 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16350 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16351 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16352 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16353 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16354 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16355 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16356 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16357 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16361 static struct hda_verb alc663_g71v_init_verbs[] = {
16362 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16363 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16364 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16366 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16367 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16368 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16370 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16371 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16372 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16376 static struct hda_verb alc663_g50v_init_verbs[] = {
16377 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16378 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16379 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16381 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16382 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16386 static struct hda_verb alc662_ecs_init_verbs[] = {
16387 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16388 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16389 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16390 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16394 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16395 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16396 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16397 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16398 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16399 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16400 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16401 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16404 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16405 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16409 static struct hda_verb alc272_dell_init_verbs[] = {
16410 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16411 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16412 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16413 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16414 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16415 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16416 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16417 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16418 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16419 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16420 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16424 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16425 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16426 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16430 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16431 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16432 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16436 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16438 unsigned int present;
16439 unsigned char bits;
16441 present = snd_hda_codec_read(codec, 0x14, 0,
16442 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16443 bits = present ? HDA_AMP_MUTE : 0;
16444 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16445 HDA_AMP_MUTE, bits);
16448 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16450 unsigned int present;
16451 unsigned char bits;
16453 present = snd_hda_codec_read(codec, 0x1b, 0,
16454 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16455 bits = present ? HDA_AMP_MUTE : 0;
16456 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16457 HDA_AMP_MUTE, bits);
16458 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16459 HDA_AMP_MUTE, bits);
16462 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16465 if ((res >> 26) == ALC880_HP_EVENT)
16466 alc662_lenovo_101e_all_automute(codec);
16467 if ((res >> 26) == ALC880_FRONT_EVENT)
16468 alc662_lenovo_101e_ispeaker_automute(codec);
16471 /* unsolicited event for HP jack sensing */
16472 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16475 if ((res >> 26) == ALC880_MIC_EVENT)
16476 alc_mic_automute(codec);
16478 alc262_hippo_unsol_event(codec, res);
16481 static void alc662_eeepc_setup(struct hda_codec *codec)
16483 struct alc_spec *spec = codec->spec;
16485 alc262_hippo1_setup(codec);
16486 spec->ext_mic.pin = 0x18;
16487 spec->ext_mic.mux_idx = 0;
16488 spec->int_mic.pin = 0x19;
16489 spec->int_mic.mux_idx = 1;
16490 spec->auto_mic = 1;
16493 static void alc662_eeepc_inithook(struct hda_codec *codec)
16495 alc262_hippo_automute(codec);
16496 alc_mic_automute(codec);
16499 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16501 struct alc_spec *spec = codec->spec;
16503 spec->autocfg.hp_pins[0] = 0x14;
16504 spec->autocfg.speaker_pins[0] = 0x1b;
16507 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16509 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16511 unsigned int present;
16512 unsigned char bits;
16514 present = snd_hda_codec_read(codec, 0x21, 0,
16515 AC_VERB_GET_PIN_SENSE, 0)
16516 & AC_PINSENSE_PRESENCE;
16517 bits = present ? HDA_AMP_MUTE : 0;
16518 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16519 AMP_IN_MUTE(0), bits);
16520 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16521 AMP_IN_MUTE(0), bits);
16524 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16526 unsigned int present;
16527 unsigned char bits;
16529 present = snd_hda_codec_read(codec, 0x21, 0,
16530 AC_VERB_GET_PIN_SENSE, 0)
16531 & AC_PINSENSE_PRESENCE;
16532 bits = present ? HDA_AMP_MUTE : 0;
16533 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16534 AMP_IN_MUTE(0), bits);
16535 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16536 AMP_IN_MUTE(0), bits);
16537 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16538 AMP_IN_MUTE(0), bits);
16539 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16540 AMP_IN_MUTE(0), bits);
16543 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16545 unsigned int present;
16546 unsigned char bits;
16548 present = snd_hda_codec_read(codec, 0x15, 0,
16549 AC_VERB_GET_PIN_SENSE, 0)
16550 & AC_PINSENSE_PRESENCE;
16551 bits = present ? HDA_AMP_MUTE : 0;
16552 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16553 AMP_IN_MUTE(0), bits);
16554 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16555 AMP_IN_MUTE(0), bits);
16556 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16557 AMP_IN_MUTE(0), bits);
16558 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16559 AMP_IN_MUTE(0), bits);
16562 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16564 unsigned int present;
16565 unsigned char bits;
16567 present = snd_hda_codec_read(codec, 0x1b, 0,
16568 AC_VERB_GET_PIN_SENSE, 0)
16569 & AC_PINSENSE_PRESENCE;
16570 bits = present ? 0 : PIN_OUT;
16571 snd_hda_codec_write(codec, 0x14, 0,
16572 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16575 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16577 unsigned int present1, present2;
16579 present1 = snd_hda_codec_read(codec, 0x21, 0,
16580 AC_VERB_GET_PIN_SENSE, 0)
16581 & AC_PINSENSE_PRESENCE;
16582 present2 = snd_hda_codec_read(codec, 0x15, 0,
16583 AC_VERB_GET_PIN_SENSE, 0)
16584 & AC_PINSENSE_PRESENCE;
16586 if (present1 || present2) {
16587 snd_hda_codec_write_cache(codec, 0x14, 0,
16588 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16590 snd_hda_codec_write_cache(codec, 0x14, 0,
16591 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16595 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16597 unsigned int present1, present2;
16599 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16600 AC_VERB_GET_PIN_SENSE, 0)
16601 & AC_PINSENSE_PRESENCE;
16602 present2 = snd_hda_codec_read(codec, 0x15, 0,
16603 AC_VERB_GET_PIN_SENSE, 0)
16604 & AC_PINSENSE_PRESENCE;
16606 if (present1 || present2) {
16607 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16608 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16609 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16610 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16612 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16613 AMP_IN_MUTE(0), 0);
16614 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16615 AMP_IN_MUTE(0), 0);
16619 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16622 switch (res >> 26) {
16623 case ALC880_HP_EVENT:
16624 alc663_m51va_speaker_automute(codec);
16626 case ALC880_MIC_EVENT:
16627 alc_mic_automute(codec);
16632 static void alc663_m51va_setup(struct hda_codec *codec)
16634 struct alc_spec *spec = codec->spec;
16635 spec->ext_mic.pin = 0x18;
16636 spec->ext_mic.mux_idx = 0;
16637 spec->int_mic.pin = 0x12;
16638 spec->int_mic.mux_idx = 1;
16639 spec->auto_mic = 1;
16642 static void alc663_m51va_inithook(struct hda_codec *codec)
16644 alc663_m51va_speaker_automute(codec);
16645 alc_mic_automute(codec);
16648 /* ***************** Mode1 ******************************/
16649 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16650 #define alc663_mode1_setup alc663_m51va_setup
16651 #define alc663_mode1_inithook alc663_m51va_inithook
16653 /* ***************** Mode2 ******************************/
16654 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16657 switch (res >> 26) {
16658 case ALC880_HP_EVENT:
16659 alc662_f5z_speaker_automute(codec);
16661 case ALC880_MIC_EVENT:
16662 alc_mic_automute(codec);
16667 #define alc662_mode2_setup alc663_m51va_setup
16669 static void alc662_mode2_inithook(struct hda_codec *codec)
16671 alc662_f5z_speaker_automute(codec);
16672 alc_mic_automute(codec);
16674 /* ***************** Mode3 ******************************/
16675 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16678 switch (res >> 26) {
16679 case ALC880_HP_EVENT:
16680 alc663_two_hp_m1_speaker_automute(codec);
16682 case ALC880_MIC_EVENT:
16683 alc_mic_automute(codec);
16688 #define alc663_mode3_setup alc663_m51va_setup
16690 static void alc663_mode3_inithook(struct hda_codec *codec)
16692 alc663_two_hp_m1_speaker_automute(codec);
16693 alc_mic_automute(codec);
16695 /* ***************** Mode4 ******************************/
16696 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16699 switch (res >> 26) {
16700 case ALC880_HP_EVENT:
16701 alc663_21jd_two_speaker_automute(codec);
16703 case ALC880_MIC_EVENT:
16704 alc_mic_automute(codec);
16709 #define alc663_mode4_setup alc663_m51va_setup
16711 static void alc663_mode4_inithook(struct hda_codec *codec)
16713 alc663_21jd_two_speaker_automute(codec);
16714 alc_mic_automute(codec);
16716 /* ***************** Mode5 ******************************/
16717 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16720 switch (res >> 26) {
16721 case ALC880_HP_EVENT:
16722 alc663_15jd_two_speaker_automute(codec);
16724 case ALC880_MIC_EVENT:
16725 alc_mic_automute(codec);
16730 #define alc663_mode5_setup alc663_m51va_setup
16732 static void alc663_mode5_inithook(struct hda_codec *codec)
16734 alc663_15jd_two_speaker_automute(codec);
16735 alc_mic_automute(codec);
16737 /* ***************** Mode6 ******************************/
16738 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16741 switch (res >> 26) {
16742 case ALC880_HP_EVENT:
16743 alc663_two_hp_m2_speaker_automute(codec);
16745 case ALC880_MIC_EVENT:
16746 alc_mic_automute(codec);
16751 #define alc663_mode6_setup alc663_m51va_setup
16753 static void alc663_mode6_inithook(struct hda_codec *codec)
16755 alc663_two_hp_m2_speaker_automute(codec);
16756 alc_mic_automute(codec);
16759 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16761 unsigned int present;
16762 unsigned char bits;
16764 present = snd_hda_codec_read(codec, 0x21, 0,
16765 AC_VERB_GET_PIN_SENSE, 0)
16766 & AC_PINSENSE_PRESENCE;
16767 bits = present ? HDA_AMP_MUTE : 0;
16768 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16769 HDA_AMP_MUTE, bits);
16770 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16771 HDA_AMP_MUTE, bits);
16774 static void alc663_g71v_front_automute(struct hda_codec *codec)
16776 unsigned int present;
16777 unsigned char bits;
16779 present = snd_hda_codec_read(codec, 0x15, 0,
16780 AC_VERB_GET_PIN_SENSE, 0)
16781 & AC_PINSENSE_PRESENCE;
16782 bits = present ? HDA_AMP_MUTE : 0;
16783 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16784 HDA_AMP_MUTE, bits);
16787 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16790 switch (res >> 26) {
16791 case ALC880_HP_EVENT:
16792 alc663_g71v_hp_automute(codec);
16794 case ALC880_FRONT_EVENT:
16795 alc663_g71v_front_automute(codec);
16797 case ALC880_MIC_EVENT:
16798 alc_mic_automute(codec);
16803 #define alc663_g71v_setup alc663_m51va_setup
16805 static void alc663_g71v_inithook(struct hda_codec *codec)
16807 alc663_g71v_front_automute(codec);
16808 alc663_g71v_hp_automute(codec);
16809 alc_mic_automute(codec);
16812 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16815 switch (res >> 26) {
16816 case ALC880_HP_EVENT:
16817 alc663_m51va_speaker_automute(codec);
16819 case ALC880_MIC_EVENT:
16820 alc_mic_automute(codec);
16825 #define alc663_g50v_setup alc663_m51va_setup
16827 static void alc663_g50v_inithook(struct hda_codec *codec)
16829 alc663_m51va_speaker_automute(codec);
16830 alc_mic_automute(codec);
16833 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16834 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16835 ALC262_HIPPO_MASTER_SWITCH,
16837 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16838 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16839 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16841 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16842 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16843 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16847 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16848 /* Master Playback automatically created from Speaker and Headphone */
16849 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16850 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16851 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16852 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16854 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16855 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16856 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16858 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16859 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16860 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16864 #ifdef CONFIG_SND_HDA_POWER_SAVE
16865 #define alc662_loopbacks alc880_loopbacks
16869 /* pcm configuration: identical with ALC880 */
16870 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16871 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16872 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16873 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16876 * configuration and preset
16878 static const char *alc662_models[ALC662_MODEL_LAST] = {
16879 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16880 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16881 [ALC662_3ST_6ch] = "3stack-6ch",
16882 [ALC662_5ST_DIG] = "6stack-dig",
16883 [ALC662_LENOVO_101E] = "lenovo-101e",
16884 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16885 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16886 [ALC662_ECS] = "ecs",
16887 [ALC663_ASUS_M51VA] = "m51va",
16888 [ALC663_ASUS_G71V] = "g71v",
16889 [ALC663_ASUS_H13] = "h13",
16890 [ALC663_ASUS_G50V] = "g50v",
16891 [ALC663_ASUS_MODE1] = "asus-mode1",
16892 [ALC662_ASUS_MODE2] = "asus-mode2",
16893 [ALC663_ASUS_MODE3] = "asus-mode3",
16894 [ALC663_ASUS_MODE4] = "asus-mode4",
16895 [ALC663_ASUS_MODE5] = "asus-mode5",
16896 [ALC663_ASUS_MODE6] = "asus-mode6",
16897 [ALC272_DELL] = "dell",
16898 [ALC272_DELL_ZM1] = "dell-zm1",
16899 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16900 [ALC662_AUTO] = "auto",
16903 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16904 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16905 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16906 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16907 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16908 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16909 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16910 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16911 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16912 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16913 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16914 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16915 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16916 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16917 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16918 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16919 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16920 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16921 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16922 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16923 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16924 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16925 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16926 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16927 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16928 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16929 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16930 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16931 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16932 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16933 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16934 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16935 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16936 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16937 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16938 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16939 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16940 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16941 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16942 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16943 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16944 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16945 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16946 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16947 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16948 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16949 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16950 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16951 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16952 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16953 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16954 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16955 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16956 ALC662_3ST_6ch_DIG),
16957 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
16958 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16959 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16960 ALC662_3ST_6ch_DIG),
16961 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16962 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16963 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16964 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16965 ALC662_3ST_6ch_DIG),
16966 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16971 static struct alc_config_preset alc662_presets[] = {
16972 [ALC662_3ST_2ch_DIG] = {
16973 .mixers = { alc662_3ST_2ch_mixer },
16974 .init_verbs = { alc662_init_verbs },
16975 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16976 .dac_nids = alc662_dac_nids,
16977 .dig_out_nid = ALC662_DIGOUT_NID,
16978 .dig_in_nid = ALC662_DIGIN_NID,
16979 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16980 .channel_mode = alc662_3ST_2ch_modes,
16981 .input_mux = &alc662_capture_source,
16983 [ALC662_3ST_6ch_DIG] = {
16984 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16985 .init_verbs = { alc662_init_verbs },
16986 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16987 .dac_nids = alc662_dac_nids,
16988 .dig_out_nid = ALC662_DIGOUT_NID,
16989 .dig_in_nid = ALC662_DIGIN_NID,
16990 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16991 .channel_mode = alc662_3ST_6ch_modes,
16993 .input_mux = &alc662_capture_source,
16995 [ALC662_3ST_6ch] = {
16996 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16997 .init_verbs = { alc662_init_verbs },
16998 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16999 .dac_nids = alc662_dac_nids,
17000 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17001 .channel_mode = alc662_3ST_6ch_modes,
17003 .input_mux = &alc662_capture_source,
17005 [ALC662_5ST_DIG] = {
17006 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17007 .init_verbs = { alc662_init_verbs },
17008 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17009 .dac_nids = alc662_dac_nids,
17010 .dig_out_nid = ALC662_DIGOUT_NID,
17011 .dig_in_nid = ALC662_DIGIN_NID,
17012 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17013 .channel_mode = alc662_5stack_modes,
17014 .input_mux = &alc662_capture_source,
17016 [ALC662_LENOVO_101E] = {
17017 .mixers = { alc662_lenovo_101e_mixer },
17018 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17019 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17020 .dac_nids = alc662_dac_nids,
17021 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17022 .channel_mode = alc662_3ST_2ch_modes,
17023 .input_mux = &alc662_lenovo_101e_capture_source,
17024 .unsol_event = alc662_lenovo_101e_unsol_event,
17025 .init_hook = alc662_lenovo_101e_all_automute,
17027 [ALC662_ASUS_EEEPC_P701] = {
17028 .mixers = { alc662_eeepc_p701_mixer },
17029 .init_verbs = { alc662_init_verbs,
17030 alc662_eeepc_sue_init_verbs },
17031 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17032 .dac_nids = alc662_dac_nids,
17033 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17034 .channel_mode = alc662_3ST_2ch_modes,
17035 .unsol_event = alc662_eeepc_unsol_event,
17036 .setup = alc662_eeepc_setup,
17037 .init_hook = alc662_eeepc_inithook,
17039 [ALC662_ASUS_EEEPC_EP20] = {
17040 .mixers = { alc662_eeepc_ep20_mixer,
17041 alc662_chmode_mixer },
17042 .init_verbs = { alc662_init_verbs,
17043 alc662_eeepc_ep20_sue_init_verbs },
17044 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17045 .dac_nids = alc662_dac_nids,
17046 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17047 .channel_mode = alc662_3ST_6ch_modes,
17048 .input_mux = &alc662_lenovo_101e_capture_source,
17049 .unsol_event = alc662_eeepc_unsol_event,
17050 .setup = alc662_eeepc_ep20_setup,
17051 .init_hook = alc662_eeepc_ep20_inithook,
17054 .mixers = { alc662_ecs_mixer },
17055 .init_verbs = { alc662_init_verbs,
17056 alc662_ecs_init_verbs },
17057 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17058 .dac_nids = alc662_dac_nids,
17059 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17060 .channel_mode = alc662_3ST_2ch_modes,
17061 .unsol_event = alc662_eeepc_unsol_event,
17062 .setup = alc662_eeepc_setup,
17063 .init_hook = alc662_eeepc_inithook,
17065 [ALC663_ASUS_M51VA] = {
17066 .mixers = { alc663_m51va_mixer },
17067 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17068 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17069 .dac_nids = alc662_dac_nids,
17070 .dig_out_nid = ALC662_DIGOUT_NID,
17071 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17072 .channel_mode = alc662_3ST_2ch_modes,
17073 .unsol_event = alc663_m51va_unsol_event,
17074 .setup = alc663_m51va_setup,
17075 .init_hook = alc663_m51va_inithook,
17077 [ALC663_ASUS_G71V] = {
17078 .mixers = { alc663_g71v_mixer },
17079 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17080 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17081 .dac_nids = alc662_dac_nids,
17082 .dig_out_nid = ALC662_DIGOUT_NID,
17083 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17084 .channel_mode = alc662_3ST_2ch_modes,
17085 .unsol_event = alc663_g71v_unsol_event,
17086 .setup = alc663_g71v_setup,
17087 .init_hook = alc663_g71v_inithook,
17089 [ALC663_ASUS_H13] = {
17090 .mixers = { alc663_m51va_mixer },
17091 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17092 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17093 .dac_nids = alc662_dac_nids,
17094 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17095 .channel_mode = alc662_3ST_2ch_modes,
17096 .unsol_event = alc663_m51va_unsol_event,
17097 .init_hook = alc663_m51va_inithook,
17099 [ALC663_ASUS_G50V] = {
17100 .mixers = { alc663_g50v_mixer },
17101 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17102 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17103 .dac_nids = alc662_dac_nids,
17104 .dig_out_nid = ALC662_DIGOUT_NID,
17105 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17106 .channel_mode = alc662_3ST_6ch_modes,
17107 .input_mux = &alc663_capture_source,
17108 .unsol_event = alc663_g50v_unsol_event,
17109 .setup = alc663_g50v_setup,
17110 .init_hook = alc663_g50v_inithook,
17112 [ALC663_ASUS_MODE1] = {
17113 .mixers = { alc663_m51va_mixer },
17114 .cap_mixer = alc662_auto_capture_mixer,
17115 .init_verbs = { alc662_init_verbs,
17116 alc663_21jd_amic_init_verbs },
17117 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17119 .dac_nids = alc662_dac_nids,
17120 .dig_out_nid = ALC662_DIGOUT_NID,
17121 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17122 .channel_mode = alc662_3ST_2ch_modes,
17123 .unsol_event = alc663_mode1_unsol_event,
17124 .setup = alc663_mode1_setup,
17125 .init_hook = alc663_mode1_inithook,
17127 [ALC662_ASUS_MODE2] = {
17128 .mixers = { alc662_1bjd_mixer },
17129 .cap_mixer = alc662_auto_capture_mixer,
17130 .init_verbs = { alc662_init_verbs,
17131 alc662_1bjd_amic_init_verbs },
17132 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17133 .dac_nids = alc662_dac_nids,
17134 .dig_out_nid = ALC662_DIGOUT_NID,
17135 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17136 .channel_mode = alc662_3ST_2ch_modes,
17137 .unsol_event = alc662_mode2_unsol_event,
17138 .setup = alc662_mode2_setup,
17139 .init_hook = alc662_mode2_inithook,
17141 [ALC663_ASUS_MODE3] = {
17142 .mixers = { alc663_two_hp_m1_mixer },
17143 .cap_mixer = alc662_auto_capture_mixer,
17144 .init_verbs = { alc662_init_verbs,
17145 alc663_two_hp_amic_m1_init_verbs },
17146 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17148 .dac_nids = alc662_dac_nids,
17149 .dig_out_nid = ALC662_DIGOUT_NID,
17150 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17151 .channel_mode = alc662_3ST_2ch_modes,
17152 .unsol_event = alc663_mode3_unsol_event,
17153 .setup = alc663_mode3_setup,
17154 .init_hook = alc663_mode3_inithook,
17156 [ALC663_ASUS_MODE4] = {
17157 .mixers = { alc663_asus_21jd_clfe_mixer },
17158 .cap_mixer = alc662_auto_capture_mixer,
17159 .init_verbs = { alc662_init_verbs,
17160 alc663_21jd_amic_init_verbs},
17161 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17163 .dac_nids = alc662_dac_nids,
17164 .dig_out_nid = ALC662_DIGOUT_NID,
17165 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17166 .channel_mode = alc662_3ST_2ch_modes,
17167 .unsol_event = alc663_mode4_unsol_event,
17168 .setup = alc663_mode4_setup,
17169 .init_hook = alc663_mode4_inithook,
17171 [ALC663_ASUS_MODE5] = {
17172 .mixers = { alc663_asus_15jd_clfe_mixer },
17173 .cap_mixer = alc662_auto_capture_mixer,
17174 .init_verbs = { alc662_init_verbs,
17175 alc663_15jd_amic_init_verbs },
17176 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17178 .dac_nids = alc662_dac_nids,
17179 .dig_out_nid = ALC662_DIGOUT_NID,
17180 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17181 .channel_mode = alc662_3ST_2ch_modes,
17182 .unsol_event = alc663_mode5_unsol_event,
17183 .setup = alc663_mode5_setup,
17184 .init_hook = alc663_mode5_inithook,
17186 [ALC663_ASUS_MODE6] = {
17187 .mixers = { alc663_two_hp_m2_mixer },
17188 .cap_mixer = alc662_auto_capture_mixer,
17189 .init_verbs = { alc662_init_verbs,
17190 alc663_two_hp_amic_m2_init_verbs },
17191 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17193 .dac_nids = alc662_dac_nids,
17194 .dig_out_nid = ALC662_DIGOUT_NID,
17195 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17196 .channel_mode = alc662_3ST_2ch_modes,
17197 .unsol_event = alc663_mode6_unsol_event,
17198 .setup = alc663_mode6_setup,
17199 .init_hook = alc663_mode6_inithook,
17202 .mixers = { alc663_m51va_mixer },
17203 .cap_mixer = alc272_auto_capture_mixer,
17204 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17205 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17206 .dac_nids = alc662_dac_nids,
17207 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17208 .adc_nids = alc272_adc_nids,
17209 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17210 .capsrc_nids = alc272_capsrc_nids,
17211 .channel_mode = alc662_3ST_2ch_modes,
17212 .unsol_event = alc663_m51va_unsol_event,
17213 .setup = alc663_m51va_setup,
17214 .init_hook = alc663_m51va_inithook,
17216 [ALC272_DELL_ZM1] = {
17217 .mixers = { alc663_m51va_mixer },
17218 .cap_mixer = alc662_auto_capture_mixer,
17219 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17220 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17221 .dac_nids = alc662_dac_nids,
17222 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17223 .adc_nids = alc662_adc_nids,
17225 .capsrc_nids = alc662_capsrc_nids,
17226 .channel_mode = alc662_3ST_2ch_modes,
17227 .unsol_event = alc663_m51va_unsol_event,
17228 .setup = alc663_m51va_setup,
17229 .init_hook = alc663_m51va_inithook,
17231 [ALC272_SAMSUNG_NC10] = {
17232 .mixers = { alc272_nc10_mixer },
17233 .init_verbs = { alc662_init_verbs,
17234 alc663_21jd_amic_init_verbs },
17235 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17236 .dac_nids = alc272_dac_nids,
17237 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17238 .channel_mode = alc662_3ST_2ch_modes,
17239 /*.input_mux = &alc272_nc10_capture_source,*/
17240 .unsol_event = alc663_mode4_unsol_event,
17241 .setup = alc663_mode4_setup,
17242 .init_hook = alc663_mode4_inithook,
17248 * BIOS auto configuration
17251 /* convert from MIX nid to DAC */
17252 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17256 else if (nid >= 0x0c && nid <= 0x0e)
17257 return nid - 0x0c + 0x02;
17262 /* get MIX nid connected to the given pin targeted to DAC */
17263 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17269 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17270 for (i = 0; i < num; i++) {
17271 if (alc662_mix_to_dac(mix[i]) == dac)
17277 /* look for an empty DAC slot */
17278 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17280 struct alc_spec *spec = codec->spec;
17284 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17287 for (i = 0; i < num; i++) {
17288 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17291 for (j = 0; j < spec->multiout.num_dacs; j++)
17292 if (spec->multiout.dac_nids[j] == nid)
17294 if (j >= spec->multiout.num_dacs)
17300 /* fill in the dac_nids table from the parsed pin configuration */
17301 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17302 const struct auto_pin_cfg *cfg)
17304 struct alc_spec *spec = codec->spec;
17308 spec->multiout.dac_nids = spec->private_dac_nids;
17309 for (i = 0; i < cfg->line_outs; i++) {
17310 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17313 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17318 static int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17319 hda_nid_t nid, unsigned int chs)
17322 sprintf(name, "%s Playback Volume", pfx);
17323 return add_control(spec, ALC_CTL_WIDGET_VOL, name,
17324 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17327 static int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17328 hda_nid_t nid, unsigned int chs)
17331 sprintf(name, "%s Playback Switch", pfx);
17332 return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17333 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17336 #define alc662_add_stereo_vol(spec, pfx, nid) \
17337 alc662_add_vol_ctl(spec, pfx, nid, 3)
17338 #define alc662_add_stereo_sw(spec, pfx, nid) \
17339 alc662_add_sw_ctl(spec, pfx, nid, 3)
17341 /* add playback controls from the parsed DAC table */
17342 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17343 const struct auto_pin_cfg *cfg)
17345 struct alc_spec *spec = codec->spec;
17346 static const char *chname[4] = {
17347 "Front", "Surround", NULL /*CLFE*/, "Side"
17349 hda_nid_t nid, mix;
17352 for (i = 0; i < cfg->line_outs; i++) {
17353 nid = spec->multiout.dac_nids[i];
17356 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17361 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17364 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17367 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17370 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17375 if (cfg->line_outs == 1 &&
17376 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17383 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17386 if (cfg->line_outs == 1 &&
17387 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17389 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17397 /* add playback controls for speaker and HP outputs */
17398 /* return DAC nid if any new DAC is assigned */
17399 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17402 struct alc_spec *spec = codec->spec;
17403 hda_nid_t nid, mix;
17408 nid = alc662_look_for_dac(codec, pin);
17411 /* the corresponding DAC is already occupied */
17412 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17413 return 0; /* no way */
17414 /* create a switch only */
17415 sprintf(name, "%s Playback Switch", pfx);
17416 return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17417 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17420 mix = alc662_dac_to_mix(codec, pin, nid);
17423 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17426 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17432 /* create playback/capture controls for input pins */
17433 #define alc662_auto_create_input_ctls \
17434 alc882_auto_create_input_ctls
17436 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17437 hda_nid_t nid, int pin_type,
17443 alc_set_pin_output(codec, nid, pin_type);
17444 /* need the manual connection? */
17445 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17448 for (i = 0; i < num; i++) {
17449 if (alc662_mix_to_dac(srcs[i]) != dac)
17451 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17456 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17458 struct alc_spec *spec = codec->spec;
17459 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17462 for (i = 0; i <= HDA_SIDE; i++) {
17463 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17465 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17466 spec->multiout.dac_nids[i]);
17470 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17472 struct alc_spec *spec = codec->spec;
17475 pin = spec->autocfg.hp_pins[0];
17477 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17478 spec->multiout.hp_nid);
17479 pin = spec->autocfg.speaker_pins[0];
17481 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17482 spec->multiout.extra_out_nid[0]);
17485 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17487 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17489 struct alc_spec *spec = codec->spec;
17492 for (i = 0; i < AUTO_PIN_LAST; i++) {
17493 hda_nid_t nid = spec->autocfg.input_pins[i];
17494 if (alc_is_input_pin(codec, nid)) {
17495 alc_set_input_pin(codec, nid, i);
17496 if (nid != ALC662_PIN_CD_NID &&
17497 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17498 snd_hda_codec_write(codec, nid, 0,
17499 AC_VERB_SET_AMP_GAIN_MUTE,
17505 #define alc662_auto_init_input_src alc882_auto_init_input_src
17507 static int alc662_parse_auto_config(struct hda_codec *codec)
17509 struct alc_spec *spec = codec->spec;
17511 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17513 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17517 if (!spec->autocfg.line_outs)
17518 return 0; /* can't find valid BIOS pin config */
17520 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17523 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17526 err = alc662_auto_create_extra_out(codec,
17527 spec->autocfg.speaker_pins[0],
17532 spec->multiout.extra_out_nid[0] = err;
17533 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17538 spec->multiout.hp_nid = err;
17539 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17543 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17545 if (spec->autocfg.dig_outs)
17546 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17548 if (spec->kctls.list)
17549 add_mixer(spec, spec->kctls.list);
17551 spec->num_mux_defs = 1;
17552 spec->input_mux = &spec->private_imux[0];
17554 add_verb(spec, alc662_auto_init_verbs);
17555 if (codec->vendor_id == 0x10ec0663)
17556 add_verb(spec, alc663_auto_init_verbs);
17558 err = alc_auto_add_mic_boost(codec);
17562 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17567 /* additional initialization for auto-configuration model */
17568 static void alc662_auto_init(struct hda_codec *codec)
17570 struct alc_spec *spec = codec->spec;
17571 alc662_auto_init_multi_out(codec);
17572 alc662_auto_init_hp_out(codec);
17573 alc662_auto_init_analog_input(codec);
17574 alc662_auto_init_input_src(codec);
17575 if (spec->unsol_event)
17576 alc_inithook(codec);
17579 static int patch_alc662(struct hda_codec *codec)
17581 struct alc_spec *spec;
17582 int err, board_config;
17584 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17588 codec->spec = spec;
17590 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17592 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17595 if (board_config < 0) {
17596 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17598 board_config = ALC662_AUTO;
17601 if (board_config == ALC662_AUTO) {
17602 /* automatic parse from the BIOS config */
17603 err = alc662_parse_auto_config(codec);
17609 "hda_codec: Cannot set up configuration "
17610 "from BIOS. Using base mode...\n");
17611 board_config = ALC662_3ST_2ch_DIG;
17615 err = snd_hda_attach_beep_device(codec, 0x1);
17621 if (board_config != ALC662_AUTO)
17622 setup_preset(codec, &alc662_presets[board_config]);
17624 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17625 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17627 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17628 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17630 if (!spec->adc_nids) {
17631 spec->adc_nids = alc662_adc_nids;
17632 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17634 if (!spec->capsrc_nids)
17635 spec->capsrc_nids = alc662_capsrc_nids;
17637 if (!spec->cap_mixer)
17638 set_capture_mixer(codec);
17639 if (codec->vendor_id == 0x10ec0662)
17640 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17642 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17644 spec->vmaster_nid = 0x02;
17646 codec->patch_ops = alc_patch_ops;
17647 if (board_config == ALC662_AUTO)
17648 spec->init_hook = alc662_auto_init;
17649 #ifdef CONFIG_SND_HDA_POWER_SAVE
17650 if (!spec->loopback.amplist)
17651 spec->loopback.amplist = alc662_loopbacks;
17653 codec->proc_widget_hook = print_realtek_coef;
17661 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17662 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17663 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17664 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17665 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17666 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17667 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17668 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17669 .patch = patch_alc861 },
17670 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17671 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17672 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17673 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17674 .patch = patch_alc882 },
17675 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17676 .patch = patch_alc662 },
17677 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17678 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17679 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17680 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17681 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17682 .patch = patch_alc882 },
17683 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17684 .patch = patch_alc882 },
17685 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17686 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17687 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17688 .patch = patch_alc882 },
17689 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17690 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17691 {} /* terminator */
17694 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17696 MODULE_LICENSE("GPL");
17697 MODULE_DESCRIPTION("Realtek HD-audio codec");
17699 static struct hda_codec_preset_list realtek_list = {
17700 .preset = snd_hda_preset_realtek,
17701 .owner = THIS_MODULE,
17704 static int __init patch_realtek_init(void)
17706 return snd_hda_add_codec_preset(&realtek_list);
17709 static void __exit patch_realtek_exit(void)
17711 snd_hda_delete_codec_preset(&realtek_list);
17714 module_init(patch_realtek_init)
17715 module_exit(patch_realtek_exit)