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,
226 ALC883_LENOVO_101E_2ch,
227 ALC883_LENOVO_NB0763,
228 ALC888_LENOVO_MS7195_DIG,
235 ALC883_FUJITSU_PI2515,
236 ALC888_FUJITSU_XA3530,
237 ALC883_3ST_6ch_INTEL,
250 #define GPIO_MASK 0x03
252 /* extra amp-initialization sequence types */
261 struct alc_mic_route {
263 unsigned char mux_idx;
264 unsigned char amix_idx;
267 #define MUX_IDX_UNDEF ((unsigned char)-1)
270 /* codec parameterization */
271 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
272 unsigned int num_mixers;
273 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
274 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
276 const struct hda_verb *init_verbs[5]; /* initialization verbs
280 unsigned int num_init_verbs;
282 char stream_name_analog[32]; /* analog PCM stream */
283 struct hda_pcm_stream *stream_analog_playback;
284 struct hda_pcm_stream *stream_analog_capture;
285 struct hda_pcm_stream *stream_analog_alt_playback;
286 struct hda_pcm_stream *stream_analog_alt_capture;
288 char stream_name_digital[32]; /* digital PCM stream */
289 struct hda_pcm_stream *stream_digital_playback;
290 struct hda_pcm_stream *stream_digital_capture;
293 struct hda_multi_out multiout; /* playback set-up
294 * max_channels, dacs must be set
295 * dig_out_nid and hp_nid are optional
297 hda_nid_t alt_dac_nid;
298 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
302 unsigned int num_adc_nids;
304 hda_nid_t *capsrc_nids;
305 hda_nid_t dig_in_nid; /* digital-in NID; optional */
308 unsigned int num_mux_defs;
309 const struct hda_input_mux *input_mux;
310 unsigned int cur_mux[3];
311 struct alc_mic_route ext_mic;
312 struct alc_mic_route int_mic;
315 const struct hda_channel_mode *channel_mode;
316 int num_channel_mode;
318 int const_channel_count;
319 int ext_channel_count;
321 /* PCM information */
322 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
324 /* dynamic controls, init_verbs and input_mux */
325 struct auto_pin_cfg autocfg;
326 struct snd_array kctls;
327 struct hda_input_mux private_imux[3];
328 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
329 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
330 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
333 void (*init_hook)(struct hda_codec *codec);
334 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
336 /* for pin sensing */
337 unsigned int sense_updated: 1;
338 unsigned int jack_present: 1;
339 unsigned int master_sw: 1;
340 unsigned int auto_mic:1;
343 unsigned int no_analog :1; /* digital I/O only */
346 /* for virtual master */
347 hda_nid_t vmaster_nid;
348 #ifdef CONFIG_SND_HDA_POWER_SAVE
349 struct hda_loopback_check loopback;
354 unsigned int pll_coef_idx, pll_coef_bit;
358 * configuration template - to be copied to the spec instance
360 struct alc_config_preset {
361 struct snd_kcontrol_new *mixers[5]; /* should be identical size
364 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
365 const struct hda_verb *init_verbs[5];
366 unsigned int num_dacs;
368 hda_nid_t dig_out_nid; /* optional */
369 hda_nid_t hp_nid; /* optional */
370 hda_nid_t *slave_dig_outs;
371 unsigned int num_adc_nids;
373 hda_nid_t *capsrc_nids;
374 hda_nid_t dig_in_nid;
375 unsigned int num_channel_mode;
376 const struct hda_channel_mode *channel_mode;
378 int const_channel_count;
379 unsigned int num_mux_defs;
380 const struct hda_input_mux *input_mux;
381 void (*unsol_event)(struct hda_codec *, unsigned int);
382 void (*setup)(struct hda_codec *);
383 void (*init_hook)(struct hda_codec *);
384 #ifdef CONFIG_SND_HDA_POWER_SAVE
385 struct hda_amp_list *loopbacks;
393 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
394 struct snd_ctl_elem_info *uinfo)
396 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
397 struct alc_spec *spec = codec->spec;
398 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
399 if (mux_idx >= spec->num_mux_defs)
401 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
404 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
405 struct snd_ctl_elem_value *ucontrol)
407 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
408 struct alc_spec *spec = codec->spec;
409 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
411 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
415 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
416 struct snd_ctl_elem_value *ucontrol)
418 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
419 struct alc_spec *spec = codec->spec;
420 const struct hda_input_mux *imux;
421 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
422 unsigned int mux_idx;
423 hda_nid_t nid = spec->capsrc_nids ?
424 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
427 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
428 imux = &spec->input_mux[mux_idx];
430 type = get_wcaps_type(get_wcaps(codec, nid));
431 if (type == AC_WID_AUD_MIX) {
432 /* Matrix-mixer style (e.g. ALC882) */
433 unsigned int *cur_val = &spec->cur_mux[adc_idx];
436 idx = ucontrol->value.enumerated.item[0];
437 if (idx >= imux->num_items)
438 idx = imux->num_items - 1;
441 for (i = 0; i < imux->num_items; i++) {
442 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
443 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
444 imux->items[i].index,
450 /* MUX style (e.g. ALC880) */
451 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
452 &spec->cur_mux[adc_idx]);
457 * channel mode setting
459 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
460 struct snd_ctl_elem_info *uinfo)
462 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
463 struct alc_spec *spec = codec->spec;
464 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
465 spec->num_channel_mode);
468 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
469 struct snd_ctl_elem_value *ucontrol)
471 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
472 struct alc_spec *spec = codec->spec;
473 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
474 spec->num_channel_mode,
475 spec->ext_channel_count);
478 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
479 struct snd_ctl_elem_value *ucontrol)
481 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
482 struct alc_spec *spec = codec->spec;
483 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
484 spec->num_channel_mode,
485 &spec->ext_channel_count);
486 if (err >= 0 && !spec->const_channel_count) {
487 spec->multiout.max_channels = spec->ext_channel_count;
488 if (spec->need_dac_fix)
489 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
495 * Control the mode of pin widget settings via the mixer. "pc" is used
496 * instead of "%" to avoid consequences of accidently treating the % as
497 * being part of a format specifier. Maximum allowed length of a value is
498 * 63 characters plus NULL terminator.
500 * Note: some retasking pin complexes seem to ignore requests for input
501 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
502 * are requested. Therefore order this list so that this behaviour will not
503 * cause problems when mixer clients move through the enum sequentially.
504 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
507 static char *alc_pin_mode_names[] = {
508 "Mic 50pc bias", "Mic 80pc bias",
509 "Line in", "Line out", "Headphone out",
511 static unsigned char alc_pin_mode_values[] = {
512 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
514 /* The control can present all 5 options, or it can limit the options based
515 * in the pin being assumed to be exclusively an input or an output pin. In
516 * addition, "input" pins may or may not process the mic bias option
517 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
518 * accept requests for bias as of chip versions up to March 2006) and/or
519 * wiring in the computer.
521 #define ALC_PIN_DIR_IN 0x00
522 #define ALC_PIN_DIR_OUT 0x01
523 #define ALC_PIN_DIR_INOUT 0x02
524 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
525 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
527 /* Info about the pin modes supported by the different pin direction modes.
528 * For each direction the minimum and maximum values are given.
530 static signed char alc_pin_mode_dir_info[5][2] = {
531 { 0, 2 }, /* ALC_PIN_DIR_IN */
532 { 3, 4 }, /* ALC_PIN_DIR_OUT */
533 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
534 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
535 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
537 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
538 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
539 #define alc_pin_mode_n_items(_dir) \
540 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
542 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
543 struct snd_ctl_elem_info *uinfo)
545 unsigned int item_num = uinfo->value.enumerated.item;
546 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
548 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
550 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
552 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
553 item_num = alc_pin_mode_min(dir);
554 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
558 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
559 struct snd_ctl_elem_value *ucontrol)
562 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
563 hda_nid_t nid = kcontrol->private_value & 0xffff;
564 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
565 long *valp = ucontrol->value.integer.value;
566 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
567 AC_VERB_GET_PIN_WIDGET_CONTROL,
570 /* Find enumerated value for current pinctl setting */
571 i = alc_pin_mode_min(dir);
572 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
574 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
578 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
579 struct snd_ctl_elem_value *ucontrol)
582 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
583 hda_nid_t nid = kcontrol->private_value & 0xffff;
584 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
585 long val = *ucontrol->value.integer.value;
586 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
587 AC_VERB_GET_PIN_WIDGET_CONTROL,
590 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
591 val = alc_pin_mode_min(dir);
593 change = pinctl != alc_pin_mode_values[val];
595 /* Set pin mode to that requested */
596 snd_hda_codec_write_cache(codec, nid, 0,
597 AC_VERB_SET_PIN_WIDGET_CONTROL,
598 alc_pin_mode_values[val]);
600 /* Also enable the retasking pin's input/output as required
601 * for the requested pin mode. Enum values of 2 or less are
604 * Dynamically switching the input/output buffers probably
605 * reduces noise slightly (particularly on input) so we'll
606 * do it. However, having both input and output buffers
607 * enabled simultaneously doesn't seem to be problematic if
608 * this turns out to be necessary in the future.
611 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
612 HDA_AMP_MUTE, HDA_AMP_MUTE);
613 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
616 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
617 HDA_AMP_MUTE, HDA_AMP_MUTE);
618 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
625 #define ALC_PIN_MODE(xname, nid, dir) \
626 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
627 .info = alc_pin_mode_info, \
628 .get = alc_pin_mode_get, \
629 .put = alc_pin_mode_put, \
630 .private_value = nid | (dir<<16) }
632 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
633 * together using a mask with more than one bit set. This control is
634 * currently used only by the ALC260 test model. At this stage they are not
635 * needed for any "production" models.
637 #ifdef CONFIG_SND_DEBUG
638 #define alc_gpio_data_info snd_ctl_boolean_mono_info
640 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
641 struct snd_ctl_elem_value *ucontrol)
643 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
644 hda_nid_t nid = kcontrol->private_value & 0xffff;
645 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
646 long *valp = ucontrol->value.integer.value;
647 unsigned int val = snd_hda_codec_read(codec, nid, 0,
648 AC_VERB_GET_GPIO_DATA, 0x00);
650 *valp = (val & mask) != 0;
653 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
654 struct snd_ctl_elem_value *ucontrol)
657 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
658 hda_nid_t nid = kcontrol->private_value & 0xffff;
659 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
660 long val = *ucontrol->value.integer.value;
661 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
662 AC_VERB_GET_GPIO_DATA,
665 /* Set/unset the masked GPIO bit(s) as needed */
666 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
671 snd_hda_codec_write_cache(codec, nid, 0,
672 AC_VERB_SET_GPIO_DATA, gpio_data);
676 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
677 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
678 .info = alc_gpio_data_info, \
679 .get = alc_gpio_data_get, \
680 .put = alc_gpio_data_put, \
681 .private_value = nid | (mask<<16) }
682 #endif /* CONFIG_SND_DEBUG */
684 /* A switch control to allow the enabling of the digital IO pins on the
685 * ALC260. This is incredibly simplistic; the intention of this control is
686 * to provide something in the test model allowing digital outputs to be
687 * identified if present. If models are found which can utilise these
688 * outputs a more complete mixer control can be devised for those models if
691 #ifdef CONFIG_SND_DEBUG
692 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
694 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
695 struct snd_ctl_elem_value *ucontrol)
697 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
698 hda_nid_t nid = kcontrol->private_value & 0xffff;
699 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
700 long *valp = ucontrol->value.integer.value;
701 unsigned int val = snd_hda_codec_read(codec, nid, 0,
702 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
704 *valp = (val & mask) != 0;
707 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
708 struct snd_ctl_elem_value *ucontrol)
711 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
712 hda_nid_t nid = kcontrol->private_value & 0xffff;
713 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
714 long val = *ucontrol->value.integer.value;
715 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
716 AC_VERB_GET_DIGI_CONVERT_1,
719 /* Set/unset the masked control bit(s) as needed */
720 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
725 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
730 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
731 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
732 .info = alc_spdif_ctrl_info, \
733 .get = alc_spdif_ctrl_get, \
734 .put = alc_spdif_ctrl_put, \
735 .private_value = nid | (mask<<16) }
736 #endif /* CONFIG_SND_DEBUG */
738 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
739 * Again, this is only used in the ALC26x test models to help identify when
740 * the EAPD line must be asserted for features to work.
742 #ifdef CONFIG_SND_DEBUG
743 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
745 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
746 struct snd_ctl_elem_value *ucontrol)
748 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
749 hda_nid_t nid = kcontrol->private_value & 0xffff;
750 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
751 long *valp = ucontrol->value.integer.value;
752 unsigned int val = snd_hda_codec_read(codec, nid, 0,
753 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
755 *valp = (val & mask) != 0;
759 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
760 struct snd_ctl_elem_value *ucontrol)
763 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
764 hda_nid_t nid = kcontrol->private_value & 0xffff;
765 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
766 long val = *ucontrol->value.integer.value;
767 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
768 AC_VERB_GET_EAPD_BTLENABLE,
771 /* Set/unset the masked control bit(s) as needed */
772 change = (!val ? 0 : mask) != (ctrl_data & mask);
777 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
783 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
784 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
785 .info = alc_eapd_ctrl_info, \
786 .get = alc_eapd_ctrl_get, \
787 .put = alc_eapd_ctrl_put, \
788 .private_value = nid | (mask<<16) }
789 #endif /* CONFIG_SND_DEBUG */
792 * set up the input pin config (depending on the given auto-pin type)
794 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
797 unsigned int val = PIN_IN;
799 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
801 pincap = snd_hda_query_pin_caps(codec, nid);
802 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
803 if (pincap & AC_PINCAP_VREF_80)
805 else if (pincap & AC_PINCAP_VREF_50)
807 else if (pincap & AC_PINCAP_VREF_100)
809 else if (pincap & AC_PINCAP_VREF_GRD)
812 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
817 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
819 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
821 spec->mixers[spec->num_mixers++] = mix;
824 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
826 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
828 spec->init_verbs[spec->num_init_verbs++] = verb;
831 #ifdef CONFIG_PROC_FS
835 static void print_realtek_coef(struct snd_info_buffer *buffer,
836 struct hda_codec *codec, hda_nid_t nid)
842 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
843 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
844 coeff = snd_hda_codec_read(codec, nid, 0,
845 AC_VERB_GET_COEF_INDEX, 0);
846 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
849 #define print_realtek_coef NULL
853 * set up from the preset table
855 static void setup_preset(struct hda_codec *codec,
856 const struct alc_config_preset *preset)
858 struct alc_spec *spec = codec->spec;
861 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
862 add_mixer(spec, preset->mixers[i]);
863 spec->cap_mixer = preset->cap_mixer;
864 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
866 add_verb(spec, preset->init_verbs[i]);
868 spec->channel_mode = preset->channel_mode;
869 spec->num_channel_mode = preset->num_channel_mode;
870 spec->need_dac_fix = preset->need_dac_fix;
871 spec->const_channel_count = preset->const_channel_count;
873 if (preset->const_channel_count)
874 spec->multiout.max_channels = preset->const_channel_count;
876 spec->multiout.max_channels = spec->channel_mode[0].channels;
877 spec->ext_channel_count = spec->channel_mode[0].channels;
879 spec->multiout.num_dacs = preset->num_dacs;
880 spec->multiout.dac_nids = preset->dac_nids;
881 spec->multiout.dig_out_nid = preset->dig_out_nid;
882 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
883 spec->multiout.hp_nid = preset->hp_nid;
885 spec->num_mux_defs = preset->num_mux_defs;
886 if (!spec->num_mux_defs)
887 spec->num_mux_defs = 1;
888 spec->input_mux = preset->input_mux;
890 spec->num_adc_nids = preset->num_adc_nids;
891 spec->adc_nids = preset->adc_nids;
892 spec->capsrc_nids = preset->capsrc_nids;
893 spec->dig_in_nid = preset->dig_in_nid;
895 spec->unsol_event = preset->unsol_event;
896 spec->init_hook = preset->init_hook;
897 #ifdef CONFIG_SND_HDA_POWER_SAVE
898 spec->loopback.amplist = preset->loopbacks;
902 preset->setup(codec);
905 /* Enable GPIO mask and set output */
906 static struct hda_verb alc_gpio1_init_verbs[] = {
907 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
908 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
909 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
913 static struct hda_verb alc_gpio2_init_verbs[] = {
914 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
915 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
916 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
920 static struct hda_verb alc_gpio3_init_verbs[] = {
921 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
922 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
923 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
928 * Fix hardware PLL issue
929 * On some codecs, the analog PLL gating control must be off while
930 * the default value is 1.
932 static void alc_fix_pll(struct hda_codec *codec)
934 struct alc_spec *spec = codec->spec;
939 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
941 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
942 AC_VERB_GET_PROC_COEF, 0);
943 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
945 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
946 val & ~(1 << spec->pll_coef_bit));
949 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
950 unsigned int coef_idx, unsigned int coef_bit)
952 struct alc_spec *spec = codec->spec;
954 spec->pll_coef_idx = coef_idx;
955 spec->pll_coef_bit = coef_bit;
959 static void alc_automute_pin(struct hda_codec *codec)
961 struct alc_spec *spec = codec->spec;
962 unsigned int present, pincap;
963 unsigned int nid = spec->autocfg.hp_pins[0];
966 pincap = snd_hda_query_pin_caps(codec, nid);
967 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
968 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
969 present = snd_hda_codec_read(codec, nid, 0,
970 AC_VERB_GET_PIN_SENSE, 0);
971 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
972 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
973 nid = spec->autocfg.speaker_pins[i];
976 snd_hda_codec_write(codec, nid, 0,
977 AC_VERB_SET_PIN_WIDGET_CONTROL,
978 spec->jack_present ? 0 : PIN_OUT);
982 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
985 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
988 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
989 for (i = 0; i < nums; i++)
995 static void alc_mic_automute(struct hda_codec *codec)
997 struct alc_spec *spec = codec->spec;
998 struct alc_mic_route *dead, *alive;
999 unsigned int present, type;
1002 if (!spec->auto_mic)
1004 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1006 if (snd_BUG_ON(!spec->adc_nids))
1009 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1011 present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0,
1012 AC_VERB_GET_PIN_SENSE, 0);
1013 present &= AC_PINSENSE_PRESENCE;
1015 alive = &spec->ext_mic;
1016 dead = &spec->int_mic;
1018 alive = &spec->int_mic;
1019 dead = &spec->ext_mic;
1022 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1023 if (type == AC_WID_AUD_MIX) {
1024 /* Matrix-mixer style (e.g. ALC882) */
1025 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1028 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1030 HDA_AMP_MUTE, HDA_AMP_MUTE);
1032 /* MUX style (e.g. ALC880) */
1033 snd_hda_codec_write_cache(codec, cap_nid, 0,
1034 AC_VERB_SET_CONNECT_SEL,
1038 /* FIXME: analog mixer */
1041 /* unsolicited event for HP jack sensing */
1042 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1044 if (codec->vendor_id == 0x10ec0880)
1049 case ALC880_HP_EVENT:
1050 alc_automute_pin(codec);
1052 case ALC880_MIC_EVENT:
1053 alc_mic_automute(codec);
1058 static void alc_inithook(struct hda_codec *codec)
1060 alc_automute_pin(codec);
1061 alc_mic_automute(codec);
1064 /* additional initialization for ALC888 variants */
1065 static void alc888_coef_init(struct hda_codec *codec)
1069 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1070 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1071 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1072 if ((tmp & 0xf0) == 0x20)
1074 snd_hda_codec_read(codec, 0x20, 0,
1075 AC_VERB_SET_PROC_COEF, 0x830);
1078 snd_hda_codec_read(codec, 0x20, 0,
1079 AC_VERB_SET_PROC_COEF, 0x3030);
1082 static void alc889_coef_init(struct hda_codec *codec)
1086 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1087 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1088 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1089 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1092 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1097 case ALC_INIT_GPIO1:
1098 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1100 case ALC_INIT_GPIO2:
1101 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1103 case ALC_INIT_GPIO3:
1104 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1106 case ALC_INIT_DEFAULT:
1107 switch (codec->vendor_id) {
1109 snd_hda_codec_write(codec, 0x0f, 0,
1110 AC_VERB_SET_EAPD_BTLENABLE, 2);
1111 snd_hda_codec_write(codec, 0x10, 0,
1112 AC_VERB_SET_EAPD_BTLENABLE, 2);
1124 snd_hda_codec_write(codec, 0x14, 0,
1125 AC_VERB_SET_EAPD_BTLENABLE, 2);
1126 snd_hda_codec_write(codec, 0x15, 0,
1127 AC_VERB_SET_EAPD_BTLENABLE, 2);
1130 switch (codec->vendor_id) {
1132 snd_hda_codec_write(codec, 0x1a, 0,
1133 AC_VERB_SET_COEF_INDEX, 7);
1134 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1135 AC_VERB_GET_PROC_COEF, 0);
1136 snd_hda_codec_write(codec, 0x1a, 0,
1137 AC_VERB_SET_COEF_INDEX, 7);
1138 snd_hda_codec_write(codec, 0x1a, 0,
1139 AC_VERB_SET_PROC_COEF,
1149 alc889_coef_init(codec);
1152 alc888_coef_init(codec);
1156 snd_hda_codec_write(codec, 0x20, 0,
1157 AC_VERB_SET_COEF_INDEX, 7);
1158 tmp = snd_hda_codec_read(codec, 0x20, 0,
1159 AC_VERB_GET_PROC_COEF, 0);
1160 snd_hda_codec_write(codec, 0x20, 0,
1161 AC_VERB_SET_COEF_INDEX, 7);
1162 snd_hda_codec_write(codec, 0x20, 0,
1163 AC_VERB_SET_PROC_COEF,
1171 static void alc_init_auto_hp(struct hda_codec *codec)
1173 struct alc_spec *spec = codec->spec;
1175 if (!spec->autocfg.hp_pins[0])
1178 if (!spec->autocfg.speaker_pins[0]) {
1179 if (spec->autocfg.line_out_pins[0] &&
1180 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1181 spec->autocfg.speaker_pins[0] =
1182 spec->autocfg.line_out_pins[0];
1187 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1188 spec->autocfg.hp_pins[0]);
1189 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1190 AC_VERB_SET_UNSOLICITED_ENABLE,
1191 AC_USRSP_EN | ALC880_HP_EVENT);
1192 spec->unsol_event = alc_sku_unsol_event;
1195 static void alc_init_auto_mic(struct hda_codec *codec)
1197 struct alc_spec *spec = codec->spec;
1198 struct auto_pin_cfg *cfg = &spec->autocfg;
1199 hda_nid_t fixed, ext;
1202 /* there must be only two mic inputs exclusively */
1203 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1204 if (cfg->input_pins[i])
1208 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1209 hda_nid_t nid = cfg->input_pins[i];
1210 unsigned int defcfg;
1213 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1214 switch (get_defcfg_connect(defcfg)) {
1215 case AC_JACK_PORT_FIXED:
1217 return; /* already occupied */
1220 case AC_JACK_PORT_COMPLEX:
1222 return; /* already occupied */
1226 return; /* invalid entry */
1229 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1230 return; /* no unsol support */
1231 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1233 spec->ext_mic.pin = ext;
1234 spec->int_mic.pin = fixed;
1235 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1236 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1238 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1239 AC_VERB_SET_UNSOLICITED_ENABLE,
1240 AC_USRSP_EN | ALC880_MIC_EVENT);
1241 spec->unsol_event = alc_sku_unsol_event;
1244 /* check subsystem ID and set up device-specific initialization;
1245 * return 1 if initialized, 0 if invalid SSID
1247 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1248 * 31 ~ 16 : Manufacture ID
1250 * 7 ~ 0 : Assembly ID
1251 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1253 static int alc_subsystem_id(struct hda_codec *codec,
1254 hda_nid_t porta, hda_nid_t porte,
1257 unsigned int ass, tmp, i;
1259 struct alc_spec *spec = codec->spec;
1261 ass = codec->subsystem_id & 0xffff;
1262 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1265 /* invalid SSID, check the special NID pin defcfg instead */
1267 * 31~30 : port connectivity
1270 * 19~16 : Check sum (15:1)
1275 if (codec->vendor_id == 0x10ec0260)
1277 ass = snd_hda_codec_get_pincfg(codec, nid);
1278 snd_printd("realtek: No valid SSID, "
1279 "checking pincfg 0x%08x for NID 0x%x\n",
1281 if (!(ass & 1) && !(ass & 0x100000))
1283 if ((ass >> 30) != 1) /* no physical connection */
1288 for (i = 1; i < 16; i++) {
1292 if (((ass >> 16) & 0xf) != tmp)
1295 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1296 ass & 0xffff, codec->vendor_id);
1300 * 2 : 0 --> Desktop, 1 --> Laptop
1301 * 3~5 : External Amplifier control
1304 tmp = (ass & 0x38) >> 3; /* external Amp control */
1307 spec->init_amp = ALC_INIT_GPIO1;
1310 spec->init_amp = ALC_INIT_GPIO2;
1313 spec->init_amp = ALC_INIT_GPIO3;
1316 spec->init_amp = ALC_INIT_DEFAULT;
1320 /* is laptop or Desktop and enable the function "Mute internal speaker
1321 * when the external headphone out jack is plugged"
1323 if (!(ass & 0x8000))
1326 * 10~8 : Jack location
1327 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1329 * 15 : 1 --> enable the function "Mute internal speaker
1330 * when the external headphone out jack is plugged"
1332 if (!spec->autocfg.hp_pins[0]) {
1333 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1335 spec->autocfg.hp_pins[0] = porta;
1337 spec->autocfg.hp_pins[0] = porte;
1339 spec->autocfg.hp_pins[0] = portd;
1344 alc_init_auto_hp(codec);
1345 alc_init_auto_mic(codec);
1349 static void alc_ssid_check(struct hda_codec *codec,
1350 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1352 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1353 struct alc_spec *spec = codec->spec;
1354 snd_printd("realtek: "
1355 "Enable default setup for auto mode as fallback\n");
1356 spec->init_amp = ALC_INIT_DEFAULT;
1357 alc_init_auto_hp(codec);
1358 alc_init_auto_mic(codec);
1363 * Fix-up pin default configurations
1371 static void alc_fix_pincfg(struct hda_codec *codec,
1372 const struct snd_pci_quirk *quirk,
1373 const struct alc_pincfg **pinfix)
1375 const struct alc_pincfg *cfg;
1377 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1381 cfg = pinfix[quirk->value];
1382 for (; cfg->nid; cfg++)
1383 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1393 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1394 /* Mic-in jack as mic in */
1395 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1396 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1397 /* Line-in jack as Line in */
1398 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1399 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1400 /* Line-Out as Front */
1401 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1408 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1409 /* Mic-in jack as mic in */
1410 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1411 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1412 /* Line-in jack as Surround */
1413 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1414 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1415 /* Line-Out as Front */
1416 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1423 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1424 /* Mic-in jack as CLFE */
1425 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1426 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1427 /* Line-in jack as Surround */
1428 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1429 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1430 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1431 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1438 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1439 /* Mic-in jack as CLFE */
1440 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1441 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1442 /* Line-in jack as Surround */
1443 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1444 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1445 /* Line-Out as Side */
1446 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1450 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1451 { 2, alc888_4ST_ch2_intel_init },
1452 { 4, alc888_4ST_ch4_intel_init },
1453 { 6, alc888_4ST_ch6_intel_init },
1454 { 8, alc888_4ST_ch8_intel_init },
1458 * ALC888 Fujitsu Siemens Amillo xa3530
1461 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1462 /* Front Mic: set to PIN_IN (empty by default) */
1463 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1464 /* Connect Internal HP to Front */
1465 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1466 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1467 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1468 /* Connect Bass HP to Front */
1469 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1470 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1471 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1472 /* Connect Line-Out side jack (SPDIF) to Side */
1473 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1474 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1475 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1476 /* Connect Mic jack to CLFE */
1477 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1478 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1479 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1480 /* Connect Line-in jack to Surround */
1481 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1482 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1483 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1484 /* Connect HP out jack to Front */
1485 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1486 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1487 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1488 /* Enable unsolicited event for HP jack and Line-out jack */
1489 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1490 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1494 static void alc_automute_amp(struct hda_codec *codec)
1496 struct alc_spec *spec = codec->spec;
1497 unsigned int val, mute, pincap;
1501 spec->jack_present = 0;
1502 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1503 nid = spec->autocfg.hp_pins[i];
1506 pincap = snd_hda_query_pin_caps(codec, nid);
1507 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1508 snd_hda_codec_read(codec, nid, 0,
1509 AC_VERB_SET_PIN_SENSE, 0);
1510 val = snd_hda_codec_read(codec, nid, 0,
1511 AC_VERB_GET_PIN_SENSE, 0);
1512 if (val & AC_PINSENSE_PRESENCE) {
1513 spec->jack_present = 1;
1518 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1519 /* Toggle internal speakers muting */
1520 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1521 nid = spec->autocfg.speaker_pins[i];
1524 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1525 HDA_AMP_MUTE, mute);
1529 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1532 if (codec->vendor_id == 0x10ec0880)
1536 if (res == ALC880_HP_EVENT)
1537 alc_automute_amp(codec);
1540 static void alc889_automute_setup(struct hda_codec *codec)
1542 struct alc_spec *spec = codec->spec;
1544 spec->autocfg.hp_pins[0] = 0x15;
1545 spec->autocfg.speaker_pins[0] = 0x14;
1546 spec->autocfg.speaker_pins[1] = 0x16;
1547 spec->autocfg.speaker_pins[2] = 0x17;
1548 spec->autocfg.speaker_pins[3] = 0x19;
1549 spec->autocfg.speaker_pins[4] = 0x1a;
1552 static void alc889_intel_init_hook(struct hda_codec *codec)
1554 alc889_coef_init(codec);
1555 alc_automute_amp(codec);
1558 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1560 struct alc_spec *spec = codec->spec;
1562 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1563 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1564 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1565 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1569 * ALC888 Acer Aspire 4930G model
1572 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1573 /* Front Mic: set to PIN_IN (empty by default) */
1574 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1575 /* Unselect Front Mic by default in input mixer 3 */
1576 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1577 /* Enable unsolicited event for HP jack */
1578 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1579 /* Connect Internal HP to front */
1580 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1581 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1582 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1583 /* Connect HP out to front */
1584 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1585 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1586 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1591 * ALC888 Acer Aspire 6530G model
1594 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1595 /* Bias voltage on for external mic port */
1596 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1597 /* Front Mic: set to PIN_IN (empty by default) */
1598 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1599 /* Unselect Front Mic by default in input mixer 3 */
1600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1601 /* Enable unsolicited event for HP jack */
1602 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1603 /* Enable speaker output */
1604 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1605 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1606 /* Enable headphone output */
1607 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1608 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1609 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1614 * ALC889 Acer Aspire 8930G model
1617 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1618 /* Front Mic: set to PIN_IN (empty by default) */
1619 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1620 /* Unselect Front Mic by default in input mixer 3 */
1621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1622 /* Enable unsolicited event for HP jack */
1623 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1624 /* Connect Internal Front to Front */
1625 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1626 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1627 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1628 /* Connect Internal Rear to Rear */
1629 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1630 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1631 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1632 /* Connect Internal CLFE to CLFE */
1633 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1634 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1635 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1636 /* Connect HP out to Front */
1637 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1639 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1640 /* Enable all DACs */
1641 /* DAC DISABLE/MUTE 1? */
1642 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1643 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1644 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1645 /* DAC DISABLE/MUTE 2? */
1646 /* some bit here disables the other DACs. Init=0x4900 */
1647 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1648 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1649 /* Enable amplifiers */
1650 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1651 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1653 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1654 * which makes the stereo useless. However, either the mic or the ALC889
1655 * makes the signal become a difference/sum signal instead of standard
1656 * stereo, which is annoying. So instead we flip this bit which makes the
1657 * codec replicate the sum signal to both channels, turning it into a
1660 /* DMIC_CONTROL? Init value = 0x0001 */
1661 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1662 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1666 static struct hda_input_mux alc888_2_capture_sources[2] = {
1667 /* Front mic only available on one ADC */
1674 { "Front Mic", 0xb },
1687 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1688 /* Interal mic only available on one ADC */
1695 { "Input Mix", 0xa },
1705 { "Input Mix", 0xa },
1710 static struct hda_input_mux alc889_capture_sources[3] = {
1711 /* Digital mic only available on first "ADC" */
1718 { "Front Mic", 0xb },
1719 { "Input Mix", 0xa },
1728 { "Input Mix", 0xa },
1737 { "Input Mix", 0xa },
1742 static struct snd_kcontrol_new alc888_base_mixer[] = {
1743 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1744 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1745 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1746 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1747 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1749 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1750 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1751 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1752 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1753 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1754 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1755 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1756 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1757 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1758 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1759 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1760 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1764 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1766 struct alc_spec *spec = codec->spec;
1768 spec->autocfg.hp_pins[0] = 0x15;
1769 spec->autocfg.speaker_pins[0] = 0x14;
1772 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1774 struct alc_spec *spec = codec->spec;
1776 spec->autocfg.hp_pins[0] = 0x15;
1777 spec->autocfg.speaker_pins[0] = 0x14;
1778 spec->autocfg.speaker_pins[1] = 0x16;
1779 spec->autocfg.speaker_pins[2] = 0x17;
1782 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1784 struct alc_spec *spec = codec->spec;
1786 spec->autocfg.hp_pins[0] = 0x15;
1787 spec->autocfg.speaker_pins[0] = 0x14;
1788 spec->autocfg.speaker_pins[1] = 0x16;
1789 spec->autocfg.speaker_pins[2] = 0x1b;
1793 * ALC880 3-stack model
1795 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1796 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1797 * F-Mic = 0x1b, HP = 0x19
1800 static hda_nid_t alc880_dac_nids[4] = {
1801 /* front, rear, clfe, rear_surr */
1802 0x02, 0x05, 0x04, 0x03
1805 static hda_nid_t alc880_adc_nids[3] = {
1810 /* The datasheet says the node 0x07 is connected from inputs,
1811 * but it shows zero connection in the real implementation on some devices.
1812 * Note: this is a 915GAV bug, fixed on 915GLV
1814 static hda_nid_t alc880_adc_nids_alt[2] = {
1819 #define ALC880_DIGOUT_NID 0x06
1820 #define ALC880_DIGIN_NID 0x0a
1822 static struct hda_input_mux alc880_capture_source = {
1826 { "Front Mic", 0x3 },
1832 /* channel source setting (2/6 channel selection for 3-stack) */
1834 static struct hda_verb alc880_threestack_ch2_init[] = {
1835 /* set line-in to input, mute it */
1836 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1837 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1838 /* set mic-in to input vref 80%, mute it */
1839 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1840 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1845 static struct hda_verb alc880_threestack_ch6_init[] = {
1846 /* set line-in to output, unmute it */
1847 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1848 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1849 /* set mic-in to output, unmute it */
1850 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1851 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1855 static struct hda_channel_mode alc880_threestack_modes[2] = {
1856 { 2, alc880_threestack_ch2_init },
1857 { 6, alc880_threestack_ch6_init },
1860 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1861 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1862 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1863 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1864 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1865 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1866 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1867 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1868 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1869 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1870 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1871 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1872 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1874 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1875 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1876 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1877 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1879 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1880 .name = "Channel Mode",
1881 .info = alc_ch_mode_info,
1882 .get = alc_ch_mode_get,
1883 .put = alc_ch_mode_put,
1888 /* capture mixer elements */
1889 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1890 struct snd_ctl_elem_info *uinfo)
1892 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1893 struct alc_spec *spec = codec->spec;
1896 mutex_lock(&codec->control_mutex);
1897 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1899 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1900 mutex_unlock(&codec->control_mutex);
1904 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1905 unsigned int size, unsigned int __user *tlv)
1907 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1908 struct alc_spec *spec = codec->spec;
1911 mutex_lock(&codec->control_mutex);
1912 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1914 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1915 mutex_unlock(&codec->control_mutex);
1919 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1920 struct snd_ctl_elem_value *ucontrol);
1922 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1923 struct snd_ctl_elem_value *ucontrol,
1926 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1927 struct alc_spec *spec = codec->spec;
1928 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1931 mutex_lock(&codec->control_mutex);
1932 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1934 err = func(kcontrol, ucontrol);
1935 mutex_unlock(&codec->control_mutex);
1939 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1940 struct snd_ctl_elem_value *ucontrol)
1942 return alc_cap_getput_caller(kcontrol, ucontrol,
1943 snd_hda_mixer_amp_volume_get);
1946 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1947 struct snd_ctl_elem_value *ucontrol)
1949 return alc_cap_getput_caller(kcontrol, ucontrol,
1950 snd_hda_mixer_amp_volume_put);
1953 /* capture mixer elements */
1954 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1956 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1957 struct snd_ctl_elem_value *ucontrol)
1959 return alc_cap_getput_caller(kcontrol, ucontrol,
1960 snd_hda_mixer_amp_switch_get);
1963 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1964 struct snd_ctl_elem_value *ucontrol)
1966 return alc_cap_getput_caller(kcontrol, ucontrol,
1967 snd_hda_mixer_amp_switch_put);
1970 #define _DEFINE_CAPMIX(num) \
1972 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1973 .name = "Capture Switch", \
1974 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1976 .info = alc_cap_sw_info, \
1977 .get = alc_cap_sw_get, \
1978 .put = alc_cap_sw_put, \
1981 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1982 .name = "Capture Volume", \
1983 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1984 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1985 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1987 .info = alc_cap_vol_info, \
1988 .get = alc_cap_vol_get, \
1989 .put = alc_cap_vol_put, \
1990 .tlv = { .c = alc_cap_vol_tlv }, \
1993 #define _DEFINE_CAPSRC(num) \
1995 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1996 /* .name = "Capture Source", */ \
1997 .name = "Input Source", \
1999 .info = alc_mux_enum_info, \
2000 .get = alc_mux_enum_get, \
2001 .put = alc_mux_enum_put, \
2004 #define DEFINE_CAPMIX(num) \
2005 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2006 _DEFINE_CAPMIX(num), \
2007 _DEFINE_CAPSRC(num), \
2011 #define DEFINE_CAPMIX_NOSRC(num) \
2012 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2013 _DEFINE_CAPMIX(num), \
2017 /* up to three ADCs */
2021 DEFINE_CAPMIX_NOSRC(1);
2022 DEFINE_CAPMIX_NOSRC(2);
2023 DEFINE_CAPMIX_NOSRC(3);
2026 * ALC880 5-stack model
2028 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2030 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2031 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2034 /* additional mixers to alc880_three_stack_mixer */
2035 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2036 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2037 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2041 /* channel source setting (6/8 channel selection for 5-stack) */
2043 static struct hda_verb alc880_fivestack_ch6_init[] = {
2044 /* set line-in to input, mute it */
2045 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2046 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2051 static struct hda_verb alc880_fivestack_ch8_init[] = {
2052 /* set line-in to output, unmute it */
2053 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2054 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2058 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2059 { 6, alc880_fivestack_ch6_init },
2060 { 8, alc880_fivestack_ch8_init },
2065 * ALC880 6-stack model
2067 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2068 * Side = 0x05 (0x0f)
2069 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2070 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2073 static hda_nid_t alc880_6st_dac_nids[4] = {
2074 /* front, rear, clfe, rear_surr */
2075 0x02, 0x03, 0x04, 0x05
2078 static struct hda_input_mux alc880_6stack_capture_source = {
2082 { "Front Mic", 0x1 },
2088 /* fixed 8-channels */
2089 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2093 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2094 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2095 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2096 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2097 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2098 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2099 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2100 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2101 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2102 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2103 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2104 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2105 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2106 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2107 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2110 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2111 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2113 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2114 .name = "Channel Mode",
2115 .info = alc_ch_mode_info,
2116 .get = alc_ch_mode_get,
2117 .put = alc_ch_mode_put,
2126 * W810 has rear IO for:
2129 * Center/LFE (DAC 04)
2132 * The system also has a pair of internal speakers, and a headphone jack.
2133 * These are both connected to Line2 on the codec, hence to DAC 02.
2135 * There is a variable resistor to control the speaker or headphone
2136 * volume. This is a hardware-only device without a software API.
2138 * Plugging headphones in will disable the internal speakers. This is
2139 * implemented in hardware, not via the driver using jack sense. In
2140 * a similar fashion, plugging into the rear socket marked "front" will
2141 * disable both the speakers and headphones.
2143 * For input, there's a microphone jack, and an "audio in" jack.
2144 * These may not do anything useful with this driver yet, because I
2145 * haven't setup any initialization verbs for these yet...
2148 static hda_nid_t alc880_w810_dac_nids[3] = {
2149 /* front, rear/surround, clfe */
2153 /* fixed 6 channels */
2154 static struct hda_channel_mode alc880_w810_modes[1] = {
2158 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2159 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2160 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2161 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2162 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2163 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2164 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2165 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2166 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2167 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2168 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2176 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2177 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2181 static hda_nid_t alc880_z71v_dac_nids[1] = {
2184 #define ALC880_Z71V_HP_DAC 0x03
2186 /* fixed 2 channels */
2187 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2191 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2192 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2193 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2194 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2195 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2196 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2197 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2199 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2205 * ALC880 F1734 model
2207 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2208 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2211 static hda_nid_t alc880_f1734_dac_nids[1] = {
2214 #define ALC880_F1734_HP_DAC 0x02
2216 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2217 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2218 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2219 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2220 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2221 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2222 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2228 static struct hda_input_mux alc880_f1734_capture_source = {
2240 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2241 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2242 * Mic = 0x18, Line = 0x1a
2245 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2246 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2248 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2249 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2250 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2251 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2252 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2253 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2254 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2255 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2256 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2257 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2258 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2259 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2260 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2261 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2262 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2264 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2265 .name = "Channel Mode",
2266 .info = alc_ch_mode_info,
2267 .get = alc_ch_mode_get,
2268 .put = alc_ch_mode_put,
2274 * ALC880 ASUS W1V model
2276 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2277 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2278 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2281 /* additional mixers to alc880_asus_mixer */
2282 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2283 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2284 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2289 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2290 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2291 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2292 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2293 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2294 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2296 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2297 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2298 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2303 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2304 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2305 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2306 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2307 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2308 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2309 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2310 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2311 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2312 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2313 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2314 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2315 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2316 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2317 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2318 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2319 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2321 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2322 .name = "Channel Mode",
2323 .info = alc_ch_mode_info,
2324 .get = alc_ch_mode_get,
2325 .put = alc_ch_mode_put,
2330 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2331 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2332 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2333 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2334 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 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("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2338 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2339 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2340 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2344 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2345 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2346 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2347 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2348 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2349 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2350 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2355 * virtual master controls
2359 * slave controls for virtual master
2361 static const char *alc_slave_vols[] = {
2362 "Front Playback Volume",
2363 "Surround Playback Volume",
2364 "Center Playback Volume",
2365 "LFE Playback Volume",
2366 "Side Playback Volume",
2367 "Headphone Playback Volume",
2368 "Speaker Playback Volume",
2369 "Mono Playback Volume",
2370 "Line-Out Playback Volume",
2371 "PCM Playback Volume",
2375 static const char *alc_slave_sws[] = {
2376 "Front Playback Switch",
2377 "Surround Playback Switch",
2378 "Center Playback Switch",
2379 "LFE Playback Switch",
2380 "Side Playback Switch",
2381 "Headphone Playback Switch",
2382 "Speaker Playback Switch",
2383 "Mono Playback Switch",
2384 "IEC958 Playback Switch",
2389 * build control elements
2392 static void alc_free_kctls(struct hda_codec *codec);
2394 /* additional beep mixers; the actual parameters are overwritten at build */
2395 static struct snd_kcontrol_new alc_beep_mixer[] = {
2396 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2397 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2401 static int alc_build_controls(struct hda_codec *codec)
2403 struct alc_spec *spec = codec->spec;
2407 for (i = 0; i < spec->num_mixers; i++) {
2408 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2412 if (spec->cap_mixer) {
2413 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2417 if (spec->multiout.dig_out_nid) {
2418 err = snd_hda_create_spdif_out_ctls(codec,
2419 spec->multiout.dig_out_nid);
2422 if (!spec->no_analog) {
2423 err = snd_hda_create_spdif_share_sw(codec,
2427 spec->multiout.share_spdif = 1;
2430 if (spec->dig_in_nid) {
2431 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2436 /* create beep controls if needed */
2437 if (spec->beep_amp) {
2438 struct snd_kcontrol_new *knew;
2439 for (knew = alc_beep_mixer; knew->name; knew++) {
2440 struct snd_kcontrol *kctl;
2441 kctl = snd_ctl_new1(knew, codec);
2444 kctl->private_value = spec->beep_amp;
2445 err = snd_hda_ctl_add(codec, kctl);
2451 /* if we have no master control, let's create it */
2452 if (!spec->no_analog &&
2453 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2454 unsigned int vmaster_tlv[4];
2455 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2456 HDA_OUTPUT, vmaster_tlv);
2457 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2458 vmaster_tlv, alc_slave_vols);
2462 if (!spec->no_analog &&
2463 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2464 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2465 NULL, alc_slave_sws);
2470 alc_free_kctls(codec); /* no longer needed */
2476 * initialize the codec volumes, etc
2480 * generic initialization of ADC, input mixers and output mixers
2482 static struct hda_verb alc880_volume_init_verbs[] = {
2484 * Unmute ADC0-2 and set the default input to mic-in
2486 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2488 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2489 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2490 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2491 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2493 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2495 * Note: PASD motherboards uses the Line In 2 as the input for front
2498 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2499 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2500 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2501 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2502 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2503 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2508 * Set up output mixers (0x0c - 0x0f)
2510 /* set vol=0 to output mixers */
2511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2512 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2513 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2514 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2515 /* set up input amps for analog loopback */
2516 /* Amp Indices: DAC = 0, mixer = 1 */
2517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2519 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2520 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2521 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2522 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2523 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2524 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2530 * 3-stack pin configuration:
2531 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2533 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2535 * preset connection lists of input pins
2536 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2538 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2539 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2540 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2543 * Set pin mode and muting
2545 /* set front pin widgets 0x14 for output */
2546 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2548 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2549 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2550 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2551 /* Mic2 (as headphone out) for HP output */
2552 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2553 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2554 /* Line In pin widget for input */
2555 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2556 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2557 /* Line2 (as front mic) pin widget for input and vref at 80% */
2558 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2559 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2560 /* CD pin widget for input */
2561 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2567 * 5-stack pin configuration:
2568 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2569 * line-in/side = 0x1a, f-mic = 0x1b
2571 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2573 * preset connection lists of input pins
2574 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2576 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2577 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2580 * Set pin mode and muting
2582 /* set pin widgets 0x14-0x17 for output */
2583 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2584 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2585 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2586 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2587 /* unmute pins for output (no gain on this amp) */
2588 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2589 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2590 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2591 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2593 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2594 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2595 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2596 /* Mic2 (as headphone out) for HP output */
2597 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2598 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2599 /* Line In pin widget for input */
2600 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2601 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2602 /* Line2 (as front mic) pin widget for input and vref at 80% */
2603 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2604 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2605 /* CD pin widget for input */
2606 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2612 * W810 pin configuration:
2613 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2615 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2616 /* hphone/speaker input selector: front DAC */
2617 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2619 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2620 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2621 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2622 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2623 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2624 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2626 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2627 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2633 * Z71V pin configuration:
2634 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2636 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2637 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2638 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2639 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2640 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2642 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2643 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2644 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2645 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2651 * 6-stack pin configuration:
2652 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2653 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2655 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2656 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2658 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2659 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2660 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2661 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2662 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2663 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2664 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2665 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2667 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2668 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2669 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2670 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2671 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2672 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2673 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2674 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2675 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2681 * Uniwill pin configuration:
2682 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2685 static struct hda_verb alc880_uniwill_init_verbs[] = {
2686 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2689 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2690 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2692 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2693 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2694 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2695 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2696 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2697 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2698 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2699 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2700 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2701 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2703 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2704 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2705 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2706 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2707 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2708 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2709 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2710 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2711 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2713 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2714 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2721 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2723 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2724 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2726 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2727 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2728 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2729 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2730 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2731 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2733 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2734 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2735 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2736 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2737 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2739 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2740 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2741 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2742 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2743 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2744 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2746 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2747 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2752 static struct hda_verb alc880_beep_init_verbs[] = {
2753 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2757 /* auto-toggle front mic */
2758 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2760 unsigned int present;
2763 present = snd_hda_codec_read(codec, 0x18, 0,
2764 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2765 bits = present ? HDA_AMP_MUTE : 0;
2766 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2769 static void alc880_uniwill_setup(struct hda_codec *codec)
2771 struct alc_spec *spec = codec->spec;
2773 spec->autocfg.hp_pins[0] = 0x14;
2774 spec->autocfg.speaker_pins[0] = 0x15;
2775 spec->autocfg.speaker_pins[0] = 0x16;
2778 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2780 alc_automute_amp(codec);
2781 alc880_uniwill_mic_automute(codec);
2784 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2787 /* Looks like the unsol event is incompatible with the standard
2788 * definition. 4bit tag is placed at 28 bit!
2790 switch (res >> 28) {
2791 case ALC880_MIC_EVENT:
2792 alc880_uniwill_mic_automute(codec);
2795 alc_automute_amp_unsol_event(codec, res);
2800 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2802 struct alc_spec *spec = codec->spec;
2804 spec->autocfg.hp_pins[0] = 0x14;
2805 spec->autocfg.speaker_pins[0] = 0x15;
2808 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2810 unsigned int present;
2812 present = snd_hda_codec_read(codec, 0x21, 0,
2813 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2814 present &= HDA_AMP_VOLMASK;
2815 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2816 HDA_AMP_VOLMASK, present);
2817 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2818 HDA_AMP_VOLMASK, present);
2821 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2824 /* Looks like the unsol event is incompatible with the standard
2825 * definition. 4bit tag is placed at 28 bit!
2827 if ((res >> 28) == ALC880_DCVOL_EVENT)
2828 alc880_uniwill_p53_dcvol_automute(codec);
2830 alc_automute_amp_unsol_event(codec, res);
2834 * F1734 pin configuration:
2835 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2837 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2838 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2839 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2840 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2841 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2842 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2844 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2845 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2846 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2847 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2849 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2850 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2851 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2852 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2853 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2854 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2855 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2856 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2857 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2859 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2860 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2866 * ASUS pin configuration:
2867 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2869 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2870 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2871 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2872 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2873 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2875 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2876 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2877 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2878 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2879 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2880 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2881 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2882 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2884 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2885 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2886 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2887 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2888 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2889 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2890 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2891 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2892 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2897 /* Enable GPIO mask and set output */
2898 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2899 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2900 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2902 /* Clevo m520g init */
2903 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2904 /* headphone output */
2905 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2907 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2908 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2910 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2911 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2913 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2914 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2915 /* Mic1 (rear panel) */
2916 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2917 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2918 /* Mic2 (front panel) */
2919 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2920 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2922 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2923 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2924 /* change to EAPD mode */
2925 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2926 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2931 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2932 /* change to EAPD mode */
2933 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2934 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2936 /* Headphone output */
2937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2939 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2940 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2942 /* Line In pin widget for input */
2943 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2944 /* CD pin widget for input */
2945 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2946 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2947 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2949 /* change to EAPD mode */
2950 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2951 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2957 * LG m1 express dual
2960 * Rear Line-In/Out (blue): 0x14
2961 * Build-in Mic-In: 0x15
2963 * HP-Out (green): 0x1b
2964 * Mic-In/Out (red): 0x19
2968 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2969 static hda_nid_t alc880_lg_dac_nids[3] = {
2973 /* seems analog CD is not working */
2974 static struct hda_input_mux alc880_lg_capture_source = {
2979 { "Internal Mic", 0x6 },
2983 /* 2,4,6 channel modes */
2984 static struct hda_verb alc880_lg_ch2_init[] = {
2985 /* set line-in and mic-in to input */
2986 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2987 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2991 static struct hda_verb alc880_lg_ch4_init[] = {
2992 /* set line-in to out and mic-in to input */
2993 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2994 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2998 static struct hda_verb alc880_lg_ch6_init[] = {
2999 /* set line-in and mic-in to output */
3000 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3001 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3005 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3006 { 2, alc880_lg_ch2_init },
3007 { 4, alc880_lg_ch4_init },
3008 { 6, alc880_lg_ch6_init },
3011 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3012 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3013 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3014 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3015 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3016 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3017 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3018 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3019 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3022 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3023 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3024 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3025 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3027 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3028 .name = "Channel Mode",
3029 .info = alc_ch_mode_info,
3030 .get = alc_ch_mode_get,
3031 .put = alc_ch_mode_put,
3036 static struct hda_verb alc880_lg_init_verbs[] = {
3037 /* set capture source to mic-in */
3038 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3039 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3040 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3041 /* mute all amp mixer inputs */
3042 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3044 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3045 /* line-in to input */
3046 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3047 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3049 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3050 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3052 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3053 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3054 /* mic-in to input */
3055 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3056 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3057 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3059 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3060 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3061 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3063 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3067 /* toggle speaker-output according to the hp-jack state */
3068 static void alc880_lg_setup(struct hda_codec *codec)
3070 struct alc_spec *spec = codec->spec;
3072 spec->autocfg.hp_pins[0] = 0x1b;
3073 spec->autocfg.speaker_pins[0] = 0x17;
3082 * Built-in Mic-In: 0x19
3088 static struct hda_input_mux alc880_lg_lw_capture_source = {
3092 { "Internal Mic", 0x1 },
3097 #define alc880_lg_lw_modes alc880_threestack_modes
3099 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3100 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3101 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3102 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3103 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3104 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3105 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3106 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3107 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3108 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3109 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3111 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3112 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3113 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3115 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3116 .name = "Channel Mode",
3117 .info = alc_ch_mode_info,
3118 .get = alc_ch_mode_get,
3119 .put = alc_ch_mode_put,
3124 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3125 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3126 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3127 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3129 /* set capture source to mic-in */
3130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3131 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3132 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3135 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3136 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3138 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3139 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3140 /* mic-in to input */
3141 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3142 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3144 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3145 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3147 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3151 /* toggle speaker-output according to the hp-jack state */
3152 static void alc880_lg_lw_setup(struct hda_codec *codec)
3154 struct alc_spec *spec = codec->spec;
3156 spec->autocfg.hp_pins[0] = 0x1b;
3157 spec->autocfg.speaker_pins[0] = 0x14;
3160 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3161 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3162 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3164 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3165 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3166 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3170 static struct hda_input_mux alc880_medion_rim_capture_source = {
3174 { "Internal Mic", 0x1 },
3178 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3179 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3181 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3182 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3184 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3185 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3186 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3187 /* Mic2 (as headphone out) for HP output */
3188 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3189 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3190 /* Internal Speaker */
3191 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3192 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3194 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3195 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3197 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3201 /* toggle speaker-output according to the hp-jack state */
3202 static void alc880_medion_rim_automute(struct hda_codec *codec)
3204 struct alc_spec *spec = codec->spec;
3205 alc_automute_amp(codec);
3207 if (spec->jack_present)
3208 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3210 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3213 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3216 /* Looks like the unsol event is incompatible with the standard
3217 * definition. 4bit tag is placed at 28 bit!
3219 if ((res >> 28) == ALC880_HP_EVENT)
3220 alc880_medion_rim_automute(codec);
3223 static void alc880_medion_rim_setup(struct hda_codec *codec)
3225 struct alc_spec *spec = codec->spec;
3227 spec->autocfg.hp_pins[0] = 0x14;
3228 spec->autocfg.speaker_pins[0] = 0x1b;
3231 #ifdef CONFIG_SND_HDA_POWER_SAVE
3232 static struct hda_amp_list alc880_loopbacks[] = {
3233 { 0x0b, HDA_INPUT, 0 },
3234 { 0x0b, HDA_INPUT, 1 },
3235 { 0x0b, HDA_INPUT, 2 },
3236 { 0x0b, HDA_INPUT, 3 },
3237 { 0x0b, HDA_INPUT, 4 },
3241 static struct hda_amp_list alc880_lg_loopbacks[] = {
3242 { 0x0b, HDA_INPUT, 1 },
3243 { 0x0b, HDA_INPUT, 6 },
3244 { 0x0b, HDA_INPUT, 7 },
3253 static int alc_init(struct hda_codec *codec)
3255 struct alc_spec *spec = codec->spec;
3259 alc_auto_init_amp(codec, spec->init_amp);
3261 for (i = 0; i < spec->num_init_verbs; i++)
3262 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3264 if (spec->init_hook)
3265 spec->init_hook(codec);
3270 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3272 struct alc_spec *spec = codec->spec;
3274 if (spec->unsol_event)
3275 spec->unsol_event(codec, res);
3278 #ifdef CONFIG_SND_HDA_POWER_SAVE
3279 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3281 struct alc_spec *spec = codec->spec;
3282 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3287 * Analog playback callbacks
3289 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3290 struct hda_codec *codec,
3291 struct snd_pcm_substream *substream)
3293 struct alc_spec *spec = codec->spec;
3294 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3298 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3299 struct hda_codec *codec,
3300 unsigned int stream_tag,
3301 unsigned int format,
3302 struct snd_pcm_substream *substream)
3304 struct alc_spec *spec = codec->spec;
3305 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3306 stream_tag, format, substream);
3309 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3310 struct hda_codec *codec,
3311 struct snd_pcm_substream *substream)
3313 struct alc_spec *spec = codec->spec;
3314 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3320 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3321 struct hda_codec *codec,
3322 struct snd_pcm_substream *substream)
3324 struct alc_spec *spec = codec->spec;
3325 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3328 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3329 struct hda_codec *codec,
3330 unsigned int stream_tag,
3331 unsigned int format,
3332 struct snd_pcm_substream *substream)
3334 struct alc_spec *spec = codec->spec;
3335 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3336 stream_tag, format, substream);
3339 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3340 struct hda_codec *codec,
3341 struct snd_pcm_substream *substream)
3343 struct alc_spec *spec = codec->spec;
3344 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3347 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3348 struct hda_codec *codec,
3349 struct snd_pcm_substream *substream)
3351 struct alc_spec *spec = codec->spec;
3352 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3358 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3359 struct hda_codec *codec,
3360 unsigned int stream_tag,
3361 unsigned int format,
3362 struct snd_pcm_substream *substream)
3364 struct alc_spec *spec = codec->spec;
3366 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3367 stream_tag, 0, format);
3371 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3372 struct hda_codec *codec,
3373 struct snd_pcm_substream *substream)
3375 struct alc_spec *spec = codec->spec;
3377 snd_hda_codec_cleanup_stream(codec,
3378 spec->adc_nids[substream->number + 1]);
3385 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3389 /* NID is set in alc_build_pcms */
3391 .open = alc880_playback_pcm_open,
3392 .prepare = alc880_playback_pcm_prepare,
3393 .cleanup = alc880_playback_pcm_cleanup
3397 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3401 /* NID is set in alc_build_pcms */
3404 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3408 /* NID is set in alc_build_pcms */
3411 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3412 .substreams = 2, /* can be overridden */
3415 /* NID is set in alc_build_pcms */
3417 .prepare = alc880_alt_capture_pcm_prepare,
3418 .cleanup = alc880_alt_capture_pcm_cleanup
3422 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3426 /* NID is set in alc_build_pcms */
3428 .open = alc880_dig_playback_pcm_open,
3429 .close = alc880_dig_playback_pcm_close,
3430 .prepare = alc880_dig_playback_pcm_prepare,
3431 .cleanup = alc880_dig_playback_pcm_cleanup
3435 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3439 /* NID is set in alc_build_pcms */
3442 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3443 static struct hda_pcm_stream alc_pcm_null_stream = {
3449 static int alc_build_pcms(struct hda_codec *codec)
3451 struct alc_spec *spec = codec->spec;
3452 struct hda_pcm *info = spec->pcm_rec;
3455 codec->num_pcms = 1;
3456 codec->pcm_info = info;
3458 if (spec->no_analog)
3461 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3462 "%s Analog", codec->chip_name);
3463 info->name = spec->stream_name_analog;
3465 if (spec->stream_analog_playback) {
3466 if (snd_BUG_ON(!spec->multiout.dac_nids))
3468 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3469 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3471 if (spec->stream_analog_capture) {
3472 if (snd_BUG_ON(!spec->adc_nids))
3474 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3475 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3478 if (spec->channel_mode) {
3479 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3480 for (i = 0; i < spec->num_channel_mode; i++) {
3481 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3482 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3488 /* SPDIF for stream index #1 */
3489 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3490 snprintf(spec->stream_name_digital,
3491 sizeof(spec->stream_name_digital),
3492 "%s Digital", codec->chip_name);
3493 codec->num_pcms = 2;
3494 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3495 info = spec->pcm_rec + 1;
3496 info->name = spec->stream_name_digital;
3497 if (spec->dig_out_type)
3498 info->pcm_type = spec->dig_out_type;
3500 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3501 if (spec->multiout.dig_out_nid &&
3502 spec->stream_digital_playback) {
3503 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3504 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3506 if (spec->dig_in_nid &&
3507 spec->stream_digital_capture) {
3508 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3509 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3511 /* FIXME: do we need this for all Realtek codec models? */
3512 codec->spdif_status_reset = 1;
3515 if (spec->no_analog)
3518 /* If the use of more than one ADC is requested for the current
3519 * model, configure a second analog capture-only PCM.
3521 /* Additional Analaog capture for index #2 */
3522 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3523 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3524 codec->num_pcms = 3;
3525 info = spec->pcm_rec + 2;
3526 info->name = spec->stream_name_analog;
3527 if (spec->alt_dac_nid) {
3528 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3529 *spec->stream_analog_alt_playback;
3530 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3533 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3534 alc_pcm_null_stream;
3535 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3537 if (spec->num_adc_nids > 1) {
3538 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3539 *spec->stream_analog_alt_capture;
3540 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3542 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3543 spec->num_adc_nids - 1;
3545 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3546 alc_pcm_null_stream;
3547 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3554 static void alc_free_kctls(struct hda_codec *codec)
3556 struct alc_spec *spec = codec->spec;
3558 if (spec->kctls.list) {
3559 struct snd_kcontrol_new *kctl = spec->kctls.list;
3561 for (i = 0; i < spec->kctls.used; i++)
3562 kfree(kctl[i].name);
3564 snd_array_free(&spec->kctls);
3567 static void alc_free(struct hda_codec *codec)
3569 struct alc_spec *spec = codec->spec;
3574 alc_free_kctls(codec);
3576 snd_hda_detach_beep_device(codec);
3579 #ifdef SND_HDA_NEEDS_RESUME
3580 static int alc_resume(struct hda_codec *codec)
3582 codec->patch_ops.init(codec);
3583 snd_hda_codec_resume_amp(codec);
3584 snd_hda_codec_resume_cache(codec);
3591 static struct hda_codec_ops alc_patch_ops = {
3592 .build_controls = alc_build_controls,
3593 .build_pcms = alc_build_pcms,
3596 .unsol_event = alc_unsol_event,
3597 #ifdef SND_HDA_NEEDS_RESUME
3598 .resume = alc_resume,
3600 #ifdef CONFIG_SND_HDA_POWER_SAVE
3601 .check_power_status = alc_check_power_status,
3607 * Test configuration for debugging
3609 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3612 #ifdef CONFIG_SND_DEBUG
3613 static hda_nid_t alc880_test_dac_nids[4] = {
3614 0x02, 0x03, 0x04, 0x05
3617 static struct hda_input_mux alc880_test_capture_source = {
3626 { "Surround", 0x6 },
3630 static struct hda_channel_mode alc880_test_modes[4] = {
3637 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3638 struct snd_ctl_elem_info *uinfo)
3640 static char *texts[] = {
3641 "N/A", "Line Out", "HP Out",
3642 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3644 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3646 uinfo->value.enumerated.items = 8;
3647 if (uinfo->value.enumerated.item >= 8)
3648 uinfo->value.enumerated.item = 7;
3649 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3653 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3654 struct snd_ctl_elem_value *ucontrol)
3656 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3657 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3658 unsigned int pin_ctl, item = 0;
3660 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3661 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3662 if (pin_ctl & AC_PINCTL_OUT_EN) {
3663 if (pin_ctl & AC_PINCTL_HP_EN)
3667 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3668 switch (pin_ctl & AC_PINCTL_VREFEN) {
3669 case AC_PINCTL_VREF_HIZ: item = 3; break;
3670 case AC_PINCTL_VREF_50: item = 4; break;
3671 case AC_PINCTL_VREF_GRD: item = 5; break;
3672 case AC_PINCTL_VREF_80: item = 6; break;
3673 case AC_PINCTL_VREF_100: item = 7; break;
3676 ucontrol->value.enumerated.item[0] = item;
3680 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3681 struct snd_ctl_elem_value *ucontrol)
3683 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3684 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3685 static unsigned int ctls[] = {
3686 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3687 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3688 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3689 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3690 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3691 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3693 unsigned int old_ctl, new_ctl;
3695 old_ctl = snd_hda_codec_read(codec, nid, 0,
3696 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3697 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3698 if (old_ctl != new_ctl) {
3700 snd_hda_codec_write_cache(codec, nid, 0,
3701 AC_VERB_SET_PIN_WIDGET_CONTROL,
3703 val = ucontrol->value.enumerated.item[0] >= 3 ?
3705 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3712 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3713 struct snd_ctl_elem_info *uinfo)
3715 static char *texts[] = {
3716 "Front", "Surround", "CLFE", "Side"
3718 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3720 uinfo->value.enumerated.items = 4;
3721 if (uinfo->value.enumerated.item >= 4)
3722 uinfo->value.enumerated.item = 3;
3723 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3727 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3728 struct snd_ctl_elem_value *ucontrol)
3730 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3731 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3734 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3735 ucontrol->value.enumerated.item[0] = sel & 3;
3739 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3740 struct snd_ctl_elem_value *ucontrol)
3742 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3743 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3746 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3747 if (ucontrol->value.enumerated.item[0] != sel) {
3748 sel = ucontrol->value.enumerated.item[0] & 3;
3749 snd_hda_codec_write_cache(codec, nid, 0,
3750 AC_VERB_SET_CONNECT_SEL, sel);
3756 #define PIN_CTL_TEST(xname,nid) { \
3757 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3759 .info = alc_test_pin_ctl_info, \
3760 .get = alc_test_pin_ctl_get, \
3761 .put = alc_test_pin_ctl_put, \
3762 .private_value = nid \
3765 #define PIN_SRC_TEST(xname,nid) { \
3766 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3768 .info = alc_test_pin_src_info, \
3769 .get = alc_test_pin_src_get, \
3770 .put = alc_test_pin_src_put, \
3771 .private_value = nid \
3774 static struct snd_kcontrol_new alc880_test_mixer[] = {
3775 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3776 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3777 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3778 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3779 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3780 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3781 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3782 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3783 PIN_CTL_TEST("Front Pin Mode", 0x14),
3784 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3785 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3786 PIN_CTL_TEST("Side Pin Mode", 0x17),
3787 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3788 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3789 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3790 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3791 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3792 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3793 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3794 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3795 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3796 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3797 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3798 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3799 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3800 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3801 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3802 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3803 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3804 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3806 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3807 .name = "Channel Mode",
3808 .info = alc_ch_mode_info,
3809 .get = alc_ch_mode_get,
3810 .put = alc_ch_mode_put,
3815 static struct hda_verb alc880_test_init_verbs[] = {
3816 /* Unmute inputs of 0x0c - 0x0f */
3817 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3818 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3819 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3820 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3821 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3822 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3823 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3824 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3825 /* Vol output for 0x0c-0x0f */
3826 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3827 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3828 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3829 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3830 /* Set output pins 0x14-0x17 */
3831 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3832 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3833 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3834 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3835 /* Unmute output pins 0x14-0x17 */
3836 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3837 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3838 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3839 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3840 /* Set input pins 0x18-0x1c */
3841 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3842 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3843 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3844 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3845 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3846 /* Mute input pins 0x18-0x1b */
3847 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3848 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3849 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3850 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3852 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3853 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3854 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3855 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3856 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3857 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3858 /* Analog input/passthru */
3859 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3860 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3861 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3862 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3863 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3871 static const char *alc880_models[ALC880_MODEL_LAST] = {
3872 [ALC880_3ST] = "3stack",
3873 [ALC880_TCL_S700] = "tcl",
3874 [ALC880_3ST_DIG] = "3stack-digout",
3875 [ALC880_CLEVO] = "clevo",
3876 [ALC880_5ST] = "5stack",
3877 [ALC880_5ST_DIG] = "5stack-digout",
3878 [ALC880_W810] = "w810",
3879 [ALC880_Z71V] = "z71v",
3880 [ALC880_6ST] = "6stack",
3881 [ALC880_6ST_DIG] = "6stack-digout",
3882 [ALC880_ASUS] = "asus",
3883 [ALC880_ASUS_W1V] = "asus-w1v",
3884 [ALC880_ASUS_DIG] = "asus-dig",
3885 [ALC880_ASUS_DIG2] = "asus-dig2",
3886 [ALC880_UNIWILL_DIG] = "uniwill",
3887 [ALC880_UNIWILL_P53] = "uniwill-p53",
3888 [ALC880_FUJITSU] = "fujitsu",
3889 [ALC880_F1734] = "F1734",
3891 [ALC880_LG_LW] = "lg-lw",
3892 [ALC880_MEDION_RIM] = "medion",
3893 #ifdef CONFIG_SND_DEBUG
3894 [ALC880_TEST] = "test",
3896 [ALC880_AUTO] = "auto",
3899 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3900 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3901 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3902 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3903 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3904 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3905 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3906 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3907 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3908 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3909 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3910 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3911 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3912 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3913 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3914 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3915 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3916 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3917 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3918 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3919 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3920 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3921 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3922 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3923 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3924 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3925 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3926 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3927 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3928 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3929 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3930 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3931 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3932 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3933 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3934 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3935 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3936 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3937 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3938 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3939 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3940 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3941 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3942 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3943 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3944 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3945 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3946 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3947 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3948 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3949 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3950 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3951 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3952 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3953 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3954 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3955 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3956 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3957 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3958 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3959 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3960 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3961 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3962 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3963 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3964 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3965 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3966 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3967 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3969 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3970 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3971 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3976 * ALC880 codec presets
3978 static struct alc_config_preset alc880_presets[] = {
3980 .mixers = { alc880_three_stack_mixer },
3981 .init_verbs = { alc880_volume_init_verbs,
3982 alc880_pin_3stack_init_verbs },
3983 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3984 .dac_nids = alc880_dac_nids,
3985 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3986 .channel_mode = alc880_threestack_modes,
3988 .input_mux = &alc880_capture_source,
3990 [ALC880_3ST_DIG] = {
3991 .mixers = { alc880_three_stack_mixer },
3992 .init_verbs = { alc880_volume_init_verbs,
3993 alc880_pin_3stack_init_verbs },
3994 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3995 .dac_nids = alc880_dac_nids,
3996 .dig_out_nid = ALC880_DIGOUT_NID,
3997 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3998 .channel_mode = alc880_threestack_modes,
4000 .input_mux = &alc880_capture_source,
4002 [ALC880_TCL_S700] = {
4003 .mixers = { alc880_tcl_s700_mixer },
4004 .init_verbs = { alc880_volume_init_verbs,
4005 alc880_pin_tcl_S700_init_verbs,
4006 alc880_gpio2_init_verbs },
4007 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4008 .dac_nids = alc880_dac_nids,
4009 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4010 .num_adc_nids = 1, /* single ADC */
4012 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4013 .channel_mode = alc880_2_jack_modes,
4014 .input_mux = &alc880_capture_source,
4017 .mixers = { alc880_three_stack_mixer,
4018 alc880_five_stack_mixer},
4019 .init_verbs = { alc880_volume_init_verbs,
4020 alc880_pin_5stack_init_verbs },
4021 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4022 .dac_nids = alc880_dac_nids,
4023 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4024 .channel_mode = alc880_fivestack_modes,
4025 .input_mux = &alc880_capture_source,
4027 [ALC880_5ST_DIG] = {
4028 .mixers = { alc880_three_stack_mixer,
4029 alc880_five_stack_mixer },
4030 .init_verbs = { alc880_volume_init_verbs,
4031 alc880_pin_5stack_init_verbs },
4032 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4033 .dac_nids = alc880_dac_nids,
4034 .dig_out_nid = ALC880_DIGOUT_NID,
4035 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4036 .channel_mode = alc880_fivestack_modes,
4037 .input_mux = &alc880_capture_source,
4040 .mixers = { alc880_six_stack_mixer },
4041 .init_verbs = { alc880_volume_init_verbs,
4042 alc880_pin_6stack_init_verbs },
4043 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4044 .dac_nids = alc880_6st_dac_nids,
4045 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4046 .channel_mode = alc880_sixstack_modes,
4047 .input_mux = &alc880_6stack_capture_source,
4049 [ALC880_6ST_DIG] = {
4050 .mixers = { alc880_six_stack_mixer },
4051 .init_verbs = { alc880_volume_init_verbs,
4052 alc880_pin_6stack_init_verbs },
4053 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4054 .dac_nids = alc880_6st_dac_nids,
4055 .dig_out_nid = ALC880_DIGOUT_NID,
4056 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4057 .channel_mode = alc880_sixstack_modes,
4058 .input_mux = &alc880_6stack_capture_source,
4061 .mixers = { alc880_w810_base_mixer },
4062 .init_verbs = { alc880_volume_init_verbs,
4063 alc880_pin_w810_init_verbs,
4064 alc880_gpio2_init_verbs },
4065 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4066 .dac_nids = alc880_w810_dac_nids,
4067 .dig_out_nid = ALC880_DIGOUT_NID,
4068 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4069 .channel_mode = alc880_w810_modes,
4070 .input_mux = &alc880_capture_source,
4073 .mixers = { alc880_z71v_mixer },
4074 .init_verbs = { alc880_volume_init_verbs,
4075 alc880_pin_z71v_init_verbs },
4076 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4077 .dac_nids = alc880_z71v_dac_nids,
4078 .dig_out_nid = ALC880_DIGOUT_NID,
4080 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4081 .channel_mode = alc880_2_jack_modes,
4082 .input_mux = &alc880_capture_source,
4085 .mixers = { alc880_f1734_mixer },
4086 .init_verbs = { alc880_volume_init_verbs,
4087 alc880_pin_f1734_init_verbs },
4088 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4089 .dac_nids = alc880_f1734_dac_nids,
4091 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4092 .channel_mode = alc880_2_jack_modes,
4093 .input_mux = &alc880_f1734_capture_source,
4094 .unsol_event = alc880_uniwill_p53_unsol_event,
4095 .setup = alc880_uniwill_p53_setup,
4096 .init_hook = alc_automute_amp,
4099 .mixers = { alc880_asus_mixer },
4100 .init_verbs = { alc880_volume_init_verbs,
4101 alc880_pin_asus_init_verbs,
4102 alc880_gpio1_init_verbs },
4103 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4104 .dac_nids = alc880_asus_dac_nids,
4105 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4106 .channel_mode = alc880_asus_modes,
4108 .input_mux = &alc880_capture_source,
4110 [ALC880_ASUS_DIG] = {
4111 .mixers = { alc880_asus_mixer },
4112 .init_verbs = { alc880_volume_init_verbs,
4113 alc880_pin_asus_init_verbs,
4114 alc880_gpio1_init_verbs },
4115 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4116 .dac_nids = alc880_asus_dac_nids,
4117 .dig_out_nid = ALC880_DIGOUT_NID,
4118 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4119 .channel_mode = alc880_asus_modes,
4121 .input_mux = &alc880_capture_source,
4123 [ALC880_ASUS_DIG2] = {
4124 .mixers = { alc880_asus_mixer },
4125 .init_verbs = { alc880_volume_init_verbs,
4126 alc880_pin_asus_init_verbs,
4127 alc880_gpio2_init_verbs }, /* use GPIO2 */
4128 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4129 .dac_nids = alc880_asus_dac_nids,
4130 .dig_out_nid = ALC880_DIGOUT_NID,
4131 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4132 .channel_mode = alc880_asus_modes,
4134 .input_mux = &alc880_capture_source,
4136 [ALC880_ASUS_W1V] = {
4137 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4138 .init_verbs = { alc880_volume_init_verbs,
4139 alc880_pin_asus_init_verbs,
4140 alc880_gpio1_init_verbs },
4141 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4142 .dac_nids = alc880_asus_dac_nids,
4143 .dig_out_nid = ALC880_DIGOUT_NID,
4144 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4145 .channel_mode = alc880_asus_modes,
4147 .input_mux = &alc880_capture_source,
4149 [ALC880_UNIWILL_DIG] = {
4150 .mixers = { alc880_asus_mixer },
4151 .init_verbs = { alc880_volume_init_verbs,
4152 alc880_pin_asus_init_verbs },
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_UNIWILL] = {
4162 .mixers = { alc880_uniwill_mixer },
4163 .init_verbs = { alc880_volume_init_verbs,
4164 alc880_uniwill_init_verbs },
4165 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4166 .dac_nids = alc880_asus_dac_nids,
4167 .dig_out_nid = ALC880_DIGOUT_NID,
4168 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4169 .channel_mode = alc880_threestack_modes,
4171 .input_mux = &alc880_capture_source,
4172 .unsol_event = alc880_uniwill_unsol_event,
4173 .setup = alc880_uniwill_setup,
4174 .init_hook = alc880_uniwill_init_hook,
4176 [ALC880_UNIWILL_P53] = {
4177 .mixers = { alc880_uniwill_p53_mixer },
4178 .init_verbs = { alc880_volume_init_verbs,
4179 alc880_uniwill_p53_init_verbs },
4180 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4181 .dac_nids = alc880_asus_dac_nids,
4182 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4183 .channel_mode = alc880_threestack_modes,
4184 .input_mux = &alc880_capture_source,
4185 .unsol_event = alc880_uniwill_p53_unsol_event,
4186 .setup = alc880_uniwill_p53_setup,
4187 .init_hook = alc_automute_amp,
4189 [ALC880_FUJITSU] = {
4190 .mixers = { alc880_fujitsu_mixer },
4191 .init_verbs = { alc880_volume_init_verbs,
4192 alc880_uniwill_p53_init_verbs,
4193 alc880_beep_init_verbs },
4194 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4195 .dac_nids = alc880_dac_nids,
4196 .dig_out_nid = ALC880_DIGOUT_NID,
4197 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4198 .channel_mode = alc880_2_jack_modes,
4199 .input_mux = &alc880_capture_source,
4200 .unsol_event = alc880_uniwill_p53_unsol_event,
4201 .setup = alc880_uniwill_p53_setup,
4202 .init_hook = alc_automute_amp,
4205 .mixers = { alc880_three_stack_mixer },
4206 .init_verbs = { alc880_volume_init_verbs,
4207 alc880_pin_clevo_init_verbs },
4208 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4209 .dac_nids = alc880_dac_nids,
4211 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4212 .channel_mode = alc880_threestack_modes,
4214 .input_mux = &alc880_capture_source,
4217 .mixers = { alc880_lg_mixer },
4218 .init_verbs = { alc880_volume_init_verbs,
4219 alc880_lg_init_verbs },
4220 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4221 .dac_nids = alc880_lg_dac_nids,
4222 .dig_out_nid = ALC880_DIGOUT_NID,
4223 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4224 .channel_mode = alc880_lg_ch_modes,
4226 .input_mux = &alc880_lg_capture_source,
4227 .unsol_event = alc_automute_amp_unsol_event,
4228 .setup = alc880_lg_setup,
4229 .init_hook = alc_automute_amp,
4230 #ifdef CONFIG_SND_HDA_POWER_SAVE
4231 .loopbacks = alc880_lg_loopbacks,
4235 .mixers = { alc880_lg_lw_mixer },
4236 .init_verbs = { alc880_volume_init_verbs,
4237 alc880_lg_lw_init_verbs },
4238 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4239 .dac_nids = alc880_dac_nids,
4240 .dig_out_nid = ALC880_DIGOUT_NID,
4241 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4242 .channel_mode = alc880_lg_lw_modes,
4243 .input_mux = &alc880_lg_lw_capture_source,
4244 .unsol_event = alc_automute_amp_unsol_event,
4245 .setup = alc880_lg_lw_setup,
4246 .init_hook = alc_automute_amp,
4248 [ALC880_MEDION_RIM] = {
4249 .mixers = { alc880_medion_rim_mixer },
4250 .init_verbs = { alc880_volume_init_verbs,
4251 alc880_medion_rim_init_verbs,
4252 alc_gpio2_init_verbs },
4253 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4254 .dac_nids = alc880_dac_nids,
4255 .dig_out_nid = ALC880_DIGOUT_NID,
4256 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4257 .channel_mode = alc880_2_jack_modes,
4258 .input_mux = &alc880_medion_rim_capture_source,
4259 .unsol_event = alc880_medion_rim_unsol_event,
4260 .setup = alc880_medion_rim_setup,
4261 .init_hook = alc880_medion_rim_automute,
4263 #ifdef CONFIG_SND_DEBUG
4265 .mixers = { alc880_test_mixer },
4266 .init_verbs = { alc880_test_init_verbs },
4267 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4268 .dac_nids = alc880_test_dac_nids,
4269 .dig_out_nid = ALC880_DIGOUT_NID,
4270 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4271 .channel_mode = alc880_test_modes,
4272 .input_mux = &alc880_test_capture_source,
4278 * Automatic parse of I/O pins from the BIOS configuration
4283 ALC_CTL_WIDGET_MUTE,
4286 static struct snd_kcontrol_new alc880_control_templates[] = {
4287 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4288 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4289 HDA_BIND_MUTE(NULL, 0, 0, 0),
4292 /* add dynamic controls */
4293 static int add_control(struct alc_spec *spec, int type, const char *name,
4296 struct snd_kcontrol_new *knew;
4298 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4299 knew = snd_array_new(&spec->kctls);
4302 *knew = alc880_control_templates[type];
4303 knew->name = kstrdup(name, GFP_KERNEL);
4306 knew->private_value = val;
4310 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4311 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4312 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4313 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4314 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4315 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4316 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4317 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4318 #define ALC880_PIN_CD_NID 0x1c
4320 /* fill in the dac_nids table from the parsed pin configuration */
4321 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4322 const struct auto_pin_cfg *cfg)
4328 memset(assigned, 0, sizeof(assigned));
4329 spec->multiout.dac_nids = spec->private_dac_nids;
4331 /* check the pins hardwired to audio widget */
4332 for (i = 0; i < cfg->line_outs; i++) {
4333 nid = cfg->line_out_pins[i];
4334 if (alc880_is_fixed_pin(nid)) {
4335 int idx = alc880_fixed_pin_idx(nid);
4336 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4340 /* left pins can be connect to any audio widget */
4341 for (i = 0; i < cfg->line_outs; i++) {
4342 nid = cfg->line_out_pins[i];
4343 if (alc880_is_fixed_pin(nid))
4345 /* search for an empty channel */
4346 for (j = 0; j < cfg->line_outs; j++) {
4348 spec->multiout.dac_nids[i] =
4349 alc880_idx_to_dac(j);
4355 spec->multiout.num_dacs = cfg->line_outs;
4359 /* add playback controls from the parsed DAC table */
4360 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4361 const struct auto_pin_cfg *cfg)
4364 static const char *chname[4] = {
4365 "Front", "Surround", NULL /*CLFE*/, "Side"
4370 for (i = 0; i < cfg->line_outs; i++) {
4371 if (!spec->multiout.dac_nids[i])
4373 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4376 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4377 "Center Playback Volume",
4378 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4382 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4383 "LFE Playback Volume",
4384 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4388 err = add_control(spec, ALC_CTL_BIND_MUTE,
4389 "Center Playback Switch",
4390 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4394 err = add_control(spec, ALC_CTL_BIND_MUTE,
4395 "LFE Playback Switch",
4396 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4402 if (cfg->line_outs == 1 &&
4403 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4407 sprintf(name, "%s Playback Volume", pfx);
4408 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4409 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4413 sprintf(name, "%s Playback Switch", pfx);
4414 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4415 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4424 /* add playback controls for speaker and HP outputs */
4425 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4435 if (alc880_is_fixed_pin(pin)) {
4436 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4437 /* specify the DAC as the extra output */
4438 if (!spec->multiout.hp_nid)
4439 spec->multiout.hp_nid = nid;
4441 spec->multiout.extra_out_nid[0] = nid;
4442 /* control HP volume/switch on the output mixer amp */
4443 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4444 sprintf(name, "%s Playback Volume", pfx);
4445 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4446 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4449 sprintf(name, "%s Playback Switch", pfx);
4450 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4451 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4454 } else if (alc880_is_multi_pin(pin)) {
4455 /* set manual connection */
4456 /* we have only a switch on HP-out PIN */
4457 sprintf(name, "%s Playback Switch", pfx);
4458 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4459 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4466 /* create input playback/capture controls for the given pin */
4467 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4468 const char *ctlname,
4469 int idx, hda_nid_t mix_nid)
4474 sprintf(name, "%s Playback Volume", ctlname);
4475 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4476 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4479 sprintf(name, "%s Playback Switch", ctlname);
4480 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4481 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4487 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4489 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4490 return (pincap & AC_PINCAP_IN) != 0;
4493 /* create playback/capture controls for input pins */
4494 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4495 const struct auto_pin_cfg *cfg,
4497 hda_nid_t cap1, hda_nid_t cap2)
4499 struct alc_spec *spec = codec->spec;
4500 struct hda_input_mux *imux = &spec->private_imux[0];
4503 for (i = 0; i < AUTO_PIN_LAST; i++) {
4506 pin = cfg->input_pins[i];
4507 if (!alc_is_input_pin(codec, pin))
4511 idx = get_connection_index(codec, mixer, pin);
4513 err = new_analog_input(spec, pin,
4514 auto_pin_cfg_labels[i],
4523 idx = get_connection_index(codec, cap1, pin);
4524 if (idx < 0 && cap2)
4525 idx = get_connection_index(codec, cap2, pin);
4527 imux->items[imux->num_items].label =
4528 auto_pin_cfg_labels[i];
4529 imux->items[imux->num_items].index = idx;
4536 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4537 const struct auto_pin_cfg *cfg)
4539 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4542 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4543 unsigned int pin_type)
4545 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4548 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4552 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4553 hda_nid_t nid, int pin_type,
4556 alc_set_pin_output(codec, nid, pin_type);
4557 /* need the manual connection? */
4558 if (alc880_is_multi_pin(nid)) {
4559 struct alc_spec *spec = codec->spec;
4560 int idx = alc880_multi_pin_idx(nid);
4561 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4562 AC_VERB_SET_CONNECT_SEL,
4563 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4567 static int get_pin_type(int line_out_type)
4569 if (line_out_type == AUTO_PIN_HP_OUT)
4575 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4577 struct alc_spec *spec = codec->spec;
4580 for (i = 0; i < spec->autocfg.line_outs; i++) {
4581 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4582 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4583 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4587 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4589 struct alc_spec *spec = codec->spec;
4592 pin = spec->autocfg.speaker_pins[0];
4593 if (pin) /* connect to front */
4594 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4595 pin = spec->autocfg.hp_pins[0];
4596 if (pin) /* connect to front */
4597 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4600 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4602 struct alc_spec *spec = codec->spec;
4605 for (i = 0; i < AUTO_PIN_LAST; i++) {
4606 hda_nid_t nid = spec->autocfg.input_pins[i];
4607 if (alc_is_input_pin(codec, nid)) {
4608 alc_set_input_pin(codec, nid, i);
4609 if (nid != ALC880_PIN_CD_NID &&
4610 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4611 snd_hda_codec_write(codec, nid, 0,
4612 AC_VERB_SET_AMP_GAIN_MUTE,
4618 /* parse the BIOS configuration and set up the alc_spec */
4619 /* return 1 if successful, 0 if the proper config is not found,
4620 * or a negative error code
4622 static int alc880_parse_auto_config(struct hda_codec *codec)
4624 struct alc_spec *spec = codec->spec;
4626 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4628 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4632 if (!spec->autocfg.line_outs)
4633 return 0; /* can't find valid BIOS pin config */
4635 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4638 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4641 err = alc880_auto_create_extra_out(spec,
4642 spec->autocfg.speaker_pins[0],
4646 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4650 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4654 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4656 /* check multiple SPDIF-out (for recent codecs) */
4657 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4659 err = snd_hda_get_connections(codec,
4660 spec->autocfg.dig_out_pins[i],
4665 spec->multiout.dig_out_nid = dig_nid;
4667 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4668 spec->slave_dig_outs[i - 1] = dig_nid;
4669 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4673 if (spec->autocfg.dig_in_pin)
4674 spec->dig_in_nid = ALC880_DIGIN_NID;
4676 if (spec->kctls.list)
4677 add_mixer(spec, spec->kctls.list);
4679 add_verb(spec, alc880_volume_init_verbs);
4681 spec->num_mux_defs = 1;
4682 spec->input_mux = &spec->private_imux[0];
4684 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4689 /* additional initialization for auto-configuration model */
4690 static void alc880_auto_init(struct hda_codec *codec)
4692 struct alc_spec *spec = codec->spec;
4693 alc880_auto_init_multi_out(codec);
4694 alc880_auto_init_extra_out(codec);
4695 alc880_auto_init_analog_input(codec);
4696 if (spec->unsol_event)
4697 alc_inithook(codec);
4700 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4701 * one of two digital mic pins, e.g. on ALC272
4703 static void fixup_automic_adc(struct hda_codec *codec)
4705 struct alc_spec *spec = codec->spec;
4708 for (i = 0; i < spec->num_adc_nids; i++) {
4709 hda_nid_t cap = spec->capsrc_nids ?
4710 spec->capsrc_nids[i] : spec->adc_nids[i];
4713 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4716 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4719 spec->int_mic.mux_idx = iidx;
4720 spec->ext_mic.mux_idx = eidx;
4721 if (spec->capsrc_nids)
4722 spec->capsrc_nids += i;
4723 spec->adc_nids += i;
4724 spec->num_adc_nids = 1;
4727 snd_printd(KERN_INFO "hda_codec: %s: "
4728 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4729 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4730 spec->auto_mic = 0; /* disable auto-mic to be sure */
4733 static void set_capture_mixer(struct hda_codec *codec)
4735 struct alc_spec *spec = codec->spec;
4736 static struct snd_kcontrol_new *caps[2][3] = {
4737 { alc_capture_mixer_nosrc1,
4738 alc_capture_mixer_nosrc2,
4739 alc_capture_mixer_nosrc3 },
4740 { alc_capture_mixer1,
4742 alc_capture_mixer3 },
4744 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4746 if (spec->auto_mic) {
4748 fixup_automic_adc(codec);
4749 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4753 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4757 #define set_beep_amp(spec, nid, idx, dir) \
4758 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4761 * OK, here we have finally the patch for ALC880
4764 static int patch_alc880(struct hda_codec *codec)
4766 struct alc_spec *spec;
4770 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4776 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4779 if (board_config < 0) {
4780 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4782 board_config = ALC880_AUTO;
4785 if (board_config == ALC880_AUTO) {
4786 /* automatic parse from the BIOS config */
4787 err = alc880_parse_auto_config(codec);
4793 "hda_codec: Cannot set up configuration "
4794 "from BIOS. Using 3-stack mode...\n");
4795 board_config = ALC880_3ST;
4799 err = snd_hda_attach_beep_device(codec, 0x1);
4805 if (board_config != ALC880_AUTO)
4806 setup_preset(codec, &alc880_presets[board_config]);
4808 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4809 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4810 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4812 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4813 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4815 if (!spec->adc_nids && spec->input_mux) {
4816 /* check whether NID 0x07 is valid */
4817 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4819 wcap = get_wcaps_type(wcap);
4820 if (wcap != AC_WID_AUD_IN) {
4821 spec->adc_nids = alc880_adc_nids_alt;
4822 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4824 spec->adc_nids = alc880_adc_nids;
4825 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4828 set_capture_mixer(codec);
4829 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4831 spec->vmaster_nid = 0x0c;
4833 codec->patch_ops = alc_patch_ops;
4834 if (board_config == ALC880_AUTO)
4835 spec->init_hook = alc880_auto_init;
4836 #ifdef CONFIG_SND_HDA_POWER_SAVE
4837 if (!spec->loopback.amplist)
4838 spec->loopback.amplist = alc880_loopbacks;
4840 codec->proc_widget_hook = print_realtek_coef;
4850 static hda_nid_t alc260_dac_nids[1] = {
4855 static hda_nid_t alc260_adc_nids[1] = {
4860 static hda_nid_t alc260_adc_nids_alt[1] = {
4865 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4866 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4868 static hda_nid_t alc260_dual_adc_nids[2] = {
4873 #define ALC260_DIGOUT_NID 0x03
4874 #define ALC260_DIGIN_NID 0x06
4876 static struct hda_input_mux alc260_capture_source = {
4880 { "Front Mic", 0x1 },
4886 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4887 * headphone jack and the internal CD lines since these are the only pins at
4888 * which audio can appear. For flexibility, also allow the option of
4889 * recording the mixer output on the second ADC (ADC0 doesn't have a
4890 * connection to the mixer output).
4892 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4896 { "Mic/Line", 0x0 },
4898 { "Headphone", 0x2 },
4904 { "Mic/Line", 0x0 },
4906 { "Headphone", 0x2 },
4913 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4914 * the Fujitsu S702x, but jacks are marked differently.
4916 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4923 { "Headphone", 0x5 },
4932 { "Headphone", 0x6 },
4938 /* Maxdata Favorit 100XS */
4939 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4943 { "Line/Mic", 0x0 },
4950 { "Line/Mic", 0x0 },
4958 * This is just place-holder, so there's something for alc_build_pcms to look
4959 * at when it calculates the maximum number of channels. ALC260 has no mixer
4960 * element which allows changing the channel mode, so the verb list is
4963 static struct hda_channel_mode alc260_modes[1] = {
4968 /* Mixer combinations
4970 * basic: base_output + input + pc_beep + capture
4971 * HP: base_output + input + capture_alt
4972 * HP_3013: hp_3013 + input + capture
4973 * fujitsu: fujitsu + capture
4974 * acer: acer + capture
4977 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4978 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4979 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4980 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4981 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4982 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4983 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4987 static struct snd_kcontrol_new alc260_input_mixer[] = {
4988 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4989 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4990 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4991 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4993 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4994 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4995 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4999 /* update HP, line and mono out pins according to the master switch */
5000 static void alc260_hp_master_update(struct hda_codec *codec,
5001 hda_nid_t hp, hda_nid_t line,
5004 struct alc_spec *spec = codec->spec;
5005 unsigned int val = spec->master_sw ? PIN_HP : 0;
5006 /* change HP and line-out pins */
5007 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5009 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5011 /* mono (speaker) depending on the HP jack sense */
5012 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5013 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5017 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5018 struct snd_ctl_elem_value *ucontrol)
5020 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5021 struct alc_spec *spec = codec->spec;
5022 *ucontrol->value.integer.value = spec->master_sw;
5026 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5027 struct snd_ctl_elem_value *ucontrol)
5029 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5030 struct alc_spec *spec = codec->spec;
5031 int val = !!*ucontrol->value.integer.value;
5032 hda_nid_t hp, line, mono;
5034 if (val == spec->master_sw)
5036 spec->master_sw = val;
5037 hp = (kcontrol->private_value >> 16) & 0xff;
5038 line = (kcontrol->private_value >> 8) & 0xff;
5039 mono = kcontrol->private_value & 0xff;
5040 alc260_hp_master_update(codec, hp, line, mono);
5044 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5046 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5047 .name = "Master Playback Switch",
5048 .info = snd_ctl_boolean_mono_info,
5049 .get = alc260_hp_master_sw_get,
5050 .put = alc260_hp_master_sw_put,
5051 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5053 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5054 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5055 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5056 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5057 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5059 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5063 static struct hda_verb alc260_hp_unsol_verbs[] = {
5064 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5068 static void alc260_hp_automute(struct hda_codec *codec)
5070 struct alc_spec *spec = codec->spec;
5071 unsigned int present;
5073 present = snd_hda_codec_read(codec, 0x10, 0,
5074 AC_VERB_GET_PIN_SENSE, 0);
5075 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5076 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5079 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5081 if ((res >> 26) == ALC880_HP_EVENT)
5082 alc260_hp_automute(codec);
5085 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5087 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5088 .name = "Master Playback Switch",
5089 .info = snd_ctl_boolean_mono_info,
5090 .get = alc260_hp_master_sw_get,
5091 .put = alc260_hp_master_sw_put,
5092 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5094 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5095 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5096 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5097 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5098 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5099 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5100 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5101 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5105 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5106 .ops = &snd_hda_bind_vol,
5108 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5109 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5110 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5115 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5116 .ops = &snd_hda_bind_sw,
5118 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5119 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5124 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5125 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5126 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5127 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5132 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5133 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5137 static void alc260_hp_3013_automute(struct hda_codec *codec)
5139 struct alc_spec *spec = codec->spec;
5140 unsigned int present;
5142 present = snd_hda_codec_read(codec, 0x15, 0,
5143 AC_VERB_GET_PIN_SENSE, 0);
5144 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5145 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5148 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5151 if ((res >> 26) == ALC880_HP_EVENT)
5152 alc260_hp_3013_automute(codec);
5155 static void alc260_hp_3012_automute(struct hda_codec *codec)
5157 unsigned int present, bits;
5159 present = snd_hda_codec_read(codec, 0x10, 0,
5160 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
5162 bits = present ? 0 : PIN_OUT;
5163 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5165 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5167 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5171 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5174 if ((res >> 26) == ALC880_HP_EVENT)
5175 alc260_hp_3012_automute(codec);
5178 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5179 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5181 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5182 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5183 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5184 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5185 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5186 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5187 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5188 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5189 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5190 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5191 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5195 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5196 * versions of the ALC260 don't act on requests to enable mic bias from NID
5197 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5198 * datasheet doesn't mention this restriction. At this stage it's not clear
5199 * whether this behaviour is intentional or is a hardware bug in chip
5200 * revisions available in early 2006. Therefore for now allow the
5201 * "Headphone Jack Mode" control to span all choices, but if it turns out
5202 * that the lack of mic bias for this NID is intentional we could change the
5203 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5205 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5206 * don't appear to make the mic bias available from the "line" jack, even
5207 * though the NID used for this jack (0x14) can supply it. The theory is
5208 * that perhaps Acer have included blocking capacitors between the ALC260
5209 * and the output jack. If this turns out to be the case for all such
5210 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5211 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5213 * The C20x Tablet series have a mono internal speaker which is controlled
5214 * via the chip's Mono sum widget and pin complex, so include the necessary
5215 * controls for such models. On models without a "mono speaker" the control
5216 * won't do anything.
5218 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5219 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5220 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5221 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5222 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5224 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5226 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5227 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5229 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5230 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5231 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5232 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5233 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5237 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5239 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5240 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5241 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5242 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5243 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5244 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5245 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5249 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5250 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5252 static struct snd_kcontrol_new alc260_will_mixer[] = {
5253 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5254 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5255 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5256 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5257 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5258 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5259 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5260 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5261 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5262 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5266 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5267 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5269 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5270 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5271 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5273 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5274 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5275 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5276 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5277 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5278 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5279 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5284 * initialization verbs
5286 static struct hda_verb alc260_init_verbs[] = {
5287 /* Line In pin widget for input */
5288 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5289 /* CD pin widget for input */
5290 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5291 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5292 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5293 /* Mic2 (front panel) pin widget for input and vref at 80% */
5294 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5295 /* LINE-2 is used for line-out in rear */
5296 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5297 /* select line-out */
5298 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5300 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5302 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5304 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5305 /* mute capture amp left and right */
5306 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5307 /* set connection select to line in (default select for this ADC) */
5308 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5309 /* mute capture amp left and right */
5310 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5311 /* set connection select to line in (default select for this ADC) */
5312 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5313 /* set vol=0 Line-Out mixer amp left and right */
5314 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5315 /* unmute pin widget amp left and right (no gain on this amp) */
5316 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5317 /* set vol=0 HP mixer amp left and right */
5318 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5319 /* unmute pin widget amp left and right (no gain on this amp) */
5320 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5321 /* set vol=0 Mono mixer amp left and right */
5322 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5323 /* unmute pin widget amp left and right (no gain on this amp) */
5324 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5325 /* unmute LINE-2 out pin */
5326 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5327 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5330 /* mute analog inputs */
5331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5336 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5337 /* mute Front out path */
5338 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5339 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5340 /* mute Headphone out path */
5341 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5342 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5343 /* mute Mono out path */
5344 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5345 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5349 #if 0 /* should be identical with alc260_init_verbs? */
5350 static struct hda_verb alc260_hp_init_verbs[] = {
5351 /* Headphone and output */
5352 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5354 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5355 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5356 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5357 /* Mic2 (front panel) pin widget for input and vref at 80% */
5358 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5359 /* Line In pin widget for input */
5360 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5361 /* Line-2 pin widget for output */
5362 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5363 /* CD pin widget for input */
5364 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5365 /* unmute amp left and right */
5366 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5367 /* set connection select to line in (default select for this ADC) */
5368 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5369 /* unmute Line-Out mixer amp left and right (volume = 0) */
5370 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5371 /* mute pin widget amp left and right (no gain on this amp) */
5372 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5373 /* unmute HP mixer amp left and right (volume = 0) */
5374 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5375 /* mute pin widget amp left and right (no gain on this amp) */
5376 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5377 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5380 /* mute analog inputs */
5381 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5382 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5383 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5384 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5385 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5386 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5387 /* Unmute Front out path */
5388 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5389 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5390 /* Unmute Headphone out path */
5391 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5392 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5393 /* Unmute Mono out path */
5394 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5395 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5400 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5401 /* Line out and output */
5402 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5404 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5405 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5406 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5407 /* Mic2 (front panel) pin widget for input and vref at 80% */
5408 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5409 /* Line In pin widget for input */
5410 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5411 /* Headphone pin widget for output */
5412 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5413 /* CD pin widget for input */
5414 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5415 /* unmute amp left and right */
5416 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5417 /* set connection select to line in (default select for this ADC) */
5418 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5419 /* unmute Line-Out mixer amp left and right (volume = 0) */
5420 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5421 /* mute pin widget amp left and right (no gain on this amp) */
5422 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5423 /* unmute HP mixer amp left and right (volume = 0) */
5424 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5425 /* mute pin widget amp left and right (no gain on this amp) */
5426 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5427 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5430 /* mute analog inputs */
5431 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5432 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5433 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5434 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5435 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5436 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5437 /* Unmute Front out path */
5438 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5439 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5440 /* Unmute Headphone out path */
5441 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5442 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5443 /* Unmute Mono out path */
5444 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5445 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5449 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5450 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5451 * audio = 0x16, internal speaker = 0x10.
5453 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5454 /* Disable all GPIOs */
5455 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5456 /* Internal speaker is connected to headphone pin */
5457 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5458 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5459 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5460 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5461 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5462 /* Ensure all other unused pins are disabled and muted. */
5463 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5464 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5465 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5466 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5467 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5468 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5469 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5470 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5472 /* Disable digital (SPDIF) pins */
5473 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5474 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5476 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5477 * when acting as an output.
5479 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5481 /* Start with output sum widgets muted and their output gains at min */
5482 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5483 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5484 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5485 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5486 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5487 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5488 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5489 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5490 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5492 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5493 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5494 /* Unmute Line1 pin widget output buffer since it starts as an output.
5495 * If the pin mode is changed by the user the pin mode control will
5496 * take care of enabling the pin's input/output buffers as needed.
5497 * Therefore there's no need to enable the input buffer at this
5500 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5501 /* Unmute input buffer of pin widget used for Line-in (no equiv
5504 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5506 /* Mute capture amp left and right */
5507 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5508 /* Set ADC connection select to match default mixer setting - line
5511 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5513 /* Do the same for the second ADC: mute capture input amp and
5514 * set ADC connection to line in (on mic1 pin)
5516 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5517 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5519 /* Mute all inputs to mixer widget (even unconnected ones) */
5520 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5521 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5522 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5523 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5524 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5525 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5526 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5527 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5532 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5533 * similar laptops (adapted from Fujitsu init verbs).
5535 static struct hda_verb alc260_acer_init_verbs[] = {
5536 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5537 * the headphone jack. Turn this on and rely on the standard mute
5538 * methods whenever the user wants to turn these outputs off.
5540 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5541 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5542 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5543 /* Internal speaker/Headphone jack is connected to Line-out pin */
5544 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5545 /* Internal microphone/Mic jack is connected to Mic1 pin */
5546 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5547 /* Line In jack is connected to Line1 pin */
5548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5549 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5550 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5551 /* Ensure all other unused pins are disabled and muted. */
5552 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5553 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5554 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5555 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5556 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5557 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5558 /* Disable digital (SPDIF) pins */
5559 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5560 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5562 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5563 * bus when acting as outputs.
5565 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5566 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5568 /* Start with output sum widgets muted and their output gains at min */
5569 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5570 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5571 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5572 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5573 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5574 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5575 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5576 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5577 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5579 /* Unmute Line-out pin widget amp left and right
5580 * (no equiv mixer ctrl)
5582 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5583 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5584 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5585 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5586 * inputs. If the pin mode is changed by the user the pin mode control
5587 * will take care of enabling the pin's input/output buffers as needed.
5588 * Therefore there's no need to enable the input buffer at this
5591 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5592 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5594 /* Mute capture amp left and right */
5595 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5596 /* Set ADC connection select to match default mixer setting - mic
5599 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5601 /* Do similar with the second ADC: mute capture input amp and
5602 * set ADC connection to mic to match ALSA's default state.
5604 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5605 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5607 /* Mute all inputs to mixer widget (even unconnected ones) */
5608 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5609 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5610 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5611 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5612 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5613 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5620 /* Initialisation sequence for Maxdata Favorit 100XS
5621 * (adapted from Acer init verbs).
5623 static struct hda_verb alc260_favorit100_init_verbs[] = {
5624 /* GPIO 0 enables the output jack.
5625 * Turn this on and rely on the standard mute
5626 * methods whenever the user wants to turn these outputs off.
5628 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5629 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5630 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5631 /* Line/Mic input jack is connected to Mic1 pin */
5632 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5633 /* Ensure all other unused pins are disabled and muted. */
5634 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5635 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5636 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5637 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5638 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5639 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5640 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5641 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5642 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5643 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5644 /* Disable digital (SPDIF) pins */
5645 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5646 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5648 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5649 * bus when acting as outputs.
5651 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5652 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5654 /* Start with output sum widgets muted and their output gains at min */
5655 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5656 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5657 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5658 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5659 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5660 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5661 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5662 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5663 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5665 /* Unmute Line-out pin widget amp left and right
5666 * (no equiv mixer ctrl)
5668 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5669 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5670 * inputs. If the pin mode is changed by the user the pin mode control
5671 * will take care of enabling the pin's input/output buffers as needed.
5672 * Therefore there's no need to enable the input buffer at this
5675 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5677 /* Mute capture amp left and right */
5678 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5679 /* Set ADC connection select to match default mixer setting - mic
5682 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5684 /* Do similar with the second ADC: mute capture input amp and
5685 * set ADC connection to mic to match ALSA's default state.
5687 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5688 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5690 /* Mute all inputs to mixer widget (even unconnected ones) */
5691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5692 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5693 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5694 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5695 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5696 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5697 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5698 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5703 static struct hda_verb alc260_will_verbs[] = {
5704 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5705 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5706 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5707 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5708 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5709 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5713 static struct hda_verb alc260_replacer_672v_verbs[] = {
5714 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5715 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5716 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5718 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5719 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5720 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5722 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5726 /* toggle speaker-output according to the hp-jack state */
5727 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5729 unsigned int present;
5731 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5732 present = snd_hda_codec_read(codec, 0x0f, 0,
5733 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5735 snd_hda_codec_write_cache(codec, 0x01, 0,
5736 AC_VERB_SET_GPIO_DATA, 1);
5737 snd_hda_codec_write_cache(codec, 0x0f, 0,
5738 AC_VERB_SET_PIN_WIDGET_CONTROL,
5741 snd_hda_codec_write_cache(codec, 0x01, 0,
5742 AC_VERB_SET_GPIO_DATA, 0);
5743 snd_hda_codec_write_cache(codec, 0x0f, 0,
5744 AC_VERB_SET_PIN_WIDGET_CONTROL,
5749 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5752 if ((res >> 26) == ALC880_HP_EVENT)
5753 alc260_replacer_672v_automute(codec);
5756 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5757 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5758 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5759 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5760 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5761 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5762 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5763 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5764 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5765 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5766 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5770 /* Test configuration for debugging, modelled after the ALC880 test
5773 #ifdef CONFIG_SND_DEBUG
5774 static hda_nid_t alc260_test_dac_nids[1] = {
5777 static hda_nid_t alc260_test_adc_nids[2] = {
5780 /* For testing the ALC260, each input MUX needs its own definition since
5781 * the signal assignments are different. This assumes that the first ADC
5784 static struct hda_input_mux alc260_test_capture_sources[2] = {
5788 { "MIC1 pin", 0x0 },
5789 { "MIC2 pin", 0x1 },
5790 { "LINE1 pin", 0x2 },
5791 { "LINE2 pin", 0x3 },
5793 { "LINE-OUT pin", 0x5 },
5794 { "HP-OUT pin", 0x6 },
5800 { "MIC1 pin", 0x0 },
5801 { "MIC2 pin", 0x1 },
5802 { "LINE1 pin", 0x2 },
5803 { "LINE2 pin", 0x3 },
5806 { "LINE-OUT pin", 0x6 },
5807 { "HP-OUT pin", 0x7 },
5811 static struct snd_kcontrol_new alc260_test_mixer[] = {
5812 /* Output driver widgets */
5813 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5814 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5815 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5816 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5817 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5818 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5820 /* Modes for retasking pin widgets
5821 * Note: the ALC260 doesn't seem to act on requests to enable mic
5822 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5823 * mention this restriction. At this stage it's not clear whether
5824 * this behaviour is intentional or is a hardware bug in chip
5825 * revisions available at least up until early 2006. Therefore for
5826 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5827 * choices, but if it turns out that the lack of mic bias for these
5828 * NIDs is intentional we could change their modes from
5829 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5831 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5832 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5833 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5834 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5835 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5836 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5838 /* Loopback mixer controls */
5839 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5840 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5841 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5842 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5843 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5844 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5845 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5846 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5847 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5848 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5849 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5850 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5851 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5852 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5854 /* Controls for GPIO pins, assuming they are configured as outputs */
5855 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5856 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5857 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5858 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5860 /* Switches to allow the digital IO pins to be enabled. The datasheet
5861 * is ambigious as to which NID is which; testing on laptops which
5862 * make this output available should provide clarification.
5864 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5865 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5867 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5868 * this output to turn on an external amplifier.
5870 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5871 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5875 static struct hda_verb alc260_test_init_verbs[] = {
5876 /* Enable all GPIOs as outputs with an initial value of 0 */
5877 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5878 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5879 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5881 /* Enable retasking pins as output, initially without power amp */
5882 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5883 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5884 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5885 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5886 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5887 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5889 /* Disable digital (SPDIF) pins initially, but users can enable
5890 * them via a mixer switch. In the case of SPDIF-out, this initverb
5891 * payload also sets the generation to 0, output to be in "consumer"
5892 * PCM format, copyright asserted, no pre-emphasis and no validity
5895 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5896 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5898 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5899 * OUT1 sum bus when acting as an output.
5901 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5902 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5903 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5904 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5906 /* Start with output sum widgets muted and their output gains at min */
5907 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5908 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5909 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5910 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5911 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5912 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5913 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5914 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5915 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5917 /* Unmute retasking pin widget output buffers since the default
5918 * state appears to be output. As the pin mode is changed by the
5919 * user the pin mode control will take care of enabling the pin's
5920 * input/output buffers as needed.
5922 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5923 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5924 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5925 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5926 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5927 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5928 /* Also unmute the mono-out pin widget */
5929 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5931 /* Mute capture amp left and right */
5932 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5933 /* Set ADC connection select to match default mixer setting (mic1
5936 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5938 /* Do the same for the second ADC: mute capture input amp and
5939 * set ADC connection to mic1 pin
5941 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5942 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5944 /* Mute all inputs to mixer widget (even unconnected ones) */
5945 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5946 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5947 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5948 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5949 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5950 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5951 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5952 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5958 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5959 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5961 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5962 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5965 * for BIOS auto-configuration
5968 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5969 const char *pfx, int *vol_bits)
5972 unsigned long vol_val, sw_val;
5976 if (nid >= 0x0f && nid < 0x11) {
5977 nid_vol = nid - 0x7;
5978 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5979 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5980 } else if (nid == 0x11) {
5981 nid_vol = nid - 0x7;
5982 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5983 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5984 } else if (nid >= 0x12 && nid <= 0x15) {
5986 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5987 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5991 if (!(*vol_bits & (1 << nid_vol))) {
5992 /* first control for the volume widget */
5993 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5994 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5997 *vol_bits |= (1 << nid_vol);
5999 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
6000 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
6006 /* add playback controls from the parsed DAC table */
6007 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6008 const struct auto_pin_cfg *cfg)
6014 spec->multiout.num_dacs = 1;
6015 spec->multiout.dac_nids = spec->private_dac_nids;
6016 spec->multiout.dac_nids[0] = 0x02;
6018 nid = cfg->line_out_pins[0];
6021 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6023 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6027 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6032 nid = cfg->speaker_pins[0];
6034 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6039 nid = cfg->hp_pins[0];
6041 err = alc260_add_playback_controls(spec, nid, "Headphone",
6049 /* create playback/capture controls for input pins */
6050 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6051 const struct auto_pin_cfg *cfg)
6053 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6056 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6057 hda_nid_t nid, int pin_type,
6060 alc_set_pin_output(codec, nid, pin_type);
6061 /* need the manual connection? */
6063 int idx = nid - 0x12;
6064 snd_hda_codec_write(codec, idx + 0x0b, 0,
6065 AC_VERB_SET_CONNECT_SEL, sel_idx);
6069 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6071 struct alc_spec *spec = codec->spec;
6074 nid = spec->autocfg.line_out_pins[0];
6076 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6077 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6080 nid = spec->autocfg.speaker_pins[0];
6082 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6084 nid = spec->autocfg.hp_pins[0];
6086 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6089 #define ALC260_PIN_CD_NID 0x16
6090 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6092 struct alc_spec *spec = codec->spec;
6095 for (i = 0; i < AUTO_PIN_LAST; i++) {
6096 hda_nid_t nid = spec->autocfg.input_pins[i];
6098 alc_set_input_pin(codec, nid, i);
6099 if (nid != ALC260_PIN_CD_NID &&
6100 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6101 snd_hda_codec_write(codec, nid, 0,
6102 AC_VERB_SET_AMP_GAIN_MUTE,
6109 * generic initialization of ADC, input mixers and output mixers
6111 static struct hda_verb alc260_volume_init_verbs[] = {
6113 * Unmute ADC0-1 and set the default input to mic-in
6115 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6116 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6117 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6118 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6120 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6122 * Note: PASD motherboards uses the Line In 2 as the input for
6123 * front panel mic (mic 2)
6125 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6126 /* mute analog inputs */
6127 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6128 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6129 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6131 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6134 * Set up output mixers (0x08 - 0x0a)
6136 /* set vol=0 to output mixers */
6137 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6138 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6139 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6140 /* set up input amps for analog loopback */
6141 /* Amp Indices: DAC = 0, mixer = 1 */
6142 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6143 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6144 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6145 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6146 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6147 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6152 static int alc260_parse_auto_config(struct hda_codec *codec)
6154 struct alc_spec *spec = codec->spec;
6156 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6158 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6162 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6165 if (!spec->kctls.list)
6166 return 0; /* can't find valid BIOS pin config */
6167 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6171 spec->multiout.max_channels = 2;
6173 if (spec->autocfg.dig_outs)
6174 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6175 if (spec->kctls.list)
6176 add_mixer(spec, spec->kctls.list);
6178 add_verb(spec, alc260_volume_init_verbs);
6180 spec->num_mux_defs = 1;
6181 spec->input_mux = &spec->private_imux[0];
6183 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6188 /* additional initialization for auto-configuration model */
6189 static void alc260_auto_init(struct hda_codec *codec)
6191 struct alc_spec *spec = codec->spec;
6192 alc260_auto_init_multi_out(codec);
6193 alc260_auto_init_analog_input(codec);
6194 if (spec->unsol_event)
6195 alc_inithook(codec);
6198 #ifdef CONFIG_SND_HDA_POWER_SAVE
6199 static struct hda_amp_list alc260_loopbacks[] = {
6200 { 0x07, HDA_INPUT, 0 },
6201 { 0x07, HDA_INPUT, 1 },
6202 { 0x07, HDA_INPUT, 2 },
6203 { 0x07, HDA_INPUT, 3 },
6204 { 0x07, HDA_INPUT, 4 },
6210 * ALC260 configurations
6212 static const char *alc260_models[ALC260_MODEL_LAST] = {
6213 [ALC260_BASIC] = "basic",
6215 [ALC260_HP_3013] = "hp-3013",
6216 [ALC260_HP_DC7600] = "hp-dc7600",
6217 [ALC260_FUJITSU_S702X] = "fujitsu",
6218 [ALC260_ACER] = "acer",
6219 [ALC260_WILL] = "will",
6220 [ALC260_REPLACER_672V] = "replacer",
6221 [ALC260_FAVORIT100] = "favorit100",
6222 #ifdef CONFIG_SND_DEBUG
6223 [ALC260_TEST] = "test",
6225 [ALC260_AUTO] = "auto",
6228 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6229 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6230 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6231 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6232 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6233 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6234 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6235 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6236 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6237 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6238 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6239 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6240 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6241 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6242 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6243 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6244 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6245 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6246 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6247 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6251 static struct alc_config_preset alc260_presets[] = {
6253 .mixers = { alc260_base_output_mixer,
6254 alc260_input_mixer },
6255 .init_verbs = { alc260_init_verbs },
6256 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6257 .dac_nids = alc260_dac_nids,
6258 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6259 .adc_nids = alc260_adc_nids,
6260 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6261 .channel_mode = alc260_modes,
6262 .input_mux = &alc260_capture_source,
6265 .mixers = { alc260_hp_output_mixer,
6266 alc260_input_mixer },
6267 .init_verbs = { alc260_init_verbs,
6268 alc260_hp_unsol_verbs },
6269 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6270 .dac_nids = alc260_dac_nids,
6271 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6272 .adc_nids = alc260_adc_nids_alt,
6273 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6274 .channel_mode = alc260_modes,
6275 .input_mux = &alc260_capture_source,
6276 .unsol_event = alc260_hp_unsol_event,
6277 .init_hook = alc260_hp_automute,
6279 [ALC260_HP_DC7600] = {
6280 .mixers = { alc260_hp_dc7600_mixer,
6281 alc260_input_mixer },
6282 .init_verbs = { alc260_init_verbs,
6283 alc260_hp_dc7600_verbs },
6284 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6285 .dac_nids = alc260_dac_nids,
6286 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6287 .adc_nids = alc260_adc_nids_alt,
6288 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6289 .channel_mode = alc260_modes,
6290 .input_mux = &alc260_capture_source,
6291 .unsol_event = alc260_hp_3012_unsol_event,
6292 .init_hook = alc260_hp_3012_automute,
6294 [ALC260_HP_3013] = {
6295 .mixers = { alc260_hp_3013_mixer,
6296 alc260_input_mixer },
6297 .init_verbs = { alc260_hp_3013_init_verbs,
6298 alc260_hp_3013_unsol_verbs },
6299 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6300 .dac_nids = alc260_dac_nids,
6301 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6302 .adc_nids = alc260_adc_nids_alt,
6303 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6304 .channel_mode = alc260_modes,
6305 .input_mux = &alc260_capture_source,
6306 .unsol_event = alc260_hp_3013_unsol_event,
6307 .init_hook = alc260_hp_3013_automute,
6309 [ALC260_FUJITSU_S702X] = {
6310 .mixers = { alc260_fujitsu_mixer },
6311 .init_verbs = { alc260_fujitsu_init_verbs },
6312 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6313 .dac_nids = alc260_dac_nids,
6314 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6315 .adc_nids = alc260_dual_adc_nids,
6316 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6317 .channel_mode = alc260_modes,
6318 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6319 .input_mux = alc260_fujitsu_capture_sources,
6322 .mixers = { alc260_acer_mixer },
6323 .init_verbs = { alc260_acer_init_verbs },
6324 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6325 .dac_nids = alc260_dac_nids,
6326 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6327 .adc_nids = alc260_dual_adc_nids,
6328 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6329 .channel_mode = alc260_modes,
6330 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6331 .input_mux = alc260_acer_capture_sources,
6333 [ALC260_FAVORIT100] = {
6334 .mixers = { alc260_favorit100_mixer },
6335 .init_verbs = { alc260_favorit100_init_verbs },
6336 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6337 .dac_nids = alc260_dac_nids,
6338 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6339 .adc_nids = alc260_dual_adc_nids,
6340 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6341 .channel_mode = alc260_modes,
6342 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6343 .input_mux = alc260_favorit100_capture_sources,
6346 .mixers = { alc260_will_mixer },
6347 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6348 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6349 .dac_nids = alc260_dac_nids,
6350 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6351 .adc_nids = alc260_adc_nids,
6352 .dig_out_nid = ALC260_DIGOUT_NID,
6353 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6354 .channel_mode = alc260_modes,
6355 .input_mux = &alc260_capture_source,
6357 [ALC260_REPLACER_672V] = {
6358 .mixers = { alc260_replacer_672v_mixer },
6359 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6360 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6361 .dac_nids = alc260_dac_nids,
6362 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6363 .adc_nids = alc260_adc_nids,
6364 .dig_out_nid = ALC260_DIGOUT_NID,
6365 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6366 .channel_mode = alc260_modes,
6367 .input_mux = &alc260_capture_source,
6368 .unsol_event = alc260_replacer_672v_unsol_event,
6369 .init_hook = alc260_replacer_672v_automute,
6371 #ifdef CONFIG_SND_DEBUG
6373 .mixers = { alc260_test_mixer },
6374 .init_verbs = { alc260_test_init_verbs },
6375 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6376 .dac_nids = alc260_test_dac_nids,
6377 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6378 .adc_nids = alc260_test_adc_nids,
6379 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6380 .channel_mode = alc260_modes,
6381 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6382 .input_mux = alc260_test_capture_sources,
6387 static int patch_alc260(struct hda_codec *codec)
6389 struct alc_spec *spec;
6390 int err, board_config;
6392 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6398 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6401 if (board_config < 0) {
6402 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6404 board_config = ALC260_AUTO;
6407 if (board_config == ALC260_AUTO) {
6408 /* automatic parse from the BIOS config */
6409 err = alc260_parse_auto_config(codec);
6415 "hda_codec: Cannot set up configuration "
6416 "from BIOS. Using base mode...\n");
6417 board_config = ALC260_BASIC;
6421 err = snd_hda_attach_beep_device(codec, 0x1);
6427 if (board_config != ALC260_AUTO)
6428 setup_preset(codec, &alc260_presets[board_config]);
6430 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6431 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6433 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6434 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6436 if (!spec->adc_nids && spec->input_mux) {
6437 /* check whether NID 0x04 is valid */
6438 unsigned int wcap = get_wcaps(codec, 0x04);
6439 wcap = get_wcaps_type(wcap);
6441 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6442 spec->adc_nids = alc260_adc_nids_alt;
6443 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6445 spec->adc_nids = alc260_adc_nids;
6446 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6449 set_capture_mixer(codec);
6450 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6452 spec->vmaster_nid = 0x08;
6454 codec->patch_ops = alc_patch_ops;
6455 if (board_config == ALC260_AUTO)
6456 spec->init_hook = alc260_auto_init;
6457 #ifdef CONFIG_SND_HDA_POWER_SAVE
6458 if (!spec->loopback.amplist)
6459 spec->loopback.amplist = alc260_loopbacks;
6461 codec->proc_widget_hook = print_realtek_coef;
6468 * ALC882/883/885/888/889 support
6470 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6471 * configuration. Each pin widget can choose any input DACs and a mixer.
6472 * Each ADC is connected from a mixer of all inputs. This makes possible
6473 * 6-channel independent captures.
6475 * In addition, an independent DAC for the multi-playback (not used in this
6478 #define ALC882_DIGOUT_NID 0x06
6479 #define ALC882_DIGIN_NID 0x0a
6480 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6481 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6482 #define ALC1200_DIGOUT_NID 0x10
6485 static struct hda_channel_mode alc882_ch_modes[1] = {
6490 static hda_nid_t alc882_dac_nids[4] = {
6491 /* front, rear, clfe, rear_surr */
6492 0x02, 0x03, 0x04, 0x05
6494 #define alc883_dac_nids alc882_dac_nids
6497 #define alc882_adc_nids alc880_adc_nids
6498 #define alc882_adc_nids_alt alc880_adc_nids_alt
6499 #define alc883_adc_nids alc882_adc_nids_alt
6500 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6501 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6502 #define alc889_adc_nids alc880_adc_nids
6504 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6505 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6506 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6507 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6508 #define alc889_capsrc_nids alc882_capsrc_nids
6511 /* FIXME: should be a matrix-type input source selection */
6513 static struct hda_input_mux alc882_capture_source = {
6517 { "Front Mic", 0x1 },
6523 #define alc883_capture_source alc882_capture_source
6525 static struct hda_input_mux alc889_capture_source = {
6528 { "Front Mic", 0x0 },
6534 static struct hda_input_mux mb5_capture_source = {
6543 static struct hda_input_mux alc883_3stack_6ch_intel = {
6547 { "Front Mic", 0x0 },
6553 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6561 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6571 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6579 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6583 { "Front Mic", 0x1 },
6588 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6596 static struct hda_input_mux alc889A_mb31_capture_source = {
6600 /* Front Mic (0x01) unused */
6602 /* Line 2 (0x03) unused */
6603 /* CD (0x04) unsused? */
6610 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6617 static struct hda_verb alc882_3ST_ch2_init[] = {
6618 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6619 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6620 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6621 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6628 static struct hda_verb alc882_3ST_ch4_init[] = {
6629 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6630 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6631 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6632 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6633 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6640 static struct hda_verb alc882_3ST_ch6_init[] = {
6641 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6642 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6643 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6644 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6645 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6646 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6650 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6651 { 2, alc882_3ST_ch2_init },
6652 { 4, alc882_3ST_ch4_init },
6653 { 6, alc882_3ST_ch6_init },
6656 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6661 static struct hda_verb alc882_sixstack_ch6_init[] = {
6662 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6663 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6664 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6665 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6672 static struct hda_verb alc882_sixstack_ch8_init[] = {
6673 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6674 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6675 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6676 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6680 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6681 { 6, alc882_sixstack_ch6_init },
6682 { 8, alc882_sixstack_ch8_init },
6686 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6692 static struct hda_verb alc885_mbp_ch2_init[] = {
6693 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6694 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6695 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6702 static struct hda_verb alc885_mbp_ch6_init[] = {
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 },
6706 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6707 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6711 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6712 { 2, alc885_mbp_ch2_init },
6713 { 6, alc885_mbp_ch6_init },
6718 * Speakers/Woofer/HP = Front
6721 static struct hda_verb alc885_mb5_ch2_init[] = {
6722 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6723 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6729 * Speakers/HP = Front
6733 static struct hda_verb alc885_mb5_ch6_init[] = {
6734 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6735 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6736 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6740 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6741 { 2, alc885_mb5_ch2_init },
6742 { 6, alc885_mb5_ch6_init },
6749 static struct hda_verb alc883_4ST_ch2_init[] = {
6750 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6751 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6752 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6753 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6754 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6755 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6762 static struct hda_verb alc883_4ST_ch4_init[] = {
6763 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6764 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6765 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6766 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6767 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6768 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6769 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6776 static struct hda_verb alc883_4ST_ch6_init[] = {
6777 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6778 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6779 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6780 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6781 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6782 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6783 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6784 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6791 static struct hda_verb alc883_4ST_ch8_init[] = {
6792 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6793 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6794 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6795 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6796 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6797 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6798 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6799 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6800 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6804 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6805 { 2, alc883_4ST_ch2_init },
6806 { 4, alc883_4ST_ch4_init },
6807 { 6, alc883_4ST_ch6_init },
6808 { 8, alc883_4ST_ch8_init },
6815 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6816 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6817 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6818 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6819 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6826 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6827 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6828 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6829 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6830 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6831 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6838 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6839 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6840 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6841 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6842 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6843 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6844 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6848 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6849 { 2, alc883_3ST_ch2_intel_init },
6850 { 4, alc883_3ST_ch4_intel_init },
6851 { 6, alc883_3ST_ch6_intel_init },
6857 static struct hda_verb alc889_ch2_intel_init[] = {
6858 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6859 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6860 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6861 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6862 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6863 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6870 static struct hda_verb alc889_ch6_intel_init[] = {
6871 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6872 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6873 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6874 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6875 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6876 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6883 static struct hda_verb alc889_ch8_intel_init[] = {
6884 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6885 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6886 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6887 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6888 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6889 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6890 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6894 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6895 { 2, alc889_ch2_intel_init },
6896 { 6, alc889_ch6_intel_init },
6897 { 8, alc889_ch8_intel_init },
6903 static struct hda_verb alc883_sixstack_ch6_init[] = {
6904 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6905 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6906 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6907 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6914 static struct hda_verb alc883_sixstack_ch8_init[] = {
6915 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6916 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6917 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6918 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6922 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6923 { 6, alc883_sixstack_ch6_init },
6924 { 8, alc883_sixstack_ch8_init },
6928 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6929 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6931 static struct snd_kcontrol_new alc882_base_mixer[] = {
6932 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6933 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6934 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6935 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6936 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6937 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6938 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6939 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6940 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6941 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6942 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6943 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6944 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6945 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6946 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6948 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6949 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6950 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6951 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6952 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6956 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6957 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6958 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6959 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6960 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6961 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6962 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6963 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6964 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6965 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6966 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6970 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6971 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6972 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6973 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6974 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6975 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6976 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6977 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6978 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6979 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6980 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6981 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6982 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6983 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6984 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6988 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6989 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6990 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6991 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6992 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6993 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6994 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6995 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6996 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6997 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7001 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7002 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7003 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7004 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7005 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7006 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7007 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7008 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7009 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7010 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7011 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7012 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7013 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7014 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7018 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7019 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7021 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7022 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7023 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7024 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7025 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7026 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7027 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7028 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7029 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7030 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7031 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7032 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7033 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7034 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7038 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7039 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7040 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7041 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7042 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7043 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7044 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7045 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7046 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7047 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7048 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7052 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7054 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7055 .name = "Channel Mode",
7056 .info = alc_ch_mode_info,
7057 .get = alc_ch_mode_get,
7058 .put = alc_ch_mode_put,
7063 static struct hda_verb alc882_base_init_verbs[] = {
7064 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7065 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7066 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7067 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7069 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7070 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7071 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7073 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7074 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7075 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7077 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7078 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7079 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7081 /* mute analog input loopbacks */
7082 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7088 /* Front Pin: output 0 (0x0c) */
7089 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7090 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7091 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7092 /* Rear Pin: output 1 (0x0d) */
7093 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7094 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7095 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7096 /* CLFE Pin: output 2 (0x0e) */
7097 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7098 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7099 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7100 /* Side Pin: output 3 (0x0f) */
7101 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7102 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7103 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7104 /* Mic (rear) pin: input vref at 80% */
7105 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7106 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7107 /* Front Mic pin: input vref at 80% */
7108 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7109 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7110 /* Line In pin: input */
7111 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7112 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7113 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7114 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7115 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7116 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7117 /* CD pin widget for input */
7118 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7120 /* FIXME: use matrix-type input source selection */
7121 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7123 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7124 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7125 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7126 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7128 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7129 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7130 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7131 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7132 /* ADC2: mute amp left and right */
7133 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7134 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7135 /* ADC3: mute amp left and right */
7136 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7137 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7142 static struct hda_verb alc882_adc1_init_verbs[] = {
7143 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7144 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7145 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7146 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7147 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7148 /* ADC1: mute amp left and right */
7149 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7150 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7154 static struct hda_verb alc882_eapd_verbs[] = {
7155 /* change to EAPD mode */
7156 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7157 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7161 static struct hda_verb alc889_eapd_verbs[] = {
7162 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7163 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7167 static struct hda_verb alc_hp15_unsol_verbs[] = {
7168 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7169 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7173 static struct hda_verb alc885_init_verbs[] = {
7174 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7175 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7176 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7177 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7179 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7180 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7181 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7183 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7184 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7185 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7187 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7188 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7189 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7191 /* mute analog input loopbacks */
7192 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7193 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7194 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7196 /* Front HP Pin: output 0 (0x0c) */
7197 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7198 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7199 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7200 /* Front Pin: output 0 (0x0c) */
7201 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7202 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7203 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7204 /* Rear Pin: output 1 (0x0d) */
7205 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7206 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7207 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7208 /* CLFE Pin: output 2 (0x0e) */
7209 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7210 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7211 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7212 /* Side Pin: output 3 (0x0f) */
7213 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7214 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7215 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7216 /* Mic (rear) pin: input vref at 80% */
7217 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7218 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7219 /* Front Mic pin: input vref at 80% */
7220 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7221 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7222 /* Line In pin: input */
7223 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7224 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7226 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7228 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7229 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7230 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7232 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7233 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7234 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7236 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7237 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7238 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7239 /* ADC2: mute amp left and right */
7240 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7241 /* ADC3: mute amp left and right */
7242 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7247 static struct hda_verb alc885_init_input_verbs[] = {
7248 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7249 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7250 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7255 /* Unmute Selector 24h and set the default input to front mic */
7256 static struct hda_verb alc889_init_input_verbs[] = {
7257 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7258 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7263 #define alc883_init_verbs alc882_base_init_verbs
7266 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7267 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7268 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7269 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7270 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7271 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7272 /* FIXME: this looks suspicious...
7273 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7274 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7279 static struct hda_verb alc882_macpro_init_verbs[] = {
7280 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7281 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7282 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7283 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7284 /* Front Pin: output 0 (0x0c) */
7285 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7286 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7287 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7288 /* Front Mic pin: input vref at 80% */
7289 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7290 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7291 /* Speaker: output */
7292 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7293 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7294 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7295 /* Headphone output (output 0 - 0x0c) */
7296 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7297 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7298 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7300 /* FIXME: use matrix-type input source selection */
7301 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7302 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7303 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7304 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7305 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7306 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7311 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7317 /* ADC1: mute amp left and right */
7318 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7319 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7320 /* ADC2: mute amp left and right */
7321 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7322 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7323 /* ADC3: mute amp left and right */
7324 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7325 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7331 static struct hda_verb alc885_mb5_init_verbs[] = {
7333 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7334 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7335 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7336 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7338 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7339 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7340 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7341 /* Surround mixer */
7342 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7343 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7344 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7346 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7350 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7351 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7352 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7353 /* Front Pin (0x0c) */
7354 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7355 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7356 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7357 /* LFE Pin (0x0e) */
7358 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7359 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7360 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7362 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7363 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7364 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7365 /* Front Mic pin: input vref at 80% */
7366 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7367 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7369 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7370 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7374 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7375 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7379 /* Macbook Pro rev3 */
7380 static struct hda_verb alc885_mbp3_init_verbs[] = {
7381 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7384 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7386 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7387 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7388 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7389 /* Front Pin: output 0 (0x0c) */
7390 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7391 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7392 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7393 /* HP Pin: output 0 (0x0d) */
7394 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7395 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7396 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7397 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7398 /* Mic (rear) pin: input vref at 80% */
7399 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7400 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7401 /* Front Mic pin: input vref at 80% */
7402 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7403 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7404 /* Line In pin: use output 1 when in LineOut mode */
7405 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7406 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7407 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7409 /* FIXME: use matrix-type input source selection */
7410 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7411 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7412 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7413 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7414 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7415 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7417 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7418 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7419 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7420 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7422 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7423 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7424 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7425 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7426 /* ADC1: mute amp left and right */
7427 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7428 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7429 /* ADC2: mute amp left and right */
7430 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7431 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7432 /* ADC3: mute amp left and right */
7433 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7434 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7439 /* iMac 24 mixer. */
7440 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7441 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7442 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7446 /* iMac 24 init verbs. */
7447 static struct hda_verb alc885_imac24_init_verbs[] = {
7448 /* Internal speakers: output 0 (0x0c) */
7449 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7450 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7451 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7452 /* Internal speakers: output 0 (0x0c) */
7453 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7454 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7455 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7456 /* Headphone: output 0 (0x0c) */
7457 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7458 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7459 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7460 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7461 /* Front Mic: input vref at 80% */
7462 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7463 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7467 /* Toggle speaker-output according to the hp-jack state */
7468 static void alc885_imac24_setup(struct hda_codec *codec)
7470 struct alc_spec *spec = codec->spec;
7472 spec->autocfg.hp_pins[0] = 0x14;
7473 spec->autocfg.speaker_pins[0] = 0x18;
7474 spec->autocfg.speaker_pins[1] = 0x1a;
7477 static void alc885_mbp3_setup(struct hda_codec *codec)
7479 struct alc_spec *spec = codec->spec;
7481 spec->autocfg.hp_pins[0] = 0x15;
7482 spec->autocfg.speaker_pins[0] = 0x14;
7486 static struct hda_verb alc882_targa_verbs[] = {
7487 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7488 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7490 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7491 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7493 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7494 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7495 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7497 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7501 /* toggle speaker-output according to the hp-jack state */
7502 static void alc882_targa_automute(struct hda_codec *codec)
7504 struct alc_spec *spec = codec->spec;
7505 alc_automute_amp(codec);
7506 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7507 spec->jack_present ? 1 : 3);
7510 static void alc882_targa_setup(struct hda_codec *codec)
7512 struct alc_spec *spec = codec->spec;
7514 spec->autocfg.hp_pins[0] = 0x14;
7515 spec->autocfg.speaker_pins[0] = 0x1b;
7518 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7520 if ((res >> 26) == ALC880_HP_EVENT)
7521 alc882_targa_automute(codec);
7524 static struct hda_verb alc882_asus_a7j_verbs[] = {
7525 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7528 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7529 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7530 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7532 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7533 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7534 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7536 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7537 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7538 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7542 static struct hda_verb alc882_asus_a7m_verbs[] = {
7543 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7546 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7547 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7548 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7550 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7551 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7552 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7554 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7555 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7556 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7560 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7562 unsigned int gpiostate, gpiomask, gpiodir;
7564 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7565 AC_VERB_GET_GPIO_DATA, 0);
7568 gpiostate |= (1 << pin);
7570 gpiostate &= ~(1 << pin);
7572 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7573 AC_VERB_GET_GPIO_MASK, 0);
7574 gpiomask |= (1 << pin);
7576 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7577 AC_VERB_GET_GPIO_DIRECTION, 0);
7578 gpiodir |= (1 << pin);
7581 snd_hda_codec_write(codec, codec->afg, 0,
7582 AC_VERB_SET_GPIO_MASK, gpiomask);
7583 snd_hda_codec_write(codec, codec->afg, 0,
7584 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7588 snd_hda_codec_write(codec, codec->afg, 0,
7589 AC_VERB_SET_GPIO_DATA, gpiostate);
7592 /* set up GPIO at initialization */
7593 static void alc885_macpro_init_hook(struct hda_codec *codec)
7595 alc882_gpio_mute(codec, 0, 0);
7596 alc882_gpio_mute(codec, 1, 0);
7599 /* set up GPIO and update auto-muting at initialization */
7600 static void alc885_imac24_init_hook(struct hda_codec *codec)
7602 alc885_macpro_init_hook(codec);
7603 alc_automute_amp(codec);
7607 * generic initialization of ADC, input mixers and output mixers
7609 static struct hda_verb alc883_auto_init_verbs[] = {
7611 * Unmute ADC0-2 and set the default input to mic-in
7613 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7614 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7615 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7616 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7618 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7620 * Note: PASD motherboards uses the Line In 2 as the input for
7621 * front panel mic (mic 2)
7623 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7631 * Set up output mixers (0x0c - 0x0f)
7633 /* set vol=0 to output mixers */
7634 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7635 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7636 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7637 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7638 /* set up input amps for analog loopback */
7639 /* Amp Indices: DAC = 0, mixer = 1 */
7640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7642 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7643 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7644 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7645 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7646 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7648 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7649 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7651 /* FIXME: use matrix-type input source selection */
7652 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7655 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7656 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7657 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7660 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7661 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7662 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7667 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7668 static struct hda_verb alc889A_mb31_ch2_init[] = {
7669 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7670 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7671 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7672 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7676 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7677 static struct hda_verb alc889A_mb31_ch4_init[] = {
7678 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7679 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7680 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7681 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7685 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7686 static struct hda_verb alc889A_mb31_ch5_init[] = {
7687 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7688 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7689 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7690 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7694 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7695 static struct hda_verb alc889A_mb31_ch6_init[] = {
7696 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7697 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7698 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7699 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7703 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7704 { 2, alc889A_mb31_ch2_init },
7705 { 4, alc889A_mb31_ch4_init },
7706 { 5, alc889A_mb31_ch5_init },
7707 { 6, alc889A_mb31_ch6_init },
7710 static struct hda_verb alc883_medion_eapd_verbs[] = {
7711 /* eanable EAPD on medion laptop */
7712 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7713 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7717 #define alc883_base_mixer alc882_base_mixer
7719 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7720 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7721 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7722 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7723 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7724 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7725 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7726 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7727 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7728 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7729 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7730 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7731 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7732 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7736 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7737 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7738 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7739 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7740 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7741 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7742 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7743 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7744 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7745 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7746 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7750 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7751 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7752 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7753 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7754 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7755 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7756 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7757 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7758 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7759 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7760 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7764 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7765 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7766 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7767 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7768 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7769 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7770 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7771 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7772 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7773 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7774 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7775 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7776 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7777 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7781 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7782 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7783 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7784 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7785 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7786 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7787 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7788 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7789 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7790 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7791 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7792 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7793 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7794 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7796 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7797 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7798 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7799 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7800 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7804 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7805 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7806 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7807 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7808 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7809 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7811 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7812 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7813 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7814 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7815 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7816 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7817 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7818 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7819 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7820 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7821 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7822 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7823 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7824 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7828 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7829 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7830 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7831 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7832 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7833 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7835 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7836 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7837 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7838 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7839 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7840 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7841 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7842 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7843 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7844 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7845 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7846 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7847 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7848 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7852 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7853 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7854 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7855 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7856 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7857 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7858 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7859 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7860 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7861 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7862 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7863 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7864 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7865 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7866 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7867 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7868 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7869 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7870 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7871 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7875 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7876 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7877 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7878 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7879 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7880 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7881 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7882 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7883 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7884 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7885 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7886 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7887 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7888 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7889 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7890 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7891 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7895 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7896 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7897 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7898 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7899 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7900 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7901 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7902 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7904 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7905 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7906 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7910 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7911 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7912 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7913 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7914 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7915 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7916 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7917 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7918 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7922 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7923 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7924 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7926 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7927 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7930 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7931 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7935 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7936 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7937 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7938 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7939 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7940 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7942 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7943 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7944 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7948 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7949 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7950 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7951 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7952 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7953 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7954 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7955 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7956 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7960 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
7961 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7962 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7963 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7964 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
7965 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7966 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7967 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7968 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7970 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7971 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7975 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7976 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7977 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7978 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7979 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7980 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7981 0x0d, 1, 0x0, HDA_OUTPUT),
7982 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7983 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7984 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7985 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7986 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7987 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7988 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7989 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7990 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7991 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7992 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7994 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7995 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7996 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8000 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8002 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8003 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8004 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8005 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8006 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8008 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8009 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8010 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8011 /* Output switches */
8012 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8013 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8014 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8016 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8017 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8019 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8020 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8021 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8022 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8026 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8027 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8028 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8029 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8030 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8031 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8032 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8036 static struct hda_bind_ctls alc883_bind_cap_vol = {
8037 .ops = &snd_hda_bind_vol,
8039 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8040 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8045 static struct hda_bind_ctls alc883_bind_cap_switch = {
8046 .ops = &snd_hda_bind_sw,
8048 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8049 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8054 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8055 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8056 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8057 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8058 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8059 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8060 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8061 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8062 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8066 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8067 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8068 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8070 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8071 /* .name = "Capture Source", */
8072 .name = "Input Source",
8074 .info = alc_mux_enum_info,
8075 .get = alc_mux_enum_get,
8076 .put = alc_mux_enum_put,
8081 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8083 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8084 .name = "Channel Mode",
8085 .info = alc_ch_mode_info,
8086 .get = alc_ch_mode_get,
8087 .put = alc_ch_mode_put,
8092 /* toggle speaker-output according to the hp-jack state */
8093 static void alc883_mitac_setup(struct hda_codec *codec)
8095 struct alc_spec *spec = codec->spec;
8097 spec->autocfg.hp_pins[0] = 0x15;
8098 spec->autocfg.speaker_pins[0] = 0x14;
8099 spec->autocfg.speaker_pins[1] = 0x17;
8102 /* auto-toggle front mic */
8104 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8106 unsigned int present;
8109 present = snd_hda_codec_read(codec, 0x18, 0,
8110 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8111 bits = present ? HDA_AMP_MUTE : 0;
8112 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8116 static struct hda_verb alc883_mitac_verbs[] = {
8118 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8119 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8121 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8122 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8124 /* enable unsolicited event */
8125 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8126 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8131 static struct hda_verb alc883_clevo_m720_verbs[] = {
8133 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8134 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8136 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8137 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8139 /* enable unsolicited event */
8140 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8141 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8146 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8148 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8149 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8151 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8152 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8154 /* enable unsolicited event */
8155 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8160 static struct hda_verb alc883_targa_verbs[] = {
8161 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8164 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8165 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8167 /* Connect Line-Out side jack (SPDIF) to Side */
8168 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8169 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8170 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8171 /* Connect Mic jack to CLFE */
8172 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8173 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8174 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8175 /* Connect Line-in jack to Surround */
8176 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8177 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8178 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8179 /* Connect HP out jack to Front */
8180 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8181 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8182 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8184 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8189 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8190 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8191 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8192 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8196 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8197 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8198 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8199 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8200 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8204 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8205 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8206 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8207 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8208 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8209 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8213 static struct hda_verb alc883_haier_w66_verbs[] = {
8214 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8215 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8217 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8219 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8220 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8221 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8222 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8226 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8227 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8228 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8229 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8230 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8231 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8232 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8233 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8234 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8238 static struct hda_verb alc888_6st_dell_verbs[] = {
8239 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8243 static struct hda_verb alc883_vaiott_verbs[] = {
8245 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8246 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8248 /* enable unsolicited event */
8249 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8254 static void alc888_3st_hp_setup(struct hda_codec *codec)
8256 struct alc_spec *spec = codec->spec;
8258 spec->autocfg.hp_pins[0] = 0x1b;
8259 spec->autocfg.speaker_pins[0] = 0x14;
8260 spec->autocfg.speaker_pins[1] = 0x16;
8261 spec->autocfg.speaker_pins[2] = 0x18;
8264 static struct hda_verb alc888_3st_hp_verbs[] = {
8265 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8266 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8267 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8268 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8275 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8276 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8277 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8278 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8279 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8286 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8287 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8288 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8289 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8290 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8291 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8298 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8299 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8300 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8301 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8302 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8303 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8304 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8308 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8309 { 2, alc888_3st_hp_2ch_init },
8310 { 4, alc888_3st_hp_4ch_init },
8311 { 6, alc888_3st_hp_6ch_init },
8314 /* toggle front-jack and RCA according to the hp-jack state */
8315 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8317 unsigned int present;
8319 present = snd_hda_codec_read(codec, 0x1b, 0,
8320 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8321 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8322 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8323 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8324 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8327 /* toggle RCA according to the front-jack state */
8328 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8330 unsigned int present;
8332 present = snd_hda_codec_read(codec, 0x14, 0,
8333 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8334 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8335 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8338 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8341 if ((res >> 26) == ALC880_HP_EVENT)
8342 alc888_lenovo_ms7195_front_automute(codec);
8343 if ((res >> 26) == ALC880_FRONT_EVENT)
8344 alc888_lenovo_ms7195_rca_automute(codec);
8347 static struct hda_verb alc883_medion_md2_verbs[] = {
8348 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8349 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8353 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8357 /* toggle speaker-output according to the hp-jack state */
8358 static void alc883_medion_md2_setup(struct hda_codec *codec)
8360 struct alc_spec *spec = codec->spec;
8362 spec->autocfg.hp_pins[0] = 0x14;
8363 spec->autocfg.speaker_pins[0] = 0x15;
8366 /* toggle speaker-output according to the hp-jack state */
8367 #define alc883_targa_init_hook alc882_targa_init_hook
8368 #define alc883_targa_unsol_event alc882_targa_unsol_event
8370 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8372 unsigned int present;
8374 present = snd_hda_codec_read(codec, 0x18, 0,
8375 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8376 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8377 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8380 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8382 struct alc_spec *spec = codec->spec;
8384 spec->autocfg.hp_pins[0] = 0x15;
8385 spec->autocfg.speaker_pins[0] = 0x14;
8388 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8390 alc_automute_amp(codec);
8391 alc883_clevo_m720_mic_automute(codec);
8394 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8397 switch (res >> 26) {
8398 case ALC880_MIC_EVENT:
8399 alc883_clevo_m720_mic_automute(codec);
8402 alc_automute_amp_unsol_event(codec, res);
8407 /* toggle speaker-output according to the hp-jack state */
8408 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8410 struct alc_spec *spec = codec->spec;
8412 spec->autocfg.hp_pins[0] = 0x14;
8413 spec->autocfg.speaker_pins[0] = 0x15;
8416 static void alc883_haier_w66_setup(struct hda_codec *codec)
8418 struct alc_spec *spec = codec->spec;
8420 spec->autocfg.hp_pins[0] = 0x1b;
8421 spec->autocfg.speaker_pins[0] = 0x14;
8424 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8426 unsigned int present;
8429 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8430 & AC_PINSENSE_PRESENCE;
8431 bits = present ? HDA_AMP_MUTE : 0;
8432 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8433 HDA_AMP_MUTE, bits);
8436 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8438 unsigned int present;
8441 present = snd_hda_codec_read(codec, 0x1b, 0,
8442 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8443 bits = present ? HDA_AMP_MUTE : 0;
8444 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8445 HDA_AMP_MUTE, bits);
8446 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8447 HDA_AMP_MUTE, bits);
8450 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8453 if ((res >> 26) == ALC880_HP_EVENT)
8454 alc883_lenovo_101e_all_automute(codec);
8455 if ((res >> 26) == ALC880_FRONT_EVENT)
8456 alc883_lenovo_101e_ispeaker_automute(codec);
8459 /* toggle speaker-output according to the hp-jack state */
8460 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8462 struct alc_spec *spec = codec->spec;
8464 spec->autocfg.hp_pins[0] = 0x14;
8465 spec->autocfg.speaker_pins[0] = 0x15;
8466 spec->autocfg.speaker_pins[1] = 0x16;
8469 static struct hda_verb alc883_acer_eapd_verbs[] = {
8470 /* HP Pin: output 0 (0x0c) */
8471 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8472 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8473 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8474 /* Front Pin: output 0 (0x0c) */
8475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8476 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8477 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8478 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8479 /* eanable EAPD on medion laptop */
8480 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8481 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8482 /* enable unsolicited event */
8483 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8487 static void alc888_6st_dell_setup(struct hda_codec *codec)
8489 struct alc_spec *spec = codec->spec;
8491 spec->autocfg.hp_pins[0] = 0x1b;
8492 spec->autocfg.speaker_pins[0] = 0x14;
8493 spec->autocfg.speaker_pins[1] = 0x15;
8494 spec->autocfg.speaker_pins[2] = 0x16;
8495 spec->autocfg.speaker_pins[3] = 0x17;
8498 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8500 struct alc_spec *spec = codec->spec;
8502 spec->autocfg.hp_pins[0] = 0x1b;
8503 spec->autocfg.speaker_pins[0] = 0x14;
8504 spec->autocfg.speaker_pins[1] = 0x15;
8505 spec->autocfg.speaker_pins[2] = 0x16;
8506 spec->autocfg.speaker_pins[3] = 0x17;
8507 spec->autocfg.speaker_pins[4] = 0x1a;
8510 static void alc883_vaiott_setup(struct hda_codec *codec)
8512 struct alc_spec *spec = codec->spec;
8514 spec->autocfg.hp_pins[0] = 0x15;
8515 spec->autocfg.speaker_pins[0] = 0x14;
8516 spec->autocfg.speaker_pins[1] = 0x17;
8519 static struct hda_verb alc888_asus_m90v_verbs[] = {
8520 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8521 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8522 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8523 /* enable unsolicited event */
8524 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8525 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8529 static void alc883_mode2_setup(struct hda_codec *codec)
8531 struct alc_spec *spec = codec->spec;
8533 spec->autocfg.hp_pins[0] = 0x1b;
8534 spec->autocfg.speaker_pins[0] = 0x14;
8535 spec->autocfg.speaker_pins[1] = 0x15;
8536 spec->autocfg.speaker_pins[2] = 0x16;
8537 spec->ext_mic.pin = 0x18;
8538 spec->int_mic.pin = 0x19;
8539 spec->ext_mic.mux_idx = 0;
8540 spec->int_mic.mux_idx = 1;
8544 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8545 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8546 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8547 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8548 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8549 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8550 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8551 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8552 /* enable unsolicited event */
8553 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8557 static void alc883_eee1601_inithook(struct hda_codec *codec)
8559 struct alc_spec *spec = codec->spec;
8561 spec->autocfg.hp_pins[0] = 0x14;
8562 spec->autocfg.speaker_pins[0] = 0x1b;
8563 alc_automute_pin(codec);
8566 static struct hda_verb alc889A_mb31_verbs[] = {
8567 /* Init rear pin (used as headphone output) */
8568 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8569 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8570 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8571 /* Init line pin (used as output in 4ch and 6ch mode) */
8572 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8573 /* Init line 2 pin (used as headphone out by default) */
8574 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8575 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8579 /* Mute speakers according to the headphone jack state */
8580 static void alc889A_mb31_automute(struct hda_codec *codec)
8582 unsigned int present;
8584 /* Mute only in 2ch or 4ch mode */
8585 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8587 present = snd_hda_codec_read(codec, 0x15, 0,
8588 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8589 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8590 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8591 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8592 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8596 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8598 if ((res >> 26) == ALC880_HP_EVENT)
8599 alc889A_mb31_automute(codec);
8603 #ifdef CONFIG_SND_HDA_POWER_SAVE
8604 #define alc882_loopbacks alc880_loopbacks
8607 /* pcm configuration: identical with ALC880 */
8608 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8609 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8610 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8611 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8613 static hda_nid_t alc883_slave_dig_outs[] = {
8614 ALC1200_DIGOUT_NID, 0,
8617 static hda_nid_t alc1200_slave_dig_outs[] = {
8618 ALC883_DIGOUT_NID, 0,
8622 * configuration and preset
8624 static const char *alc882_models[ALC882_MODEL_LAST] = {
8625 [ALC882_3ST_DIG] = "3stack-dig",
8626 [ALC882_6ST_DIG] = "6stack-dig",
8627 [ALC882_ARIMA] = "arima",
8628 [ALC882_W2JC] = "w2jc",
8629 [ALC882_TARGA] = "targa",
8630 [ALC882_ASUS_A7J] = "asus-a7j",
8631 [ALC882_ASUS_A7M] = "asus-a7m",
8632 [ALC885_MACPRO] = "macpro",
8633 [ALC885_MB5] = "mb5",
8634 [ALC885_MBP3] = "mbp3",
8635 [ALC885_IMAC24] = "imac24",
8636 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8637 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8638 [ALC883_3ST_6ch] = "3stack-6ch",
8639 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8640 [ALC883_TARGA_DIG] = "targa-dig",
8641 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8642 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8643 [ALC883_ACER] = "acer",
8644 [ALC883_ACER_ASPIRE] = "acer-aspire",
8645 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8646 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8647 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8648 [ALC883_MEDION] = "medion",
8649 [ALC883_MEDION_MD2] = "medion-md2",
8650 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8651 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8652 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8653 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8654 [ALC888_LENOVO_SKY] = "lenovo-sky",
8655 [ALC883_HAIER_W66] = "haier-w66",
8656 [ALC888_3ST_HP] = "3stack-hp",
8657 [ALC888_6ST_DELL] = "6stack-dell",
8658 [ALC883_MITAC] = "mitac",
8659 [ALC883_CLEVO_M720] = "clevo-m720",
8660 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8661 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8662 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8663 [ALC889A_INTEL] = "intel-alc889a",
8664 [ALC889_INTEL] = "intel-x58",
8665 [ALC1200_ASUS_P5Q] = "asus-p5q",
8666 [ALC889A_MB31] = "mb31",
8667 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8668 [ALC882_AUTO] = "auto",
8671 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8672 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8674 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8675 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8676 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8677 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8678 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8679 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8680 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8681 ALC888_ACER_ASPIRE_4930G),
8682 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8683 ALC888_ACER_ASPIRE_4930G),
8684 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8685 ALC888_ACER_ASPIRE_8930G),
8686 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8687 ALC888_ACER_ASPIRE_8930G),
8688 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8689 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8690 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8691 ALC888_ACER_ASPIRE_6530G),
8692 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8693 ALC888_ACER_ASPIRE_6530G),
8694 /* default Acer -- disabled as it causes more problems.
8695 * model=auto should work fine now
8697 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8699 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8701 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8702 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8703 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8704 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8705 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8706 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8708 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8709 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8710 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8711 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8712 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8713 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8714 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8715 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8716 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8717 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8718 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8720 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8721 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8722 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8723 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8724 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8725 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8726 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8727 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8728 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8730 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8731 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8732 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8733 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8734 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8735 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8736 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8737 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8738 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8739 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8740 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8741 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8742 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8743 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8744 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8745 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8746 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8747 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8748 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8749 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8750 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8751 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8752 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8753 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8754 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8755 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8756 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8757 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8758 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8760 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8761 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8762 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8763 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8764 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8765 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8766 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8767 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8768 ALC883_FUJITSU_PI2515),
8769 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8770 ALC888_FUJITSU_XA3530),
8771 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8772 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8773 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8774 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8775 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8776 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8777 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8778 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8779 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8781 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8782 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8783 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8784 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8785 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8786 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8787 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8792 /* codec SSID table for Intel Mac */
8793 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8794 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8795 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8796 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8797 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8798 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8799 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8800 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8801 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8802 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8803 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8804 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8805 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8806 * no perfect solution yet
8808 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8812 static struct alc_config_preset alc882_presets[] = {
8813 [ALC882_3ST_DIG] = {
8814 .mixers = { alc882_base_mixer },
8815 .init_verbs = { alc882_base_init_verbs,
8816 alc882_adc1_init_verbs },
8817 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8818 .dac_nids = alc882_dac_nids,
8819 .dig_out_nid = ALC882_DIGOUT_NID,
8820 .dig_in_nid = ALC882_DIGIN_NID,
8821 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8822 .channel_mode = alc882_ch_modes,
8824 .input_mux = &alc882_capture_source,
8826 [ALC882_6ST_DIG] = {
8827 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8828 .init_verbs = { alc882_base_init_verbs,
8829 alc882_adc1_init_verbs },
8830 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8831 .dac_nids = alc882_dac_nids,
8832 .dig_out_nid = ALC882_DIGOUT_NID,
8833 .dig_in_nid = ALC882_DIGIN_NID,
8834 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8835 .channel_mode = alc882_sixstack_modes,
8836 .input_mux = &alc882_capture_source,
8839 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8840 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8841 alc882_eapd_verbs },
8842 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8843 .dac_nids = alc882_dac_nids,
8844 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8845 .channel_mode = alc882_sixstack_modes,
8846 .input_mux = &alc882_capture_source,
8849 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8850 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8851 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8852 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8853 .dac_nids = alc882_dac_nids,
8854 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8855 .channel_mode = alc880_threestack_modes,
8857 .input_mux = &alc882_capture_source,
8858 .dig_out_nid = ALC882_DIGOUT_NID,
8861 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8862 .init_verbs = { alc885_mbp3_init_verbs,
8863 alc880_gpio1_init_verbs },
8864 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8865 .dac_nids = alc882_dac_nids,
8866 .channel_mode = alc885_mbp_6ch_modes,
8867 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
8868 .input_mux = &alc882_capture_source,
8869 .dig_out_nid = ALC882_DIGOUT_NID,
8870 .dig_in_nid = ALC882_DIGIN_NID,
8871 .unsol_event = alc_automute_amp_unsol_event,
8872 .setup = alc885_mbp3_setup,
8873 .init_hook = alc_automute_amp,
8876 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8877 .init_verbs = { alc885_mb5_init_verbs,
8878 alc880_gpio1_init_verbs },
8879 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8880 .dac_nids = alc882_dac_nids,
8881 .channel_mode = alc885_mb5_6ch_modes,
8882 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8883 .input_mux = &mb5_capture_source,
8884 .dig_out_nid = ALC882_DIGOUT_NID,
8885 .dig_in_nid = ALC882_DIGIN_NID,
8888 .mixers = { alc882_macpro_mixer },
8889 .init_verbs = { alc882_macpro_init_verbs },
8890 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8891 .dac_nids = alc882_dac_nids,
8892 .dig_out_nid = ALC882_DIGOUT_NID,
8893 .dig_in_nid = ALC882_DIGIN_NID,
8894 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8895 .channel_mode = alc882_ch_modes,
8896 .input_mux = &alc882_capture_source,
8897 .init_hook = alc885_macpro_init_hook,
8900 .mixers = { alc885_imac24_mixer },
8901 .init_verbs = { alc885_imac24_init_verbs },
8902 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8903 .dac_nids = alc882_dac_nids,
8904 .dig_out_nid = ALC882_DIGOUT_NID,
8905 .dig_in_nid = ALC882_DIGIN_NID,
8906 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8907 .channel_mode = alc882_ch_modes,
8908 .input_mux = &alc882_capture_source,
8909 .unsol_event = alc_automute_amp_unsol_event,
8910 .setup = alc885_imac24_setup,
8911 .init_hook = alc885_imac24_init_hook,
8914 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
8915 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8916 alc880_gpio3_init_verbs, alc882_targa_verbs},
8917 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8918 .dac_nids = alc882_dac_nids,
8919 .dig_out_nid = ALC882_DIGOUT_NID,
8920 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8921 .adc_nids = alc882_adc_nids,
8922 .capsrc_nids = alc882_capsrc_nids,
8923 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8924 .channel_mode = alc882_3ST_6ch_modes,
8926 .input_mux = &alc882_capture_source,
8927 .unsol_event = alc882_targa_unsol_event,
8928 .setup = alc882_targa_setup,
8929 .init_hook = alc882_targa_automute,
8931 [ALC882_ASUS_A7J] = {
8932 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
8933 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8934 alc882_asus_a7j_verbs},
8935 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8936 .dac_nids = alc882_dac_nids,
8937 .dig_out_nid = ALC882_DIGOUT_NID,
8938 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8939 .adc_nids = alc882_adc_nids,
8940 .capsrc_nids = alc882_capsrc_nids,
8941 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8942 .channel_mode = alc882_3ST_6ch_modes,
8944 .input_mux = &alc882_capture_source,
8946 [ALC882_ASUS_A7M] = {
8947 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
8948 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8949 alc882_eapd_verbs, alc880_gpio1_init_verbs,
8950 alc882_asus_a7m_verbs },
8951 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8952 .dac_nids = alc882_dac_nids,
8953 .dig_out_nid = ALC882_DIGOUT_NID,
8954 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8955 .channel_mode = alc880_threestack_modes,
8957 .input_mux = &alc882_capture_source,
8959 [ALC883_3ST_2ch_DIG] = {
8960 .mixers = { alc883_3ST_2ch_mixer },
8961 .init_verbs = { alc883_init_verbs },
8962 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8963 .dac_nids = alc883_dac_nids,
8964 .dig_out_nid = ALC883_DIGOUT_NID,
8965 .dig_in_nid = ALC883_DIGIN_NID,
8966 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8967 .channel_mode = alc883_3ST_2ch_modes,
8968 .input_mux = &alc883_capture_source,
8970 [ALC883_3ST_6ch_DIG] = {
8971 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8972 .init_verbs = { alc883_init_verbs },
8973 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8974 .dac_nids = alc883_dac_nids,
8975 .dig_out_nid = ALC883_DIGOUT_NID,
8976 .dig_in_nid = ALC883_DIGIN_NID,
8977 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8978 .channel_mode = alc883_3ST_6ch_modes,
8980 .input_mux = &alc883_capture_source,
8982 [ALC883_3ST_6ch] = {
8983 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8984 .init_verbs = { alc883_init_verbs },
8985 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8986 .dac_nids = alc883_dac_nids,
8987 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8988 .channel_mode = alc883_3ST_6ch_modes,
8990 .input_mux = &alc883_capture_source,
8992 [ALC883_3ST_6ch_INTEL] = {
8993 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8994 .init_verbs = { alc883_init_verbs },
8995 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8996 .dac_nids = alc883_dac_nids,
8997 .dig_out_nid = ALC883_DIGOUT_NID,
8998 .dig_in_nid = ALC883_DIGIN_NID,
8999 .slave_dig_outs = alc883_slave_dig_outs,
9000 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9001 .channel_mode = alc883_3ST_6ch_intel_modes,
9003 .input_mux = &alc883_3stack_6ch_intel,
9006 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9007 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9008 alc_hp15_unsol_verbs },
9009 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9010 .dac_nids = alc883_dac_nids,
9011 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9012 .adc_nids = alc889_adc_nids,
9013 .dig_out_nid = ALC883_DIGOUT_NID,
9014 .dig_in_nid = ALC883_DIGIN_NID,
9015 .slave_dig_outs = alc883_slave_dig_outs,
9016 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9017 .channel_mode = alc889_8ch_intel_modes,
9018 .capsrc_nids = alc889_capsrc_nids,
9019 .input_mux = &alc889_capture_source,
9020 .setup = alc889_automute_setup,
9021 .init_hook = alc_automute_amp,
9022 .unsol_event = alc_automute_amp_unsol_event,
9026 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9027 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9028 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9029 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9030 .dac_nids = alc883_dac_nids,
9031 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9032 .adc_nids = alc889_adc_nids,
9033 .dig_out_nid = ALC883_DIGOUT_NID,
9034 .dig_in_nid = ALC883_DIGIN_NID,
9035 .slave_dig_outs = alc883_slave_dig_outs,
9036 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9037 .channel_mode = alc889_8ch_intel_modes,
9038 .capsrc_nids = alc889_capsrc_nids,
9039 .input_mux = &alc889_capture_source,
9040 .setup = alc889_automute_setup,
9041 .init_hook = alc889_intel_init_hook,
9042 .unsol_event = alc_automute_amp_unsol_event,
9045 [ALC883_6ST_DIG] = {
9046 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9047 .init_verbs = { alc883_init_verbs },
9048 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9049 .dac_nids = alc883_dac_nids,
9050 .dig_out_nid = ALC883_DIGOUT_NID,
9051 .dig_in_nid = ALC883_DIGIN_NID,
9052 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9053 .channel_mode = alc883_sixstack_modes,
9054 .input_mux = &alc883_capture_source,
9056 [ALC883_TARGA_DIG] = {
9057 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9058 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9059 alc883_targa_verbs},
9060 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9061 .dac_nids = alc883_dac_nids,
9062 .dig_out_nid = ALC883_DIGOUT_NID,
9063 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9064 .channel_mode = alc883_3ST_6ch_modes,
9066 .input_mux = &alc883_capture_source,
9067 .unsol_event = alc883_targa_unsol_event,
9068 .setup = alc882_targa_setup,
9069 .init_hook = alc882_targa_automute,
9071 [ALC883_TARGA_2ch_DIG] = {
9072 .mixers = { alc883_targa_2ch_mixer},
9073 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9074 alc883_targa_verbs},
9075 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9076 .dac_nids = alc883_dac_nids,
9077 .adc_nids = alc883_adc_nids_alt,
9078 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9079 .dig_out_nid = ALC883_DIGOUT_NID,
9080 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9081 .channel_mode = alc883_3ST_2ch_modes,
9082 .input_mux = &alc883_capture_source,
9083 .unsol_event = alc883_targa_unsol_event,
9084 .setup = alc882_targa_setup,
9085 .init_hook = alc882_targa_automute,
9087 [ALC883_TARGA_8ch_DIG] = {
9088 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9089 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9090 alc883_targa_verbs },
9091 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9092 .dac_nids = alc883_dac_nids,
9093 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9094 .adc_nids = alc883_adc_nids_rev,
9095 .capsrc_nids = alc883_capsrc_nids_rev,
9096 .dig_out_nid = ALC883_DIGOUT_NID,
9097 .dig_in_nid = ALC883_DIGIN_NID,
9098 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9099 .channel_mode = alc883_4ST_8ch_modes,
9101 .input_mux = &alc883_capture_source,
9102 .unsol_event = alc883_targa_unsol_event,
9103 .setup = alc882_targa_setup,
9104 .init_hook = alc882_targa_automute,
9107 .mixers = { alc883_base_mixer },
9108 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9109 * and the headphone jack. Turn this on and rely on the
9110 * standard mute methods whenever the user wants to turn
9111 * these outputs off.
9113 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9114 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9115 .dac_nids = alc883_dac_nids,
9116 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9117 .channel_mode = alc883_3ST_2ch_modes,
9118 .input_mux = &alc883_capture_source,
9120 [ALC883_ACER_ASPIRE] = {
9121 .mixers = { alc883_acer_aspire_mixer },
9122 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9123 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9124 .dac_nids = alc883_dac_nids,
9125 .dig_out_nid = ALC883_DIGOUT_NID,
9126 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9127 .channel_mode = alc883_3ST_2ch_modes,
9128 .input_mux = &alc883_capture_source,
9129 .unsol_event = alc_automute_amp_unsol_event,
9130 .setup = alc883_acer_aspire_setup,
9131 .init_hook = alc_automute_amp,
9133 [ALC888_ACER_ASPIRE_4930G] = {
9134 .mixers = { alc888_base_mixer,
9135 alc883_chmode_mixer },
9136 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9137 alc888_acer_aspire_4930g_verbs },
9138 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9139 .dac_nids = alc883_dac_nids,
9140 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9141 .adc_nids = alc883_adc_nids_rev,
9142 .capsrc_nids = alc883_capsrc_nids_rev,
9143 .dig_out_nid = ALC883_DIGOUT_NID,
9144 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9145 .channel_mode = alc883_3ST_6ch_modes,
9148 ARRAY_SIZE(alc888_2_capture_sources),
9149 .input_mux = alc888_2_capture_sources,
9150 .unsol_event = alc_automute_amp_unsol_event,
9151 .setup = alc888_acer_aspire_4930g_setup,
9152 .init_hook = alc_automute_amp,
9154 [ALC888_ACER_ASPIRE_6530G] = {
9155 .mixers = { alc888_acer_aspire_6530_mixer },
9156 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9157 alc888_acer_aspire_6530g_verbs },
9158 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9159 .dac_nids = alc883_dac_nids,
9160 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9161 .adc_nids = alc883_adc_nids_rev,
9162 .capsrc_nids = alc883_capsrc_nids_rev,
9163 .dig_out_nid = ALC883_DIGOUT_NID,
9164 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9165 .channel_mode = alc883_3ST_2ch_modes,
9167 ARRAY_SIZE(alc888_2_capture_sources),
9168 .input_mux = alc888_acer_aspire_6530_sources,
9169 .unsol_event = alc_automute_amp_unsol_event,
9170 .setup = alc888_acer_aspire_6530g_setup,
9171 .init_hook = alc_automute_amp,
9173 [ALC888_ACER_ASPIRE_8930G] = {
9174 .mixers = { alc888_base_mixer,
9175 alc883_chmode_mixer },
9176 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9177 alc889_acer_aspire_8930g_verbs },
9178 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9179 .dac_nids = alc883_dac_nids,
9180 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9181 .adc_nids = alc889_adc_nids,
9182 .capsrc_nids = alc889_capsrc_nids,
9183 .dig_out_nid = ALC883_DIGOUT_NID,
9184 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9185 .channel_mode = alc883_3ST_6ch_modes,
9187 .const_channel_count = 6,
9189 ARRAY_SIZE(alc889_capture_sources),
9190 .input_mux = alc889_capture_sources,
9191 .unsol_event = alc_automute_amp_unsol_event,
9192 .setup = alc889_acer_aspire_8930g_setup,
9193 .init_hook = alc_automute_amp,
9196 .mixers = { alc883_fivestack_mixer,
9197 alc883_chmode_mixer },
9198 .init_verbs = { alc883_init_verbs,
9199 alc883_medion_eapd_verbs },
9200 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9201 .dac_nids = alc883_dac_nids,
9202 .adc_nids = alc883_adc_nids_alt,
9203 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9204 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9205 .channel_mode = alc883_sixstack_modes,
9206 .input_mux = &alc883_capture_source,
9208 [ALC883_MEDION_MD2] = {
9209 .mixers = { alc883_medion_md2_mixer},
9210 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9211 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9212 .dac_nids = alc883_dac_nids,
9213 .dig_out_nid = ALC883_DIGOUT_NID,
9214 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9215 .channel_mode = alc883_3ST_2ch_modes,
9216 .input_mux = &alc883_capture_source,
9217 .unsol_event = alc_automute_amp_unsol_event,
9218 .setup = alc883_medion_md2_setup,
9219 .init_hook = alc_automute_amp,
9221 [ALC883_LAPTOP_EAPD] = {
9222 .mixers = { alc883_base_mixer },
9223 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9224 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9225 .dac_nids = alc883_dac_nids,
9226 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9227 .channel_mode = alc883_3ST_2ch_modes,
9228 .input_mux = &alc883_capture_source,
9230 [ALC883_CLEVO_M720] = {
9231 .mixers = { alc883_clevo_m720_mixer },
9232 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9233 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9234 .dac_nids = alc883_dac_nids,
9235 .dig_out_nid = ALC883_DIGOUT_NID,
9236 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9237 .channel_mode = alc883_3ST_2ch_modes,
9238 .input_mux = &alc883_capture_source,
9239 .unsol_event = alc883_clevo_m720_unsol_event,
9240 .setup = alc883_clevo_m720_setup,
9241 .init_hook = alc883_clevo_m720_init_hook,
9243 [ALC883_LENOVO_101E_2ch] = {
9244 .mixers = { alc883_lenovo_101e_2ch_mixer},
9245 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9246 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9247 .dac_nids = alc883_dac_nids,
9248 .adc_nids = alc883_adc_nids_alt,
9249 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9250 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9251 .channel_mode = alc883_3ST_2ch_modes,
9252 .input_mux = &alc883_lenovo_101e_capture_source,
9253 .unsol_event = alc883_lenovo_101e_unsol_event,
9254 .init_hook = alc883_lenovo_101e_all_automute,
9256 [ALC883_LENOVO_NB0763] = {
9257 .mixers = { alc883_lenovo_nb0763_mixer },
9258 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9259 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9260 .dac_nids = alc883_dac_nids,
9261 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9262 .channel_mode = alc883_3ST_2ch_modes,
9264 .input_mux = &alc883_lenovo_nb0763_capture_source,
9265 .unsol_event = alc_automute_amp_unsol_event,
9266 .setup = alc883_medion_md2_setup,
9267 .init_hook = alc_automute_amp,
9269 [ALC888_LENOVO_MS7195_DIG] = {
9270 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9271 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9272 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9273 .dac_nids = alc883_dac_nids,
9274 .dig_out_nid = ALC883_DIGOUT_NID,
9275 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9276 .channel_mode = alc883_3ST_6ch_modes,
9278 .input_mux = &alc883_capture_source,
9279 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9280 .init_hook = alc888_lenovo_ms7195_front_automute,
9282 [ALC883_HAIER_W66] = {
9283 .mixers = { alc883_targa_2ch_mixer},
9284 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9285 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9286 .dac_nids = alc883_dac_nids,
9287 .dig_out_nid = ALC883_DIGOUT_NID,
9288 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9289 .channel_mode = alc883_3ST_2ch_modes,
9290 .input_mux = &alc883_capture_source,
9291 .unsol_event = alc_automute_amp_unsol_event,
9292 .setup = alc883_haier_w66_setup,
9293 .init_hook = alc_automute_amp,
9296 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9297 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9298 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9299 .dac_nids = alc883_dac_nids,
9300 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9301 .channel_mode = alc888_3st_hp_modes,
9303 .input_mux = &alc883_capture_source,
9304 .unsol_event = alc_automute_amp_unsol_event,
9305 .setup = alc888_3st_hp_setup,
9306 .init_hook = alc_automute_amp,
9308 [ALC888_6ST_DELL] = {
9309 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9310 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9311 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9312 .dac_nids = alc883_dac_nids,
9313 .dig_out_nid = ALC883_DIGOUT_NID,
9314 .dig_in_nid = ALC883_DIGIN_NID,
9315 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9316 .channel_mode = alc883_sixstack_modes,
9317 .input_mux = &alc883_capture_source,
9318 .unsol_event = alc_automute_amp_unsol_event,
9319 .setup = alc888_6st_dell_setup,
9320 .init_hook = alc_automute_amp,
9323 .mixers = { alc883_mitac_mixer },
9324 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9325 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9326 .dac_nids = alc883_dac_nids,
9327 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9328 .channel_mode = alc883_3ST_2ch_modes,
9329 .input_mux = &alc883_capture_source,
9330 .unsol_event = alc_automute_amp_unsol_event,
9331 .setup = alc883_mitac_setup,
9332 .init_hook = alc_automute_amp,
9334 [ALC883_FUJITSU_PI2515] = {
9335 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9336 .init_verbs = { alc883_init_verbs,
9337 alc883_2ch_fujitsu_pi2515_verbs},
9338 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9339 .dac_nids = alc883_dac_nids,
9340 .dig_out_nid = ALC883_DIGOUT_NID,
9341 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9342 .channel_mode = alc883_3ST_2ch_modes,
9343 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9344 .unsol_event = alc_automute_amp_unsol_event,
9345 .setup = alc883_2ch_fujitsu_pi2515_setup,
9346 .init_hook = alc_automute_amp,
9348 [ALC888_FUJITSU_XA3530] = {
9349 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9350 .init_verbs = { alc883_init_verbs,
9351 alc888_fujitsu_xa3530_verbs },
9352 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9353 .dac_nids = alc883_dac_nids,
9354 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9355 .adc_nids = alc883_adc_nids_rev,
9356 .capsrc_nids = alc883_capsrc_nids_rev,
9357 .dig_out_nid = ALC883_DIGOUT_NID,
9358 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9359 .channel_mode = alc888_4ST_8ch_intel_modes,
9361 ARRAY_SIZE(alc888_2_capture_sources),
9362 .input_mux = alc888_2_capture_sources,
9363 .unsol_event = alc_automute_amp_unsol_event,
9364 .setup = alc888_fujitsu_xa3530_setup,
9365 .init_hook = alc_automute_amp,
9367 [ALC888_LENOVO_SKY] = {
9368 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9369 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9370 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9371 .dac_nids = alc883_dac_nids,
9372 .dig_out_nid = ALC883_DIGOUT_NID,
9373 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9374 .channel_mode = alc883_sixstack_modes,
9376 .input_mux = &alc883_lenovo_sky_capture_source,
9377 .unsol_event = alc_automute_amp_unsol_event,
9378 .setup = alc888_lenovo_sky_setup,
9379 .init_hook = alc_automute_amp,
9381 [ALC888_ASUS_M90V] = {
9382 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9383 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9384 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9385 .dac_nids = alc883_dac_nids,
9386 .dig_out_nid = ALC883_DIGOUT_NID,
9387 .dig_in_nid = ALC883_DIGIN_NID,
9388 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9389 .channel_mode = alc883_3ST_6ch_modes,
9391 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9392 .unsol_event = alc_sku_unsol_event,
9393 .setup = alc883_mode2_setup,
9394 .init_hook = alc_inithook,
9396 [ALC888_ASUS_EEE1601] = {
9397 .mixers = { alc883_asus_eee1601_mixer },
9398 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9399 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9400 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9401 .dac_nids = alc883_dac_nids,
9402 .dig_out_nid = ALC883_DIGOUT_NID,
9403 .dig_in_nid = ALC883_DIGIN_NID,
9404 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9405 .channel_mode = alc883_3ST_2ch_modes,
9407 .input_mux = &alc883_asus_eee1601_capture_source,
9408 .unsol_event = alc_sku_unsol_event,
9409 .init_hook = alc883_eee1601_inithook,
9411 [ALC1200_ASUS_P5Q] = {
9412 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9413 .init_verbs = { alc883_init_verbs },
9414 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9415 .dac_nids = alc883_dac_nids,
9416 .dig_out_nid = ALC1200_DIGOUT_NID,
9417 .dig_in_nid = ALC883_DIGIN_NID,
9418 .slave_dig_outs = alc1200_slave_dig_outs,
9419 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9420 .channel_mode = alc883_sixstack_modes,
9421 .input_mux = &alc883_capture_source,
9424 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9425 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9426 alc880_gpio1_init_verbs },
9427 .adc_nids = alc883_adc_nids,
9428 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9429 .dac_nids = alc883_dac_nids,
9430 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9431 .channel_mode = alc889A_mb31_6ch_modes,
9432 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9433 .input_mux = &alc889A_mb31_capture_source,
9434 .dig_out_nid = ALC883_DIGOUT_NID,
9435 .unsol_event = alc889A_mb31_unsol_event,
9436 .init_hook = alc889A_mb31_automute,
9438 [ALC883_SONY_VAIO_TT] = {
9439 .mixers = { alc883_vaiott_mixer },
9440 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9441 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9442 .dac_nids = alc883_dac_nids,
9443 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9444 .channel_mode = alc883_3ST_2ch_modes,
9445 .input_mux = &alc883_capture_source,
9446 .unsol_event = alc_automute_amp_unsol_event,
9447 .setup = alc883_vaiott_setup,
9448 .init_hook = alc_automute_amp,
9457 PINFIX_ABIT_AW9D_MAX
9460 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9461 { 0x15, 0x01080104 }, /* side */
9462 { 0x16, 0x01011012 }, /* rear */
9463 { 0x17, 0x01016011 }, /* clfe */
9467 static const struct alc_pincfg *alc882_pin_fixes[] = {
9468 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
9471 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
9472 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9477 * BIOS auto configuration
9479 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9480 const struct auto_pin_cfg *cfg)
9482 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9485 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9486 hda_nid_t nid, int pin_type,
9490 struct alc_spec *spec = codec->spec;
9493 alc_set_pin_output(codec, nid, pin_type);
9494 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9497 idx = spec->multiout.dac_nids[dac_idx] - 2;
9498 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9502 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9504 struct alc_spec *spec = codec->spec;
9507 for (i = 0; i <= HDA_SIDE; i++) {
9508 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9509 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9511 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9516 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9518 struct alc_spec *spec = codec->spec;
9521 pin = spec->autocfg.hp_pins[0];
9522 if (pin) /* connect to front */
9524 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9525 pin = spec->autocfg.speaker_pins[0];
9527 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9530 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9532 struct alc_spec *spec = codec->spec;
9535 for (i = 0; i < AUTO_PIN_LAST; i++) {
9536 hda_nid_t nid = spec->autocfg.input_pins[i];
9539 alc_set_input_pin(codec, nid, i);
9540 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9541 snd_hda_codec_write(codec, nid, 0,
9542 AC_VERB_SET_AMP_GAIN_MUTE,
9547 static void alc882_auto_init_input_src(struct hda_codec *codec)
9549 struct alc_spec *spec = codec->spec;
9552 for (c = 0; c < spec->num_adc_nids; c++) {
9553 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9554 hda_nid_t nid = spec->capsrc_nids[c];
9555 unsigned int mux_idx;
9556 const struct hda_input_mux *imux;
9557 int conns, mute, idx, item;
9559 conns = snd_hda_get_connections(codec, nid, conn_list,
9560 ARRAY_SIZE(conn_list));
9563 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9564 imux = &spec->input_mux[mux_idx];
9565 for (idx = 0; idx < conns; idx++) {
9566 /* if the current connection is the selected one,
9567 * unmute it as default - otherwise mute it
9569 mute = AMP_IN_MUTE(idx);
9570 for (item = 0; item < imux->num_items; item++) {
9571 if (imux->items[item].index == idx) {
9572 if (spec->cur_mux[c] == item)
9573 mute = AMP_IN_UNMUTE(idx);
9577 /* check if we have a selector or mixer
9578 * we could check for the widget type instead, but
9579 * just check for Amp-In presence (in case of mixer
9580 * without amp-in there is something wrong, this
9581 * function shouldn't be used or capsrc nid is wrong)
9583 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9584 snd_hda_codec_write(codec, nid, 0,
9585 AC_VERB_SET_AMP_GAIN_MUTE,
9587 else if (mute != AMP_IN_MUTE(idx))
9588 snd_hda_codec_write(codec, nid, 0,
9589 AC_VERB_SET_CONNECT_SEL,
9595 /* add mic boosts if needed */
9596 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9598 struct alc_spec *spec = codec->spec;
9602 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9603 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9604 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9606 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9610 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9611 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9612 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9614 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9621 /* almost identical with ALC880 parser... */
9622 static int alc882_parse_auto_config(struct hda_codec *codec)
9624 struct alc_spec *spec = codec->spec;
9625 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9628 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9632 if (!spec->autocfg.line_outs)
9633 return 0; /* can't find valid BIOS pin config */
9635 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9638 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9641 err = alc880_auto_create_extra_out(spec,
9642 spec->autocfg.speaker_pins[0],
9646 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9650 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9654 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9656 /* check multiple SPDIF-out (for recent codecs) */
9657 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9659 err = snd_hda_get_connections(codec,
9660 spec->autocfg.dig_out_pins[i],
9665 spec->multiout.dig_out_nid = dig_nid;
9667 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9668 spec->slave_dig_outs[i - 1] = dig_nid;
9669 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
9673 if (spec->autocfg.dig_in_pin)
9674 spec->dig_in_nid = ALC880_DIGIN_NID;
9676 if (spec->kctls.list)
9677 add_mixer(spec, spec->kctls.list);
9679 add_verb(spec, alc883_auto_init_verbs);
9680 /* if ADC 0x07 is available, initialize it, too */
9681 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9682 add_verb(spec, alc882_adc1_init_verbs);
9684 spec->num_mux_defs = 1;
9685 spec->input_mux = &spec->private_imux[0];
9687 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9689 err = alc_auto_add_mic_boost(codec);
9693 return 1; /* config found */
9696 /* additional initialization for auto-configuration model */
9697 static void alc882_auto_init(struct hda_codec *codec)
9699 struct alc_spec *spec = codec->spec;
9700 alc882_auto_init_multi_out(codec);
9701 alc882_auto_init_hp_out(codec);
9702 alc882_auto_init_analog_input(codec);
9703 alc882_auto_init_input_src(codec);
9704 if (spec->unsol_event)
9705 alc_inithook(codec);
9708 static int patch_alc882(struct hda_codec *codec)
9710 struct alc_spec *spec;
9711 int err, board_config;
9713 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9719 switch (codec->vendor_id) {
9724 /* ALC883 and variants */
9725 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9729 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9733 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9734 board_config = snd_hda_check_board_codec_sid_config(codec,
9735 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9737 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9738 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9740 board_config = ALC882_AUTO;
9743 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
9745 if (board_config == ALC882_AUTO) {
9746 /* automatic parse from the BIOS config */
9747 err = alc882_parse_auto_config(codec);
9753 "hda_codec: Cannot set up configuration "
9754 "from BIOS. Using base mode...\n");
9755 board_config = ALC882_3ST_DIG;
9759 err = snd_hda_attach_beep_device(codec, 0x1);
9765 if (board_config != ALC882_AUTO)
9766 setup_preset(codec, &alc882_presets[board_config]);
9768 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9769 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9770 /* FIXME: setup DAC5 */
9771 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9772 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9774 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9775 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9777 if (codec->vendor_id == 0x10ec0888)
9778 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9780 if (!spec->adc_nids && spec->input_mux) {
9782 spec->num_adc_nids = 0;
9783 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9785 hda_nid_t nid = alc882_adc_nids[i];
9786 unsigned int wcap = get_wcaps(codec, nid);
9788 wcap = get_wcaps_type(wcap);
9789 if (wcap != AC_WID_AUD_IN)
9791 spec->private_adc_nids[spec->num_adc_nids] = nid;
9792 err = snd_hda_get_connections(codec, nid, &cap, 1);
9795 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9796 spec->num_adc_nids++;
9798 spec->adc_nids = spec->private_adc_nids;
9799 spec->capsrc_nids = spec->private_capsrc_nids;
9802 set_capture_mixer(codec);
9803 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9805 spec->vmaster_nid = 0x0c;
9807 codec->patch_ops = alc_patch_ops;
9808 if (board_config == ALC882_AUTO)
9809 spec->init_hook = alc882_auto_init;
9810 #ifdef CONFIG_SND_HDA_POWER_SAVE
9811 if (!spec->loopback.amplist)
9812 spec->loopback.amplist = alc882_loopbacks;
9814 codec->proc_widget_hook = print_realtek_coef;
9824 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9825 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9827 #define alc262_dac_nids alc260_dac_nids
9828 #define alc262_adc_nids alc882_adc_nids
9829 #define alc262_adc_nids_alt alc882_adc_nids_alt
9830 #define alc262_capsrc_nids alc882_capsrc_nids
9831 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9833 #define alc262_modes alc260_modes
9834 #define alc262_capture_source alc882_capture_source
9836 static hda_nid_t alc262_dmic_adc_nids[1] = {
9841 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9843 static struct snd_kcontrol_new alc262_base_mixer[] = {
9844 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9845 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9846 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9847 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9848 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9849 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9850 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9851 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9852 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9853 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9854 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9855 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9856 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9857 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9858 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9859 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9863 /* update HP, line and mono-out pins according to the master switch */
9864 static void alc262_hp_master_update(struct hda_codec *codec)
9866 struct alc_spec *spec = codec->spec;
9867 int val = spec->master_sw;
9870 snd_hda_codec_write_cache(codec, 0x1b, 0,
9871 AC_VERB_SET_PIN_WIDGET_CONTROL,
9873 snd_hda_codec_write_cache(codec, 0x15, 0,
9874 AC_VERB_SET_PIN_WIDGET_CONTROL,
9876 /* mono (speaker) depending on the HP jack sense */
9877 val = val && !spec->jack_present;
9878 snd_hda_codec_write_cache(codec, 0x16, 0,
9879 AC_VERB_SET_PIN_WIDGET_CONTROL,
9883 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9885 struct alc_spec *spec = codec->spec;
9886 unsigned int presence;
9887 presence = snd_hda_codec_read(codec, 0x1b, 0,
9888 AC_VERB_GET_PIN_SENSE, 0);
9889 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9890 alc262_hp_master_update(codec);
9893 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9895 if ((res >> 26) != ALC880_HP_EVENT)
9897 alc262_hp_bpc_automute(codec);
9900 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9902 struct alc_spec *spec = codec->spec;
9903 unsigned int presence;
9904 presence = snd_hda_codec_read(codec, 0x15, 0,
9905 AC_VERB_GET_PIN_SENSE, 0);
9906 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9907 alc262_hp_master_update(codec);
9910 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9913 if ((res >> 26) != ALC880_HP_EVENT)
9915 alc262_hp_wildwest_automute(codec);
9918 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9920 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9921 struct snd_ctl_elem_value *ucontrol)
9923 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9924 struct alc_spec *spec = codec->spec;
9925 int val = !!*ucontrol->value.integer.value;
9927 if (val == spec->master_sw)
9929 spec->master_sw = val;
9930 alc262_hp_master_update(codec);
9934 #define ALC262_HP_MASTER_SWITCH \
9936 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9937 .name = "Master Playback Switch", \
9938 .info = snd_ctl_boolean_mono_info, \
9939 .get = alc262_hp_master_sw_get, \
9940 .put = alc262_hp_master_sw_put, \
9943 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9944 ALC262_HP_MASTER_SWITCH,
9945 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9946 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9947 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9948 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9950 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9952 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9953 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9954 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9955 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9956 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9957 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9958 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9959 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9960 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9961 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9962 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9963 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9967 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9968 ALC262_HP_MASTER_SWITCH,
9969 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9970 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9971 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9972 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9973 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9975 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9977 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9978 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9979 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9980 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9981 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9982 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9983 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9987 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9988 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9989 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9990 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9994 /* mute/unmute internal speaker according to the hp jack and mute state */
9995 static void alc262_hp_t5735_setup(struct hda_codec *codec)
9997 struct alc_spec *spec = codec->spec;
9999 spec->autocfg.hp_pins[0] = 0x15;
10000 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10003 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10004 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10005 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10006 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10007 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10008 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10009 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10010 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10014 static struct hda_verb alc262_hp_t5735_verbs[] = {
10015 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10016 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10018 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10022 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10023 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10024 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10025 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10026 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10027 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10028 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10032 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10033 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10034 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10035 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10036 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10037 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10038 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10039 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10040 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10041 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10042 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10046 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10053 /* bind hp and internal speaker mute (with plug check) as master switch */
10054 static void alc262_hippo_master_update(struct hda_codec *codec)
10056 struct alc_spec *spec = codec->spec;
10057 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10058 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10059 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10063 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10064 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10065 HDA_AMP_MUTE, mute);
10066 /* mute internal speaker per jack sense */
10067 if (spec->jack_present)
10068 mute = HDA_AMP_MUTE;
10070 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10071 HDA_AMP_MUTE, mute);
10072 if (speaker_nid && speaker_nid != line_nid)
10073 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10074 HDA_AMP_MUTE, mute);
10077 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10079 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10080 struct snd_ctl_elem_value *ucontrol)
10082 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10083 struct alc_spec *spec = codec->spec;
10084 int val = !!*ucontrol->value.integer.value;
10086 if (val == spec->master_sw)
10088 spec->master_sw = val;
10089 alc262_hippo_master_update(codec);
10093 #define ALC262_HIPPO_MASTER_SWITCH \
10095 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10096 .name = "Master Playback Switch", \
10097 .info = snd_ctl_boolean_mono_info, \
10098 .get = alc262_hippo_master_sw_get, \
10099 .put = alc262_hippo_master_sw_put, \
10102 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10103 ALC262_HIPPO_MASTER_SWITCH,
10104 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10105 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10106 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10107 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10108 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10109 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10110 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10111 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10112 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10113 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10114 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10115 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10119 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10120 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10121 ALC262_HIPPO_MASTER_SWITCH,
10122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10123 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10124 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10125 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10127 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10128 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10129 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10130 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10131 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10135 /* mute/unmute internal speaker according to the hp jack and mute state */
10136 static void alc262_hippo_automute(struct hda_codec *codec)
10138 struct alc_spec *spec = codec->spec;
10139 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10140 unsigned int present;
10142 /* need to execute and sync at first */
10143 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10144 present = snd_hda_codec_read(codec, hp_nid, 0,
10145 AC_VERB_GET_PIN_SENSE, 0);
10146 spec->jack_present = (present & 0x80000000) != 0;
10147 alc262_hippo_master_update(codec);
10150 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10152 if ((res >> 26) != ALC880_HP_EVENT)
10154 alc262_hippo_automute(codec);
10157 static void alc262_hippo_setup(struct hda_codec *codec)
10159 struct alc_spec *spec = codec->spec;
10161 spec->autocfg.hp_pins[0] = 0x15;
10162 spec->autocfg.speaker_pins[0] = 0x14;
10165 static void alc262_hippo1_setup(struct hda_codec *codec)
10167 struct alc_spec *spec = codec->spec;
10169 spec->autocfg.hp_pins[0] = 0x1b;
10170 spec->autocfg.speaker_pins[0] = 0x14;
10174 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10175 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10176 ALC262_HIPPO_MASTER_SWITCH,
10177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10179 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10180 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10184 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10185 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10186 ALC262_HIPPO_MASTER_SWITCH,
10187 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10188 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10189 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10190 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10191 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10195 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10196 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10197 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10198 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10199 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10200 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10201 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10203 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10204 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10205 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10206 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10207 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10211 static struct hda_verb alc262_tyan_verbs[] = {
10212 /* Headphone automute */
10213 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10214 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10215 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10217 /* P11 AUX_IN, white 4-pin connector */
10218 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10219 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10220 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10221 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10226 /* unsolicited event for HP jack sensing */
10227 static void alc262_tyan_setup(struct hda_codec *codec)
10229 struct alc_spec *spec = codec->spec;
10231 spec->autocfg.hp_pins[0] = 0x1b;
10232 spec->autocfg.speaker_pins[0] = 0x15;
10236 #define alc262_capture_mixer alc882_capture_mixer
10237 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10240 * generic initialization of ADC, input mixers and output mixers
10242 static struct hda_verb alc262_init_verbs[] = {
10244 * Unmute ADC0-2 and set the default input to mic-in
10246 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10247 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10248 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10249 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10250 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10251 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10253 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10255 * Note: PASD motherboards uses the Line In 2 as the input for
10256 * front panel mic (mic 2)
10258 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10259 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10260 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10261 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10262 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10263 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10266 * Set up output mixers (0x0c - 0x0e)
10268 /* set vol=0 to output mixers */
10269 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10270 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10271 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10272 /* set up input amps for analog loopback */
10273 /* Amp Indices: DAC = 0, mixer = 1 */
10274 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10275 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10276 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10277 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10278 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10279 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10281 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10283 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10284 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10285 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10286 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10288 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10289 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10290 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10291 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10292 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10294 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10295 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10297 /* FIXME: use matrix-type input source selection */
10298 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10299 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10302 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10303 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10318 static struct hda_verb alc262_eapd_verbs[] = {
10319 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10320 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10324 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10325 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10326 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10327 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10329 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10330 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10334 static struct hda_verb alc262_sony_unsol_verbs[] = {
10335 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10336 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10337 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10339 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10340 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10344 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10345 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10346 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10348 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10349 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10353 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10354 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10355 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10356 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10357 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10358 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10359 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10360 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10361 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10365 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10367 struct alc_spec *spec = codec->spec;
10369 spec->autocfg.hp_pins[0] = 0x15;
10370 spec->autocfg.speaker_pins[0] = 0x14;
10371 spec->ext_mic.pin = 0x18;
10372 spec->ext_mic.mux_idx = 0;
10373 spec->int_mic.pin = 0x12;
10374 spec->int_mic.mux_idx = 9;
10375 spec->auto_mic = 1;
10381 * 0x16 = internal speaker
10382 * 0x18 = external mic
10385 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10386 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10387 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10391 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10393 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10394 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10398 static struct hda_verb alc262_nec_verbs[] = {
10399 /* Unmute Speaker */
10400 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10403 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10404 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10406 /* External mic to headphone */
10407 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10408 /* External mic to speaker */
10409 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10415 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10416 * 0x1b = port replicator headphone out
10419 #define ALC_HP_EVENT 0x37
10421 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10422 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10423 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10424 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10425 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10429 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10430 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10431 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10435 static struct hda_input_mux alc262_fujitsu_capture_source = {
10439 { "Int Mic", 0x1 },
10444 static struct hda_input_mux alc262_HP_capture_source = {
10448 { "Front Mic", 0x1 },
10455 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10459 { "Front Mic", 0x2 },
10465 /* mute/unmute internal speaker according to the hp jacks and mute state */
10466 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10468 struct alc_spec *spec = codec->spec;
10471 if (force || !spec->sense_updated) {
10472 unsigned int present;
10473 /* need to execute and sync at first */
10474 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10475 /* check laptop HP jack */
10476 present = snd_hda_codec_read(codec, 0x14, 0,
10477 AC_VERB_GET_PIN_SENSE, 0);
10478 /* need to execute and sync at first */
10479 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10480 /* check docking HP jack */
10481 present |= snd_hda_codec_read(codec, 0x1b, 0,
10482 AC_VERB_GET_PIN_SENSE, 0);
10483 if (present & AC_PINSENSE_PRESENCE)
10484 spec->jack_present = 1;
10486 spec->jack_present = 0;
10487 spec->sense_updated = 1;
10489 /* unmute internal speaker only if both HPs are unplugged and
10490 * master switch is on
10492 if (spec->jack_present)
10493 mute = HDA_AMP_MUTE;
10495 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10496 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10497 HDA_AMP_MUTE, mute);
10500 /* unsolicited event for HP jack sensing */
10501 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10504 if ((res >> 26) != ALC_HP_EVENT)
10506 alc262_fujitsu_automute(codec, 1);
10509 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10511 alc262_fujitsu_automute(codec, 1);
10514 /* bind volumes of both NID 0x0c and 0x0d */
10515 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10516 .ops = &snd_hda_bind_vol,
10518 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10519 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10524 /* mute/unmute internal speaker according to the hp jack and mute state */
10525 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10527 struct alc_spec *spec = codec->spec;
10530 if (force || !spec->sense_updated) {
10531 unsigned int present_int_hp;
10532 /* need to execute and sync at first */
10533 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10534 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10535 AC_VERB_GET_PIN_SENSE, 0);
10536 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10537 spec->sense_updated = 1;
10539 if (spec->jack_present) {
10540 /* mute internal speaker */
10541 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10542 HDA_AMP_MUTE, HDA_AMP_MUTE);
10543 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10544 HDA_AMP_MUTE, HDA_AMP_MUTE);
10546 /* unmute internal speaker if necessary */
10547 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10548 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10549 HDA_AMP_MUTE, mute);
10550 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10551 HDA_AMP_MUTE, mute);
10555 /* unsolicited event for HP jack sensing */
10556 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10559 if ((res >> 26) != ALC_HP_EVENT)
10561 alc262_lenovo_3000_automute(codec, 1);
10564 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10565 int dir, int idx, long *valp)
10569 for (i = 0; i < 2; i++, valp++)
10570 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10572 *valp ? 0 : HDA_AMP_MUTE);
10576 /* bind hp and internal speaker mute (with plug check) */
10577 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10578 struct snd_ctl_elem_value *ucontrol)
10580 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10581 long *valp = ucontrol->value.integer.value;
10584 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10585 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10587 alc262_fujitsu_automute(codec, 0);
10591 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10592 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10594 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10595 .name = "Master Playback Switch",
10596 .info = snd_hda_mixer_amp_switch_info,
10597 .get = snd_hda_mixer_amp_switch_get,
10598 .put = alc262_fujitsu_master_sw_put,
10599 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10601 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10602 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10603 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10604 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10605 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10606 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10607 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10608 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10612 /* bind hp and internal speaker mute (with plug check) */
10613 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10614 struct snd_ctl_elem_value *ucontrol)
10616 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10617 long *valp = ucontrol->value.integer.value;
10620 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10622 alc262_lenovo_3000_automute(codec, 0);
10626 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10627 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10629 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10630 .name = "Master Playback Switch",
10631 .info = snd_hda_mixer_amp_switch_info,
10632 .get = snd_hda_mixer_amp_switch_get,
10633 .put = alc262_lenovo_3000_master_sw_put,
10634 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10636 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10637 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10638 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10639 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10640 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10641 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10642 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10643 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10647 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10648 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10649 ALC262_HIPPO_MASTER_SWITCH,
10650 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10651 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10652 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10653 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10654 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10655 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10659 /* additional init verbs for Benq laptops */
10660 static struct hda_verb alc262_EAPD_verbs[] = {
10661 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10662 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10666 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10667 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10668 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10670 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10671 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10675 /* Samsung Q1 Ultra Vista model setup */
10676 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10677 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10678 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10681 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10682 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10686 static struct hda_verb alc262_ultra_verbs[] = {
10688 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10689 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10690 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10692 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10693 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10694 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10695 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10697 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10698 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10699 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10700 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10701 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10703 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10704 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10705 /* ADC, choose mic */
10706 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10707 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10708 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10709 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10710 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10711 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10712 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10713 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10714 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10715 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10719 /* mute/unmute internal speaker according to the hp jack and mute state */
10720 static void alc262_ultra_automute(struct hda_codec *codec)
10722 struct alc_spec *spec = codec->spec;
10726 /* auto-mute only when HP is used as HP */
10727 if (!spec->cur_mux[0]) {
10728 unsigned int present;
10729 /* need to execute and sync at first */
10730 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10731 present = snd_hda_codec_read(codec, 0x15, 0,
10732 AC_VERB_GET_PIN_SENSE, 0);
10733 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10734 if (spec->jack_present)
10735 mute = HDA_AMP_MUTE;
10737 /* mute/unmute internal speaker */
10738 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10739 HDA_AMP_MUTE, mute);
10740 /* mute/unmute HP */
10741 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10742 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10745 /* unsolicited event for HP jack sensing */
10746 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10749 if ((res >> 26) != ALC880_HP_EVENT)
10751 alc262_ultra_automute(codec);
10754 static struct hda_input_mux alc262_ultra_capture_source = {
10758 { "Headphone", 0x7 },
10762 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10763 struct snd_ctl_elem_value *ucontrol)
10765 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10766 struct alc_spec *spec = codec->spec;
10769 ret = alc_mux_enum_put(kcontrol, ucontrol);
10772 /* reprogram the HP pin as mic or HP according to the input source */
10773 snd_hda_codec_write_cache(codec, 0x15, 0,
10774 AC_VERB_SET_PIN_WIDGET_CONTROL,
10775 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10776 alc262_ultra_automute(codec); /* mute/unmute HP */
10780 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10781 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10782 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10784 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10785 .name = "Capture Source",
10786 .info = alc_mux_enum_info,
10787 .get = alc_mux_enum_get,
10788 .put = alc262_ultra_mux_enum_put,
10793 /* add playback controls from the parsed DAC table */
10794 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10795 const struct auto_pin_cfg *cfg)
10800 spec->multiout.num_dacs = 1; /* only use one dac */
10801 spec->multiout.dac_nids = spec->private_dac_nids;
10802 spec->multiout.dac_nids[0] = 2;
10804 nid = cfg->line_out_pins[0];
10806 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10807 "Front Playback Volume",
10808 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10811 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10812 "Front Playback Switch",
10813 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10818 nid = cfg->speaker_pins[0];
10821 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10822 "Speaker Playback Volume",
10823 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10827 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10828 "Speaker Playback Switch",
10829 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10834 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10835 "Speaker Playback Switch",
10836 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10842 nid = cfg->hp_pins[0];
10844 /* spec->multiout.hp_nid = 2; */
10846 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10847 "Headphone Playback Volume",
10848 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10852 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10853 "Headphone Playback Switch",
10854 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10859 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10860 "Headphone Playback Switch",
10861 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10870 #define alc262_auto_create_input_ctls \
10871 alc880_auto_create_input_ctls
10874 * generic initialization of ADC, input mixers and output mixers
10876 static struct hda_verb alc262_volume_init_verbs[] = {
10878 * Unmute ADC0-2 and set the default input to mic-in
10880 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10881 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10882 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10883 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10884 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10885 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10887 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10889 * Note: PASD motherboards uses the Line In 2 as the input for
10890 * front panel mic (mic 2)
10892 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10893 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10894 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10895 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10896 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10897 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10900 * Set up output mixers (0x0c - 0x0f)
10902 /* set vol=0 to output mixers */
10903 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10904 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10905 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10907 /* set up input amps for analog loopback */
10908 /* Amp Indices: DAC = 0, mixer = 1 */
10909 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10910 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10911 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10912 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10913 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10914 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10916 /* FIXME: use matrix-type input source selection */
10917 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10918 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10919 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10920 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10921 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10922 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10924 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10925 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10926 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10927 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10929 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10930 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10931 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10932 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10937 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10939 * Unmute ADC0-2 and set the default input to mic-in
10941 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10942 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10943 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10944 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10945 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10946 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10948 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10950 * Note: PASD motherboards uses the Line In 2 as the input for
10951 * front panel mic (mic 2)
10953 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10954 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10955 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10956 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10957 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10958 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10959 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10960 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10963 * Set up output mixers (0x0c - 0x0e)
10965 /* set vol=0 to output mixers */
10966 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10967 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10968 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10970 /* set up input amps for analog loopback */
10971 /* Amp Indices: DAC = 0, mixer = 1 */
10972 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10973 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10974 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10975 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10976 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10977 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10979 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10980 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10981 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10983 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10984 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10986 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10987 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10989 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10990 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10991 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10992 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10993 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10995 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10996 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10997 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10998 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10999 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11000 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11003 /* FIXME: use matrix-type input source selection */
11004 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11005 /* Input mixer1: only unmute Mic */
11006 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11007 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11008 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11009 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11010 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11011 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11012 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11013 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11014 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11016 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11017 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11018 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11019 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11020 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11021 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11022 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11023 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11024 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11026 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11027 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11028 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11029 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11030 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11031 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11032 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11033 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11034 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11036 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11041 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11043 * Unmute ADC0-2 and set the default input to mic-in
11045 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11046 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11047 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11048 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11049 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11050 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11052 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11054 * Note: PASD motherboards uses the Line In 2 as the input for front
11055 * panel mic (mic 2)
11057 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11058 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11059 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11060 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11061 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11062 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11063 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11064 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11065 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11067 * Set up output mixers (0x0c - 0x0e)
11069 /* set vol=0 to output mixers */
11070 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11071 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11072 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11074 /* set up input amps for analog loopback */
11075 /* Amp Indices: DAC = 0, mixer = 1 */
11076 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11077 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11078 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11079 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11080 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11084 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11085 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11086 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11087 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11088 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11089 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11090 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11092 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11093 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11095 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11096 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11098 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11099 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11100 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11101 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11102 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11103 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11105 /* FIXME: use matrix-type input source selection */
11106 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11107 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11108 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11109 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11110 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11111 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11112 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11113 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11114 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11116 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11117 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11118 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11119 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11120 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11121 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11122 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11124 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11125 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11126 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11127 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11128 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11129 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11130 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11132 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11137 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11139 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11140 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11141 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11143 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11144 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11145 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11146 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11148 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11149 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11150 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11155 #ifdef CONFIG_SND_HDA_POWER_SAVE
11156 #define alc262_loopbacks alc880_loopbacks
11159 /* pcm configuration: identical with ALC880 */
11160 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11161 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11162 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11163 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11166 * BIOS auto configuration
11168 static int alc262_parse_auto_config(struct hda_codec *codec)
11170 struct alc_spec *spec = codec->spec;
11172 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11174 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11178 if (!spec->autocfg.line_outs) {
11179 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11180 spec->multiout.max_channels = 2;
11181 spec->no_analog = 1;
11184 return 0; /* can't find valid BIOS pin config */
11186 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11189 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11193 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11196 if (spec->autocfg.dig_outs) {
11197 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11198 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11200 if (spec->autocfg.dig_in_pin)
11201 spec->dig_in_nid = ALC262_DIGIN_NID;
11203 if (spec->kctls.list)
11204 add_mixer(spec, spec->kctls.list);
11206 add_verb(spec, alc262_volume_init_verbs);
11207 spec->num_mux_defs = 1;
11208 spec->input_mux = &spec->private_imux[0];
11210 err = alc_auto_add_mic_boost(codec);
11214 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11219 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11220 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11221 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11222 #define alc262_auto_init_input_src alc882_auto_init_input_src
11225 /* init callback for auto-configuration model -- overriding the default init */
11226 static void alc262_auto_init(struct hda_codec *codec)
11228 struct alc_spec *spec = codec->spec;
11229 alc262_auto_init_multi_out(codec);
11230 alc262_auto_init_hp_out(codec);
11231 alc262_auto_init_analog_input(codec);
11232 alc262_auto_init_input_src(codec);
11233 if (spec->unsol_event)
11234 alc_inithook(codec);
11238 * configuration and preset
11240 static const char *alc262_models[ALC262_MODEL_LAST] = {
11241 [ALC262_BASIC] = "basic",
11242 [ALC262_HIPPO] = "hippo",
11243 [ALC262_HIPPO_1] = "hippo_1",
11244 [ALC262_FUJITSU] = "fujitsu",
11245 [ALC262_HP_BPC] = "hp-bpc",
11246 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11247 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11248 [ALC262_HP_RP5700] = "hp-rp5700",
11249 [ALC262_BENQ_ED8] = "benq",
11250 [ALC262_BENQ_T31] = "benq-t31",
11251 [ALC262_SONY_ASSAMD] = "sony-assamd",
11252 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11253 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11254 [ALC262_ULTRA] = "ultra",
11255 [ALC262_LENOVO_3000] = "lenovo-3000",
11256 [ALC262_NEC] = "nec",
11257 [ALC262_TYAN] = "tyan",
11258 [ALC262_AUTO] = "auto",
11261 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11262 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11263 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11264 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11266 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11268 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11270 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11271 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11272 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11273 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11274 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11275 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11276 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11277 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11278 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11279 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11280 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11281 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11282 ALC262_HP_TC_T5735),
11283 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11284 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11285 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11286 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11287 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11288 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11289 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11290 ALC262_SONY_ASSAMD),
11291 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11292 ALC262_TOSHIBA_RX1),
11293 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11294 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11295 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11296 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11297 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11299 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11300 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11301 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11302 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11303 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11307 static struct alc_config_preset alc262_presets[] = {
11309 .mixers = { alc262_base_mixer },
11310 .init_verbs = { alc262_init_verbs },
11311 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11312 .dac_nids = alc262_dac_nids,
11314 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11315 .channel_mode = alc262_modes,
11316 .input_mux = &alc262_capture_source,
11319 .mixers = { alc262_hippo_mixer },
11320 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11321 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11322 .dac_nids = alc262_dac_nids,
11324 .dig_out_nid = ALC262_DIGOUT_NID,
11325 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11326 .channel_mode = alc262_modes,
11327 .input_mux = &alc262_capture_source,
11328 .unsol_event = alc262_hippo_unsol_event,
11329 .setup = alc262_hippo_setup,
11330 .init_hook = alc262_hippo_automute,
11332 [ALC262_HIPPO_1] = {
11333 .mixers = { alc262_hippo1_mixer },
11334 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11335 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11336 .dac_nids = alc262_dac_nids,
11338 .dig_out_nid = ALC262_DIGOUT_NID,
11339 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11340 .channel_mode = alc262_modes,
11341 .input_mux = &alc262_capture_source,
11342 .unsol_event = alc262_hippo_unsol_event,
11343 .setup = alc262_hippo1_setup,
11344 .init_hook = alc262_hippo_automute,
11346 [ALC262_FUJITSU] = {
11347 .mixers = { alc262_fujitsu_mixer },
11348 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11349 alc262_fujitsu_unsol_verbs },
11350 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11351 .dac_nids = alc262_dac_nids,
11353 .dig_out_nid = ALC262_DIGOUT_NID,
11354 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11355 .channel_mode = alc262_modes,
11356 .input_mux = &alc262_fujitsu_capture_source,
11357 .unsol_event = alc262_fujitsu_unsol_event,
11358 .init_hook = alc262_fujitsu_init_hook,
11360 [ALC262_HP_BPC] = {
11361 .mixers = { alc262_HP_BPC_mixer },
11362 .init_verbs = { alc262_HP_BPC_init_verbs },
11363 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11364 .dac_nids = alc262_dac_nids,
11366 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11367 .channel_mode = alc262_modes,
11368 .input_mux = &alc262_HP_capture_source,
11369 .unsol_event = alc262_hp_bpc_unsol_event,
11370 .init_hook = alc262_hp_bpc_automute,
11372 [ALC262_HP_BPC_D7000_WF] = {
11373 .mixers = { alc262_HP_BPC_WildWest_mixer },
11374 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11375 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11376 .dac_nids = alc262_dac_nids,
11378 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11379 .channel_mode = alc262_modes,
11380 .input_mux = &alc262_HP_D7000_capture_source,
11381 .unsol_event = alc262_hp_wildwest_unsol_event,
11382 .init_hook = alc262_hp_wildwest_automute,
11384 [ALC262_HP_BPC_D7000_WL] = {
11385 .mixers = { alc262_HP_BPC_WildWest_mixer,
11386 alc262_HP_BPC_WildWest_option_mixer },
11387 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11388 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11389 .dac_nids = alc262_dac_nids,
11391 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11392 .channel_mode = alc262_modes,
11393 .input_mux = &alc262_HP_D7000_capture_source,
11394 .unsol_event = alc262_hp_wildwest_unsol_event,
11395 .init_hook = alc262_hp_wildwest_automute,
11397 [ALC262_HP_TC_T5735] = {
11398 .mixers = { alc262_hp_t5735_mixer },
11399 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11400 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11401 .dac_nids = alc262_dac_nids,
11403 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11404 .channel_mode = alc262_modes,
11405 .input_mux = &alc262_capture_source,
11406 .unsol_event = alc_automute_amp_unsol_event,
11407 .setup = alc262_hp_t5735_setup,
11408 .init_hook = alc_automute_amp,
11410 [ALC262_HP_RP5700] = {
11411 .mixers = { alc262_hp_rp5700_mixer },
11412 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11413 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11414 .dac_nids = alc262_dac_nids,
11415 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11416 .channel_mode = alc262_modes,
11417 .input_mux = &alc262_hp_rp5700_capture_source,
11419 [ALC262_BENQ_ED8] = {
11420 .mixers = { alc262_base_mixer },
11421 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11422 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11423 .dac_nids = alc262_dac_nids,
11425 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11426 .channel_mode = alc262_modes,
11427 .input_mux = &alc262_capture_source,
11429 [ALC262_SONY_ASSAMD] = {
11430 .mixers = { alc262_sony_mixer },
11431 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11432 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11433 .dac_nids = alc262_dac_nids,
11435 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11436 .channel_mode = alc262_modes,
11437 .input_mux = &alc262_capture_source,
11438 .unsol_event = alc262_hippo_unsol_event,
11439 .setup = alc262_hippo_setup,
11440 .init_hook = alc262_hippo_automute,
11442 [ALC262_BENQ_T31] = {
11443 .mixers = { alc262_benq_t31_mixer },
11444 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11445 alc_hp15_unsol_verbs },
11446 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11447 .dac_nids = alc262_dac_nids,
11449 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11450 .channel_mode = alc262_modes,
11451 .input_mux = &alc262_capture_source,
11452 .unsol_event = alc262_hippo_unsol_event,
11453 .setup = alc262_hippo_setup,
11454 .init_hook = alc262_hippo_automute,
11457 .mixers = { alc262_ultra_mixer },
11458 .cap_mixer = alc262_ultra_capture_mixer,
11459 .init_verbs = { alc262_ultra_verbs },
11460 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11461 .dac_nids = alc262_dac_nids,
11462 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11463 .channel_mode = alc262_modes,
11464 .input_mux = &alc262_ultra_capture_source,
11465 .adc_nids = alc262_adc_nids, /* ADC0 */
11466 .capsrc_nids = alc262_capsrc_nids,
11467 .num_adc_nids = 1, /* single ADC */
11468 .unsol_event = alc262_ultra_unsol_event,
11469 .init_hook = alc262_ultra_automute,
11471 [ALC262_LENOVO_3000] = {
11472 .mixers = { alc262_lenovo_3000_mixer },
11473 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11474 alc262_lenovo_3000_unsol_verbs },
11475 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11476 .dac_nids = alc262_dac_nids,
11478 .dig_out_nid = ALC262_DIGOUT_NID,
11479 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11480 .channel_mode = alc262_modes,
11481 .input_mux = &alc262_fujitsu_capture_source,
11482 .unsol_event = alc262_lenovo_3000_unsol_event,
11485 .mixers = { alc262_nec_mixer },
11486 .init_verbs = { alc262_nec_verbs },
11487 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11488 .dac_nids = alc262_dac_nids,
11490 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11491 .channel_mode = alc262_modes,
11492 .input_mux = &alc262_capture_source,
11494 [ALC262_TOSHIBA_S06] = {
11495 .mixers = { alc262_toshiba_s06_mixer },
11496 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11497 alc262_eapd_verbs },
11498 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11499 .capsrc_nids = alc262_dmic_capsrc_nids,
11500 .dac_nids = alc262_dac_nids,
11501 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11502 .num_adc_nids = 1, /* single ADC */
11503 .dig_out_nid = ALC262_DIGOUT_NID,
11504 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11505 .channel_mode = alc262_modes,
11506 .unsol_event = alc_sku_unsol_event,
11507 .setup = alc262_toshiba_s06_setup,
11508 .init_hook = alc_inithook,
11510 [ALC262_TOSHIBA_RX1] = {
11511 .mixers = { alc262_toshiba_rx1_mixer },
11512 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11513 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11514 .dac_nids = alc262_dac_nids,
11516 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11517 .channel_mode = alc262_modes,
11518 .input_mux = &alc262_capture_source,
11519 .unsol_event = alc262_hippo_unsol_event,
11520 .setup = alc262_hippo_setup,
11521 .init_hook = alc262_hippo_automute,
11524 .mixers = { alc262_tyan_mixer },
11525 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11526 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11527 .dac_nids = alc262_dac_nids,
11529 .dig_out_nid = ALC262_DIGOUT_NID,
11530 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11531 .channel_mode = alc262_modes,
11532 .input_mux = &alc262_capture_source,
11533 .unsol_event = alc_automute_amp_unsol_event,
11534 .setup = alc262_tyan_setup,
11535 .init_hook = alc_automute_amp,
11539 static int patch_alc262(struct hda_codec *codec)
11541 struct alc_spec *spec;
11545 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11549 codec->spec = spec;
11551 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11556 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11557 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11558 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11559 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11563 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11565 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11569 if (board_config < 0) {
11570 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11572 board_config = ALC262_AUTO;
11575 if (board_config == ALC262_AUTO) {
11576 /* automatic parse from the BIOS config */
11577 err = alc262_parse_auto_config(codec);
11583 "hda_codec: Cannot set up configuration "
11584 "from BIOS. Using base mode...\n");
11585 board_config = ALC262_BASIC;
11589 if (!spec->no_analog) {
11590 err = snd_hda_attach_beep_device(codec, 0x1);
11597 if (board_config != ALC262_AUTO)
11598 setup_preset(codec, &alc262_presets[board_config]);
11600 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11601 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11603 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11604 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11606 if (!spec->adc_nids && spec->input_mux) {
11608 /* check whether the digital-mic has to be supported */
11609 for (i = 0; i < spec->input_mux->num_items; i++) {
11610 if (spec->input_mux->items[i].index >= 9)
11613 if (i < spec->input_mux->num_items) {
11614 /* use only ADC0 */
11615 spec->adc_nids = alc262_dmic_adc_nids;
11616 spec->num_adc_nids = 1;
11617 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11619 /* all analog inputs */
11620 /* check whether NID 0x07 is valid */
11621 unsigned int wcap = get_wcaps(codec, 0x07);
11624 wcap = get_wcaps_type(wcap);
11625 if (wcap != AC_WID_AUD_IN) {
11626 spec->adc_nids = alc262_adc_nids_alt;
11627 spec->num_adc_nids =
11628 ARRAY_SIZE(alc262_adc_nids_alt);
11629 spec->capsrc_nids = alc262_capsrc_nids_alt;
11631 spec->adc_nids = alc262_adc_nids;
11632 spec->num_adc_nids =
11633 ARRAY_SIZE(alc262_adc_nids);
11634 spec->capsrc_nids = alc262_capsrc_nids;
11638 if (!spec->cap_mixer && !spec->no_analog)
11639 set_capture_mixer(codec);
11640 if (!spec->no_analog)
11641 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11643 spec->vmaster_nid = 0x0c;
11645 codec->patch_ops = alc_patch_ops;
11646 if (board_config == ALC262_AUTO)
11647 spec->init_hook = alc262_auto_init;
11648 #ifdef CONFIG_SND_HDA_POWER_SAVE
11649 if (!spec->loopback.amplist)
11650 spec->loopback.amplist = alc262_loopbacks;
11652 codec->proc_widget_hook = print_realtek_coef;
11658 * ALC268 channel source setting (2 channel)
11660 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11661 #define alc268_modes alc260_modes
11663 static hda_nid_t alc268_dac_nids[2] = {
11668 static hda_nid_t alc268_adc_nids[2] = {
11673 static hda_nid_t alc268_adc_nids_alt[1] = {
11678 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11680 static struct snd_kcontrol_new alc268_base_mixer[] = {
11681 /* output mixer control */
11682 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11683 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11684 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11685 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11686 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11687 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11688 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11692 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11693 /* output mixer control */
11694 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11695 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11696 ALC262_HIPPO_MASTER_SWITCH,
11697 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11698 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11699 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11703 /* bind Beep switches of both NID 0x0f and 0x10 */
11704 static struct hda_bind_ctls alc268_bind_beep_sw = {
11705 .ops = &snd_hda_bind_sw,
11707 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11708 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11713 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11714 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11715 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11719 static struct hda_verb alc268_eapd_verbs[] = {
11720 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11721 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11725 /* Toshiba specific */
11726 static struct hda_verb alc268_toshiba_verbs[] = {
11727 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11731 /* Acer specific */
11732 /* bind volumes of both NID 0x02 and 0x03 */
11733 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11734 .ops = &snd_hda_bind_vol,
11736 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11737 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11742 /* mute/unmute internal speaker according to the hp jack and mute state */
11743 static void alc268_acer_automute(struct hda_codec *codec, int force)
11745 struct alc_spec *spec = codec->spec;
11748 if (force || !spec->sense_updated) {
11749 unsigned int present;
11750 present = snd_hda_codec_read(codec, 0x14, 0,
11751 AC_VERB_GET_PIN_SENSE, 0);
11752 spec->jack_present = (present & 0x80000000) != 0;
11753 spec->sense_updated = 1;
11755 if (spec->jack_present)
11756 mute = HDA_AMP_MUTE; /* mute internal speaker */
11757 else /* unmute internal speaker if necessary */
11758 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11759 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11760 HDA_AMP_MUTE, mute);
11764 /* bind hp and internal speaker mute (with plug check) */
11765 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11766 struct snd_ctl_elem_value *ucontrol)
11768 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11769 long *valp = ucontrol->value.integer.value;
11772 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11774 alc268_acer_automute(codec, 0);
11778 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11779 /* output mixer control */
11780 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11782 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11783 .name = "Master Playback Switch",
11784 .info = snd_hda_mixer_amp_switch_info,
11785 .get = snd_hda_mixer_amp_switch_get,
11786 .put = alc268_acer_master_sw_put,
11787 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11789 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11793 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11794 /* output mixer control */
11795 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11797 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11798 .name = "Master Playback Switch",
11799 .info = snd_hda_mixer_amp_switch_info,
11800 .get = snd_hda_mixer_amp_switch_get,
11801 .put = alc268_acer_master_sw_put,
11802 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11804 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11805 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11806 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11810 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11811 /* output mixer control */
11812 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11814 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11815 .name = "Master Playback Switch",
11816 .info = snd_hda_mixer_amp_switch_info,
11817 .get = snd_hda_mixer_amp_switch_get,
11818 .put = alc268_acer_master_sw_put,
11819 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11821 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11822 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11826 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11827 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11828 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11829 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11830 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11831 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11832 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11836 static struct hda_verb alc268_acer_verbs[] = {
11837 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11838 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11839 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11840 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11841 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11842 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11843 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11847 /* unsolicited event for HP jack sensing */
11848 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11849 #define alc268_toshiba_setup alc262_hippo_setup
11850 #define alc268_toshiba_automute alc262_hippo_automute
11852 static void alc268_acer_unsol_event(struct hda_codec *codec,
11855 if ((res >> 26) != ALC880_HP_EVENT)
11857 alc268_acer_automute(codec, 1);
11860 static void alc268_acer_init_hook(struct hda_codec *codec)
11862 alc268_acer_automute(codec, 1);
11865 /* toggle speaker-output according to the hp-jack state */
11866 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11868 unsigned int present;
11869 unsigned char bits;
11871 present = snd_hda_codec_read(codec, 0x15, 0,
11872 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11873 bits = present ? AMP_IN_MUTE(0) : 0;
11874 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11875 AMP_IN_MUTE(0), bits);
11876 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11877 AMP_IN_MUTE(0), bits);
11880 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11883 switch (res >> 26) {
11884 case ALC880_HP_EVENT:
11885 alc268_aspire_one_speaker_automute(codec);
11887 case ALC880_MIC_EVENT:
11888 alc_mic_automute(codec);
11893 static void alc268_acer_lc_setup(struct hda_codec *codec)
11895 struct alc_spec *spec = codec->spec;
11896 spec->ext_mic.pin = 0x18;
11897 spec->ext_mic.mux_idx = 0;
11898 spec->int_mic.pin = 0x12;
11899 spec->int_mic.mux_idx = 6;
11900 spec->auto_mic = 1;
11903 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11905 alc268_aspire_one_speaker_automute(codec);
11906 alc_mic_automute(codec);
11909 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11910 /* output mixer control */
11911 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11912 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11913 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11914 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11915 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11916 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11920 static struct hda_verb alc268_dell_verbs[] = {
11921 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11922 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11923 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11924 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11928 /* mute/unmute internal speaker according to the hp jack and mute state */
11929 static void alc268_dell_setup(struct hda_codec *codec)
11931 struct alc_spec *spec = codec->spec;
11933 spec->autocfg.hp_pins[0] = 0x15;
11934 spec->autocfg.speaker_pins[0] = 0x14;
11935 spec->ext_mic.pin = 0x18;
11936 spec->ext_mic.mux_idx = 0;
11937 spec->int_mic.pin = 0x19;
11938 spec->int_mic.mux_idx = 1;
11939 spec->auto_mic = 1;
11942 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11943 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11944 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11945 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11946 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11947 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11948 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11949 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11950 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11954 static struct hda_verb alc267_quanta_il1_verbs[] = {
11955 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11956 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11960 static void alc267_quanta_il1_setup(struct hda_codec *codec)
11962 struct alc_spec *spec = codec->spec;
11963 spec->autocfg.hp_pins[0] = 0x15;
11964 spec->autocfg.speaker_pins[0] = 0x14;
11965 spec->ext_mic.pin = 0x18;
11966 spec->ext_mic.mux_idx = 0;
11967 spec->int_mic.pin = 0x19;
11968 spec->int_mic.mux_idx = 1;
11969 spec->auto_mic = 1;
11973 * generic initialization of ADC, input mixers and output mixers
11975 static struct hda_verb alc268_base_init_verbs[] = {
11976 /* Unmute DAC0-1 and set vol = 0 */
11977 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11978 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11981 * Set up output mixers (0x0c - 0x0e)
11983 /* set vol=0 to output mixers */
11984 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11985 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11987 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11988 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11990 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11991 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11992 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11993 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11994 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11995 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11996 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11997 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11999 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12000 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12001 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12002 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12003 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12005 /* set PCBEEP vol = 0, mute connections */
12006 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12007 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12008 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12010 /* Unmute Selector 23h,24h and set the default input to mic-in */
12012 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12013 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12014 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12015 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12021 * generic initialization of ADC, input mixers and output mixers
12023 static struct hda_verb alc268_volume_init_verbs[] = {
12024 /* set output DAC */
12025 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12026 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12028 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12029 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12030 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12031 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12032 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12034 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12035 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12036 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12038 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12039 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12041 /* set PCBEEP vol = 0, mute connections */
12042 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12043 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12044 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12049 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12050 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12051 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12055 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12056 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12057 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12062 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12063 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12064 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12065 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12066 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12071 static struct hda_input_mux alc268_capture_source = {
12075 { "Front Mic", 0x1 },
12081 static struct hda_input_mux alc268_acer_capture_source = {
12085 { "Internal Mic", 0x1 },
12090 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12094 { "Internal Mic", 0x6 },
12099 #ifdef CONFIG_SND_DEBUG
12100 static struct snd_kcontrol_new alc268_test_mixer[] = {
12101 /* Volume widgets */
12102 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12103 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12104 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12105 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12106 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12107 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12108 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12109 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12110 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12111 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12112 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12113 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12114 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12115 /* The below appears problematic on some hardwares */
12116 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12117 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12118 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12119 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12120 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12122 /* Modes for retasking pin widgets */
12123 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12124 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12125 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12126 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12128 /* Controls for GPIO pins, assuming they are configured as outputs */
12129 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12130 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12131 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12132 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12134 /* Switches to allow the digital SPDIF output pin to be enabled.
12135 * The ALC268 does not have an SPDIF input.
12137 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12139 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12140 * this output to turn on an external amplifier.
12142 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12143 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12149 /* create input playback/capture controls for the given pin */
12150 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12151 const char *ctlname, int idx)
12157 sprintf(name, "%s Playback Volume", ctlname);
12169 if (spec->multiout.dac_nids[0] != dac &&
12170 spec->multiout.dac_nids[1] != dac) {
12171 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12172 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12176 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12179 sprintf(name, "%s Playback Switch", ctlname);
12181 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12182 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12184 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12185 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12191 /* add playback controls from the parsed DAC table */
12192 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12193 const struct auto_pin_cfg *cfg)
12198 spec->multiout.dac_nids = spec->private_dac_nids;
12200 nid = cfg->line_out_pins[0];
12203 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12207 err = alc268_new_analog_output(spec, nid, name, 0);
12212 nid = cfg->speaker_pins[0];
12214 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12215 "Speaker Playback Volume",
12216 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12220 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12224 nid = cfg->hp_pins[0];
12226 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12231 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12233 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12234 "Mono Playback Switch",
12235 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12242 /* create playback/capture controls for input pins */
12243 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12244 const struct auto_pin_cfg *cfg)
12246 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12249 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12251 struct alc_spec *spec = codec->spec;
12252 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12253 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12254 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12255 unsigned int dac_vol1, dac_vol2;
12258 snd_hda_codec_write(codec, speaker_nid, 0,
12259 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12260 snd_hda_codec_write(codec, 0x0f, 0,
12261 AC_VERB_SET_AMP_GAIN_MUTE,
12263 snd_hda_codec_write(codec, 0x10, 0,
12264 AC_VERB_SET_AMP_GAIN_MUTE,
12267 snd_hda_codec_write(codec, 0x0f, 0,
12268 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12269 snd_hda_codec_write(codec, 0x10, 0,
12270 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12273 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12274 if (line_nid == 0x14)
12275 dac_vol2 = AMP_OUT_ZERO;
12276 else if (line_nid == 0x15)
12277 dac_vol1 = AMP_OUT_ZERO;
12278 if (hp_nid == 0x14)
12279 dac_vol2 = AMP_OUT_ZERO;
12280 else if (hp_nid == 0x15)
12281 dac_vol1 = AMP_OUT_ZERO;
12282 if (line_nid != 0x16 || hp_nid != 0x16 ||
12283 spec->autocfg.line_out_pins[1] != 0x16 ||
12284 spec->autocfg.line_out_pins[2] != 0x16)
12285 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12287 snd_hda_codec_write(codec, 0x02, 0,
12288 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12289 snd_hda_codec_write(codec, 0x03, 0,
12290 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12293 /* pcm configuration: identical with ALC880 */
12294 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12295 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12296 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12297 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12300 * BIOS auto configuration
12302 static int alc268_parse_auto_config(struct hda_codec *codec)
12304 struct alc_spec *spec = codec->spec;
12306 static hda_nid_t alc268_ignore[] = { 0 };
12308 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12312 if (!spec->autocfg.line_outs) {
12313 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12314 spec->multiout.max_channels = 2;
12315 spec->no_analog = 1;
12318 return 0; /* can't find valid BIOS pin config */
12320 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12323 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12327 spec->multiout.max_channels = 2;
12330 /* digital only support output */
12331 if (spec->autocfg.dig_outs) {
12332 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12333 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12335 if (spec->kctls.list)
12336 add_mixer(spec, spec->kctls.list);
12338 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12339 add_mixer(spec, alc268_beep_mixer);
12341 add_verb(spec, alc268_volume_init_verbs);
12342 spec->num_mux_defs = 2;
12343 spec->input_mux = &spec->private_imux[0];
12345 err = alc_auto_add_mic_boost(codec);
12349 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12354 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12355 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12356 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12358 /* init callback for auto-configuration model -- overriding the default init */
12359 static void alc268_auto_init(struct hda_codec *codec)
12361 struct alc_spec *spec = codec->spec;
12362 alc268_auto_init_multi_out(codec);
12363 alc268_auto_init_hp_out(codec);
12364 alc268_auto_init_mono_speaker_out(codec);
12365 alc268_auto_init_analog_input(codec);
12366 if (spec->unsol_event)
12367 alc_inithook(codec);
12371 * configuration and preset
12373 static const char *alc268_models[ALC268_MODEL_LAST] = {
12374 [ALC267_QUANTA_IL1] = "quanta-il1",
12375 [ALC268_3ST] = "3stack",
12376 [ALC268_TOSHIBA] = "toshiba",
12377 [ALC268_ACER] = "acer",
12378 [ALC268_ACER_DMIC] = "acer-dmic",
12379 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12380 [ALC268_DELL] = "dell",
12381 [ALC268_ZEPTO] = "zepto",
12382 #ifdef CONFIG_SND_DEBUG
12383 [ALC268_TEST] = "test",
12385 [ALC268_AUTO] = "auto",
12388 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12389 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12390 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12391 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12392 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12393 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12394 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12395 ALC268_ACER_ASPIRE_ONE),
12396 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12397 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12398 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12400 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12401 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12402 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12403 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12404 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12405 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12409 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12410 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12411 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12412 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12413 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12418 static struct alc_config_preset alc268_presets[] = {
12419 [ALC267_QUANTA_IL1] = {
12420 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12421 alc268_capture_nosrc_mixer },
12422 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12423 alc267_quanta_il1_verbs },
12424 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12425 .dac_nids = alc268_dac_nids,
12426 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12427 .adc_nids = alc268_adc_nids_alt,
12429 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12430 .channel_mode = alc268_modes,
12431 .unsol_event = alc_sku_unsol_event,
12432 .setup = alc267_quanta_il1_setup,
12433 .init_hook = alc_inithook,
12436 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12437 alc268_beep_mixer },
12438 .init_verbs = { alc268_base_init_verbs },
12439 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12440 .dac_nids = alc268_dac_nids,
12441 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12442 .adc_nids = alc268_adc_nids_alt,
12443 .capsrc_nids = alc268_capsrc_nids,
12445 .dig_out_nid = ALC268_DIGOUT_NID,
12446 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12447 .channel_mode = alc268_modes,
12448 .input_mux = &alc268_capture_source,
12450 [ALC268_TOSHIBA] = {
12451 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12452 alc268_beep_mixer },
12453 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12454 alc268_toshiba_verbs },
12455 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12456 .dac_nids = alc268_dac_nids,
12457 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12458 .adc_nids = alc268_adc_nids_alt,
12459 .capsrc_nids = alc268_capsrc_nids,
12461 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12462 .channel_mode = alc268_modes,
12463 .input_mux = &alc268_capture_source,
12464 .unsol_event = alc268_toshiba_unsol_event,
12465 .setup = alc268_toshiba_setup,
12466 .init_hook = alc268_toshiba_automute,
12469 .mixers = { alc268_acer_mixer, alc268_capture_nosrc_mixer,
12470 alc268_beep_mixer },
12471 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12472 alc268_acer_verbs },
12473 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12474 .dac_nids = alc268_dac_nids,
12475 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12476 .adc_nids = alc268_adc_nids_alt,
12477 .capsrc_nids = alc268_capsrc_nids,
12479 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12480 .channel_mode = alc268_modes,
12481 .input_mux = &alc268_acer_capture_source,
12482 .unsol_event = alc268_acer_unsol_event,
12483 .init_hook = alc268_acer_init_hook,
12485 [ALC268_ACER_DMIC] = {
12486 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12487 alc268_beep_mixer },
12488 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12489 alc268_acer_verbs },
12490 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12491 .dac_nids = alc268_dac_nids,
12492 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12493 .adc_nids = alc268_adc_nids_alt,
12494 .capsrc_nids = alc268_capsrc_nids,
12496 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12497 .channel_mode = alc268_modes,
12498 .input_mux = &alc268_acer_dmic_capture_source,
12499 .unsol_event = alc268_acer_unsol_event,
12500 .init_hook = alc268_acer_init_hook,
12502 [ALC268_ACER_ASPIRE_ONE] = {
12503 .mixers = { alc268_acer_aspire_one_mixer,
12505 alc268_capture_nosrc_mixer },
12506 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12507 alc268_acer_aspire_one_verbs },
12508 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12509 .dac_nids = alc268_dac_nids,
12510 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12511 .adc_nids = alc268_adc_nids_alt,
12512 .capsrc_nids = alc268_capsrc_nids,
12514 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12515 .channel_mode = alc268_modes,
12516 .unsol_event = alc268_acer_lc_unsol_event,
12517 .setup = alc268_acer_lc_setup,
12518 .init_hook = alc268_acer_lc_init_hook,
12521 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12522 alc268_capture_nosrc_mixer },
12523 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12524 alc268_dell_verbs },
12525 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12526 .dac_nids = alc268_dac_nids,
12527 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12528 .adc_nids = alc268_adc_nids_alt,
12529 .capsrc_nids = alc268_capsrc_nids,
12531 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12532 .channel_mode = alc268_modes,
12533 .unsol_event = alc_sku_unsol_event,
12534 .setup = alc268_dell_setup,
12535 .init_hook = alc_inithook,
12538 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12539 alc268_beep_mixer },
12540 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12541 alc268_toshiba_verbs },
12542 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12543 .dac_nids = alc268_dac_nids,
12544 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12545 .adc_nids = alc268_adc_nids_alt,
12546 .capsrc_nids = alc268_capsrc_nids,
12548 .dig_out_nid = ALC268_DIGOUT_NID,
12549 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12550 .channel_mode = alc268_modes,
12551 .input_mux = &alc268_capture_source,
12552 .setup = alc268_toshiba_setup,
12553 .init_hook = alc268_toshiba_automute,
12555 #ifdef CONFIG_SND_DEBUG
12557 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12558 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12559 alc268_volume_init_verbs },
12560 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12561 .dac_nids = alc268_dac_nids,
12562 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12563 .adc_nids = alc268_adc_nids_alt,
12564 .capsrc_nids = alc268_capsrc_nids,
12566 .dig_out_nid = ALC268_DIGOUT_NID,
12567 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12568 .channel_mode = alc268_modes,
12569 .input_mux = &alc268_capture_source,
12574 static int patch_alc268(struct hda_codec *codec)
12576 struct alc_spec *spec;
12578 int i, has_beep, err;
12580 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12584 codec->spec = spec;
12586 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12590 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12591 board_config = snd_hda_check_board_codec_sid_config(codec,
12592 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12594 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12595 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12597 board_config = ALC268_AUTO;
12600 if (board_config == ALC268_AUTO) {
12601 /* automatic parse from the BIOS config */
12602 err = alc268_parse_auto_config(codec);
12608 "hda_codec: Cannot set up configuration "
12609 "from BIOS. Using base mode...\n");
12610 board_config = ALC268_3ST;
12614 if (board_config != ALC268_AUTO)
12615 setup_preset(codec, &alc268_presets[board_config]);
12617 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12618 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12619 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12621 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12624 for (i = 0; i < spec->num_mixers; i++) {
12625 if (spec->mixers[i] == alc268_beep_mixer) {
12632 err = snd_hda_attach_beep_device(codec, 0x1);
12637 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12638 /* override the amp caps for beep generator */
12639 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12640 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12641 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12642 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12643 (0 << AC_AMPCAP_MUTE_SHIFT));
12646 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12647 /* check whether NID 0x07 is valid */
12648 unsigned int wcap = get_wcaps(codec, 0x07);
12652 wcap = get_wcaps_type(wcap);
12653 if (spec->auto_mic ||
12654 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12655 spec->adc_nids = alc268_adc_nids_alt;
12656 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12657 if (spec->auto_mic || spec->input_mux->num_items == 1)
12658 add_mixer(spec, alc268_capture_nosrc_mixer);
12660 add_mixer(spec, alc268_capture_alt_mixer);
12662 spec->adc_nids = alc268_adc_nids;
12663 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12664 add_mixer(spec, alc268_capture_mixer);
12666 spec->capsrc_nids = alc268_capsrc_nids;
12667 /* set default input source */
12668 for (i = 0; i < spec->num_adc_nids; i++)
12669 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12670 0, AC_VERB_SET_CONNECT_SEL,
12671 i < spec->num_mux_defs ?
12672 spec->input_mux[i].items[0].index :
12673 spec->input_mux->items[0].index);
12676 spec->vmaster_nid = 0x02;
12678 codec->patch_ops = alc_patch_ops;
12679 if (board_config == ALC268_AUTO)
12680 spec->init_hook = alc268_auto_init;
12682 codec->proc_widget_hook = print_realtek_coef;
12688 * ALC269 channel source setting (2 channel)
12690 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12692 #define alc269_dac_nids alc260_dac_nids
12694 static hda_nid_t alc269_adc_nids[1] = {
12699 static hda_nid_t alc269_capsrc_nids[1] = {
12703 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12707 #define alc269_modes alc260_modes
12708 #define alc269_capture_source alc880_lg_lw_capture_source
12710 static struct snd_kcontrol_new alc269_base_mixer[] = {
12711 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12712 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12713 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12714 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12715 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12716 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12717 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12718 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12719 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12720 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12721 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12722 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12726 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12727 /* output mixer control */
12728 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12730 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12731 .name = "Master Playback Switch",
12732 .info = snd_hda_mixer_amp_switch_info,
12733 .get = snd_hda_mixer_amp_switch_get,
12734 .put = alc268_acer_master_sw_put,
12735 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12737 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12738 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12739 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12740 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12741 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12742 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12746 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12747 /* output mixer control */
12748 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12750 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12751 .name = "Master Playback Switch",
12752 .info = snd_hda_mixer_amp_switch_info,
12753 .get = snd_hda_mixer_amp_switch_get,
12754 .put = alc268_acer_master_sw_put,
12755 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12757 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12758 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12759 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12760 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12761 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12762 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12763 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12764 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12765 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12769 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12770 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12771 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12772 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12773 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12777 /* capture mixer elements */
12778 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12779 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12780 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12781 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12786 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12788 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12789 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12790 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12791 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12792 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12793 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12794 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12798 static struct hda_verb alc269_lifebook_verbs[] = {
12799 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12800 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12801 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12802 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12803 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12804 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12805 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12806 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12807 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12808 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12812 /* toggle speaker-output according to the hp-jack state */
12813 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12815 unsigned int present;
12816 unsigned char bits;
12818 present = snd_hda_codec_read(codec, 0x15, 0,
12819 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12820 bits = present ? AMP_IN_MUTE(0) : 0;
12821 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12822 AMP_IN_MUTE(0), bits);
12823 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12824 AMP_IN_MUTE(0), bits);
12826 snd_hda_codec_write(codec, 0x20, 0,
12827 AC_VERB_SET_COEF_INDEX, 0x0c);
12828 snd_hda_codec_write(codec, 0x20, 0,
12829 AC_VERB_SET_PROC_COEF, 0x680);
12831 snd_hda_codec_write(codec, 0x20, 0,
12832 AC_VERB_SET_COEF_INDEX, 0x0c);
12833 snd_hda_codec_write(codec, 0x20, 0,
12834 AC_VERB_SET_PROC_COEF, 0x480);
12837 /* toggle speaker-output according to the hp-jacks state */
12838 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12840 unsigned int present;
12841 unsigned char bits;
12843 /* Check laptop headphone socket */
12844 present = snd_hda_codec_read(codec, 0x15, 0,
12845 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12847 /* Check port replicator headphone socket */
12848 present |= snd_hda_codec_read(codec, 0x1a, 0,
12849 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12851 bits = present ? AMP_IN_MUTE(0) : 0;
12852 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12853 AMP_IN_MUTE(0), bits);
12854 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12855 AMP_IN_MUTE(0), bits);
12857 snd_hda_codec_write(codec, 0x20, 0,
12858 AC_VERB_SET_COEF_INDEX, 0x0c);
12859 snd_hda_codec_write(codec, 0x20, 0,
12860 AC_VERB_SET_PROC_COEF, 0x680);
12862 snd_hda_codec_write(codec, 0x20, 0,
12863 AC_VERB_SET_COEF_INDEX, 0x0c);
12864 snd_hda_codec_write(codec, 0x20, 0,
12865 AC_VERB_SET_PROC_COEF, 0x480);
12868 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12870 unsigned int present_laptop;
12871 unsigned int present_dock;
12873 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12874 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12876 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12877 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12879 /* Laptop mic port overrides dock mic port, design decision */
12881 snd_hda_codec_write(codec, 0x23, 0,
12882 AC_VERB_SET_CONNECT_SEL, 0x3);
12883 if (present_laptop)
12884 snd_hda_codec_write(codec, 0x23, 0,
12885 AC_VERB_SET_CONNECT_SEL, 0x0);
12886 if (!present_dock && !present_laptop)
12887 snd_hda_codec_write(codec, 0x23, 0,
12888 AC_VERB_SET_CONNECT_SEL, 0x1);
12891 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12894 switch (res >> 26) {
12895 case ALC880_HP_EVENT:
12896 alc269_quanta_fl1_speaker_automute(codec);
12898 case ALC880_MIC_EVENT:
12899 alc_mic_automute(codec);
12904 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12907 if ((res >> 26) == ALC880_HP_EVENT)
12908 alc269_lifebook_speaker_automute(codec);
12909 if ((res >> 26) == ALC880_MIC_EVENT)
12910 alc269_lifebook_mic_autoswitch(codec);
12913 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
12915 struct alc_spec *spec = codec->spec;
12916 spec->ext_mic.pin = 0x18;
12917 spec->ext_mic.mux_idx = 0;
12918 spec->int_mic.pin = 0x19;
12919 spec->int_mic.mux_idx = 1;
12920 spec->auto_mic = 1;
12923 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12925 alc269_quanta_fl1_speaker_automute(codec);
12926 alc_mic_automute(codec);
12929 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12931 alc269_lifebook_speaker_automute(codec);
12932 alc269_lifebook_mic_autoswitch(codec);
12935 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12936 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12937 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12938 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12939 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12940 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12941 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12942 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12946 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12947 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12948 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12949 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12950 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12951 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12952 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12956 /* toggle speaker-output according to the hp-jack state */
12957 static void alc269_speaker_automute(struct hda_codec *codec)
12959 unsigned int present;
12960 unsigned char bits;
12962 present = snd_hda_codec_read(codec, 0x15, 0,
12963 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12964 bits = present ? AMP_IN_MUTE(0) : 0;
12965 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12966 AMP_IN_MUTE(0), bits);
12967 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12968 AMP_IN_MUTE(0), bits);
12971 /* unsolicited event for HP jack sensing */
12972 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
12975 switch (res >> 26) {
12976 case ALC880_HP_EVENT:
12977 alc269_speaker_automute(codec);
12979 case ALC880_MIC_EVENT:
12980 alc_mic_automute(codec);
12985 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
12987 struct alc_spec *spec = codec->spec;
12988 spec->ext_mic.pin = 0x18;
12989 spec->ext_mic.mux_idx = 0;
12990 spec->int_mic.pin = 0x12;
12991 spec->int_mic.mux_idx = 5;
12992 spec->auto_mic = 1;
12995 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
12997 struct alc_spec *spec = codec->spec;
12998 spec->ext_mic.pin = 0x18;
12999 spec->ext_mic.mux_idx = 0;
13000 spec->int_mic.pin = 0x19;
13001 spec->int_mic.mux_idx = 1;
13002 spec->auto_mic = 1;
13005 static void alc269_eeepc_inithook(struct hda_codec *codec)
13007 alc269_speaker_automute(codec);
13008 alc_mic_automute(codec);
13012 * generic initialization of ADC, input mixers and output mixers
13014 static struct hda_verb alc269_init_verbs[] = {
13016 * Unmute ADC0 and set the default input to mic-in
13018 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13020 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13021 * analog-loopback mixer widget
13022 * Note: PASD motherboards uses the Line In 2 as the input for
13023 * front panel mic (mic 2)
13025 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13026 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13027 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13028 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13029 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13030 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13033 * Set up output mixers (0x0c - 0x0e)
13035 /* set vol=0 to output mixers */
13036 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13037 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13039 /* set up input amps for analog loopback */
13040 /* Amp Indices: DAC = 0, mixer = 1 */
13041 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13042 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13043 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13044 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13045 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13046 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13048 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13049 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13050 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13051 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13052 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13053 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13054 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13056 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13058 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13059 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13060 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13061 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13062 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13064 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13065 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13067 /* FIXME: use matrix-type input source selection */
13068 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13069 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13070 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13071 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13072 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13073 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13076 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13077 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13081 #define alc269_auto_create_multi_out_ctls \
13082 alc268_auto_create_multi_out_ctls
13083 #define alc269_auto_create_input_ctls \
13084 alc268_auto_create_input_ctls
13086 #ifdef CONFIG_SND_HDA_POWER_SAVE
13087 #define alc269_loopbacks alc880_loopbacks
13090 /* pcm configuration: identical with ALC880 */
13091 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13092 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13093 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13094 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13096 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13100 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13101 /* NID is set in alc_build_pcms */
13103 .open = alc880_playback_pcm_open,
13104 .prepare = alc880_playback_pcm_prepare,
13105 .cleanup = alc880_playback_pcm_cleanup
13109 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13113 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13114 /* NID is set in alc_build_pcms */
13118 * BIOS auto configuration
13120 static int alc269_parse_auto_config(struct hda_codec *codec)
13122 struct alc_spec *spec = codec->spec;
13124 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13126 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13131 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13134 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13138 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13140 if (spec->autocfg.dig_outs)
13141 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13143 if (spec->kctls.list)
13144 add_mixer(spec, spec->kctls.list);
13146 add_verb(spec, alc269_init_verbs);
13147 spec->num_mux_defs = 1;
13148 spec->input_mux = &spec->private_imux[0];
13149 /* set default input source */
13150 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13151 0, AC_VERB_SET_CONNECT_SEL,
13152 spec->input_mux->items[0].index);
13154 err = alc_auto_add_mic_boost(codec);
13158 if (!spec->cap_mixer && !spec->no_analog)
13159 set_capture_mixer(codec);
13161 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13166 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13167 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13168 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13171 /* init callback for auto-configuration model -- overriding the default init */
13172 static void alc269_auto_init(struct hda_codec *codec)
13174 struct alc_spec *spec = codec->spec;
13175 alc269_auto_init_multi_out(codec);
13176 alc269_auto_init_hp_out(codec);
13177 alc269_auto_init_analog_input(codec);
13178 if (spec->unsol_event)
13179 alc_inithook(codec);
13183 * configuration and preset
13185 static const char *alc269_models[ALC269_MODEL_LAST] = {
13186 [ALC269_BASIC] = "basic",
13187 [ALC269_QUANTA_FL1] = "quanta",
13188 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13189 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13190 [ALC269_FUJITSU] = "fujitsu",
13191 [ALC269_LIFEBOOK] = "lifebook"
13194 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13195 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13196 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13197 ALC269_ASUS_EEEPC_P703),
13198 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13199 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13200 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13201 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13202 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13203 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13204 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13205 ALC269_ASUS_EEEPC_P901),
13206 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13207 ALC269_ASUS_EEEPC_P901),
13208 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13209 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13210 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13214 static struct alc_config_preset alc269_presets[] = {
13216 .mixers = { alc269_base_mixer },
13217 .init_verbs = { alc269_init_verbs },
13218 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13219 .dac_nids = alc269_dac_nids,
13221 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13222 .channel_mode = alc269_modes,
13223 .input_mux = &alc269_capture_source,
13225 [ALC269_QUANTA_FL1] = {
13226 .mixers = { alc269_quanta_fl1_mixer },
13227 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13228 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13229 .dac_nids = alc269_dac_nids,
13231 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13232 .channel_mode = alc269_modes,
13233 .input_mux = &alc269_capture_source,
13234 .unsol_event = alc269_quanta_fl1_unsol_event,
13235 .setup = alc269_quanta_fl1_setup,
13236 .init_hook = alc269_quanta_fl1_init_hook,
13238 [ALC269_ASUS_EEEPC_P703] = {
13239 .mixers = { alc269_eeepc_mixer },
13240 .cap_mixer = alc269_epc_capture_mixer,
13241 .init_verbs = { alc269_init_verbs,
13242 alc269_eeepc_amic_init_verbs },
13243 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13244 .dac_nids = alc269_dac_nids,
13246 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13247 .channel_mode = alc269_modes,
13248 .unsol_event = alc269_eeepc_unsol_event,
13249 .setup = alc269_eeepc_amic_setup,
13250 .init_hook = alc269_eeepc_inithook,
13252 [ALC269_ASUS_EEEPC_P901] = {
13253 .mixers = { alc269_eeepc_mixer },
13254 .cap_mixer = alc269_epc_capture_mixer,
13255 .init_verbs = { alc269_init_verbs,
13256 alc269_eeepc_dmic_init_verbs },
13257 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13258 .dac_nids = alc269_dac_nids,
13260 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13261 .channel_mode = alc269_modes,
13262 .unsol_event = alc269_eeepc_unsol_event,
13263 .setup = alc269_eeepc_dmic_setup,
13264 .init_hook = alc269_eeepc_inithook,
13266 [ALC269_FUJITSU] = {
13267 .mixers = { alc269_fujitsu_mixer },
13268 .cap_mixer = alc269_epc_capture_mixer,
13269 .init_verbs = { alc269_init_verbs,
13270 alc269_eeepc_dmic_init_verbs },
13271 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13272 .dac_nids = alc269_dac_nids,
13274 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13275 .channel_mode = alc269_modes,
13276 .unsol_event = alc269_eeepc_unsol_event,
13277 .setup = alc269_eeepc_dmic_setup,
13278 .init_hook = alc269_eeepc_inithook,
13280 [ALC269_LIFEBOOK] = {
13281 .mixers = { alc269_lifebook_mixer },
13282 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13283 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13284 .dac_nids = alc269_dac_nids,
13286 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13287 .channel_mode = alc269_modes,
13288 .input_mux = &alc269_capture_source,
13289 .unsol_event = alc269_lifebook_unsol_event,
13290 .init_hook = alc269_lifebook_init_hook,
13294 static int patch_alc269(struct hda_codec *codec)
13296 struct alc_spec *spec;
13300 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13304 codec->spec = spec;
13306 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13308 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13312 if (board_config < 0) {
13313 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13315 board_config = ALC269_AUTO;
13318 if (board_config == ALC269_AUTO) {
13319 /* automatic parse from the BIOS config */
13320 err = alc269_parse_auto_config(codec);
13326 "hda_codec: Cannot set up configuration "
13327 "from BIOS. Using base mode...\n");
13328 board_config = ALC269_BASIC;
13332 err = snd_hda_attach_beep_device(codec, 0x1);
13338 if (board_config != ALC269_AUTO)
13339 setup_preset(codec, &alc269_presets[board_config]);
13341 if (codec->subsystem_id == 0x17aa3bf8) {
13342 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13343 * fix the sample rate of analog I/O to 44.1kHz
13345 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13346 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13348 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13349 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13351 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13352 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13354 spec->adc_nids = alc269_adc_nids;
13355 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13356 spec->capsrc_nids = alc269_capsrc_nids;
13357 if (!spec->cap_mixer)
13358 set_capture_mixer(codec);
13359 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13361 spec->vmaster_nid = 0x02;
13363 codec->patch_ops = alc_patch_ops;
13364 if (board_config == ALC269_AUTO)
13365 spec->init_hook = alc269_auto_init;
13366 #ifdef CONFIG_SND_HDA_POWER_SAVE
13367 if (!spec->loopback.amplist)
13368 spec->loopback.amplist = alc269_loopbacks;
13370 codec->proc_widget_hook = print_realtek_coef;
13376 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13380 * set the path ways for 2 channel output
13381 * need to set the codec line out and mic 1 pin widgets to inputs
13383 static struct hda_verb alc861_threestack_ch2_init[] = {
13384 /* set pin widget 1Ah (line in) for input */
13385 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13386 /* set pin widget 18h (mic1/2) for input, for mic also enable
13389 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13391 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13393 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13394 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13400 * need to set the codec line out and mic 1 pin widgets to outputs
13402 static struct hda_verb alc861_threestack_ch6_init[] = {
13403 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13404 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13405 /* set pin widget 18h (mic1) for output (CLFE)*/
13406 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13408 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13409 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13411 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13413 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13414 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13419 static struct hda_channel_mode alc861_threestack_modes[2] = {
13420 { 2, alc861_threestack_ch2_init },
13421 { 6, alc861_threestack_ch6_init },
13423 /* Set mic1 as input and unmute the mixer */
13424 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13425 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13426 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13429 /* Set mic1 as output and mute mixer */
13430 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13431 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13432 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13436 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13437 { 2, alc861_uniwill_m31_ch2_init },
13438 { 4, alc861_uniwill_m31_ch4_init },
13441 /* Set mic1 and line-in as input and unmute the mixer */
13442 static struct hda_verb alc861_asus_ch2_init[] = {
13443 /* set pin widget 1Ah (line in) for input */
13444 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13445 /* set pin widget 18h (mic1/2) for input, for mic also enable
13448 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13450 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13452 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13453 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13457 /* Set mic1 nad line-in as output and mute mixer */
13458 static struct hda_verb alc861_asus_ch6_init[] = {
13459 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13460 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13461 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13462 /* set pin widget 18h (mic1) for output (CLFE)*/
13463 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13464 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13465 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13466 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13468 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13470 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13471 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13476 static struct hda_channel_mode alc861_asus_modes[2] = {
13477 { 2, alc861_asus_ch2_init },
13478 { 6, alc861_asus_ch6_init },
13483 static struct snd_kcontrol_new alc861_base_mixer[] = {
13484 /* output mixer control */
13485 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13486 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13487 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13488 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13489 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13491 /*Input mixer control */
13492 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13493 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13494 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13495 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13496 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13497 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13498 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13499 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13500 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13501 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13506 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13507 /* output mixer control */
13508 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13509 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13510 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13511 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13512 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13514 /* Input mixer control */
13515 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13516 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13517 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13518 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13519 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13520 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13521 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13522 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13523 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13524 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13527 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13528 .name = "Channel Mode",
13529 .info = alc_ch_mode_info,
13530 .get = alc_ch_mode_get,
13531 .put = alc_ch_mode_put,
13532 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13537 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13538 /* output mixer control */
13539 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13540 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13541 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13546 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13547 /* output mixer control */
13548 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13549 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13550 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13551 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13552 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13554 /* Input mixer control */
13555 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13556 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13557 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13558 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13559 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13560 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13561 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13562 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13563 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13564 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13567 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13568 .name = "Channel Mode",
13569 .info = alc_ch_mode_info,
13570 .get = alc_ch_mode_get,
13571 .put = alc_ch_mode_put,
13572 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13577 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13578 /* output mixer control */
13579 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13580 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13581 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13582 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13583 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13585 /* Input mixer control */
13586 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13587 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13588 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13589 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13590 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13591 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13592 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13593 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13594 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13595 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13598 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13599 .name = "Channel Mode",
13600 .info = alc_ch_mode_info,
13601 .get = alc_ch_mode_get,
13602 .put = alc_ch_mode_put,
13603 .private_value = ARRAY_SIZE(alc861_asus_modes),
13608 /* additional mixer */
13609 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13610 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13611 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13616 * generic initialization of ADC, input mixers and output mixers
13618 static struct hda_verb alc861_base_init_verbs[] = {
13620 * Unmute ADC0 and set the default input to mic-in
13622 /* port-A for surround (rear panel) */
13623 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13624 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13625 /* port-B for mic-in (rear panel) with vref */
13626 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13627 /* port-C for line-in (rear panel) */
13628 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13629 /* port-D for Front */
13630 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13631 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13632 /* port-E for HP out (front panel) */
13633 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13634 /* route front PCM to HP */
13635 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13636 /* port-F for mic-in (front panel) with vref */
13637 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13638 /* port-G for CLFE (rear panel) */
13639 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13640 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13641 /* port-H for side (rear panel) */
13642 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13643 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13645 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13646 /* route front mic to ADC1*/
13647 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13648 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13650 /* Unmute DAC0~3 & spdif out*/
13651 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13652 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13653 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13654 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13655 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13657 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13658 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13659 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13660 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13661 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13663 /* Unmute Stereo Mixer 15 */
13664 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13665 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13666 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13667 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13669 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13670 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13671 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13672 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13673 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13674 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13675 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13676 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13677 /* hp used DAC 3 (Front) */
13678 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13679 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13684 static struct hda_verb alc861_threestack_init_verbs[] = {
13686 * Unmute ADC0 and set the default input to mic-in
13688 /* port-A for surround (rear panel) */
13689 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13690 /* port-B for mic-in (rear panel) with vref */
13691 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13692 /* port-C for line-in (rear panel) */
13693 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13694 /* port-D for Front */
13695 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13696 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13697 /* port-E for HP out (front panel) */
13698 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13699 /* route front PCM to HP */
13700 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13701 /* port-F for mic-in (front panel) with vref */
13702 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13703 /* port-G for CLFE (rear panel) */
13704 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13705 /* port-H for side (rear panel) */
13706 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13708 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13709 /* route front mic to ADC1*/
13710 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13711 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13712 /* Unmute DAC0~3 & spdif out*/
13713 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13714 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13715 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13716 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13717 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13719 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13720 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13721 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13722 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13723 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13725 /* Unmute Stereo Mixer 15 */
13726 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13727 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13728 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13729 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13731 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13732 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13733 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13734 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13735 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13736 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13737 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13738 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13739 /* hp used DAC 3 (Front) */
13740 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13741 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13745 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13747 * Unmute ADC0 and set the default input to mic-in
13749 /* port-A for surround (rear panel) */
13750 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13751 /* port-B for mic-in (rear panel) with vref */
13752 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13753 /* port-C for line-in (rear panel) */
13754 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13755 /* port-D for Front */
13756 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13757 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13758 /* port-E for HP out (front panel) */
13759 /* this has to be set to VREF80 */
13760 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13761 /* route front PCM to HP */
13762 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13763 /* port-F for mic-in (front panel) with vref */
13764 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13765 /* port-G for CLFE (rear panel) */
13766 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13767 /* port-H for side (rear panel) */
13768 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13770 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13771 /* route front mic to ADC1*/
13772 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13773 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13774 /* Unmute DAC0~3 & spdif out*/
13775 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13776 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13777 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13778 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13779 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13781 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13782 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13783 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13784 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13785 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13787 /* Unmute Stereo Mixer 15 */
13788 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13789 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13790 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13791 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13793 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13794 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13795 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13796 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13797 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13798 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13799 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13800 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13801 /* hp used DAC 3 (Front) */
13802 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13803 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13807 static struct hda_verb alc861_asus_init_verbs[] = {
13809 * Unmute ADC0 and set the default input to mic-in
13811 /* port-A for surround (rear panel)
13812 * according to codec#0 this is the HP jack
13814 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13815 /* route front PCM to HP */
13816 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13817 /* port-B for mic-in (rear panel) with vref */
13818 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13819 /* port-C for line-in (rear panel) */
13820 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13821 /* port-D for Front */
13822 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13823 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13824 /* port-E for HP out (front panel) */
13825 /* this has to be set to VREF80 */
13826 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13827 /* route front PCM to HP */
13828 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13829 /* port-F for mic-in (front panel) with vref */
13830 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13831 /* port-G for CLFE (rear panel) */
13832 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13833 /* port-H for side (rear panel) */
13834 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13836 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13837 /* route front mic to ADC1*/
13838 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13839 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13840 /* Unmute DAC0~3 & spdif out*/
13841 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13842 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13843 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13844 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13845 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13846 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13847 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13848 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13849 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13850 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13852 /* Unmute Stereo Mixer 15 */
13853 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13855 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13856 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13858 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13859 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13860 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13861 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13862 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13863 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13864 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13865 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13866 /* hp used DAC 3 (Front) */
13867 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13868 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13872 /* additional init verbs for ASUS laptops */
13873 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13874 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13875 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13880 * generic initialization of ADC, input mixers and output mixers
13882 static struct hda_verb alc861_auto_init_verbs[] = {
13884 * Unmute ADC0 and set the default input to mic-in
13886 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13887 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13889 /* Unmute DAC0~3 & spdif out*/
13890 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13891 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13892 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13893 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13894 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13896 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13897 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13898 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13899 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13900 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13902 /* Unmute Stereo Mixer 15 */
13903 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13904 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13905 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13906 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13908 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13909 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13910 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13911 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13912 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13913 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13914 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13915 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13917 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13918 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13919 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13920 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13921 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13922 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13923 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13924 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13926 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13931 static struct hda_verb alc861_toshiba_init_verbs[] = {
13932 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13937 /* toggle speaker-output according to the hp-jack state */
13938 static void alc861_toshiba_automute(struct hda_codec *codec)
13940 unsigned int present;
13942 present = snd_hda_codec_read(codec, 0x0f, 0,
13943 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13944 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13945 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13946 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13947 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13950 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13953 if ((res >> 26) == ALC880_HP_EVENT)
13954 alc861_toshiba_automute(codec);
13957 /* pcm configuration: identical with ALC880 */
13958 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13959 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13960 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13961 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13964 #define ALC861_DIGOUT_NID 0x07
13966 static struct hda_channel_mode alc861_8ch_modes[1] = {
13970 static hda_nid_t alc861_dac_nids[4] = {
13971 /* front, surround, clfe, side */
13972 0x03, 0x06, 0x05, 0x04
13975 static hda_nid_t alc660_dac_nids[3] = {
13976 /* front, clfe, surround */
13980 static hda_nid_t alc861_adc_nids[1] = {
13985 static struct hda_input_mux alc861_capture_source = {
13989 { "Front Mic", 0x3 },
13996 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
13998 struct alc_spec *spec = codec->spec;
13999 hda_nid_t mix, srcs[5];
14002 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14004 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14007 for (i = 0; i < num; i++) {
14009 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14010 if (type != AC_WID_AUD_OUT)
14012 for (j = 0; j < spec->multiout.num_dacs; j++)
14013 if (spec->multiout.dac_nids[j] == srcs[i])
14015 if (j >= spec->multiout.num_dacs)
14021 /* fill in the dac_nids table from the parsed pin configuration */
14022 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14023 const struct auto_pin_cfg *cfg)
14025 struct alc_spec *spec = codec->spec;
14027 hda_nid_t nid, dac;
14029 spec->multiout.dac_nids = spec->private_dac_nids;
14030 for (i = 0; i < cfg->line_outs; i++) {
14031 nid = cfg->line_out_pins[i];
14032 dac = alc861_look_for_dac(codec, nid);
14035 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14040 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14041 hda_nid_t nid, unsigned int chs)
14044 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
14045 return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name,
14046 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14049 /* add playback controls from the parsed DAC table */
14050 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14051 const struct auto_pin_cfg *cfg)
14053 struct alc_spec *spec = codec->spec;
14054 static const char *chname[4] = {
14055 "Front", "Surround", NULL /*CLFE*/, "Side"
14060 if (cfg->line_outs == 1) {
14061 const char *pfx = NULL;
14064 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14067 nid = spec->multiout.dac_nids[0];
14068 return alc861_create_out_sw(codec, pfx, nid, 3);
14072 for (i = 0; i < cfg->line_outs; i++) {
14073 nid = spec->multiout.dac_nids[i];
14078 err = alc861_create_out_sw(codec, "Center", nid, 1);
14081 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14085 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14093 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14095 struct alc_spec *spec = codec->spec;
14102 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14103 nid = alc861_look_for_dac(codec, pin);
14105 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14108 spec->multiout.hp_nid = nid;
14114 /* create playback/capture controls for input pins */
14115 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14116 const struct auto_pin_cfg *cfg)
14118 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14121 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14123 int pin_type, hda_nid_t dac)
14125 hda_nid_t mix, srcs[5];
14128 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14130 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14132 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14134 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14137 for (i = 0; i < num; i++) {
14139 if (srcs[i] == dac || srcs[i] == 0x15)
14140 mute = AMP_IN_UNMUTE(i);
14142 mute = AMP_IN_MUTE(i);
14143 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14148 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14150 struct alc_spec *spec = codec->spec;
14153 for (i = 0; i < spec->autocfg.line_outs; i++) {
14154 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14155 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14157 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14158 spec->multiout.dac_nids[i]);
14162 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14164 struct alc_spec *spec = codec->spec;
14167 pin = spec->autocfg.hp_pins[0];
14169 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14170 spec->multiout.hp_nid);
14171 pin = spec->autocfg.speaker_pins[0];
14173 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT,
14174 spec->multiout.dac_nids[0]);
14177 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14179 struct alc_spec *spec = codec->spec;
14182 for (i = 0; i < AUTO_PIN_LAST; i++) {
14183 hda_nid_t nid = spec->autocfg.input_pins[i];
14184 if (nid >= 0x0c && nid <= 0x11)
14185 alc_set_input_pin(codec, nid, i);
14189 /* parse the BIOS configuration and set up the alc_spec */
14190 /* return 1 if successful, 0 if the proper config is not found,
14191 * or a negative error code
14193 static int alc861_parse_auto_config(struct hda_codec *codec)
14195 struct alc_spec *spec = codec->spec;
14197 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14199 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14203 if (!spec->autocfg.line_outs)
14204 return 0; /* can't find valid BIOS pin config */
14206 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14209 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14212 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14215 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14219 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14221 if (spec->autocfg.dig_outs)
14222 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14224 if (spec->kctls.list)
14225 add_mixer(spec, spec->kctls.list);
14227 add_verb(spec, alc861_auto_init_verbs);
14229 spec->num_mux_defs = 1;
14230 spec->input_mux = &spec->private_imux[0];
14232 spec->adc_nids = alc861_adc_nids;
14233 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14234 set_capture_mixer(codec);
14236 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14241 /* additional initialization for auto-configuration model */
14242 static void alc861_auto_init(struct hda_codec *codec)
14244 struct alc_spec *spec = codec->spec;
14245 alc861_auto_init_multi_out(codec);
14246 alc861_auto_init_hp_out(codec);
14247 alc861_auto_init_analog_input(codec);
14248 if (spec->unsol_event)
14249 alc_inithook(codec);
14252 #ifdef CONFIG_SND_HDA_POWER_SAVE
14253 static struct hda_amp_list alc861_loopbacks[] = {
14254 { 0x15, HDA_INPUT, 0 },
14255 { 0x15, HDA_INPUT, 1 },
14256 { 0x15, HDA_INPUT, 2 },
14257 { 0x15, HDA_INPUT, 3 },
14264 * configuration and preset
14266 static const char *alc861_models[ALC861_MODEL_LAST] = {
14267 [ALC861_3ST] = "3stack",
14268 [ALC660_3ST] = "3stack-660",
14269 [ALC861_3ST_DIG] = "3stack-dig",
14270 [ALC861_6ST_DIG] = "6stack-dig",
14271 [ALC861_UNIWILL_M31] = "uniwill-m31",
14272 [ALC861_TOSHIBA] = "toshiba",
14273 [ALC861_ASUS] = "asus",
14274 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14275 [ALC861_AUTO] = "auto",
14278 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14279 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14280 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14281 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14282 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14283 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14284 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14285 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14286 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14287 * Any other models that need this preset?
14289 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14290 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14291 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14292 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14293 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14294 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14295 /* FIXME: the below seems conflict */
14296 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14297 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14298 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14302 static struct alc_config_preset alc861_presets[] = {
14304 .mixers = { alc861_3ST_mixer },
14305 .init_verbs = { alc861_threestack_init_verbs },
14306 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14307 .dac_nids = alc861_dac_nids,
14308 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14309 .channel_mode = alc861_threestack_modes,
14311 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14312 .adc_nids = alc861_adc_nids,
14313 .input_mux = &alc861_capture_source,
14315 [ALC861_3ST_DIG] = {
14316 .mixers = { alc861_base_mixer },
14317 .init_verbs = { alc861_threestack_init_verbs },
14318 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14319 .dac_nids = alc861_dac_nids,
14320 .dig_out_nid = ALC861_DIGOUT_NID,
14321 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14322 .channel_mode = alc861_threestack_modes,
14324 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14325 .adc_nids = alc861_adc_nids,
14326 .input_mux = &alc861_capture_source,
14328 [ALC861_6ST_DIG] = {
14329 .mixers = { alc861_base_mixer },
14330 .init_verbs = { alc861_base_init_verbs },
14331 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14332 .dac_nids = alc861_dac_nids,
14333 .dig_out_nid = ALC861_DIGOUT_NID,
14334 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14335 .channel_mode = alc861_8ch_modes,
14336 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14337 .adc_nids = alc861_adc_nids,
14338 .input_mux = &alc861_capture_source,
14341 .mixers = { alc861_3ST_mixer },
14342 .init_verbs = { alc861_threestack_init_verbs },
14343 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14344 .dac_nids = alc660_dac_nids,
14345 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14346 .channel_mode = alc861_threestack_modes,
14348 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14349 .adc_nids = alc861_adc_nids,
14350 .input_mux = &alc861_capture_source,
14352 [ALC861_UNIWILL_M31] = {
14353 .mixers = { alc861_uniwill_m31_mixer },
14354 .init_verbs = { alc861_uniwill_m31_init_verbs },
14355 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14356 .dac_nids = alc861_dac_nids,
14357 .dig_out_nid = ALC861_DIGOUT_NID,
14358 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14359 .channel_mode = alc861_uniwill_m31_modes,
14361 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14362 .adc_nids = alc861_adc_nids,
14363 .input_mux = &alc861_capture_source,
14365 [ALC861_TOSHIBA] = {
14366 .mixers = { alc861_toshiba_mixer },
14367 .init_verbs = { alc861_base_init_verbs,
14368 alc861_toshiba_init_verbs },
14369 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14370 .dac_nids = alc861_dac_nids,
14371 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14372 .channel_mode = alc883_3ST_2ch_modes,
14373 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14374 .adc_nids = alc861_adc_nids,
14375 .input_mux = &alc861_capture_source,
14376 .unsol_event = alc861_toshiba_unsol_event,
14377 .init_hook = alc861_toshiba_automute,
14380 .mixers = { alc861_asus_mixer },
14381 .init_verbs = { alc861_asus_init_verbs },
14382 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14383 .dac_nids = alc861_dac_nids,
14384 .dig_out_nid = ALC861_DIGOUT_NID,
14385 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14386 .channel_mode = alc861_asus_modes,
14389 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14390 .adc_nids = alc861_adc_nids,
14391 .input_mux = &alc861_capture_source,
14393 [ALC861_ASUS_LAPTOP] = {
14394 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14395 .init_verbs = { alc861_asus_init_verbs,
14396 alc861_asus_laptop_init_verbs },
14397 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14398 .dac_nids = alc861_dac_nids,
14399 .dig_out_nid = ALC861_DIGOUT_NID,
14400 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14401 .channel_mode = alc883_3ST_2ch_modes,
14403 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14404 .adc_nids = alc861_adc_nids,
14405 .input_mux = &alc861_capture_source,
14410 static int patch_alc861(struct hda_codec *codec)
14412 struct alc_spec *spec;
14416 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14420 codec->spec = spec;
14422 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14426 if (board_config < 0) {
14427 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14429 board_config = ALC861_AUTO;
14432 if (board_config == ALC861_AUTO) {
14433 /* automatic parse from the BIOS config */
14434 err = alc861_parse_auto_config(codec);
14440 "hda_codec: Cannot set up configuration "
14441 "from BIOS. Using base mode...\n");
14442 board_config = ALC861_3ST_DIG;
14446 err = snd_hda_attach_beep_device(codec, 0x23);
14452 if (board_config != ALC861_AUTO)
14453 setup_preset(codec, &alc861_presets[board_config]);
14455 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14456 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14458 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14459 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14461 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14463 spec->vmaster_nid = 0x03;
14465 codec->patch_ops = alc_patch_ops;
14466 if (board_config == ALC861_AUTO)
14467 spec->init_hook = alc861_auto_init;
14468 #ifdef CONFIG_SND_HDA_POWER_SAVE
14469 if (!spec->loopback.amplist)
14470 spec->loopback.amplist = alc861_loopbacks;
14472 codec->proc_widget_hook = print_realtek_coef;
14478 * ALC861-VD support
14482 * In addition, an independent DAC
14484 #define ALC861VD_DIGOUT_NID 0x06
14486 static hda_nid_t alc861vd_dac_nids[4] = {
14487 /* front, surr, clfe, side surr */
14488 0x02, 0x03, 0x04, 0x05
14491 /* dac_nids for ALC660vd are in a different order - according to
14492 * Realtek's driver.
14493 * This should probably result in a different mixer for 6stack models
14494 * of ALC660vd codecs, but for now there is only 3stack mixer
14495 * - and it is the same as in 861vd.
14496 * adc_nids in ALC660vd are (is) the same as in 861vd
14498 static hda_nid_t alc660vd_dac_nids[3] = {
14499 /* front, rear, clfe, rear_surr */
14503 static hda_nid_t alc861vd_adc_nids[1] = {
14508 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14511 /* FIXME: should be a matrix-type input source selection */
14512 static struct hda_input_mux alc861vd_capture_source = {
14516 { "Front Mic", 0x1 },
14522 static struct hda_input_mux alc861vd_dallas_capture_source = {
14525 { "Ext Mic", 0x0 },
14526 { "Int Mic", 0x1 },
14530 static struct hda_input_mux alc861vd_hp_capture_source = {
14533 { "Front Mic", 0x0 },
14534 { "ATAPI Mic", 0x1 },
14541 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14548 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14549 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14550 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14551 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14552 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14559 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14560 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14561 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14562 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14563 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14567 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14568 { 6, alc861vd_6stack_ch6_init },
14569 { 8, alc861vd_6stack_ch8_init },
14572 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14574 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14575 .name = "Channel Mode",
14576 .info = alc_ch_mode_info,
14577 .get = alc_ch_mode_get,
14578 .put = alc_ch_mode_put,
14583 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14584 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14586 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14587 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14588 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14590 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14591 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14593 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14595 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14597 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14598 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14600 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14601 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14603 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14605 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14606 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14607 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14609 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14610 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14611 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14613 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14614 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14616 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14617 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14622 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14623 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14624 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14626 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14628 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14629 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14630 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14632 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14633 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14634 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14636 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14637 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14639 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14640 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14645 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14646 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14647 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14648 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14650 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14652 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14653 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14654 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14656 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14657 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14658 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14660 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14661 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14666 /* Pin assignment: Speaker=0x14, HP = 0x15,
14667 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14669 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14670 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14671 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14672 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14673 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14674 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14675 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14676 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14677 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14678 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14679 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14683 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14684 * Front Mic=0x18, ATAPI Mic = 0x19,
14686 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14687 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14688 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14689 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14690 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14691 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14692 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14693 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14694 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14700 * generic initialization of ADC, input mixers and output mixers
14702 static struct hda_verb alc861vd_volume_init_verbs[] = {
14704 * Unmute ADC0 and set the default input to mic-in
14706 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14707 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14709 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14710 * the analog-loopback mixer widget
14712 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14714 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14715 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14716 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14717 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14719 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14720 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14721 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14722 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14723 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14726 * Set up output mixers (0x02 - 0x05)
14728 /* set vol=0 to output mixers */
14729 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14730 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14731 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14732 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14734 /* set up input amps for analog loopback */
14735 /* Amp Indices: DAC = 0, mixer = 1 */
14736 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14737 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14738 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14739 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14740 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14741 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14742 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14743 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14749 * 3-stack pin configuration:
14750 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14752 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14754 * Set pin mode and muting
14756 /* set front pin widgets 0x14 for output */
14757 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14758 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14759 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14761 /* Mic (rear) pin: input vref at 80% */
14762 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14763 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14764 /* Front Mic pin: input vref at 80% */
14765 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14766 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14767 /* Line In pin: input */
14768 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14769 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14770 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14771 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14772 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14773 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14774 /* CD pin widget for input */
14775 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14781 * 6-stack pin configuration:
14783 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14785 * Set pin mode and muting
14787 /* set front pin widgets 0x14 for output */
14788 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14789 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14790 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14792 /* Rear Pin: output 1 (0x0d) */
14793 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14794 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14795 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14796 /* CLFE Pin: output 2 (0x0e) */
14797 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14798 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14799 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14800 /* Side Pin: output 3 (0x0f) */
14801 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14802 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14803 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14805 /* Mic (rear) pin: input vref at 80% */
14806 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14807 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14808 /* Front Mic pin: input vref at 80% */
14809 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14810 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14811 /* Line In pin: input */
14812 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14813 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14814 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14815 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14816 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14817 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14818 /* CD pin widget for input */
14819 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14824 static struct hda_verb alc861vd_eapd_verbs[] = {
14825 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14829 static struct hda_verb alc660vd_eapd_verbs[] = {
14830 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14831 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14835 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14836 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14837 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14838 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14839 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14840 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14844 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14846 unsigned int present;
14847 unsigned char bits;
14849 present = snd_hda_codec_read(codec, 0x18, 0,
14850 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14851 bits = present ? HDA_AMP_MUTE : 0;
14852 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14853 HDA_AMP_MUTE, bits);
14856 static void alc861vd_lenovo_setup(struct hda_codec *codec)
14858 struct alc_spec *spec = codec->spec;
14859 spec->autocfg.hp_pins[0] = 0x1b;
14860 spec->autocfg.speaker_pins[0] = 0x14;
14863 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14865 alc_automute_amp(codec);
14866 alc861vd_lenovo_mic_automute(codec);
14869 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14872 switch (res >> 26) {
14873 case ALC880_MIC_EVENT:
14874 alc861vd_lenovo_mic_automute(codec);
14877 alc_automute_amp_unsol_event(codec, res);
14882 static struct hda_verb alc861vd_dallas_verbs[] = {
14883 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14884 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14885 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14886 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14889 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14890 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14891 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14892 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14893 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14894 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14895 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14897 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14898 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14899 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14900 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14901 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14902 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14903 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14904 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14906 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14907 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14908 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14909 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14910 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14911 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14912 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14913 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14915 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14916 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14917 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14918 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14920 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14921 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14922 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14927 /* toggle speaker-output according to the hp-jack state */
14928 static void alc861vd_dallas_setup(struct hda_codec *codec)
14930 struct alc_spec *spec = codec->spec;
14932 spec->autocfg.hp_pins[0] = 0x15;
14933 spec->autocfg.speaker_pins[0] = 0x14;
14936 #ifdef CONFIG_SND_HDA_POWER_SAVE
14937 #define alc861vd_loopbacks alc880_loopbacks
14940 /* pcm configuration: identical with ALC880 */
14941 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14942 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14943 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14944 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14947 * configuration and preset
14949 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14950 [ALC660VD_3ST] = "3stack-660",
14951 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14952 [ALC660VD_ASUS_V1S] = "asus-v1s",
14953 [ALC861VD_3ST] = "3stack",
14954 [ALC861VD_3ST_DIG] = "3stack-digout",
14955 [ALC861VD_6ST_DIG] = "6stack-digout",
14956 [ALC861VD_LENOVO] = "lenovo",
14957 [ALC861VD_DALLAS] = "dallas",
14958 [ALC861VD_HP] = "hp",
14959 [ALC861VD_AUTO] = "auto",
14962 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14963 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14964 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14965 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14966 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14967 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14968 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14969 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14970 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14971 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14972 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
14973 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14974 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14975 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14976 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14977 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14981 static struct alc_config_preset alc861vd_presets[] = {
14983 .mixers = { alc861vd_3st_mixer },
14984 .init_verbs = { alc861vd_volume_init_verbs,
14985 alc861vd_3stack_init_verbs },
14986 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14987 .dac_nids = alc660vd_dac_nids,
14988 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14989 .channel_mode = alc861vd_3stack_2ch_modes,
14990 .input_mux = &alc861vd_capture_source,
14992 [ALC660VD_3ST_DIG] = {
14993 .mixers = { alc861vd_3st_mixer },
14994 .init_verbs = { alc861vd_volume_init_verbs,
14995 alc861vd_3stack_init_verbs },
14996 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14997 .dac_nids = alc660vd_dac_nids,
14998 .dig_out_nid = ALC861VD_DIGOUT_NID,
14999 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15000 .channel_mode = alc861vd_3stack_2ch_modes,
15001 .input_mux = &alc861vd_capture_source,
15004 .mixers = { alc861vd_3st_mixer },
15005 .init_verbs = { alc861vd_volume_init_verbs,
15006 alc861vd_3stack_init_verbs },
15007 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15008 .dac_nids = alc861vd_dac_nids,
15009 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15010 .channel_mode = alc861vd_3stack_2ch_modes,
15011 .input_mux = &alc861vd_capture_source,
15013 [ALC861VD_3ST_DIG] = {
15014 .mixers = { alc861vd_3st_mixer },
15015 .init_verbs = { alc861vd_volume_init_verbs,
15016 alc861vd_3stack_init_verbs },
15017 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15018 .dac_nids = alc861vd_dac_nids,
15019 .dig_out_nid = ALC861VD_DIGOUT_NID,
15020 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15021 .channel_mode = alc861vd_3stack_2ch_modes,
15022 .input_mux = &alc861vd_capture_source,
15024 [ALC861VD_6ST_DIG] = {
15025 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15026 .init_verbs = { alc861vd_volume_init_verbs,
15027 alc861vd_6stack_init_verbs },
15028 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15029 .dac_nids = alc861vd_dac_nids,
15030 .dig_out_nid = ALC861VD_DIGOUT_NID,
15031 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15032 .channel_mode = alc861vd_6stack_modes,
15033 .input_mux = &alc861vd_capture_source,
15035 [ALC861VD_LENOVO] = {
15036 .mixers = { alc861vd_lenovo_mixer },
15037 .init_verbs = { alc861vd_volume_init_verbs,
15038 alc861vd_3stack_init_verbs,
15039 alc861vd_eapd_verbs,
15040 alc861vd_lenovo_unsol_verbs },
15041 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15042 .dac_nids = alc660vd_dac_nids,
15043 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15044 .channel_mode = alc861vd_3stack_2ch_modes,
15045 .input_mux = &alc861vd_capture_source,
15046 .unsol_event = alc861vd_lenovo_unsol_event,
15047 .setup = alc861vd_lenovo_setup,
15048 .init_hook = alc861vd_lenovo_init_hook,
15050 [ALC861VD_DALLAS] = {
15051 .mixers = { alc861vd_dallas_mixer },
15052 .init_verbs = { alc861vd_dallas_verbs },
15053 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15054 .dac_nids = alc861vd_dac_nids,
15055 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15056 .channel_mode = alc861vd_3stack_2ch_modes,
15057 .input_mux = &alc861vd_dallas_capture_source,
15058 .unsol_event = alc_automute_amp_unsol_event,
15059 .setup = alc861vd_dallas_setup,
15060 .init_hook = alc_automute_amp,
15063 .mixers = { alc861vd_hp_mixer },
15064 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15065 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15066 .dac_nids = alc861vd_dac_nids,
15067 .dig_out_nid = ALC861VD_DIGOUT_NID,
15068 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15069 .channel_mode = alc861vd_3stack_2ch_modes,
15070 .input_mux = &alc861vd_hp_capture_source,
15071 .unsol_event = alc_automute_amp_unsol_event,
15072 .setup = alc861vd_dallas_setup,
15073 .init_hook = alc_automute_amp,
15075 [ALC660VD_ASUS_V1S] = {
15076 .mixers = { alc861vd_lenovo_mixer },
15077 .init_verbs = { alc861vd_volume_init_verbs,
15078 alc861vd_3stack_init_verbs,
15079 alc861vd_eapd_verbs,
15080 alc861vd_lenovo_unsol_verbs },
15081 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15082 .dac_nids = alc660vd_dac_nids,
15083 .dig_out_nid = ALC861VD_DIGOUT_NID,
15084 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15085 .channel_mode = alc861vd_3stack_2ch_modes,
15086 .input_mux = &alc861vd_capture_source,
15087 .unsol_event = alc861vd_lenovo_unsol_event,
15088 .setup = alc861vd_lenovo_setup,
15089 .init_hook = alc861vd_lenovo_init_hook,
15094 * BIOS auto configuration
15096 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15097 const struct auto_pin_cfg *cfg)
15099 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15103 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15104 hda_nid_t nid, int pin_type, int dac_idx)
15106 alc_set_pin_output(codec, nid, pin_type);
15109 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15111 struct alc_spec *spec = codec->spec;
15114 for (i = 0; i <= HDA_SIDE; i++) {
15115 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15116 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15118 alc861vd_auto_set_output_and_unmute(codec, nid,
15124 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15126 struct alc_spec *spec = codec->spec;
15129 pin = spec->autocfg.hp_pins[0];
15130 if (pin) /* connect to front and use dac 0 */
15131 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15132 pin = spec->autocfg.speaker_pins[0];
15134 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15137 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15139 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15141 struct alc_spec *spec = codec->spec;
15144 for (i = 0; i < AUTO_PIN_LAST; i++) {
15145 hda_nid_t nid = spec->autocfg.input_pins[i];
15146 if (alc_is_input_pin(codec, nid)) {
15147 alc_set_input_pin(codec, nid, i);
15148 if (nid != ALC861VD_PIN_CD_NID &&
15149 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15150 snd_hda_codec_write(codec, nid, 0,
15151 AC_VERB_SET_AMP_GAIN_MUTE,
15157 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15159 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15160 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15162 /* add playback controls from the parsed DAC table */
15163 /* Based on ALC880 version. But ALC861VD has separate,
15164 * different NIDs for mute/unmute switch and volume control */
15165 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15166 const struct auto_pin_cfg *cfg)
15169 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15170 hda_nid_t nid_v, nid_s;
15173 for (i = 0; i < cfg->line_outs; i++) {
15174 if (!spec->multiout.dac_nids[i])
15176 nid_v = alc861vd_idx_to_mixer_vol(
15178 spec->multiout.dac_nids[i]));
15179 nid_s = alc861vd_idx_to_mixer_switch(
15181 spec->multiout.dac_nids[i]));
15185 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15186 "Center Playback Volume",
15187 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15191 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15192 "LFE Playback Volume",
15193 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15197 err = add_control(spec, ALC_CTL_BIND_MUTE,
15198 "Center Playback Switch",
15199 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15203 err = add_control(spec, ALC_CTL_BIND_MUTE,
15204 "LFE Playback Switch",
15205 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15210 sprintf(name, "%s Playback Volume", chname[i]);
15211 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15212 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15216 sprintf(name, "%s Playback Switch", chname[i]);
15217 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15218 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15227 /* add playback controls for speaker and HP outputs */
15228 /* Based on ALC880 version. But ALC861VD has separate,
15229 * different NIDs for mute/unmute switch and volume control */
15230 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15231 hda_nid_t pin, const char *pfx)
15233 hda_nid_t nid_v, nid_s;
15240 if (alc880_is_fixed_pin(pin)) {
15241 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15242 /* specify the DAC as the extra output */
15243 if (!spec->multiout.hp_nid)
15244 spec->multiout.hp_nid = nid_v;
15246 spec->multiout.extra_out_nid[0] = nid_v;
15247 /* control HP volume/switch on the output mixer amp */
15248 nid_v = alc861vd_idx_to_mixer_vol(
15249 alc880_fixed_pin_idx(pin));
15250 nid_s = alc861vd_idx_to_mixer_switch(
15251 alc880_fixed_pin_idx(pin));
15253 sprintf(name, "%s Playback Volume", pfx);
15254 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15255 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15258 sprintf(name, "%s Playback Switch", pfx);
15259 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15260 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15263 } else if (alc880_is_multi_pin(pin)) {
15264 /* set manual connection */
15265 /* we have only a switch on HP-out PIN */
15266 sprintf(name, "%s Playback Switch", pfx);
15267 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15268 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15275 /* parse the BIOS configuration and set up the alc_spec
15276 * return 1 if successful, 0 if the proper config is not found,
15277 * or a negative error code
15278 * Based on ALC880 version - had to change it to override
15279 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15280 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15282 struct alc_spec *spec = codec->spec;
15284 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15286 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15290 if (!spec->autocfg.line_outs)
15291 return 0; /* can't find valid BIOS pin config */
15293 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15296 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15299 err = alc861vd_auto_create_extra_out(spec,
15300 spec->autocfg.speaker_pins[0],
15304 err = alc861vd_auto_create_extra_out(spec,
15305 spec->autocfg.hp_pins[0],
15309 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15313 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15315 if (spec->autocfg.dig_outs)
15316 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15318 if (spec->kctls.list)
15319 add_mixer(spec, spec->kctls.list);
15321 add_verb(spec, alc861vd_volume_init_verbs);
15323 spec->num_mux_defs = 1;
15324 spec->input_mux = &spec->private_imux[0];
15326 err = alc_auto_add_mic_boost(codec);
15330 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15335 /* additional initialization for auto-configuration model */
15336 static void alc861vd_auto_init(struct hda_codec *codec)
15338 struct alc_spec *spec = codec->spec;
15339 alc861vd_auto_init_multi_out(codec);
15340 alc861vd_auto_init_hp_out(codec);
15341 alc861vd_auto_init_analog_input(codec);
15342 alc861vd_auto_init_input_src(codec);
15343 if (spec->unsol_event)
15344 alc_inithook(codec);
15347 static int patch_alc861vd(struct hda_codec *codec)
15349 struct alc_spec *spec;
15350 int err, board_config;
15352 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15356 codec->spec = spec;
15358 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15362 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15363 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15365 board_config = ALC861VD_AUTO;
15368 if (board_config == ALC861VD_AUTO) {
15369 /* automatic parse from the BIOS config */
15370 err = alc861vd_parse_auto_config(codec);
15376 "hda_codec: Cannot set up configuration "
15377 "from BIOS. Using base mode...\n");
15378 board_config = ALC861VD_3ST;
15382 err = snd_hda_attach_beep_device(codec, 0x23);
15388 if (board_config != ALC861VD_AUTO)
15389 setup_preset(codec, &alc861vd_presets[board_config]);
15391 if (codec->vendor_id == 0x10ec0660) {
15392 /* always turn on EAPD */
15393 add_verb(spec, alc660vd_eapd_verbs);
15396 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15397 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15399 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15400 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15402 if (!spec->adc_nids) {
15403 spec->adc_nids = alc861vd_adc_nids;
15404 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15406 if (!spec->capsrc_nids)
15407 spec->capsrc_nids = alc861vd_capsrc_nids;
15409 set_capture_mixer(codec);
15410 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15412 spec->vmaster_nid = 0x02;
15414 codec->patch_ops = alc_patch_ops;
15416 if (board_config == ALC861VD_AUTO)
15417 spec->init_hook = alc861vd_auto_init;
15418 #ifdef CONFIG_SND_HDA_POWER_SAVE
15419 if (!spec->loopback.amplist)
15420 spec->loopback.amplist = alc861vd_loopbacks;
15422 codec->proc_widget_hook = print_realtek_coef;
15430 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15431 * configuration. Each pin widget can choose any input DACs and a mixer.
15432 * Each ADC is connected from a mixer of all inputs. This makes possible
15433 * 6-channel independent captures.
15435 * In addition, an independent DAC for the multi-playback (not used in this
15438 #define ALC662_DIGOUT_NID 0x06
15439 #define ALC662_DIGIN_NID 0x0a
15441 static hda_nid_t alc662_dac_nids[4] = {
15442 /* front, rear, clfe, rear_surr */
15446 static hda_nid_t alc272_dac_nids[2] = {
15450 static hda_nid_t alc662_adc_nids[2] = {
15455 static hda_nid_t alc272_adc_nids[1] = {
15460 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15461 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15465 /* FIXME: should be a matrix-type input source selection */
15466 static struct hda_input_mux alc662_capture_source = {
15470 { "Front Mic", 0x1 },
15476 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15484 static struct hda_input_mux alc663_capture_source = {
15488 { "Front Mic", 0x1 },
15493 #if 0 /* set to 1 for testing other input sources below */
15494 static struct hda_input_mux alc272_nc10_capture_source = {
15497 { "Autoselect Mic", 0x0 },
15498 { "Internal Mic", 0x1 },
15499 { "In-0x02", 0x2 },
15500 { "In-0x03", 0x3 },
15501 { "In-0x04", 0x4 },
15502 { "In-0x05", 0x5 },
15503 { "In-0x06", 0x6 },
15504 { "In-0x07", 0x7 },
15505 { "In-0x08", 0x8 },
15506 { "In-0x09", 0x9 },
15507 { "In-0x0a", 0x0a },
15508 { "In-0x0b", 0x0b },
15509 { "In-0x0c", 0x0c },
15510 { "In-0x0d", 0x0d },
15511 { "In-0x0e", 0x0e },
15512 { "In-0x0f", 0x0f },
15520 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15527 static struct hda_verb alc662_3ST_ch2_init[] = {
15528 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15529 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15530 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15531 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15538 static struct hda_verb alc662_3ST_ch6_init[] = {
15539 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15540 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15541 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15542 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15543 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15544 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15548 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15549 { 2, alc662_3ST_ch2_init },
15550 { 6, alc662_3ST_ch6_init },
15556 static struct hda_verb alc662_sixstack_ch6_init[] = {
15557 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15558 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15559 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15566 static struct hda_verb alc662_sixstack_ch8_init[] = {
15567 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15568 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15569 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15573 static struct hda_channel_mode alc662_5stack_modes[2] = {
15574 { 2, alc662_sixstack_ch6_init },
15575 { 6, alc662_sixstack_ch8_init },
15578 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15579 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15582 static struct snd_kcontrol_new alc662_base_mixer[] = {
15583 /* output mixer control */
15584 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15585 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15586 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15587 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15588 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15589 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15590 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15591 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15592 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15594 /*Input mixer control */
15595 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15596 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15597 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15598 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15599 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15600 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15601 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15602 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15606 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15607 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15608 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15609 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15610 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15611 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15612 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15613 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15614 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15615 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15616 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15617 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15621 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15622 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15623 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15624 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15625 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15626 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15627 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15628 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15629 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15630 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15631 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15632 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15633 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15634 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15635 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15636 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15637 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15638 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15642 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15643 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15644 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15645 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15646 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15647 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15648 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15649 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15650 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15651 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15655 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15656 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15657 ALC262_HIPPO_MASTER_SWITCH,
15659 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15660 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15661 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15663 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15664 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15665 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15669 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15670 ALC262_HIPPO_MASTER_SWITCH,
15671 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15672 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15673 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15674 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15675 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15676 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15677 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15678 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15679 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15683 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15684 .ops = &snd_hda_bind_vol,
15686 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15687 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15692 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15693 .ops = &snd_hda_bind_sw,
15695 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15696 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15701 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15702 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15703 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15704 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15705 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15709 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15710 .ops = &snd_hda_bind_sw,
15712 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15713 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15714 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15719 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15720 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15721 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15722 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15723 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15724 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15725 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15730 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15731 .ops = &snd_hda_bind_sw,
15733 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15734 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15735 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15740 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15741 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15742 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15743 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15744 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15745 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15746 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15750 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15751 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15752 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15753 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15754 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15755 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15756 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15757 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15761 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15762 .ops = &snd_hda_bind_vol,
15764 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15765 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15770 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15771 .ops = &snd_hda_bind_sw,
15773 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15774 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15779 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15780 HDA_BIND_VOL("Master Playback Volume",
15781 &alc663_asus_two_bind_master_vol),
15782 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15783 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15784 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15785 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15786 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15790 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15791 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15792 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15793 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15794 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15796 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15800 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15801 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15802 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15803 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15804 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15805 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15807 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15808 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15809 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15810 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15814 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15815 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15816 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15817 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15819 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15820 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15821 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15822 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15823 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15824 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15828 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15830 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15831 .name = "Channel Mode",
15832 .info = alc_ch_mode_info,
15833 .get = alc_ch_mode_get,
15834 .put = alc_ch_mode_put,
15839 static struct hda_verb alc662_init_verbs[] = {
15840 /* ADC: mute amp left and right */
15841 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15842 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15843 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15845 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15846 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15847 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15848 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15849 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15851 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15852 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15853 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15854 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15855 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15856 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15858 /* Front Pin: output 0 (0x0c) */
15859 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15860 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15862 /* Rear Pin: output 1 (0x0d) */
15863 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15864 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15866 /* CLFE Pin: output 2 (0x0e) */
15867 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15868 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15870 /* Mic (rear) pin: input vref at 80% */
15871 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15872 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15873 /* Front Mic pin: input vref at 80% */
15874 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15875 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15876 /* Line In pin: input */
15877 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15878 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15879 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15880 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15881 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15882 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15883 /* CD pin widget for input */
15884 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15886 /* FIXME: use matrix-type input source selection */
15887 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15889 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15890 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15892 /* always trun on EAPD */
15893 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15894 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15899 static struct hda_verb alc662_sue_init_verbs[] = {
15900 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15901 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15905 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15906 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15907 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15911 /* Set Unsolicited Event*/
15912 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15913 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15914 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15919 * generic initialization of ADC, input mixers and output mixers
15921 static struct hda_verb alc662_auto_init_verbs[] = {
15923 * Unmute ADC and set the default input to mic-in
15925 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15926 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15928 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15930 * Note: PASD motherboards uses the Line In 2 as the input for front
15931 * panel mic (mic 2)
15933 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15936 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15937 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15938 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15941 * Set up output mixers (0x0c - 0x0f)
15943 /* set vol=0 to output mixers */
15944 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15945 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15946 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15948 /* set up input amps for analog loopback */
15949 /* Amp Indices: DAC = 0, mixer = 1 */
15950 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15951 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15952 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15953 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15954 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15955 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15958 /* FIXME: use matrix-type input source selection */
15959 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15961 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15962 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15966 /* additional verbs for ALC663 */
15967 static struct hda_verb alc663_auto_init_verbs[] = {
15968 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15969 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15973 static struct hda_verb alc663_m51va_init_verbs[] = {
15974 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15975 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15976 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15977 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15978 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15979 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15980 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15981 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15982 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15986 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15987 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15988 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15989 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15990 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15991 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15992 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15993 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15997 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15998 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15999 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16000 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16001 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16002 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16003 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16004 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16005 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16009 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16011 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16012 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16013 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16014 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16015 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16016 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16020 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16021 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16022 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16023 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16024 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16025 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16026 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16027 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16028 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16029 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16030 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16031 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16032 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16036 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16037 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16038 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16039 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16040 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16041 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16042 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16043 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16044 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16045 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16046 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16047 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16048 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16052 static struct hda_verb alc663_g71v_init_verbs[] = {
16053 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16054 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16055 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16057 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16058 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16059 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16061 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16062 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16063 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16067 static struct hda_verb alc663_g50v_init_verbs[] = {
16068 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16069 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16070 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16072 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16073 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16077 static struct hda_verb alc662_ecs_init_verbs[] = {
16078 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16080 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16081 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16085 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16086 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16087 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16088 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16089 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16090 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16091 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16092 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16093 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16094 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16095 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16096 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16100 static struct hda_verb alc272_dell_init_verbs[] = {
16101 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16102 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16103 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16104 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16105 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16106 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16107 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16108 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16109 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16110 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16111 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16115 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16116 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16117 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16121 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16122 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16123 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16127 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16129 unsigned int present;
16130 unsigned char bits;
16132 present = snd_hda_codec_read(codec, 0x14, 0,
16133 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16134 bits = present ? HDA_AMP_MUTE : 0;
16135 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16136 HDA_AMP_MUTE, bits);
16139 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16141 unsigned int present;
16142 unsigned char bits;
16144 present = snd_hda_codec_read(codec, 0x1b, 0,
16145 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16146 bits = present ? HDA_AMP_MUTE : 0;
16147 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16148 HDA_AMP_MUTE, bits);
16149 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16150 HDA_AMP_MUTE, bits);
16153 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16156 if ((res >> 26) == ALC880_HP_EVENT)
16157 alc662_lenovo_101e_all_automute(codec);
16158 if ((res >> 26) == ALC880_FRONT_EVENT)
16159 alc662_lenovo_101e_ispeaker_automute(codec);
16162 /* unsolicited event for HP jack sensing */
16163 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16166 if ((res >> 26) == ALC880_MIC_EVENT)
16167 alc_mic_automute(codec);
16169 alc262_hippo_unsol_event(codec, res);
16172 static void alc662_eeepc_setup(struct hda_codec *codec)
16174 struct alc_spec *spec = codec->spec;
16176 alc262_hippo1_setup(codec);
16177 spec->ext_mic.pin = 0x18;
16178 spec->ext_mic.mux_idx = 0;
16179 spec->int_mic.pin = 0x19;
16180 spec->int_mic.mux_idx = 1;
16181 spec->auto_mic = 1;
16184 static void alc662_eeepc_inithook(struct hda_codec *codec)
16186 alc262_hippo_automute(codec);
16187 alc_mic_automute(codec);
16190 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16192 struct alc_spec *spec = codec->spec;
16194 spec->autocfg.hp_pins[0] = 0x14;
16195 spec->autocfg.speaker_pins[0] = 0x1b;
16198 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16200 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16202 unsigned int present;
16203 unsigned char bits;
16205 present = snd_hda_codec_read(codec, 0x21, 0,
16206 AC_VERB_GET_PIN_SENSE, 0)
16207 & AC_PINSENSE_PRESENCE;
16208 bits = present ? HDA_AMP_MUTE : 0;
16209 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16210 AMP_IN_MUTE(0), bits);
16211 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16212 AMP_IN_MUTE(0), bits);
16215 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16217 unsigned int present;
16218 unsigned char bits;
16220 present = snd_hda_codec_read(codec, 0x21, 0,
16221 AC_VERB_GET_PIN_SENSE, 0)
16222 & AC_PINSENSE_PRESENCE;
16223 bits = present ? HDA_AMP_MUTE : 0;
16224 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16225 AMP_IN_MUTE(0), bits);
16226 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16227 AMP_IN_MUTE(0), bits);
16228 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16229 AMP_IN_MUTE(0), bits);
16230 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16231 AMP_IN_MUTE(0), bits);
16234 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16236 unsigned int present;
16237 unsigned char bits;
16239 present = snd_hda_codec_read(codec, 0x15, 0,
16240 AC_VERB_GET_PIN_SENSE, 0)
16241 & AC_PINSENSE_PRESENCE;
16242 bits = present ? HDA_AMP_MUTE : 0;
16243 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16244 AMP_IN_MUTE(0), bits);
16245 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16246 AMP_IN_MUTE(0), bits);
16247 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16248 AMP_IN_MUTE(0), bits);
16249 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16250 AMP_IN_MUTE(0), bits);
16253 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16255 unsigned int present;
16256 unsigned char bits;
16258 present = snd_hda_codec_read(codec, 0x1b, 0,
16259 AC_VERB_GET_PIN_SENSE, 0)
16260 & AC_PINSENSE_PRESENCE;
16261 bits = present ? 0 : PIN_OUT;
16262 snd_hda_codec_write(codec, 0x14, 0,
16263 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16266 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16268 unsigned int present1, present2;
16270 present1 = snd_hda_codec_read(codec, 0x21, 0,
16271 AC_VERB_GET_PIN_SENSE, 0)
16272 & AC_PINSENSE_PRESENCE;
16273 present2 = snd_hda_codec_read(codec, 0x15, 0,
16274 AC_VERB_GET_PIN_SENSE, 0)
16275 & AC_PINSENSE_PRESENCE;
16277 if (present1 || present2) {
16278 snd_hda_codec_write_cache(codec, 0x14, 0,
16279 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16281 snd_hda_codec_write_cache(codec, 0x14, 0,
16282 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16286 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16288 unsigned int present1, present2;
16290 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16291 AC_VERB_GET_PIN_SENSE, 0)
16292 & AC_PINSENSE_PRESENCE;
16293 present2 = snd_hda_codec_read(codec, 0x15, 0,
16294 AC_VERB_GET_PIN_SENSE, 0)
16295 & AC_PINSENSE_PRESENCE;
16297 if (present1 || present2) {
16298 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16299 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16300 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16301 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16303 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16304 AMP_IN_MUTE(0), 0);
16305 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16306 AMP_IN_MUTE(0), 0);
16310 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16313 switch (res >> 26) {
16314 case ALC880_HP_EVENT:
16315 alc663_m51va_speaker_automute(codec);
16317 case ALC880_MIC_EVENT:
16318 alc_mic_automute(codec);
16323 static void alc663_m51va_setup(struct hda_codec *codec)
16325 struct alc_spec *spec = codec->spec;
16326 spec->ext_mic.pin = 0x18;
16327 spec->ext_mic.mux_idx = 0;
16328 spec->int_mic.pin = 0x12;
16329 spec->int_mic.mux_idx = 1;
16330 spec->auto_mic = 1;
16333 static void alc663_m51va_inithook(struct hda_codec *codec)
16335 alc663_m51va_speaker_automute(codec);
16336 alc_mic_automute(codec);
16339 /* ***************** Mode1 ******************************/
16340 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16341 #define alc663_mode1_setup alc663_m51va_setup
16342 #define alc663_mode1_inithook alc663_m51va_inithook
16344 /* ***************** Mode2 ******************************/
16345 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16348 switch (res >> 26) {
16349 case ALC880_HP_EVENT:
16350 alc662_f5z_speaker_automute(codec);
16352 case ALC880_MIC_EVENT:
16353 alc_mic_automute(codec);
16358 #define alc662_mode2_setup alc663_m51va_setup
16360 static void alc662_mode2_inithook(struct hda_codec *codec)
16362 alc662_f5z_speaker_automute(codec);
16363 alc_mic_automute(codec);
16365 /* ***************** Mode3 ******************************/
16366 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16369 switch (res >> 26) {
16370 case ALC880_HP_EVENT:
16371 alc663_two_hp_m1_speaker_automute(codec);
16373 case ALC880_MIC_EVENT:
16374 alc_mic_automute(codec);
16379 #define alc663_mode3_setup alc663_m51va_setup
16381 static void alc663_mode3_inithook(struct hda_codec *codec)
16383 alc663_two_hp_m1_speaker_automute(codec);
16384 alc_mic_automute(codec);
16386 /* ***************** Mode4 ******************************/
16387 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16390 switch (res >> 26) {
16391 case ALC880_HP_EVENT:
16392 alc663_21jd_two_speaker_automute(codec);
16394 case ALC880_MIC_EVENT:
16395 alc_mic_automute(codec);
16400 #define alc663_mode4_setup alc663_m51va_setup
16402 static void alc663_mode4_inithook(struct hda_codec *codec)
16404 alc663_21jd_two_speaker_automute(codec);
16405 alc_mic_automute(codec);
16407 /* ***************** Mode5 ******************************/
16408 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16411 switch (res >> 26) {
16412 case ALC880_HP_EVENT:
16413 alc663_15jd_two_speaker_automute(codec);
16415 case ALC880_MIC_EVENT:
16416 alc_mic_automute(codec);
16421 #define alc663_mode5_setup alc663_m51va_setup
16423 static void alc663_mode5_inithook(struct hda_codec *codec)
16425 alc663_15jd_two_speaker_automute(codec);
16426 alc_mic_automute(codec);
16428 /* ***************** Mode6 ******************************/
16429 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16432 switch (res >> 26) {
16433 case ALC880_HP_EVENT:
16434 alc663_two_hp_m2_speaker_automute(codec);
16436 case ALC880_MIC_EVENT:
16437 alc_mic_automute(codec);
16442 #define alc663_mode6_setup alc663_m51va_setup
16444 static void alc663_mode6_inithook(struct hda_codec *codec)
16446 alc663_two_hp_m2_speaker_automute(codec);
16447 alc_mic_automute(codec);
16450 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16452 unsigned int present;
16453 unsigned char bits;
16455 present = snd_hda_codec_read(codec, 0x21, 0,
16456 AC_VERB_GET_PIN_SENSE, 0)
16457 & AC_PINSENSE_PRESENCE;
16458 bits = present ? HDA_AMP_MUTE : 0;
16459 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16460 HDA_AMP_MUTE, bits);
16461 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16462 HDA_AMP_MUTE, bits);
16465 static void alc663_g71v_front_automute(struct hda_codec *codec)
16467 unsigned int present;
16468 unsigned char bits;
16470 present = snd_hda_codec_read(codec, 0x15, 0,
16471 AC_VERB_GET_PIN_SENSE, 0)
16472 & AC_PINSENSE_PRESENCE;
16473 bits = present ? HDA_AMP_MUTE : 0;
16474 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16475 HDA_AMP_MUTE, bits);
16478 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16481 switch (res >> 26) {
16482 case ALC880_HP_EVENT:
16483 alc663_g71v_hp_automute(codec);
16485 case ALC880_FRONT_EVENT:
16486 alc663_g71v_front_automute(codec);
16488 case ALC880_MIC_EVENT:
16489 alc_mic_automute(codec);
16494 #define alc663_g71v_setup alc663_m51va_setup
16496 static void alc663_g71v_inithook(struct hda_codec *codec)
16498 alc663_g71v_front_automute(codec);
16499 alc663_g71v_hp_automute(codec);
16500 alc_mic_automute(codec);
16503 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16506 switch (res >> 26) {
16507 case ALC880_HP_EVENT:
16508 alc663_m51va_speaker_automute(codec);
16510 case ALC880_MIC_EVENT:
16511 alc_mic_automute(codec);
16516 #define alc663_g50v_setup alc663_m51va_setup
16518 static void alc663_g50v_inithook(struct hda_codec *codec)
16520 alc663_m51va_speaker_automute(codec);
16521 alc_mic_automute(codec);
16524 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16525 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16526 ALC262_HIPPO_MASTER_SWITCH,
16528 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16529 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16530 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16532 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16533 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16534 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16538 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16539 /* Master Playback automatically created from Speaker and Headphone */
16540 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16541 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16542 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16543 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16545 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16546 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16547 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16549 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16550 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16551 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16555 #ifdef CONFIG_SND_HDA_POWER_SAVE
16556 #define alc662_loopbacks alc880_loopbacks
16560 /* pcm configuration: identical with ALC880 */
16561 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16562 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16563 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16564 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16567 * configuration and preset
16569 static const char *alc662_models[ALC662_MODEL_LAST] = {
16570 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16571 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16572 [ALC662_3ST_6ch] = "3stack-6ch",
16573 [ALC662_5ST_DIG] = "6stack-dig",
16574 [ALC662_LENOVO_101E] = "lenovo-101e",
16575 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16576 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16577 [ALC662_ECS] = "ecs",
16578 [ALC663_ASUS_M51VA] = "m51va",
16579 [ALC663_ASUS_G71V] = "g71v",
16580 [ALC663_ASUS_H13] = "h13",
16581 [ALC663_ASUS_G50V] = "g50v",
16582 [ALC663_ASUS_MODE1] = "asus-mode1",
16583 [ALC662_ASUS_MODE2] = "asus-mode2",
16584 [ALC663_ASUS_MODE3] = "asus-mode3",
16585 [ALC663_ASUS_MODE4] = "asus-mode4",
16586 [ALC663_ASUS_MODE5] = "asus-mode5",
16587 [ALC663_ASUS_MODE6] = "asus-mode6",
16588 [ALC272_DELL] = "dell",
16589 [ALC272_DELL_ZM1] = "dell-zm1",
16590 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16591 [ALC662_AUTO] = "auto",
16594 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16595 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16596 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16597 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16598 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16599 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16600 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16601 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16602 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16603 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16604 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16605 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16606 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16607 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16608 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16609 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16610 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16611 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16612 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16613 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16614 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16615 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16616 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16617 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16618 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16619 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16620 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16621 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16622 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16623 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16624 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16625 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16626 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16627 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16628 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16629 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16630 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16631 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16632 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16633 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16634 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16635 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16636 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16637 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16638 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16639 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16640 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16641 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16642 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16643 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16644 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16645 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16646 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16647 ALC662_3ST_6ch_DIG),
16648 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16649 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16650 ALC662_3ST_6ch_DIG),
16651 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16652 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16653 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16654 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16655 ALC662_3ST_6ch_DIG),
16656 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16661 static struct alc_config_preset alc662_presets[] = {
16662 [ALC662_3ST_2ch_DIG] = {
16663 .mixers = { alc662_3ST_2ch_mixer },
16664 .init_verbs = { alc662_init_verbs },
16665 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16666 .dac_nids = alc662_dac_nids,
16667 .dig_out_nid = ALC662_DIGOUT_NID,
16668 .dig_in_nid = ALC662_DIGIN_NID,
16669 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16670 .channel_mode = alc662_3ST_2ch_modes,
16671 .input_mux = &alc662_capture_source,
16673 [ALC662_3ST_6ch_DIG] = {
16674 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16675 .init_verbs = { alc662_init_verbs },
16676 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16677 .dac_nids = alc662_dac_nids,
16678 .dig_out_nid = ALC662_DIGOUT_NID,
16679 .dig_in_nid = ALC662_DIGIN_NID,
16680 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16681 .channel_mode = alc662_3ST_6ch_modes,
16683 .input_mux = &alc662_capture_source,
16685 [ALC662_3ST_6ch] = {
16686 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16687 .init_verbs = { alc662_init_verbs },
16688 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16689 .dac_nids = alc662_dac_nids,
16690 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16691 .channel_mode = alc662_3ST_6ch_modes,
16693 .input_mux = &alc662_capture_source,
16695 [ALC662_5ST_DIG] = {
16696 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16697 .init_verbs = { alc662_init_verbs },
16698 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16699 .dac_nids = alc662_dac_nids,
16700 .dig_out_nid = ALC662_DIGOUT_NID,
16701 .dig_in_nid = ALC662_DIGIN_NID,
16702 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16703 .channel_mode = alc662_5stack_modes,
16704 .input_mux = &alc662_capture_source,
16706 [ALC662_LENOVO_101E] = {
16707 .mixers = { alc662_lenovo_101e_mixer },
16708 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16709 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16710 .dac_nids = alc662_dac_nids,
16711 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16712 .channel_mode = alc662_3ST_2ch_modes,
16713 .input_mux = &alc662_lenovo_101e_capture_source,
16714 .unsol_event = alc662_lenovo_101e_unsol_event,
16715 .init_hook = alc662_lenovo_101e_all_automute,
16717 [ALC662_ASUS_EEEPC_P701] = {
16718 .mixers = { alc662_eeepc_p701_mixer },
16719 .init_verbs = { alc662_init_verbs,
16720 alc662_eeepc_sue_init_verbs },
16721 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16722 .dac_nids = alc662_dac_nids,
16723 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16724 .channel_mode = alc662_3ST_2ch_modes,
16725 .unsol_event = alc662_eeepc_unsol_event,
16726 .setup = alc662_eeepc_setup,
16727 .init_hook = alc662_eeepc_inithook,
16729 [ALC662_ASUS_EEEPC_EP20] = {
16730 .mixers = { alc662_eeepc_ep20_mixer,
16731 alc662_chmode_mixer },
16732 .init_verbs = { alc662_init_verbs,
16733 alc662_eeepc_ep20_sue_init_verbs },
16734 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16735 .dac_nids = alc662_dac_nids,
16736 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16737 .channel_mode = alc662_3ST_6ch_modes,
16738 .input_mux = &alc662_lenovo_101e_capture_source,
16739 .unsol_event = alc662_eeepc_unsol_event,
16740 .setup = alc662_eeepc_ep20_setup,
16741 .init_hook = alc662_eeepc_ep20_inithook,
16744 .mixers = { alc662_ecs_mixer },
16745 .init_verbs = { alc662_init_verbs,
16746 alc662_ecs_init_verbs },
16747 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16748 .dac_nids = alc662_dac_nids,
16749 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16750 .channel_mode = alc662_3ST_2ch_modes,
16751 .unsol_event = alc662_eeepc_unsol_event,
16752 .setup = alc662_eeepc_setup,
16753 .init_hook = alc662_eeepc_inithook,
16755 [ALC663_ASUS_M51VA] = {
16756 .mixers = { alc663_m51va_mixer },
16757 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16758 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16759 .dac_nids = alc662_dac_nids,
16760 .dig_out_nid = ALC662_DIGOUT_NID,
16761 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16762 .channel_mode = alc662_3ST_2ch_modes,
16763 .unsol_event = alc663_m51va_unsol_event,
16764 .setup = alc663_m51va_setup,
16765 .init_hook = alc663_m51va_inithook,
16767 [ALC663_ASUS_G71V] = {
16768 .mixers = { alc663_g71v_mixer },
16769 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16770 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16771 .dac_nids = alc662_dac_nids,
16772 .dig_out_nid = ALC662_DIGOUT_NID,
16773 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16774 .channel_mode = alc662_3ST_2ch_modes,
16775 .unsol_event = alc663_g71v_unsol_event,
16776 .setup = alc663_g71v_setup,
16777 .init_hook = alc663_g71v_inithook,
16779 [ALC663_ASUS_H13] = {
16780 .mixers = { alc663_m51va_mixer },
16781 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16782 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16783 .dac_nids = alc662_dac_nids,
16784 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16785 .channel_mode = alc662_3ST_2ch_modes,
16786 .unsol_event = alc663_m51va_unsol_event,
16787 .init_hook = alc663_m51va_inithook,
16789 [ALC663_ASUS_G50V] = {
16790 .mixers = { alc663_g50v_mixer },
16791 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16792 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16793 .dac_nids = alc662_dac_nids,
16794 .dig_out_nid = ALC662_DIGOUT_NID,
16795 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16796 .channel_mode = alc662_3ST_6ch_modes,
16797 .input_mux = &alc663_capture_source,
16798 .unsol_event = alc663_g50v_unsol_event,
16799 .setup = alc663_g50v_setup,
16800 .init_hook = alc663_g50v_inithook,
16802 [ALC663_ASUS_MODE1] = {
16803 .mixers = { alc663_m51va_mixer },
16804 .cap_mixer = alc662_auto_capture_mixer,
16805 .init_verbs = { alc662_init_verbs,
16806 alc663_21jd_amic_init_verbs },
16807 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16809 .dac_nids = alc662_dac_nids,
16810 .dig_out_nid = ALC662_DIGOUT_NID,
16811 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16812 .channel_mode = alc662_3ST_2ch_modes,
16813 .unsol_event = alc663_mode1_unsol_event,
16814 .setup = alc663_mode1_setup,
16815 .init_hook = alc663_mode1_inithook,
16817 [ALC662_ASUS_MODE2] = {
16818 .mixers = { alc662_1bjd_mixer },
16819 .cap_mixer = alc662_auto_capture_mixer,
16820 .init_verbs = { alc662_init_verbs,
16821 alc662_1bjd_amic_init_verbs },
16822 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16823 .dac_nids = alc662_dac_nids,
16824 .dig_out_nid = ALC662_DIGOUT_NID,
16825 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16826 .channel_mode = alc662_3ST_2ch_modes,
16827 .unsol_event = alc662_mode2_unsol_event,
16828 .setup = alc662_mode2_setup,
16829 .init_hook = alc662_mode2_inithook,
16831 [ALC663_ASUS_MODE3] = {
16832 .mixers = { alc663_two_hp_m1_mixer },
16833 .cap_mixer = alc662_auto_capture_mixer,
16834 .init_verbs = { alc662_init_verbs,
16835 alc663_two_hp_amic_m1_init_verbs },
16836 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16838 .dac_nids = alc662_dac_nids,
16839 .dig_out_nid = ALC662_DIGOUT_NID,
16840 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16841 .channel_mode = alc662_3ST_2ch_modes,
16842 .unsol_event = alc663_mode3_unsol_event,
16843 .setup = alc663_mode3_setup,
16844 .init_hook = alc663_mode3_inithook,
16846 [ALC663_ASUS_MODE4] = {
16847 .mixers = { alc663_asus_21jd_clfe_mixer },
16848 .cap_mixer = alc662_auto_capture_mixer,
16849 .init_verbs = { alc662_init_verbs,
16850 alc663_21jd_amic_init_verbs},
16851 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16853 .dac_nids = alc662_dac_nids,
16854 .dig_out_nid = ALC662_DIGOUT_NID,
16855 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16856 .channel_mode = alc662_3ST_2ch_modes,
16857 .unsol_event = alc663_mode4_unsol_event,
16858 .setup = alc663_mode4_setup,
16859 .init_hook = alc663_mode4_inithook,
16861 [ALC663_ASUS_MODE5] = {
16862 .mixers = { alc663_asus_15jd_clfe_mixer },
16863 .cap_mixer = alc662_auto_capture_mixer,
16864 .init_verbs = { alc662_init_verbs,
16865 alc663_15jd_amic_init_verbs },
16866 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16868 .dac_nids = alc662_dac_nids,
16869 .dig_out_nid = ALC662_DIGOUT_NID,
16870 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16871 .channel_mode = alc662_3ST_2ch_modes,
16872 .unsol_event = alc663_mode5_unsol_event,
16873 .setup = alc663_mode5_setup,
16874 .init_hook = alc663_mode5_inithook,
16876 [ALC663_ASUS_MODE6] = {
16877 .mixers = { alc663_two_hp_m2_mixer },
16878 .cap_mixer = alc662_auto_capture_mixer,
16879 .init_verbs = { alc662_init_verbs,
16880 alc663_two_hp_amic_m2_init_verbs },
16881 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16883 .dac_nids = alc662_dac_nids,
16884 .dig_out_nid = ALC662_DIGOUT_NID,
16885 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16886 .channel_mode = alc662_3ST_2ch_modes,
16887 .unsol_event = alc663_mode6_unsol_event,
16888 .setup = alc663_mode6_setup,
16889 .init_hook = alc663_mode6_inithook,
16892 .mixers = { alc663_m51va_mixer },
16893 .cap_mixer = alc272_auto_capture_mixer,
16894 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16895 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16896 .dac_nids = alc662_dac_nids,
16897 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16898 .adc_nids = alc272_adc_nids,
16899 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16900 .capsrc_nids = alc272_capsrc_nids,
16901 .channel_mode = alc662_3ST_2ch_modes,
16902 .unsol_event = alc663_m51va_unsol_event,
16903 .setup = alc663_m51va_setup,
16904 .init_hook = alc663_m51va_inithook,
16906 [ALC272_DELL_ZM1] = {
16907 .mixers = { alc663_m51va_mixer },
16908 .cap_mixer = alc662_auto_capture_mixer,
16909 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16910 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16911 .dac_nids = alc662_dac_nids,
16912 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16913 .adc_nids = alc662_adc_nids,
16915 .capsrc_nids = alc662_capsrc_nids,
16916 .channel_mode = alc662_3ST_2ch_modes,
16917 .unsol_event = alc663_m51va_unsol_event,
16918 .setup = alc663_m51va_setup,
16919 .init_hook = alc663_m51va_inithook,
16921 [ALC272_SAMSUNG_NC10] = {
16922 .mixers = { alc272_nc10_mixer },
16923 .init_verbs = { alc662_init_verbs,
16924 alc663_21jd_amic_init_verbs },
16925 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16926 .dac_nids = alc272_dac_nids,
16927 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16928 .channel_mode = alc662_3ST_2ch_modes,
16929 /*.input_mux = &alc272_nc10_capture_source,*/
16930 .unsol_event = alc663_mode4_unsol_event,
16931 .setup = alc663_mode4_setup,
16932 .init_hook = alc663_mode4_inithook,
16938 * BIOS auto configuration
16941 /* add playback controls from the parsed DAC table */
16942 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16943 const struct auto_pin_cfg *cfg)
16946 static const char *chname[4] = {
16947 "Front", "Surround", NULL /*CLFE*/, "Side"
16952 for (i = 0; i < cfg->line_outs; i++) {
16953 if (!spec->multiout.dac_nids[i])
16955 nid = alc880_idx_to_dac(i);
16958 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16959 "Center Playback Volume",
16960 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16964 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16965 "LFE Playback Volume",
16966 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16970 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16971 "Center Playback Switch",
16972 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16976 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16977 "LFE Playback Switch",
16978 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16983 sprintf(name, "%s Playback Volume", chname[i]);
16984 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16985 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16989 sprintf(name, "%s Playback Switch", chname[i]);
16990 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16991 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
17000 /* add playback controls for speaker and HP outputs */
17001 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17012 /* ALC663 has a mono output pin on 0x17 */
17013 sprintf(name, "%s Playback Switch", pfx);
17014 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17015 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17019 if (alc880_is_fixed_pin(pin)) {
17020 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17021 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17022 /* specify the DAC as the extra output */
17023 if (!spec->multiout.hp_nid)
17024 spec->multiout.hp_nid = nid;
17026 spec->multiout.extra_out_nid[0] = nid;
17027 /* control HP volume/switch on the output mixer amp */
17028 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17029 sprintf(name, "%s Playback Volume", pfx);
17030 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17031 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17034 sprintf(name, "%s Playback Switch", pfx);
17035 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17036 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17039 } else if (alc880_is_multi_pin(pin)) {
17040 /* set manual connection */
17041 /* we have only a switch on HP-out PIN */
17042 sprintf(name, "%s Playback Switch", pfx);
17043 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17044 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17051 /* create playback/capture controls for input pins */
17052 #define alc662_auto_create_input_ctls \
17053 alc880_auto_create_input_ctls
17055 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17056 hda_nid_t nid, int pin_type,
17059 alc_set_pin_output(codec, nid, pin_type);
17060 /* need the manual connection? */
17061 if (alc880_is_multi_pin(nid)) {
17062 struct alc_spec *spec = codec->spec;
17063 int idx = alc880_multi_pin_idx(nid);
17064 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17065 AC_VERB_SET_CONNECT_SEL,
17066 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17070 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17072 struct alc_spec *spec = codec->spec;
17075 for (i = 0; i <= HDA_SIDE; i++) {
17076 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17077 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17079 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17084 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17086 struct alc_spec *spec = codec->spec;
17089 pin = spec->autocfg.hp_pins[0];
17090 if (pin) /* connect to front */
17092 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17093 pin = spec->autocfg.speaker_pins[0];
17095 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17098 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17100 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17102 struct alc_spec *spec = codec->spec;
17105 for (i = 0; i < AUTO_PIN_LAST; i++) {
17106 hda_nid_t nid = spec->autocfg.input_pins[i];
17107 if (alc_is_input_pin(codec, nid)) {
17108 alc_set_input_pin(codec, nid, i);
17109 if (nid != ALC662_PIN_CD_NID &&
17110 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17111 snd_hda_codec_write(codec, nid, 0,
17112 AC_VERB_SET_AMP_GAIN_MUTE,
17118 #define alc662_auto_init_input_src alc882_auto_init_input_src
17120 static int alc662_parse_auto_config(struct hda_codec *codec)
17122 struct alc_spec *spec = codec->spec;
17124 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17126 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17130 if (!spec->autocfg.line_outs)
17131 return 0; /* can't find valid BIOS pin config */
17133 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17136 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17139 err = alc662_auto_create_extra_out(spec,
17140 spec->autocfg.speaker_pins[0],
17144 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17148 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17152 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17154 if (spec->autocfg.dig_outs)
17155 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17157 if (spec->kctls.list)
17158 add_mixer(spec, spec->kctls.list);
17160 spec->num_mux_defs = 1;
17161 spec->input_mux = &spec->private_imux[0];
17163 add_verb(spec, alc662_auto_init_verbs);
17164 if (codec->vendor_id == 0x10ec0663)
17165 add_verb(spec, alc663_auto_init_verbs);
17167 err = alc_auto_add_mic_boost(codec);
17171 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17176 /* additional initialization for auto-configuration model */
17177 static void alc662_auto_init(struct hda_codec *codec)
17179 struct alc_spec *spec = codec->spec;
17180 alc662_auto_init_multi_out(codec);
17181 alc662_auto_init_hp_out(codec);
17182 alc662_auto_init_analog_input(codec);
17183 alc662_auto_init_input_src(codec);
17184 if (spec->unsol_event)
17185 alc_inithook(codec);
17188 static int patch_alc662(struct hda_codec *codec)
17190 struct alc_spec *spec;
17191 int err, board_config;
17193 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17197 codec->spec = spec;
17199 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17201 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17204 if (board_config < 0) {
17205 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17207 board_config = ALC662_AUTO;
17210 if (board_config == ALC662_AUTO) {
17211 /* automatic parse from the BIOS config */
17212 err = alc662_parse_auto_config(codec);
17218 "hda_codec: Cannot set up configuration "
17219 "from BIOS. Using base mode...\n");
17220 board_config = ALC662_3ST_2ch_DIG;
17224 err = snd_hda_attach_beep_device(codec, 0x1);
17230 if (board_config != ALC662_AUTO)
17231 setup_preset(codec, &alc662_presets[board_config]);
17233 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17234 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17236 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17237 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17239 if (!spec->adc_nids) {
17240 spec->adc_nids = alc662_adc_nids;
17241 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17243 if (!spec->capsrc_nids)
17244 spec->capsrc_nids = alc662_capsrc_nids;
17246 if (!spec->cap_mixer)
17247 set_capture_mixer(codec);
17248 if (codec->vendor_id == 0x10ec0662)
17249 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17251 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17253 spec->vmaster_nid = 0x02;
17255 codec->patch_ops = alc_patch_ops;
17256 if (board_config == ALC662_AUTO)
17257 spec->init_hook = alc662_auto_init;
17258 #ifdef CONFIG_SND_HDA_POWER_SAVE
17259 if (!spec->loopback.amplist)
17260 spec->loopback.amplist = alc662_loopbacks;
17262 codec->proc_widget_hook = print_realtek_coef;
17270 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17271 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17272 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17273 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17274 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17275 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17276 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17277 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17278 .patch = patch_alc861 },
17279 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17280 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17281 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17282 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17283 .patch = patch_alc882 },
17284 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17285 .patch = patch_alc662 },
17286 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17287 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17288 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17289 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17290 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17291 .patch = patch_alc882 },
17292 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17293 .patch = patch_alc882 },
17294 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17295 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17296 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17297 .patch = patch_alc882 },
17298 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17299 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17300 {} /* terminator */
17303 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17305 MODULE_LICENSE("GPL");
17306 MODULE_DESCRIPTION("Realtek HD-audio codec");
17308 static struct hda_codec_preset_list realtek_list = {
17309 .preset = snd_hda_preset_realtek,
17310 .owner = THIS_MODULE,
17313 static int __init patch_realtek_init(void)
17315 return snd_hda_add_codec_preset(&realtek_list);
17318 static void __exit patch_realtek_exit(void)
17320 snd_hda_delete_codec_preset(&realtek_list);
17323 module_init(patch_realtek_init)
17324 module_exit(patch_realtek_exit)