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];
6020 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
6025 nid = cfg->speaker_pins[0];
6027 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6032 nid = cfg->hp_pins[0];
6034 err = alc260_add_playback_controls(spec, nid, "Headphone",
6042 /* create playback/capture controls for input pins */
6043 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6044 const struct auto_pin_cfg *cfg)
6046 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6049 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6050 hda_nid_t nid, int pin_type,
6053 alc_set_pin_output(codec, nid, pin_type);
6054 /* need the manual connection? */
6056 int idx = nid - 0x12;
6057 snd_hda_codec_write(codec, idx + 0x0b, 0,
6058 AC_VERB_SET_CONNECT_SEL, sel_idx);
6062 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6064 struct alc_spec *spec = codec->spec;
6067 nid = spec->autocfg.line_out_pins[0];
6069 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6070 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6073 nid = spec->autocfg.speaker_pins[0];
6075 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6077 nid = spec->autocfg.hp_pins[0];
6079 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6082 #define ALC260_PIN_CD_NID 0x16
6083 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6085 struct alc_spec *spec = codec->spec;
6088 for (i = 0; i < AUTO_PIN_LAST; i++) {
6089 hda_nid_t nid = spec->autocfg.input_pins[i];
6091 alc_set_input_pin(codec, nid, i);
6092 if (nid != ALC260_PIN_CD_NID &&
6093 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6094 snd_hda_codec_write(codec, nid, 0,
6095 AC_VERB_SET_AMP_GAIN_MUTE,
6102 * generic initialization of ADC, input mixers and output mixers
6104 static struct hda_verb alc260_volume_init_verbs[] = {
6106 * Unmute ADC0-1 and set the default input to mic-in
6108 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6109 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6110 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6111 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6113 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6115 * Note: PASD motherboards uses the Line In 2 as the input for
6116 * front panel mic (mic 2)
6118 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6119 /* mute analog inputs */
6120 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6121 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6122 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6123 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6124 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6127 * Set up output mixers (0x08 - 0x0a)
6129 /* set vol=0 to output mixers */
6130 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6131 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6132 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6133 /* set up input amps for analog loopback */
6134 /* Amp Indices: DAC = 0, mixer = 1 */
6135 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6136 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6137 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6138 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6139 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6140 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6145 static int alc260_parse_auto_config(struct hda_codec *codec)
6147 struct alc_spec *spec = codec->spec;
6149 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6151 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6155 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6158 if (!spec->kctls.list)
6159 return 0; /* can't find valid BIOS pin config */
6160 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6164 spec->multiout.max_channels = 2;
6166 if (spec->autocfg.dig_outs)
6167 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6168 if (spec->kctls.list)
6169 add_mixer(spec, spec->kctls.list);
6171 add_verb(spec, alc260_volume_init_verbs);
6173 spec->num_mux_defs = 1;
6174 spec->input_mux = &spec->private_imux[0];
6176 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6181 /* additional initialization for auto-configuration model */
6182 static void alc260_auto_init(struct hda_codec *codec)
6184 struct alc_spec *spec = codec->spec;
6185 alc260_auto_init_multi_out(codec);
6186 alc260_auto_init_analog_input(codec);
6187 if (spec->unsol_event)
6188 alc_inithook(codec);
6191 #ifdef CONFIG_SND_HDA_POWER_SAVE
6192 static struct hda_amp_list alc260_loopbacks[] = {
6193 { 0x07, HDA_INPUT, 0 },
6194 { 0x07, HDA_INPUT, 1 },
6195 { 0x07, HDA_INPUT, 2 },
6196 { 0x07, HDA_INPUT, 3 },
6197 { 0x07, HDA_INPUT, 4 },
6203 * ALC260 configurations
6205 static const char *alc260_models[ALC260_MODEL_LAST] = {
6206 [ALC260_BASIC] = "basic",
6208 [ALC260_HP_3013] = "hp-3013",
6209 [ALC260_HP_DC7600] = "hp-dc7600",
6210 [ALC260_FUJITSU_S702X] = "fujitsu",
6211 [ALC260_ACER] = "acer",
6212 [ALC260_WILL] = "will",
6213 [ALC260_REPLACER_672V] = "replacer",
6214 [ALC260_FAVORIT100] = "favorit100",
6215 #ifdef CONFIG_SND_DEBUG
6216 [ALC260_TEST] = "test",
6218 [ALC260_AUTO] = "auto",
6221 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6222 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6223 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6224 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6225 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6226 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6227 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6228 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6229 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6230 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6231 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6232 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6233 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6234 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6235 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6236 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6237 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6238 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6239 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6240 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6244 static struct alc_config_preset alc260_presets[] = {
6246 .mixers = { alc260_base_output_mixer,
6247 alc260_input_mixer },
6248 .init_verbs = { alc260_init_verbs },
6249 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6250 .dac_nids = alc260_dac_nids,
6251 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6252 .adc_nids = alc260_adc_nids,
6253 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6254 .channel_mode = alc260_modes,
6255 .input_mux = &alc260_capture_source,
6258 .mixers = { alc260_hp_output_mixer,
6259 alc260_input_mixer },
6260 .init_verbs = { alc260_init_verbs,
6261 alc260_hp_unsol_verbs },
6262 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6263 .dac_nids = alc260_dac_nids,
6264 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6265 .adc_nids = alc260_adc_nids_alt,
6266 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6267 .channel_mode = alc260_modes,
6268 .input_mux = &alc260_capture_source,
6269 .unsol_event = alc260_hp_unsol_event,
6270 .init_hook = alc260_hp_automute,
6272 [ALC260_HP_DC7600] = {
6273 .mixers = { alc260_hp_dc7600_mixer,
6274 alc260_input_mixer },
6275 .init_verbs = { alc260_init_verbs,
6276 alc260_hp_dc7600_verbs },
6277 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6278 .dac_nids = alc260_dac_nids,
6279 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6280 .adc_nids = alc260_adc_nids_alt,
6281 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6282 .channel_mode = alc260_modes,
6283 .input_mux = &alc260_capture_source,
6284 .unsol_event = alc260_hp_3012_unsol_event,
6285 .init_hook = alc260_hp_3012_automute,
6287 [ALC260_HP_3013] = {
6288 .mixers = { alc260_hp_3013_mixer,
6289 alc260_input_mixer },
6290 .init_verbs = { alc260_hp_3013_init_verbs,
6291 alc260_hp_3013_unsol_verbs },
6292 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6293 .dac_nids = alc260_dac_nids,
6294 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6295 .adc_nids = alc260_adc_nids_alt,
6296 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6297 .channel_mode = alc260_modes,
6298 .input_mux = &alc260_capture_source,
6299 .unsol_event = alc260_hp_3013_unsol_event,
6300 .init_hook = alc260_hp_3013_automute,
6302 [ALC260_FUJITSU_S702X] = {
6303 .mixers = { alc260_fujitsu_mixer },
6304 .init_verbs = { alc260_fujitsu_init_verbs },
6305 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6306 .dac_nids = alc260_dac_nids,
6307 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6308 .adc_nids = alc260_dual_adc_nids,
6309 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6310 .channel_mode = alc260_modes,
6311 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6312 .input_mux = alc260_fujitsu_capture_sources,
6315 .mixers = { alc260_acer_mixer },
6316 .init_verbs = { alc260_acer_init_verbs },
6317 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6318 .dac_nids = alc260_dac_nids,
6319 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6320 .adc_nids = alc260_dual_adc_nids,
6321 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6322 .channel_mode = alc260_modes,
6323 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6324 .input_mux = alc260_acer_capture_sources,
6326 [ALC260_FAVORIT100] = {
6327 .mixers = { alc260_favorit100_mixer },
6328 .init_verbs = { alc260_favorit100_init_verbs },
6329 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6330 .dac_nids = alc260_dac_nids,
6331 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6332 .adc_nids = alc260_dual_adc_nids,
6333 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6334 .channel_mode = alc260_modes,
6335 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6336 .input_mux = alc260_favorit100_capture_sources,
6339 .mixers = { alc260_will_mixer },
6340 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6341 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6342 .dac_nids = alc260_dac_nids,
6343 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6344 .adc_nids = alc260_adc_nids,
6345 .dig_out_nid = ALC260_DIGOUT_NID,
6346 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6347 .channel_mode = alc260_modes,
6348 .input_mux = &alc260_capture_source,
6350 [ALC260_REPLACER_672V] = {
6351 .mixers = { alc260_replacer_672v_mixer },
6352 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6353 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6354 .dac_nids = alc260_dac_nids,
6355 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6356 .adc_nids = alc260_adc_nids,
6357 .dig_out_nid = ALC260_DIGOUT_NID,
6358 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6359 .channel_mode = alc260_modes,
6360 .input_mux = &alc260_capture_source,
6361 .unsol_event = alc260_replacer_672v_unsol_event,
6362 .init_hook = alc260_replacer_672v_automute,
6364 #ifdef CONFIG_SND_DEBUG
6366 .mixers = { alc260_test_mixer },
6367 .init_verbs = { alc260_test_init_verbs },
6368 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6369 .dac_nids = alc260_test_dac_nids,
6370 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6371 .adc_nids = alc260_test_adc_nids,
6372 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6373 .channel_mode = alc260_modes,
6374 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6375 .input_mux = alc260_test_capture_sources,
6380 static int patch_alc260(struct hda_codec *codec)
6382 struct alc_spec *spec;
6383 int err, board_config;
6385 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6391 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6394 if (board_config < 0) {
6395 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6397 board_config = ALC260_AUTO;
6400 if (board_config == ALC260_AUTO) {
6401 /* automatic parse from the BIOS config */
6402 err = alc260_parse_auto_config(codec);
6408 "hda_codec: Cannot set up configuration "
6409 "from BIOS. Using base mode...\n");
6410 board_config = ALC260_BASIC;
6414 err = snd_hda_attach_beep_device(codec, 0x1);
6420 if (board_config != ALC260_AUTO)
6421 setup_preset(codec, &alc260_presets[board_config]);
6423 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6424 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6426 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6427 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6429 if (!spec->adc_nids && spec->input_mux) {
6430 /* check whether NID 0x04 is valid */
6431 unsigned int wcap = get_wcaps(codec, 0x04);
6432 wcap = get_wcaps_type(wcap);
6434 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6435 spec->adc_nids = alc260_adc_nids_alt;
6436 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6438 spec->adc_nids = alc260_adc_nids;
6439 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6442 set_capture_mixer(codec);
6443 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6445 spec->vmaster_nid = 0x08;
6447 codec->patch_ops = alc_patch_ops;
6448 if (board_config == ALC260_AUTO)
6449 spec->init_hook = alc260_auto_init;
6450 #ifdef CONFIG_SND_HDA_POWER_SAVE
6451 if (!spec->loopback.amplist)
6452 spec->loopback.amplist = alc260_loopbacks;
6454 codec->proc_widget_hook = print_realtek_coef;
6461 * ALC882/883/885/888/889 support
6463 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6464 * configuration. Each pin widget can choose any input DACs and a mixer.
6465 * Each ADC is connected from a mixer of all inputs. This makes possible
6466 * 6-channel independent captures.
6468 * In addition, an independent DAC for the multi-playback (not used in this
6471 #define ALC882_DIGOUT_NID 0x06
6472 #define ALC882_DIGIN_NID 0x0a
6473 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6474 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6475 #define ALC1200_DIGOUT_NID 0x10
6478 static struct hda_channel_mode alc882_ch_modes[1] = {
6483 static hda_nid_t alc882_dac_nids[4] = {
6484 /* front, rear, clfe, rear_surr */
6485 0x02, 0x03, 0x04, 0x05
6487 #define alc883_dac_nids alc882_dac_nids
6490 #define alc882_adc_nids alc880_adc_nids
6491 #define alc882_adc_nids_alt alc880_adc_nids_alt
6492 #define alc883_adc_nids alc882_adc_nids_alt
6493 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6494 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6495 #define alc889_adc_nids alc880_adc_nids
6497 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6498 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6499 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6500 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6501 #define alc889_capsrc_nids alc882_capsrc_nids
6504 /* FIXME: should be a matrix-type input source selection */
6506 static struct hda_input_mux alc882_capture_source = {
6510 { "Front Mic", 0x1 },
6516 #define alc883_capture_source alc882_capture_source
6518 static struct hda_input_mux alc889_capture_source = {
6521 { "Front Mic", 0x0 },
6527 static struct hda_input_mux mb5_capture_source = {
6536 static struct hda_input_mux alc883_3stack_6ch_intel = {
6540 { "Front Mic", 0x0 },
6546 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6554 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6564 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6572 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6576 { "Front Mic", 0x1 },
6581 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6589 static struct hda_input_mux alc889A_mb31_capture_source = {
6593 /* Front Mic (0x01) unused */
6595 /* Line 2 (0x03) unused */
6596 /* CD (0x04) unsused? */
6603 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6610 static struct hda_verb alc882_3ST_ch2_init[] = {
6611 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6612 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6613 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6614 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6621 static struct hda_verb alc882_3ST_ch4_init[] = {
6622 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6623 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6624 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6625 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6626 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6633 static struct hda_verb alc882_3ST_ch6_init[] = {
6634 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6635 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6636 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6637 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6638 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6639 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6643 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6644 { 2, alc882_3ST_ch2_init },
6645 { 4, alc882_3ST_ch4_init },
6646 { 6, alc882_3ST_ch6_init },
6649 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6654 static struct hda_verb alc882_sixstack_ch6_init[] = {
6655 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6656 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6657 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6658 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6665 static struct hda_verb alc882_sixstack_ch8_init[] = {
6666 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6667 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6668 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6669 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6673 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6674 { 6, alc882_sixstack_ch6_init },
6675 { 8, alc882_sixstack_ch8_init },
6679 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6685 static struct hda_verb alc885_mbp_ch2_init[] = {
6686 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6687 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6688 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6695 static struct hda_verb alc885_mbp_ch6_init[] = {
6696 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6697 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6698 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6699 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6700 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6704 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6705 { 2, alc885_mbp_ch2_init },
6706 { 6, alc885_mbp_ch6_init },
6711 * Speakers/Woofer/HP = Front
6714 static struct hda_verb alc885_mb5_ch2_init[] = {
6715 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6716 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6722 * Speakers/HP = Front
6726 static struct hda_verb alc885_mb5_ch6_init[] = {
6727 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6728 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6729 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6733 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6734 { 2, alc885_mb5_ch2_init },
6735 { 6, alc885_mb5_ch6_init },
6742 static struct hda_verb alc883_4ST_ch2_init[] = {
6743 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6744 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6745 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6746 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6747 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6748 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6755 static struct hda_verb alc883_4ST_ch4_init[] = {
6756 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6757 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6758 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6759 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6760 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6761 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6762 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6769 static struct hda_verb alc883_4ST_ch6_init[] = {
6770 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6771 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6772 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6773 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6774 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6775 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6776 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6777 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6784 static struct hda_verb alc883_4ST_ch8_init[] = {
6785 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6786 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6787 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6788 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6789 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6790 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6791 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6792 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6793 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6797 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6798 { 2, alc883_4ST_ch2_init },
6799 { 4, alc883_4ST_ch4_init },
6800 { 6, alc883_4ST_ch6_init },
6801 { 8, alc883_4ST_ch8_init },
6808 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6809 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6810 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6811 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6812 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6819 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6820 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6821 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6822 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6823 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6824 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6831 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6832 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6833 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6834 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6835 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6836 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6837 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6841 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6842 { 2, alc883_3ST_ch2_intel_init },
6843 { 4, alc883_3ST_ch4_intel_init },
6844 { 6, alc883_3ST_ch6_intel_init },
6850 static struct hda_verb alc889_ch2_intel_init[] = {
6851 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6852 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6853 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6854 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6855 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6856 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6863 static struct hda_verb alc889_ch6_intel_init[] = {
6864 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6865 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6866 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6867 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6868 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6869 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6876 static struct hda_verb alc889_ch8_intel_init[] = {
6877 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6878 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6879 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6880 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6881 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6882 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6883 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6887 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6888 { 2, alc889_ch2_intel_init },
6889 { 6, alc889_ch6_intel_init },
6890 { 8, alc889_ch8_intel_init },
6896 static struct hda_verb alc883_sixstack_ch6_init[] = {
6897 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6898 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6899 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6900 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6907 static struct hda_verb alc883_sixstack_ch8_init[] = {
6908 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6909 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6910 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6911 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6915 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6916 { 6, alc883_sixstack_ch6_init },
6917 { 8, alc883_sixstack_ch8_init },
6921 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6922 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6924 static struct snd_kcontrol_new alc882_base_mixer[] = {
6925 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6926 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6927 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6928 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6929 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6930 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6931 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6932 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6933 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6934 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6935 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6936 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6937 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6938 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6939 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6940 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6941 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6942 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6943 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6944 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6945 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6949 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6950 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6951 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6952 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6953 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6954 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6955 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6956 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6957 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6958 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6959 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6963 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6964 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6965 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6966 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6967 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6968 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6969 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6970 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6971 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6972 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6973 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6974 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6975 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6976 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6977 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6981 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6982 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6983 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6984 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6985 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6986 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6987 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6988 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6989 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6990 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6994 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6995 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6996 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6997 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6998 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6999 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7000 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7001 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7002 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7003 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7004 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7005 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7006 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7007 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7011 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7012 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7014 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7015 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7016 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7017 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7018 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7019 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7020 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7021 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7022 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7023 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7024 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7025 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7026 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7027 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7031 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7032 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7033 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7034 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7035 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7036 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7037 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7038 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7039 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7040 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7041 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7045 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7047 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7048 .name = "Channel Mode",
7049 .info = alc_ch_mode_info,
7050 .get = alc_ch_mode_get,
7051 .put = alc_ch_mode_put,
7056 static struct hda_verb alc882_base_init_verbs[] = {
7057 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7059 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7060 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7062 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7063 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7064 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7066 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7067 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7068 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7070 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7071 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7072 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7074 /* mute analog input loopbacks */
7075 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7076 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7077 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7078 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7079 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7081 /* Front Pin: output 0 (0x0c) */
7082 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7083 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7084 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7085 /* Rear Pin: output 1 (0x0d) */
7086 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7087 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7088 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7089 /* CLFE Pin: output 2 (0x0e) */
7090 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7091 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7092 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7093 /* Side Pin: output 3 (0x0f) */
7094 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7095 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7096 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7097 /* Mic (rear) pin: input vref at 80% */
7098 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7099 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7100 /* Front Mic pin: input vref at 80% */
7101 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7102 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7103 /* Line In pin: input */
7104 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7105 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7106 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7107 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7108 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7109 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7110 /* CD pin widget for input */
7111 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7113 /* FIXME: use matrix-type input source selection */
7114 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7116 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7117 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7118 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7119 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7121 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7122 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7123 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7124 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7125 /* ADC2: mute amp left and right */
7126 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7127 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7128 /* ADC3: mute amp left and right */
7129 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7130 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7135 static struct hda_verb alc882_adc1_init_verbs[] = {
7136 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7137 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7138 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7139 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7140 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7141 /* ADC1: mute amp left and right */
7142 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7143 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7147 static struct hda_verb alc882_eapd_verbs[] = {
7148 /* change to EAPD mode */
7149 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7150 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7154 static struct hda_verb alc889_eapd_verbs[] = {
7155 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7156 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7160 static struct hda_verb alc_hp15_unsol_verbs[] = {
7161 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7162 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7166 static struct hda_verb alc885_init_verbs[] = {
7167 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7168 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7169 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7170 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7172 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7173 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7174 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7176 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7177 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7178 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7180 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7181 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7182 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7184 /* mute analog input loopbacks */
7185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7187 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7189 /* Front HP Pin: output 0 (0x0c) */
7190 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7191 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7192 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7193 /* Front Pin: output 0 (0x0c) */
7194 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7195 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7196 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7197 /* Rear Pin: output 1 (0x0d) */
7198 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7199 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7200 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7201 /* CLFE Pin: output 2 (0x0e) */
7202 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7203 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7204 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7205 /* Side Pin: output 3 (0x0f) */
7206 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7207 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7208 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7209 /* Mic (rear) pin: input vref at 80% */
7210 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7211 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7212 /* Front Mic pin: input vref at 80% */
7213 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7214 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7215 /* Line In pin: input */
7216 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7217 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7219 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7221 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7222 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7223 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7225 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7226 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7227 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7229 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7230 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7231 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7232 /* ADC2: mute amp left and right */
7233 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7234 /* ADC3: mute amp left and right */
7235 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7240 static struct hda_verb alc885_init_input_verbs[] = {
7241 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7242 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7243 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7248 /* Unmute Selector 24h and set the default input to front mic */
7249 static struct hda_verb alc889_init_input_verbs[] = {
7250 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7251 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7256 #define alc883_init_verbs alc882_base_init_verbs
7259 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7260 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7261 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7262 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7263 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7264 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7265 /* FIXME: this looks suspicious...
7266 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7267 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7272 static struct hda_verb alc882_macpro_init_verbs[] = {
7273 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7274 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7275 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7276 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7277 /* Front Pin: output 0 (0x0c) */
7278 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7279 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7280 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7281 /* Front Mic pin: input vref at 80% */
7282 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7283 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7284 /* Speaker: output */
7285 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7286 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7287 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7288 /* Headphone output (output 0 - 0x0c) */
7289 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7290 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7291 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7293 /* FIXME: use matrix-type input source selection */
7294 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7295 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7296 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7297 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7298 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7301 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7302 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7304 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7306 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7307 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7308 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7310 /* ADC1: mute amp left and right */
7311 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7312 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7313 /* ADC2: mute amp left and right */
7314 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7315 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7316 /* ADC3: mute amp left and right */
7317 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7318 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7324 static struct hda_verb alc885_mb5_init_verbs[] = {
7326 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7327 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7328 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7329 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7331 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7334 /* Surround mixer */
7335 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7336 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7337 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7339 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7340 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7341 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7343 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7344 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7345 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7346 /* Front Pin (0x0c) */
7347 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7348 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7349 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7350 /* LFE Pin (0x0e) */
7351 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7352 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7353 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7355 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7356 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7357 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7358 /* Front Mic pin: input vref at 80% */
7359 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7360 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7362 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7363 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7365 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7372 /* Macbook Pro rev3 */
7373 static struct hda_verb alc885_mbp3_init_verbs[] = {
7374 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7375 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7376 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7377 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7379 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7380 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7381 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7382 /* Front Pin: output 0 (0x0c) */
7383 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7384 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7385 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7386 /* HP Pin: output 0 (0x0d) */
7387 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7388 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7389 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7390 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7391 /* Mic (rear) pin: input vref at 80% */
7392 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7393 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7394 /* Front Mic pin: input vref at 80% */
7395 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7396 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7397 /* Line In pin: use output 1 when in LineOut mode */
7398 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7399 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7400 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7402 /* FIXME: use matrix-type input source selection */
7403 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7404 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7405 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7406 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7407 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7408 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7410 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7411 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7412 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7413 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7415 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7416 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7417 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7418 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7419 /* ADC1: mute amp left and right */
7420 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7421 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7422 /* ADC2: mute amp left and right */
7423 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7424 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7425 /* ADC3: mute amp left and right */
7426 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7427 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7432 /* iMac 24 mixer. */
7433 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7434 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7435 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7439 /* iMac 24 init verbs. */
7440 static struct hda_verb alc885_imac24_init_verbs[] = {
7441 /* Internal speakers: output 0 (0x0c) */
7442 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7443 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7444 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7445 /* Internal speakers: output 0 (0x0c) */
7446 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7447 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7448 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7449 /* Headphone: output 0 (0x0c) */
7450 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7451 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7452 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7453 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7454 /* Front Mic: input vref at 80% */
7455 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7456 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7460 /* Toggle speaker-output according to the hp-jack state */
7461 static void alc885_imac24_setup(struct hda_codec *codec)
7463 struct alc_spec *spec = codec->spec;
7465 spec->autocfg.hp_pins[0] = 0x14;
7466 spec->autocfg.speaker_pins[0] = 0x18;
7467 spec->autocfg.speaker_pins[1] = 0x1a;
7470 static void alc885_mbp3_setup(struct hda_codec *codec)
7472 struct alc_spec *spec = codec->spec;
7474 spec->autocfg.hp_pins[0] = 0x15;
7475 spec->autocfg.speaker_pins[0] = 0x14;
7479 static struct hda_verb alc882_targa_verbs[] = {
7480 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7481 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7483 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7484 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7486 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7487 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7488 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7490 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7494 /* toggle speaker-output according to the hp-jack state */
7495 static void alc882_targa_automute(struct hda_codec *codec)
7497 struct alc_spec *spec = codec->spec;
7498 alc_automute_amp(codec);
7499 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7500 spec->jack_present ? 1 : 3);
7503 static void alc882_targa_setup(struct hda_codec *codec)
7505 struct alc_spec *spec = codec->spec;
7507 spec->autocfg.hp_pins[0] = 0x14;
7508 spec->autocfg.speaker_pins[0] = 0x1b;
7511 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7513 if ((res >> 26) == ALC880_HP_EVENT)
7514 alc882_targa_automute(codec);
7517 static struct hda_verb alc882_asus_a7j_verbs[] = {
7518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7521 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7522 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7523 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7525 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7526 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7527 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7529 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7530 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7531 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7535 static struct hda_verb alc882_asus_a7m_verbs[] = {
7536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7537 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7539 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7540 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7541 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7543 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7544 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7545 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7547 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7548 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7549 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7553 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7555 unsigned int gpiostate, gpiomask, gpiodir;
7557 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7558 AC_VERB_GET_GPIO_DATA, 0);
7561 gpiostate |= (1 << pin);
7563 gpiostate &= ~(1 << pin);
7565 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7566 AC_VERB_GET_GPIO_MASK, 0);
7567 gpiomask |= (1 << pin);
7569 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7570 AC_VERB_GET_GPIO_DIRECTION, 0);
7571 gpiodir |= (1 << pin);
7574 snd_hda_codec_write(codec, codec->afg, 0,
7575 AC_VERB_SET_GPIO_MASK, gpiomask);
7576 snd_hda_codec_write(codec, codec->afg, 0,
7577 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7581 snd_hda_codec_write(codec, codec->afg, 0,
7582 AC_VERB_SET_GPIO_DATA, gpiostate);
7585 /* set up GPIO at initialization */
7586 static void alc885_macpro_init_hook(struct hda_codec *codec)
7588 alc882_gpio_mute(codec, 0, 0);
7589 alc882_gpio_mute(codec, 1, 0);
7592 /* set up GPIO and update auto-muting at initialization */
7593 static void alc885_imac24_init_hook(struct hda_codec *codec)
7595 alc885_macpro_init_hook(codec);
7596 alc_automute_amp(codec);
7600 * generic initialization of ADC, input mixers and output mixers
7602 static struct hda_verb alc883_auto_init_verbs[] = {
7604 * Unmute ADC0-2 and set the default input to mic-in
7606 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7607 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7608 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7609 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7611 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7613 * Note: PASD motherboards uses the Line In 2 as the input for
7614 * front panel mic (mic 2)
7616 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7617 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7618 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7619 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7620 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7621 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7624 * Set up output mixers (0x0c - 0x0f)
7626 /* set vol=0 to output mixers */
7627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7629 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7630 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7631 /* set up input amps for analog loopback */
7632 /* Amp Indices: DAC = 0, mixer = 1 */
7633 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7634 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7635 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7636 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7637 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7638 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7639 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7640 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7641 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7642 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7644 /* FIXME: use matrix-type input source selection */
7645 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7647 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7648 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7649 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7650 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7652 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7660 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7661 static struct hda_verb alc889A_mb31_ch2_init[] = {
7662 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7663 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7664 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7665 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7669 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7670 static struct hda_verb alc889A_mb31_ch4_init[] = {
7671 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7672 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7673 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7674 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7678 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7679 static struct hda_verb alc889A_mb31_ch5_init[] = {
7680 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7681 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7682 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7683 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7687 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7688 static struct hda_verb alc889A_mb31_ch6_init[] = {
7689 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7690 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7691 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7692 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7696 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7697 { 2, alc889A_mb31_ch2_init },
7698 { 4, alc889A_mb31_ch4_init },
7699 { 5, alc889A_mb31_ch5_init },
7700 { 6, alc889A_mb31_ch6_init },
7703 static struct hda_verb alc883_medion_eapd_verbs[] = {
7704 /* eanable EAPD on medion laptop */
7705 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7706 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7710 #define alc883_base_mixer alc882_base_mixer
7712 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7713 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7714 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7715 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7716 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7717 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7718 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7719 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7720 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7721 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7722 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7723 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7724 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7725 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7729 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7730 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7731 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7732 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7733 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7734 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7735 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7736 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7737 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7738 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7739 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7743 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7744 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7745 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7746 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7747 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7748 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7749 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7750 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7751 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7752 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7753 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7757 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7758 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7759 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7760 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7761 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7762 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7763 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7764 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7765 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7766 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7767 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7768 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7769 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7770 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7774 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7775 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7776 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7777 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7778 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7779 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7780 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7781 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7782 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7783 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7784 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7785 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7786 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7787 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7788 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7789 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7790 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7791 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7792 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7793 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7797 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7798 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7799 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7800 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7801 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7802 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7804 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7805 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7806 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7807 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7808 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7809 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7810 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7811 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7812 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7813 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7814 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7815 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7816 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7817 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7821 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7822 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7823 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7824 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7825 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7826 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7828 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7829 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7830 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7831 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7832 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7833 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7834 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7835 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7836 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7837 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7838 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7839 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7840 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7841 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7845 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7846 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7847 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7848 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7849 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7850 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7851 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7852 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7853 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7854 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7855 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7856 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7857 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7858 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7860 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7861 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7862 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7863 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7864 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7868 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7869 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7870 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7871 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7872 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7873 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7874 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7875 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7876 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7877 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7878 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7879 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7880 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7881 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7882 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7883 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7884 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7888 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7889 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7890 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7891 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7892 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7893 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7894 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7895 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7897 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7898 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7899 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7903 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7904 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7905 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7906 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7907 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7908 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7909 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7910 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7911 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7915 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7916 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7917 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7918 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7919 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7920 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7921 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7922 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7923 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7924 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7928 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7929 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7930 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7931 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7932 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7933 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7934 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7935 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7936 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7937 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7941 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7942 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7943 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7944 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7945 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7946 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7948 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7949 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7953 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
7954 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7955 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7956 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7957 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
7958 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7959 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7960 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7961 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7962 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7963 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7964 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7968 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7969 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7970 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7971 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7972 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7973 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7974 0x0d, 1, 0x0, HDA_OUTPUT),
7975 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7976 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7977 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7978 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7979 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7980 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7981 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7982 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7983 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7984 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7985 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7986 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7987 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7988 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7989 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7993 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
7995 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7996 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7997 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7998 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7999 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8001 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8002 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8003 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8004 /* Output switches */
8005 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8006 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8007 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8009 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8010 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8013 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8014 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8015 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8019 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8020 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8021 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8022 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8023 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8024 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8025 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8029 static struct hda_bind_ctls alc883_bind_cap_vol = {
8030 .ops = &snd_hda_bind_vol,
8032 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8033 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8038 static struct hda_bind_ctls alc883_bind_cap_switch = {
8039 .ops = &snd_hda_bind_sw,
8041 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8042 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8047 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8048 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8049 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8050 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8051 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8052 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8053 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8054 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8055 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8059 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8060 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8061 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8063 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8064 /* .name = "Capture Source", */
8065 .name = "Input Source",
8067 .info = alc_mux_enum_info,
8068 .get = alc_mux_enum_get,
8069 .put = alc_mux_enum_put,
8074 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8076 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8077 .name = "Channel Mode",
8078 .info = alc_ch_mode_info,
8079 .get = alc_ch_mode_get,
8080 .put = alc_ch_mode_put,
8085 /* toggle speaker-output according to the hp-jack state */
8086 static void alc883_mitac_setup(struct hda_codec *codec)
8088 struct alc_spec *spec = codec->spec;
8090 spec->autocfg.hp_pins[0] = 0x15;
8091 spec->autocfg.speaker_pins[0] = 0x14;
8092 spec->autocfg.speaker_pins[1] = 0x17;
8095 /* auto-toggle front mic */
8097 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8099 unsigned int present;
8102 present = snd_hda_codec_read(codec, 0x18, 0,
8103 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8104 bits = present ? HDA_AMP_MUTE : 0;
8105 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8109 static struct hda_verb alc883_mitac_verbs[] = {
8111 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8112 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8114 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8115 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8117 /* enable unsolicited event */
8118 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8119 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8124 static struct hda_verb alc883_clevo_m720_verbs[] = {
8126 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8127 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8129 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8130 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8132 /* enable unsolicited event */
8133 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8134 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8139 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8141 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8142 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8144 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8145 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8147 /* enable unsolicited event */
8148 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8153 static struct hda_verb alc883_targa_verbs[] = {
8154 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8155 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8157 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8158 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8160 /* Connect Line-Out side jack (SPDIF) to Side */
8161 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8162 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8163 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8164 /* Connect Mic jack to CLFE */
8165 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8166 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8167 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8168 /* Connect Line-in jack to Surround */
8169 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8170 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8171 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8172 /* Connect HP out jack to Front */
8173 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8174 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8175 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8177 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8182 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8183 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8184 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8185 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8189 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8190 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8191 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8192 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8193 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8197 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8198 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8199 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8200 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8201 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8202 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8206 static struct hda_verb alc883_haier_w66_verbs[] = {
8207 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8208 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8210 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8212 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8213 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8214 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8215 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8219 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8220 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8221 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8222 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8223 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8224 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8225 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8226 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8227 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8231 static struct hda_verb alc888_6st_dell_verbs[] = {
8232 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8236 static struct hda_verb alc883_vaiott_verbs[] = {
8238 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8239 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8241 /* enable unsolicited event */
8242 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8247 static void alc888_3st_hp_setup(struct hda_codec *codec)
8249 struct alc_spec *spec = codec->spec;
8251 spec->autocfg.hp_pins[0] = 0x1b;
8252 spec->autocfg.speaker_pins[0] = 0x14;
8253 spec->autocfg.speaker_pins[1] = 0x16;
8254 spec->autocfg.speaker_pins[2] = 0x18;
8257 static struct hda_verb alc888_3st_hp_verbs[] = {
8258 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8259 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8260 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8261 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8268 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8269 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8270 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8271 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8272 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8279 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8280 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8281 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8282 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8283 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8284 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8291 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8292 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8293 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8294 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8295 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8296 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8297 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8301 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8302 { 2, alc888_3st_hp_2ch_init },
8303 { 4, alc888_3st_hp_4ch_init },
8304 { 6, alc888_3st_hp_6ch_init },
8307 /* toggle front-jack and RCA according to the hp-jack state */
8308 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8310 unsigned int present;
8312 present = snd_hda_codec_read(codec, 0x1b, 0,
8313 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8314 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8315 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8316 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8317 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8320 /* toggle RCA according to the front-jack state */
8321 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8323 unsigned int present;
8325 present = snd_hda_codec_read(codec, 0x14, 0,
8326 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8327 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8328 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8331 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8334 if ((res >> 26) == ALC880_HP_EVENT)
8335 alc888_lenovo_ms7195_front_automute(codec);
8336 if ((res >> 26) == ALC880_FRONT_EVENT)
8337 alc888_lenovo_ms7195_rca_automute(codec);
8340 static struct hda_verb alc883_medion_md2_verbs[] = {
8341 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8342 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8344 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8346 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8350 /* toggle speaker-output according to the hp-jack state */
8351 static void alc883_medion_md2_setup(struct hda_codec *codec)
8353 struct alc_spec *spec = codec->spec;
8355 spec->autocfg.hp_pins[0] = 0x14;
8356 spec->autocfg.speaker_pins[0] = 0x15;
8359 /* toggle speaker-output according to the hp-jack state */
8360 #define alc883_targa_init_hook alc882_targa_init_hook
8361 #define alc883_targa_unsol_event alc882_targa_unsol_event
8363 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8365 unsigned int present;
8367 present = snd_hda_codec_read(codec, 0x18, 0,
8368 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8369 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8370 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8373 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8375 struct alc_spec *spec = codec->spec;
8377 spec->autocfg.hp_pins[0] = 0x15;
8378 spec->autocfg.speaker_pins[0] = 0x14;
8381 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8383 alc_automute_amp(codec);
8384 alc883_clevo_m720_mic_automute(codec);
8387 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8390 switch (res >> 26) {
8391 case ALC880_MIC_EVENT:
8392 alc883_clevo_m720_mic_automute(codec);
8395 alc_automute_amp_unsol_event(codec, res);
8400 /* toggle speaker-output according to the hp-jack state */
8401 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8403 struct alc_spec *spec = codec->spec;
8405 spec->autocfg.hp_pins[0] = 0x14;
8406 spec->autocfg.speaker_pins[0] = 0x15;
8409 static void alc883_haier_w66_setup(struct hda_codec *codec)
8411 struct alc_spec *spec = codec->spec;
8413 spec->autocfg.hp_pins[0] = 0x1b;
8414 spec->autocfg.speaker_pins[0] = 0x14;
8417 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8419 unsigned int present;
8422 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8423 & AC_PINSENSE_PRESENCE;
8424 bits = present ? HDA_AMP_MUTE : 0;
8425 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8426 HDA_AMP_MUTE, bits);
8429 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8431 unsigned int present;
8434 present = snd_hda_codec_read(codec, 0x1b, 0,
8435 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8436 bits = present ? HDA_AMP_MUTE : 0;
8437 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8438 HDA_AMP_MUTE, bits);
8439 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8440 HDA_AMP_MUTE, bits);
8443 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8446 if ((res >> 26) == ALC880_HP_EVENT)
8447 alc883_lenovo_101e_all_automute(codec);
8448 if ((res >> 26) == ALC880_FRONT_EVENT)
8449 alc883_lenovo_101e_ispeaker_automute(codec);
8452 /* toggle speaker-output according to the hp-jack state */
8453 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8455 struct alc_spec *spec = codec->spec;
8457 spec->autocfg.hp_pins[0] = 0x14;
8458 spec->autocfg.speaker_pins[0] = 0x15;
8459 spec->autocfg.speaker_pins[1] = 0x16;
8462 static struct hda_verb alc883_acer_eapd_verbs[] = {
8463 /* HP Pin: output 0 (0x0c) */
8464 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8465 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8466 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8467 /* Front Pin: output 0 (0x0c) */
8468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8469 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8470 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8471 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8472 /* eanable EAPD on medion laptop */
8473 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8474 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8475 /* enable unsolicited event */
8476 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8480 static void alc888_6st_dell_setup(struct hda_codec *codec)
8482 struct alc_spec *spec = codec->spec;
8484 spec->autocfg.hp_pins[0] = 0x1b;
8485 spec->autocfg.speaker_pins[0] = 0x14;
8486 spec->autocfg.speaker_pins[1] = 0x15;
8487 spec->autocfg.speaker_pins[2] = 0x16;
8488 spec->autocfg.speaker_pins[3] = 0x17;
8491 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8493 struct alc_spec *spec = codec->spec;
8495 spec->autocfg.hp_pins[0] = 0x1b;
8496 spec->autocfg.speaker_pins[0] = 0x14;
8497 spec->autocfg.speaker_pins[1] = 0x15;
8498 spec->autocfg.speaker_pins[2] = 0x16;
8499 spec->autocfg.speaker_pins[3] = 0x17;
8500 spec->autocfg.speaker_pins[4] = 0x1a;
8503 static void alc883_vaiott_setup(struct hda_codec *codec)
8505 struct alc_spec *spec = codec->spec;
8507 spec->autocfg.hp_pins[0] = 0x15;
8508 spec->autocfg.speaker_pins[0] = 0x14;
8509 spec->autocfg.speaker_pins[1] = 0x17;
8512 static struct hda_verb alc888_asus_m90v_verbs[] = {
8513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8514 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8515 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8516 /* enable unsolicited event */
8517 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8518 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8522 static void alc883_mode2_setup(struct hda_codec *codec)
8524 struct alc_spec *spec = codec->spec;
8526 spec->autocfg.hp_pins[0] = 0x1b;
8527 spec->autocfg.speaker_pins[0] = 0x14;
8528 spec->autocfg.speaker_pins[1] = 0x15;
8529 spec->autocfg.speaker_pins[2] = 0x16;
8530 spec->ext_mic.pin = 0x18;
8531 spec->int_mic.pin = 0x19;
8532 spec->ext_mic.mux_idx = 0;
8533 spec->int_mic.mux_idx = 1;
8537 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8538 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8539 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8540 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8541 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8542 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8543 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8544 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8545 /* enable unsolicited event */
8546 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8550 static void alc883_eee1601_inithook(struct hda_codec *codec)
8552 struct alc_spec *spec = codec->spec;
8554 spec->autocfg.hp_pins[0] = 0x14;
8555 spec->autocfg.speaker_pins[0] = 0x1b;
8556 alc_automute_pin(codec);
8559 static struct hda_verb alc889A_mb31_verbs[] = {
8560 /* Init rear pin (used as headphone output) */
8561 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8562 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8563 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8564 /* Init line pin (used as output in 4ch and 6ch mode) */
8565 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8566 /* Init line 2 pin (used as headphone out by default) */
8567 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8568 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8572 /* Mute speakers according to the headphone jack state */
8573 static void alc889A_mb31_automute(struct hda_codec *codec)
8575 unsigned int present;
8577 /* Mute only in 2ch or 4ch mode */
8578 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8580 present = snd_hda_codec_read(codec, 0x15, 0,
8581 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8582 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8583 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8584 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8585 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8589 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8591 if ((res >> 26) == ALC880_HP_EVENT)
8592 alc889A_mb31_automute(codec);
8596 #ifdef CONFIG_SND_HDA_POWER_SAVE
8597 #define alc882_loopbacks alc880_loopbacks
8600 /* pcm configuration: identical with ALC880 */
8601 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8602 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8603 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8604 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8606 static hda_nid_t alc883_slave_dig_outs[] = {
8607 ALC1200_DIGOUT_NID, 0,
8610 static hda_nid_t alc1200_slave_dig_outs[] = {
8611 ALC883_DIGOUT_NID, 0,
8615 * configuration and preset
8617 static const char *alc882_models[ALC882_MODEL_LAST] = {
8618 [ALC882_3ST_DIG] = "3stack-dig",
8619 [ALC882_6ST_DIG] = "6stack-dig",
8620 [ALC882_ARIMA] = "arima",
8621 [ALC882_W2JC] = "w2jc",
8622 [ALC882_TARGA] = "targa",
8623 [ALC882_ASUS_A7J] = "asus-a7j",
8624 [ALC882_ASUS_A7M] = "asus-a7m",
8625 [ALC885_MACPRO] = "macpro",
8626 [ALC885_MB5] = "mb5",
8627 [ALC885_MBP3] = "mbp3",
8628 [ALC885_IMAC24] = "imac24",
8629 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8630 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8631 [ALC883_3ST_6ch] = "3stack-6ch",
8632 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8633 [ALC883_TARGA_DIG] = "targa-dig",
8634 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8635 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8636 [ALC883_ACER] = "acer",
8637 [ALC883_ACER_ASPIRE] = "acer-aspire",
8638 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8639 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8640 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8641 [ALC883_MEDION] = "medion",
8642 [ALC883_MEDION_MD2] = "medion-md2",
8643 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8644 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8645 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8646 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8647 [ALC888_LENOVO_SKY] = "lenovo-sky",
8648 [ALC883_HAIER_W66] = "haier-w66",
8649 [ALC888_3ST_HP] = "3stack-hp",
8650 [ALC888_6ST_DELL] = "6stack-dell",
8651 [ALC883_MITAC] = "mitac",
8652 [ALC883_CLEVO_M720] = "clevo-m720",
8653 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8654 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8655 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8656 [ALC889A_INTEL] = "intel-alc889a",
8657 [ALC889_INTEL] = "intel-x58",
8658 [ALC1200_ASUS_P5Q] = "asus-p5q",
8659 [ALC889A_MB31] = "mb31",
8660 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8661 [ALC882_AUTO] = "auto",
8664 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8665 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8667 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8668 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8669 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8670 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8671 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8672 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8673 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8674 ALC888_ACER_ASPIRE_4930G),
8675 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8676 ALC888_ACER_ASPIRE_4930G),
8677 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8678 ALC888_ACER_ASPIRE_8930G),
8679 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8680 ALC888_ACER_ASPIRE_8930G),
8681 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8682 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8683 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8684 ALC888_ACER_ASPIRE_6530G),
8685 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8686 ALC888_ACER_ASPIRE_6530G),
8687 /* default Acer -- disabled as it causes more problems.
8688 * model=auto should work fine now
8690 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8692 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8694 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8695 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8696 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8697 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8698 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8699 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8701 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8702 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8703 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8704 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8705 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8706 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8707 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8708 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8709 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8710 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8711 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8713 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8714 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8715 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8716 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8717 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8718 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8719 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8720 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8721 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8723 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8724 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8725 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8726 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8727 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8728 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8729 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8730 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8731 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8732 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8733 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8734 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8735 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8736 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8737 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8738 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8739 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8740 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8741 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8742 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8743 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8744 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8745 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8746 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8747 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8748 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8749 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8750 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8751 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8753 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8754 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8755 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8756 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8757 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8758 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8759 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8760 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8761 ALC883_FUJITSU_PI2515),
8762 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8763 ALC888_FUJITSU_XA3530),
8764 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8765 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8766 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8767 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8768 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8769 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8770 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8771 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8772 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8774 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8775 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8776 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8777 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8778 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8779 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8780 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8785 /* codec SSID table for Intel Mac */
8786 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8787 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8788 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8789 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8790 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8791 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8792 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8793 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8794 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8795 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8796 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8797 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8798 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8799 * no perfect solution yet
8801 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8805 static struct alc_config_preset alc882_presets[] = {
8806 [ALC882_3ST_DIG] = {
8807 .mixers = { alc882_base_mixer },
8808 .init_verbs = { alc882_base_init_verbs,
8809 alc882_adc1_init_verbs },
8810 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8811 .dac_nids = alc882_dac_nids,
8812 .dig_out_nid = ALC882_DIGOUT_NID,
8813 .dig_in_nid = ALC882_DIGIN_NID,
8814 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8815 .channel_mode = alc882_ch_modes,
8817 .input_mux = &alc882_capture_source,
8819 [ALC882_6ST_DIG] = {
8820 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8821 .init_verbs = { alc882_base_init_verbs,
8822 alc882_adc1_init_verbs },
8823 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8824 .dac_nids = alc882_dac_nids,
8825 .dig_out_nid = ALC882_DIGOUT_NID,
8826 .dig_in_nid = ALC882_DIGIN_NID,
8827 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8828 .channel_mode = alc882_sixstack_modes,
8829 .input_mux = &alc882_capture_source,
8832 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8833 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8834 alc882_eapd_verbs },
8835 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8836 .dac_nids = alc882_dac_nids,
8837 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8838 .channel_mode = alc882_sixstack_modes,
8839 .input_mux = &alc882_capture_source,
8842 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8843 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8844 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8845 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8846 .dac_nids = alc882_dac_nids,
8847 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8848 .channel_mode = alc880_threestack_modes,
8850 .input_mux = &alc882_capture_source,
8851 .dig_out_nid = ALC882_DIGOUT_NID,
8854 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8855 .init_verbs = { alc885_mbp3_init_verbs,
8856 alc880_gpio1_init_verbs },
8857 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8858 .dac_nids = alc882_dac_nids,
8859 .channel_mode = alc885_mbp_6ch_modes,
8860 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
8861 .input_mux = &alc882_capture_source,
8862 .dig_out_nid = ALC882_DIGOUT_NID,
8863 .dig_in_nid = ALC882_DIGIN_NID,
8864 .unsol_event = alc_automute_amp_unsol_event,
8865 .setup = alc885_mbp3_setup,
8866 .init_hook = alc_automute_amp,
8869 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8870 .init_verbs = { alc885_mb5_init_verbs,
8871 alc880_gpio1_init_verbs },
8872 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8873 .dac_nids = alc882_dac_nids,
8874 .channel_mode = alc885_mb5_6ch_modes,
8875 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8876 .input_mux = &mb5_capture_source,
8877 .dig_out_nid = ALC882_DIGOUT_NID,
8878 .dig_in_nid = ALC882_DIGIN_NID,
8881 .mixers = { alc882_macpro_mixer },
8882 .init_verbs = { alc882_macpro_init_verbs },
8883 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8884 .dac_nids = alc882_dac_nids,
8885 .dig_out_nid = ALC882_DIGOUT_NID,
8886 .dig_in_nid = ALC882_DIGIN_NID,
8887 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8888 .channel_mode = alc882_ch_modes,
8889 .input_mux = &alc882_capture_source,
8890 .init_hook = alc885_macpro_init_hook,
8893 .mixers = { alc885_imac24_mixer },
8894 .init_verbs = { alc885_imac24_init_verbs },
8895 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8896 .dac_nids = alc882_dac_nids,
8897 .dig_out_nid = ALC882_DIGOUT_NID,
8898 .dig_in_nid = ALC882_DIGIN_NID,
8899 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8900 .channel_mode = alc882_ch_modes,
8901 .input_mux = &alc882_capture_source,
8902 .unsol_event = alc_automute_amp_unsol_event,
8903 .setup = alc885_imac24_setup,
8904 .init_hook = alc885_imac24_init_hook,
8907 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
8908 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8909 alc880_gpio3_init_verbs, alc882_targa_verbs},
8910 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8911 .dac_nids = alc882_dac_nids,
8912 .dig_out_nid = ALC882_DIGOUT_NID,
8913 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8914 .adc_nids = alc882_adc_nids,
8915 .capsrc_nids = alc882_capsrc_nids,
8916 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8917 .channel_mode = alc882_3ST_6ch_modes,
8919 .input_mux = &alc882_capture_source,
8920 .unsol_event = alc882_targa_unsol_event,
8921 .setup = alc882_targa_setup,
8922 .init_hook = alc882_targa_automute,
8924 [ALC882_ASUS_A7J] = {
8925 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
8926 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8927 alc882_asus_a7j_verbs},
8928 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8929 .dac_nids = alc882_dac_nids,
8930 .dig_out_nid = ALC882_DIGOUT_NID,
8931 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8932 .adc_nids = alc882_adc_nids,
8933 .capsrc_nids = alc882_capsrc_nids,
8934 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8935 .channel_mode = alc882_3ST_6ch_modes,
8937 .input_mux = &alc882_capture_source,
8939 [ALC882_ASUS_A7M] = {
8940 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
8941 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8942 alc882_eapd_verbs, alc880_gpio1_init_verbs,
8943 alc882_asus_a7m_verbs },
8944 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8945 .dac_nids = alc882_dac_nids,
8946 .dig_out_nid = ALC882_DIGOUT_NID,
8947 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8948 .channel_mode = alc880_threestack_modes,
8950 .input_mux = &alc882_capture_source,
8952 [ALC883_3ST_2ch_DIG] = {
8953 .mixers = { alc883_3ST_2ch_mixer },
8954 .init_verbs = { alc883_init_verbs },
8955 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8956 .dac_nids = alc883_dac_nids,
8957 .dig_out_nid = ALC883_DIGOUT_NID,
8958 .dig_in_nid = ALC883_DIGIN_NID,
8959 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8960 .channel_mode = alc883_3ST_2ch_modes,
8961 .input_mux = &alc883_capture_source,
8963 [ALC883_3ST_6ch_DIG] = {
8964 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8965 .init_verbs = { alc883_init_verbs },
8966 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8967 .dac_nids = alc883_dac_nids,
8968 .dig_out_nid = ALC883_DIGOUT_NID,
8969 .dig_in_nid = ALC883_DIGIN_NID,
8970 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8971 .channel_mode = alc883_3ST_6ch_modes,
8973 .input_mux = &alc883_capture_source,
8975 [ALC883_3ST_6ch] = {
8976 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8977 .init_verbs = { alc883_init_verbs },
8978 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8979 .dac_nids = alc883_dac_nids,
8980 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8981 .channel_mode = alc883_3ST_6ch_modes,
8983 .input_mux = &alc883_capture_source,
8985 [ALC883_3ST_6ch_INTEL] = {
8986 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8987 .init_verbs = { alc883_init_verbs },
8988 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8989 .dac_nids = alc883_dac_nids,
8990 .dig_out_nid = ALC883_DIGOUT_NID,
8991 .dig_in_nid = ALC883_DIGIN_NID,
8992 .slave_dig_outs = alc883_slave_dig_outs,
8993 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8994 .channel_mode = alc883_3ST_6ch_intel_modes,
8996 .input_mux = &alc883_3stack_6ch_intel,
8999 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9000 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9001 alc_hp15_unsol_verbs },
9002 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9003 .dac_nids = alc883_dac_nids,
9004 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9005 .adc_nids = alc889_adc_nids,
9006 .dig_out_nid = ALC883_DIGOUT_NID,
9007 .dig_in_nid = ALC883_DIGIN_NID,
9008 .slave_dig_outs = alc883_slave_dig_outs,
9009 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9010 .channel_mode = alc889_8ch_intel_modes,
9011 .capsrc_nids = alc889_capsrc_nids,
9012 .input_mux = &alc889_capture_source,
9013 .setup = alc889_automute_setup,
9014 .init_hook = alc_automute_amp,
9015 .unsol_event = alc_automute_amp_unsol_event,
9019 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9020 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9021 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9022 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9023 .dac_nids = alc883_dac_nids,
9024 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9025 .adc_nids = alc889_adc_nids,
9026 .dig_out_nid = ALC883_DIGOUT_NID,
9027 .dig_in_nid = ALC883_DIGIN_NID,
9028 .slave_dig_outs = alc883_slave_dig_outs,
9029 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9030 .channel_mode = alc889_8ch_intel_modes,
9031 .capsrc_nids = alc889_capsrc_nids,
9032 .input_mux = &alc889_capture_source,
9033 .setup = alc889_automute_setup,
9034 .init_hook = alc889_intel_init_hook,
9035 .unsol_event = alc_automute_amp_unsol_event,
9038 [ALC883_6ST_DIG] = {
9039 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9040 .init_verbs = { alc883_init_verbs },
9041 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9042 .dac_nids = alc883_dac_nids,
9043 .dig_out_nid = ALC883_DIGOUT_NID,
9044 .dig_in_nid = ALC883_DIGIN_NID,
9045 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9046 .channel_mode = alc883_sixstack_modes,
9047 .input_mux = &alc883_capture_source,
9049 [ALC883_TARGA_DIG] = {
9050 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9051 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9052 alc883_targa_verbs},
9053 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9054 .dac_nids = alc883_dac_nids,
9055 .dig_out_nid = ALC883_DIGOUT_NID,
9056 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9057 .channel_mode = alc883_3ST_6ch_modes,
9059 .input_mux = &alc883_capture_source,
9060 .unsol_event = alc883_targa_unsol_event,
9061 .setup = alc882_targa_setup,
9062 .init_hook = alc882_targa_automute,
9064 [ALC883_TARGA_2ch_DIG] = {
9065 .mixers = { alc883_targa_2ch_mixer},
9066 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9067 alc883_targa_verbs},
9068 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9069 .dac_nids = alc883_dac_nids,
9070 .adc_nids = alc883_adc_nids_alt,
9071 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9072 .dig_out_nid = ALC883_DIGOUT_NID,
9073 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9074 .channel_mode = alc883_3ST_2ch_modes,
9075 .input_mux = &alc883_capture_source,
9076 .unsol_event = alc883_targa_unsol_event,
9077 .setup = alc882_targa_setup,
9078 .init_hook = alc882_targa_automute,
9080 [ALC883_TARGA_8ch_DIG] = {
9081 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9082 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9083 alc883_targa_verbs },
9084 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9085 .dac_nids = alc883_dac_nids,
9086 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9087 .adc_nids = alc883_adc_nids_rev,
9088 .capsrc_nids = alc883_capsrc_nids_rev,
9089 .dig_out_nid = ALC883_DIGOUT_NID,
9090 .dig_in_nid = ALC883_DIGIN_NID,
9091 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9092 .channel_mode = alc883_4ST_8ch_modes,
9094 .input_mux = &alc883_capture_source,
9095 .unsol_event = alc883_targa_unsol_event,
9096 .setup = alc882_targa_setup,
9097 .init_hook = alc882_targa_automute,
9100 .mixers = { alc883_base_mixer },
9101 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9102 * and the headphone jack. Turn this on and rely on the
9103 * standard mute methods whenever the user wants to turn
9104 * these outputs off.
9106 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9107 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9108 .dac_nids = alc883_dac_nids,
9109 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9110 .channel_mode = alc883_3ST_2ch_modes,
9111 .input_mux = &alc883_capture_source,
9113 [ALC883_ACER_ASPIRE] = {
9114 .mixers = { alc883_acer_aspire_mixer },
9115 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9116 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9117 .dac_nids = alc883_dac_nids,
9118 .dig_out_nid = ALC883_DIGOUT_NID,
9119 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9120 .channel_mode = alc883_3ST_2ch_modes,
9121 .input_mux = &alc883_capture_source,
9122 .unsol_event = alc_automute_amp_unsol_event,
9123 .setup = alc883_acer_aspire_setup,
9124 .init_hook = alc_automute_amp,
9126 [ALC888_ACER_ASPIRE_4930G] = {
9127 .mixers = { alc888_base_mixer,
9128 alc883_chmode_mixer },
9129 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9130 alc888_acer_aspire_4930g_verbs },
9131 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9132 .dac_nids = alc883_dac_nids,
9133 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9134 .adc_nids = alc883_adc_nids_rev,
9135 .capsrc_nids = alc883_capsrc_nids_rev,
9136 .dig_out_nid = ALC883_DIGOUT_NID,
9137 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9138 .channel_mode = alc883_3ST_6ch_modes,
9141 ARRAY_SIZE(alc888_2_capture_sources),
9142 .input_mux = alc888_2_capture_sources,
9143 .unsol_event = alc_automute_amp_unsol_event,
9144 .setup = alc888_acer_aspire_4930g_setup,
9145 .init_hook = alc_automute_amp,
9147 [ALC888_ACER_ASPIRE_6530G] = {
9148 .mixers = { alc888_acer_aspire_6530_mixer },
9149 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9150 alc888_acer_aspire_6530g_verbs },
9151 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9152 .dac_nids = alc883_dac_nids,
9153 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9154 .adc_nids = alc883_adc_nids_rev,
9155 .capsrc_nids = alc883_capsrc_nids_rev,
9156 .dig_out_nid = ALC883_DIGOUT_NID,
9157 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9158 .channel_mode = alc883_3ST_2ch_modes,
9160 ARRAY_SIZE(alc888_2_capture_sources),
9161 .input_mux = alc888_acer_aspire_6530_sources,
9162 .unsol_event = alc_automute_amp_unsol_event,
9163 .setup = alc888_acer_aspire_6530g_setup,
9164 .init_hook = alc_automute_amp,
9166 [ALC888_ACER_ASPIRE_8930G] = {
9167 .mixers = { alc888_base_mixer,
9168 alc883_chmode_mixer },
9169 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9170 alc889_acer_aspire_8930g_verbs },
9171 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9172 .dac_nids = alc883_dac_nids,
9173 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9174 .adc_nids = alc889_adc_nids,
9175 .capsrc_nids = alc889_capsrc_nids,
9176 .dig_out_nid = ALC883_DIGOUT_NID,
9177 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9178 .channel_mode = alc883_3ST_6ch_modes,
9180 .const_channel_count = 6,
9182 ARRAY_SIZE(alc889_capture_sources),
9183 .input_mux = alc889_capture_sources,
9184 .unsol_event = alc_automute_amp_unsol_event,
9185 .setup = alc889_acer_aspire_8930g_setup,
9186 .init_hook = alc_automute_amp,
9189 .mixers = { alc883_fivestack_mixer,
9190 alc883_chmode_mixer },
9191 .init_verbs = { alc883_init_verbs,
9192 alc883_medion_eapd_verbs },
9193 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9194 .dac_nids = alc883_dac_nids,
9195 .adc_nids = alc883_adc_nids_alt,
9196 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9197 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9198 .channel_mode = alc883_sixstack_modes,
9199 .input_mux = &alc883_capture_source,
9201 [ALC883_MEDION_MD2] = {
9202 .mixers = { alc883_medion_md2_mixer},
9203 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9204 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9205 .dac_nids = alc883_dac_nids,
9206 .dig_out_nid = ALC883_DIGOUT_NID,
9207 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9208 .channel_mode = alc883_3ST_2ch_modes,
9209 .input_mux = &alc883_capture_source,
9210 .unsol_event = alc_automute_amp_unsol_event,
9211 .setup = alc883_medion_md2_setup,
9212 .init_hook = alc_automute_amp,
9214 [ALC883_LAPTOP_EAPD] = {
9215 .mixers = { alc883_base_mixer },
9216 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9217 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9218 .dac_nids = alc883_dac_nids,
9219 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9220 .channel_mode = alc883_3ST_2ch_modes,
9221 .input_mux = &alc883_capture_source,
9223 [ALC883_CLEVO_M720] = {
9224 .mixers = { alc883_clevo_m720_mixer },
9225 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9226 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9227 .dac_nids = alc883_dac_nids,
9228 .dig_out_nid = ALC883_DIGOUT_NID,
9229 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9230 .channel_mode = alc883_3ST_2ch_modes,
9231 .input_mux = &alc883_capture_source,
9232 .unsol_event = alc883_clevo_m720_unsol_event,
9233 .setup = alc883_clevo_m720_setup,
9234 .init_hook = alc883_clevo_m720_init_hook,
9236 [ALC883_LENOVO_101E_2ch] = {
9237 .mixers = { alc883_lenovo_101e_2ch_mixer},
9238 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9239 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9240 .dac_nids = alc883_dac_nids,
9241 .adc_nids = alc883_adc_nids_alt,
9242 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9243 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9244 .channel_mode = alc883_3ST_2ch_modes,
9245 .input_mux = &alc883_lenovo_101e_capture_source,
9246 .unsol_event = alc883_lenovo_101e_unsol_event,
9247 .init_hook = alc883_lenovo_101e_all_automute,
9249 [ALC883_LENOVO_NB0763] = {
9250 .mixers = { alc883_lenovo_nb0763_mixer },
9251 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9252 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9253 .dac_nids = alc883_dac_nids,
9254 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9255 .channel_mode = alc883_3ST_2ch_modes,
9257 .input_mux = &alc883_lenovo_nb0763_capture_source,
9258 .unsol_event = alc_automute_amp_unsol_event,
9259 .setup = alc883_medion_md2_setup,
9260 .init_hook = alc_automute_amp,
9262 [ALC888_LENOVO_MS7195_DIG] = {
9263 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9264 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9265 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9266 .dac_nids = alc883_dac_nids,
9267 .dig_out_nid = ALC883_DIGOUT_NID,
9268 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9269 .channel_mode = alc883_3ST_6ch_modes,
9271 .input_mux = &alc883_capture_source,
9272 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9273 .init_hook = alc888_lenovo_ms7195_front_automute,
9275 [ALC883_HAIER_W66] = {
9276 .mixers = { alc883_targa_2ch_mixer},
9277 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9278 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9279 .dac_nids = alc883_dac_nids,
9280 .dig_out_nid = ALC883_DIGOUT_NID,
9281 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9282 .channel_mode = alc883_3ST_2ch_modes,
9283 .input_mux = &alc883_capture_source,
9284 .unsol_event = alc_automute_amp_unsol_event,
9285 .setup = alc883_haier_w66_setup,
9286 .init_hook = alc_automute_amp,
9289 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9290 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9291 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9292 .dac_nids = alc883_dac_nids,
9293 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9294 .channel_mode = alc888_3st_hp_modes,
9296 .input_mux = &alc883_capture_source,
9297 .unsol_event = alc_automute_amp_unsol_event,
9298 .setup = alc888_3st_hp_setup,
9299 .init_hook = alc_automute_amp,
9301 [ALC888_6ST_DELL] = {
9302 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9303 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9304 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9305 .dac_nids = alc883_dac_nids,
9306 .dig_out_nid = ALC883_DIGOUT_NID,
9307 .dig_in_nid = ALC883_DIGIN_NID,
9308 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9309 .channel_mode = alc883_sixstack_modes,
9310 .input_mux = &alc883_capture_source,
9311 .unsol_event = alc_automute_amp_unsol_event,
9312 .setup = alc888_6st_dell_setup,
9313 .init_hook = alc_automute_amp,
9316 .mixers = { alc883_mitac_mixer },
9317 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9318 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9319 .dac_nids = alc883_dac_nids,
9320 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9321 .channel_mode = alc883_3ST_2ch_modes,
9322 .input_mux = &alc883_capture_source,
9323 .unsol_event = alc_automute_amp_unsol_event,
9324 .setup = alc883_mitac_setup,
9325 .init_hook = alc_automute_amp,
9327 [ALC883_FUJITSU_PI2515] = {
9328 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9329 .init_verbs = { alc883_init_verbs,
9330 alc883_2ch_fujitsu_pi2515_verbs},
9331 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9332 .dac_nids = alc883_dac_nids,
9333 .dig_out_nid = ALC883_DIGOUT_NID,
9334 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9335 .channel_mode = alc883_3ST_2ch_modes,
9336 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9337 .unsol_event = alc_automute_amp_unsol_event,
9338 .setup = alc883_2ch_fujitsu_pi2515_setup,
9339 .init_hook = alc_automute_amp,
9341 [ALC888_FUJITSU_XA3530] = {
9342 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9343 .init_verbs = { alc883_init_verbs,
9344 alc888_fujitsu_xa3530_verbs },
9345 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9346 .dac_nids = alc883_dac_nids,
9347 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9348 .adc_nids = alc883_adc_nids_rev,
9349 .capsrc_nids = alc883_capsrc_nids_rev,
9350 .dig_out_nid = ALC883_DIGOUT_NID,
9351 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9352 .channel_mode = alc888_4ST_8ch_intel_modes,
9354 ARRAY_SIZE(alc888_2_capture_sources),
9355 .input_mux = alc888_2_capture_sources,
9356 .unsol_event = alc_automute_amp_unsol_event,
9357 .setup = alc888_fujitsu_xa3530_setup,
9358 .init_hook = alc_automute_amp,
9360 [ALC888_LENOVO_SKY] = {
9361 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9362 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9363 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9364 .dac_nids = alc883_dac_nids,
9365 .dig_out_nid = ALC883_DIGOUT_NID,
9366 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9367 .channel_mode = alc883_sixstack_modes,
9369 .input_mux = &alc883_lenovo_sky_capture_source,
9370 .unsol_event = alc_automute_amp_unsol_event,
9371 .setup = alc888_lenovo_sky_setup,
9372 .init_hook = alc_automute_amp,
9374 [ALC888_ASUS_M90V] = {
9375 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9376 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9377 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9378 .dac_nids = alc883_dac_nids,
9379 .dig_out_nid = ALC883_DIGOUT_NID,
9380 .dig_in_nid = ALC883_DIGIN_NID,
9381 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9382 .channel_mode = alc883_3ST_6ch_modes,
9384 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9385 .unsol_event = alc_sku_unsol_event,
9386 .setup = alc883_mode2_setup,
9387 .init_hook = alc_inithook,
9389 [ALC888_ASUS_EEE1601] = {
9390 .mixers = { alc883_asus_eee1601_mixer },
9391 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9392 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9393 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9394 .dac_nids = alc883_dac_nids,
9395 .dig_out_nid = ALC883_DIGOUT_NID,
9396 .dig_in_nid = ALC883_DIGIN_NID,
9397 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9398 .channel_mode = alc883_3ST_2ch_modes,
9400 .input_mux = &alc883_asus_eee1601_capture_source,
9401 .unsol_event = alc_sku_unsol_event,
9402 .init_hook = alc883_eee1601_inithook,
9404 [ALC1200_ASUS_P5Q] = {
9405 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9406 .init_verbs = { alc883_init_verbs },
9407 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9408 .dac_nids = alc883_dac_nids,
9409 .dig_out_nid = ALC1200_DIGOUT_NID,
9410 .dig_in_nid = ALC883_DIGIN_NID,
9411 .slave_dig_outs = alc1200_slave_dig_outs,
9412 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9413 .channel_mode = alc883_sixstack_modes,
9414 .input_mux = &alc883_capture_source,
9417 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9418 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9419 alc880_gpio1_init_verbs },
9420 .adc_nids = alc883_adc_nids,
9421 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9422 .dac_nids = alc883_dac_nids,
9423 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9424 .channel_mode = alc889A_mb31_6ch_modes,
9425 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9426 .input_mux = &alc889A_mb31_capture_source,
9427 .dig_out_nid = ALC883_DIGOUT_NID,
9428 .unsol_event = alc889A_mb31_unsol_event,
9429 .init_hook = alc889A_mb31_automute,
9431 [ALC883_SONY_VAIO_TT] = {
9432 .mixers = { alc883_vaiott_mixer },
9433 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9434 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9435 .dac_nids = alc883_dac_nids,
9436 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9437 .channel_mode = alc883_3ST_2ch_modes,
9438 .input_mux = &alc883_capture_source,
9439 .unsol_event = alc_automute_amp_unsol_event,
9440 .setup = alc883_vaiott_setup,
9441 .init_hook = alc_automute_amp,
9450 PINFIX_ABIT_AW9D_MAX
9453 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9454 { 0x15, 0x01080104 }, /* side */
9455 { 0x16, 0x01011012 }, /* rear */
9456 { 0x17, 0x01016011 }, /* clfe */
9460 static const struct alc_pincfg *alc882_pin_fixes[] = {
9461 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
9464 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
9465 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9470 * BIOS auto configuration
9472 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9473 const struct auto_pin_cfg *cfg)
9475 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9478 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9479 hda_nid_t nid, int pin_type,
9483 struct alc_spec *spec = codec->spec;
9486 alc_set_pin_output(codec, nid, pin_type);
9487 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9490 idx = spec->multiout.dac_nids[dac_idx] - 2;
9491 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9495 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9497 struct alc_spec *spec = codec->spec;
9500 for (i = 0; i <= HDA_SIDE; i++) {
9501 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9502 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9504 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9509 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9511 struct alc_spec *spec = codec->spec;
9514 pin = spec->autocfg.hp_pins[0];
9515 if (pin) /* connect to front */
9517 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9518 pin = spec->autocfg.speaker_pins[0];
9520 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9523 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9525 struct alc_spec *spec = codec->spec;
9528 for (i = 0; i < AUTO_PIN_LAST; i++) {
9529 hda_nid_t nid = spec->autocfg.input_pins[i];
9532 alc_set_input_pin(codec, nid, i);
9533 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9534 snd_hda_codec_write(codec, nid, 0,
9535 AC_VERB_SET_AMP_GAIN_MUTE,
9540 static void alc882_auto_init_input_src(struct hda_codec *codec)
9542 struct alc_spec *spec = codec->spec;
9545 for (c = 0; c < spec->num_adc_nids; c++) {
9546 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9547 hda_nid_t nid = spec->capsrc_nids[c];
9548 unsigned int mux_idx;
9549 const struct hda_input_mux *imux;
9550 int conns, mute, idx, item;
9552 conns = snd_hda_get_connections(codec, nid, conn_list,
9553 ARRAY_SIZE(conn_list));
9556 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9557 imux = &spec->input_mux[mux_idx];
9558 for (idx = 0; idx < conns; idx++) {
9559 /* if the current connection is the selected one,
9560 * unmute it as default - otherwise mute it
9562 mute = AMP_IN_MUTE(idx);
9563 for (item = 0; item < imux->num_items; item++) {
9564 if (imux->items[item].index == idx) {
9565 if (spec->cur_mux[c] == item)
9566 mute = AMP_IN_UNMUTE(idx);
9570 /* check if we have a selector or mixer
9571 * we could check for the widget type instead, but
9572 * just check for Amp-In presence (in case of mixer
9573 * without amp-in there is something wrong, this
9574 * function shouldn't be used or capsrc nid is wrong)
9576 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9577 snd_hda_codec_write(codec, nid, 0,
9578 AC_VERB_SET_AMP_GAIN_MUTE,
9580 else if (mute != AMP_IN_MUTE(idx))
9581 snd_hda_codec_write(codec, nid, 0,
9582 AC_VERB_SET_CONNECT_SEL,
9588 /* add mic boosts if needed */
9589 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9591 struct alc_spec *spec = codec->spec;
9595 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9596 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9597 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9599 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9603 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9604 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9605 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9607 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9614 /* almost identical with ALC880 parser... */
9615 static int alc882_parse_auto_config(struct hda_codec *codec)
9617 struct alc_spec *spec = codec->spec;
9618 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9621 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9625 if (!spec->autocfg.line_outs)
9626 return 0; /* can't find valid BIOS pin config */
9628 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9631 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9634 err = alc880_auto_create_extra_out(spec,
9635 spec->autocfg.speaker_pins[0],
9639 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9643 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9647 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9649 /* check multiple SPDIF-out (for recent codecs) */
9650 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9652 err = snd_hda_get_connections(codec,
9653 spec->autocfg.dig_out_pins[i],
9658 spec->multiout.dig_out_nid = dig_nid;
9660 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9661 spec->slave_dig_outs[i - 1] = dig_nid;
9662 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
9666 if (spec->autocfg.dig_in_pin)
9667 spec->dig_in_nid = ALC880_DIGIN_NID;
9669 if (spec->kctls.list)
9670 add_mixer(spec, spec->kctls.list);
9672 add_verb(spec, alc883_auto_init_verbs);
9673 /* if ADC 0x07 is available, initialize it, too */
9674 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9675 add_verb(spec, alc882_adc1_init_verbs);
9677 spec->num_mux_defs = 1;
9678 spec->input_mux = &spec->private_imux[0];
9680 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9682 err = alc_auto_add_mic_boost(codec);
9686 return 1; /* config found */
9689 /* additional initialization for auto-configuration model */
9690 static void alc882_auto_init(struct hda_codec *codec)
9692 struct alc_spec *spec = codec->spec;
9693 alc882_auto_init_multi_out(codec);
9694 alc882_auto_init_hp_out(codec);
9695 alc882_auto_init_analog_input(codec);
9696 alc882_auto_init_input_src(codec);
9697 if (spec->unsol_event)
9698 alc_inithook(codec);
9701 static int patch_alc882(struct hda_codec *codec)
9703 struct alc_spec *spec;
9704 int err, board_config;
9706 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9712 switch (codec->vendor_id) {
9717 /* ALC883 and variants */
9718 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9722 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9726 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9727 board_config = snd_hda_check_board_codec_sid_config(codec,
9728 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9730 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9731 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9733 board_config = ALC882_AUTO;
9736 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
9738 if (board_config == ALC882_AUTO) {
9739 /* automatic parse from the BIOS config */
9740 err = alc882_parse_auto_config(codec);
9746 "hda_codec: Cannot set up configuration "
9747 "from BIOS. Using base mode...\n");
9748 board_config = ALC882_3ST_DIG;
9752 err = snd_hda_attach_beep_device(codec, 0x1);
9758 if (board_config != ALC882_AUTO)
9759 setup_preset(codec, &alc882_presets[board_config]);
9761 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9762 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9763 /* FIXME: setup DAC5 */
9764 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9765 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9767 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9768 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9770 if (codec->vendor_id == 0x10ec0888)
9771 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9773 if (!spec->adc_nids && spec->input_mux) {
9775 spec->num_adc_nids = 0;
9776 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9778 hda_nid_t nid = alc882_adc_nids[i];
9779 unsigned int wcap = get_wcaps(codec, nid);
9781 wcap = get_wcaps_type(wcap);
9782 if (wcap != AC_WID_AUD_IN)
9784 spec->private_adc_nids[spec->num_adc_nids] = nid;
9785 err = snd_hda_get_connections(codec, nid, &cap, 1);
9788 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9789 spec->num_adc_nids++;
9791 spec->adc_nids = spec->private_adc_nids;
9792 spec->capsrc_nids = spec->private_capsrc_nids;
9795 set_capture_mixer(codec);
9796 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9798 spec->vmaster_nid = 0x0c;
9800 codec->patch_ops = alc_patch_ops;
9801 if (board_config == ALC882_AUTO)
9802 spec->init_hook = alc882_auto_init;
9803 #ifdef CONFIG_SND_HDA_POWER_SAVE
9804 if (!spec->loopback.amplist)
9805 spec->loopback.amplist = alc882_loopbacks;
9807 codec->proc_widget_hook = print_realtek_coef;
9817 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9818 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9820 #define alc262_dac_nids alc260_dac_nids
9821 #define alc262_adc_nids alc882_adc_nids
9822 #define alc262_adc_nids_alt alc882_adc_nids_alt
9823 #define alc262_capsrc_nids alc882_capsrc_nids
9824 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9826 #define alc262_modes alc260_modes
9827 #define alc262_capture_source alc882_capture_source
9829 static hda_nid_t alc262_dmic_adc_nids[1] = {
9834 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9836 static struct snd_kcontrol_new alc262_base_mixer[] = {
9837 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9838 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9839 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9840 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9841 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9842 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9843 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9844 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9845 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9846 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9847 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9848 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9849 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9850 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9851 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9852 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9856 /* update HP, line and mono-out pins according to the master switch */
9857 static void alc262_hp_master_update(struct hda_codec *codec)
9859 struct alc_spec *spec = codec->spec;
9860 int val = spec->master_sw;
9863 snd_hda_codec_write_cache(codec, 0x1b, 0,
9864 AC_VERB_SET_PIN_WIDGET_CONTROL,
9866 snd_hda_codec_write_cache(codec, 0x15, 0,
9867 AC_VERB_SET_PIN_WIDGET_CONTROL,
9869 /* mono (speaker) depending on the HP jack sense */
9870 val = val && !spec->jack_present;
9871 snd_hda_codec_write_cache(codec, 0x16, 0,
9872 AC_VERB_SET_PIN_WIDGET_CONTROL,
9876 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9878 struct alc_spec *spec = codec->spec;
9879 unsigned int presence;
9880 presence = snd_hda_codec_read(codec, 0x1b, 0,
9881 AC_VERB_GET_PIN_SENSE, 0);
9882 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9883 alc262_hp_master_update(codec);
9886 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9888 if ((res >> 26) != ALC880_HP_EVENT)
9890 alc262_hp_bpc_automute(codec);
9893 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9895 struct alc_spec *spec = codec->spec;
9896 unsigned int presence;
9897 presence = snd_hda_codec_read(codec, 0x15, 0,
9898 AC_VERB_GET_PIN_SENSE, 0);
9899 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9900 alc262_hp_master_update(codec);
9903 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9906 if ((res >> 26) != ALC880_HP_EVENT)
9908 alc262_hp_wildwest_automute(codec);
9911 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9913 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9914 struct snd_ctl_elem_value *ucontrol)
9916 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9917 struct alc_spec *spec = codec->spec;
9918 int val = !!*ucontrol->value.integer.value;
9920 if (val == spec->master_sw)
9922 spec->master_sw = val;
9923 alc262_hp_master_update(codec);
9927 #define ALC262_HP_MASTER_SWITCH \
9929 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9930 .name = "Master Playback Switch", \
9931 .info = snd_ctl_boolean_mono_info, \
9932 .get = alc262_hp_master_sw_get, \
9933 .put = alc262_hp_master_sw_put, \
9936 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9937 ALC262_HP_MASTER_SWITCH,
9938 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9939 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9940 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9941 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9943 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9945 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9946 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9947 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9948 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9949 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9950 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9951 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9952 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9953 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9954 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9955 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9956 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9960 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9961 ALC262_HP_MASTER_SWITCH,
9962 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9963 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9964 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9965 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9966 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9968 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9970 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9971 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9972 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9973 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9974 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9975 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9976 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9980 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9981 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9982 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9983 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9987 /* mute/unmute internal speaker according to the hp jack and mute state */
9988 static void alc262_hp_t5735_setup(struct hda_codec *codec)
9990 struct alc_spec *spec = codec->spec;
9992 spec->autocfg.hp_pins[0] = 0x15;
9993 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9996 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9997 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9998 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9999 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10000 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10001 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10002 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10003 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10007 static struct hda_verb alc262_hp_t5735_verbs[] = {
10008 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10009 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10011 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10015 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10016 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10017 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10018 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10019 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10020 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10021 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10025 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10026 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10027 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10028 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10029 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10030 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10031 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10032 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10033 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10035 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10039 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10046 /* bind hp and internal speaker mute (with plug check) as master switch */
10047 static void alc262_hippo_master_update(struct hda_codec *codec)
10049 struct alc_spec *spec = codec->spec;
10050 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10051 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10052 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10056 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10057 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10058 HDA_AMP_MUTE, mute);
10059 /* mute internal speaker per jack sense */
10060 if (spec->jack_present)
10061 mute = HDA_AMP_MUTE;
10063 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10064 HDA_AMP_MUTE, mute);
10065 if (speaker_nid && speaker_nid != line_nid)
10066 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10067 HDA_AMP_MUTE, mute);
10070 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10072 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10073 struct snd_ctl_elem_value *ucontrol)
10075 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10076 struct alc_spec *spec = codec->spec;
10077 int val = !!*ucontrol->value.integer.value;
10079 if (val == spec->master_sw)
10081 spec->master_sw = val;
10082 alc262_hippo_master_update(codec);
10086 #define ALC262_HIPPO_MASTER_SWITCH \
10088 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10089 .name = "Master Playback Switch", \
10090 .info = snd_ctl_boolean_mono_info, \
10091 .get = alc262_hippo_master_sw_get, \
10092 .put = alc262_hippo_master_sw_put, \
10095 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10096 ALC262_HIPPO_MASTER_SWITCH,
10097 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10098 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10099 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10100 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10101 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10102 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10103 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10104 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10105 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10106 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10107 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10108 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10112 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10113 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10114 ALC262_HIPPO_MASTER_SWITCH,
10115 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10116 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10117 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10118 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10120 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10121 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10122 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10123 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10124 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10128 /* mute/unmute internal speaker according to the hp jack and mute state */
10129 static void alc262_hippo_automute(struct hda_codec *codec)
10131 struct alc_spec *spec = codec->spec;
10132 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10133 unsigned int present;
10135 /* need to execute and sync at first */
10136 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10137 present = snd_hda_codec_read(codec, hp_nid, 0,
10138 AC_VERB_GET_PIN_SENSE, 0);
10139 spec->jack_present = (present & 0x80000000) != 0;
10140 alc262_hippo_master_update(codec);
10143 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10145 if ((res >> 26) != ALC880_HP_EVENT)
10147 alc262_hippo_automute(codec);
10150 static void alc262_hippo_setup(struct hda_codec *codec)
10152 struct alc_spec *spec = codec->spec;
10154 spec->autocfg.hp_pins[0] = 0x15;
10155 spec->autocfg.speaker_pins[0] = 0x14;
10158 static void alc262_hippo1_setup(struct hda_codec *codec)
10160 struct alc_spec *spec = codec->spec;
10162 spec->autocfg.hp_pins[0] = 0x1b;
10163 spec->autocfg.speaker_pins[0] = 0x14;
10167 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10168 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10169 ALC262_HIPPO_MASTER_SWITCH,
10170 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10171 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10172 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10173 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10177 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10178 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10179 ALC262_HIPPO_MASTER_SWITCH,
10180 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10181 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10182 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10183 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10184 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10188 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10189 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10190 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10191 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10192 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10193 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10194 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10195 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10196 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10197 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10198 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10199 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10200 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10204 static struct hda_verb alc262_tyan_verbs[] = {
10205 /* Headphone automute */
10206 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10207 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10208 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10210 /* P11 AUX_IN, white 4-pin connector */
10211 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10212 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10213 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10214 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10219 /* unsolicited event for HP jack sensing */
10220 static void alc262_tyan_setup(struct hda_codec *codec)
10222 struct alc_spec *spec = codec->spec;
10224 spec->autocfg.hp_pins[0] = 0x1b;
10225 spec->autocfg.speaker_pins[0] = 0x15;
10229 #define alc262_capture_mixer alc882_capture_mixer
10230 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10233 * generic initialization of ADC, input mixers and output mixers
10235 static struct hda_verb alc262_init_verbs[] = {
10237 * Unmute ADC0-2 and set the default input to mic-in
10239 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10240 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10241 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10242 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10243 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10244 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10246 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10248 * Note: PASD motherboards uses the Line In 2 as the input for
10249 * front panel mic (mic 2)
10251 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10254 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10255 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10256 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10259 * Set up output mixers (0x0c - 0x0e)
10261 /* set vol=0 to output mixers */
10262 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10263 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10264 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10265 /* set up input amps for analog loopback */
10266 /* Amp Indices: DAC = 0, mixer = 1 */
10267 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10268 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10269 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10270 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10271 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10272 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10274 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10275 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10276 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10277 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10278 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10279 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10281 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10282 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10283 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10284 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10285 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10287 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10288 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10290 /* FIXME: use matrix-type input source selection */
10291 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10292 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10293 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10294 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10295 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10296 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10299 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10300 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10301 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10303 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10304 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10305 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10306 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10311 static struct hda_verb alc262_eapd_verbs[] = {
10312 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10313 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10317 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10318 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10319 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10320 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10322 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10323 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10327 static struct hda_verb alc262_sony_unsol_verbs[] = {
10328 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10329 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10330 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10332 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10333 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10337 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10338 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10339 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10340 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10341 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10342 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10346 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10347 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10348 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10349 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10350 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10351 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10352 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10353 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10354 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10358 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10360 struct alc_spec *spec = codec->spec;
10362 spec->autocfg.hp_pins[0] = 0x15;
10363 spec->autocfg.speaker_pins[0] = 0x14;
10364 spec->ext_mic.pin = 0x18;
10365 spec->ext_mic.mux_idx = 0;
10366 spec->int_mic.pin = 0x12;
10367 spec->int_mic.mux_idx = 9;
10368 spec->auto_mic = 1;
10374 * 0x16 = internal speaker
10375 * 0x18 = external mic
10378 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10379 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10380 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10382 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10383 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10384 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10386 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10387 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10391 static struct hda_verb alc262_nec_verbs[] = {
10392 /* Unmute Speaker */
10393 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10396 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10397 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10399 /* External mic to headphone */
10400 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10401 /* External mic to speaker */
10402 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10408 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10409 * 0x1b = port replicator headphone out
10412 #define ALC_HP_EVENT 0x37
10414 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10415 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10416 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10417 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10418 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10422 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10423 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10424 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10428 static struct hda_input_mux alc262_fujitsu_capture_source = {
10432 { "Int Mic", 0x1 },
10437 static struct hda_input_mux alc262_HP_capture_source = {
10441 { "Front Mic", 0x1 },
10448 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10452 { "Front Mic", 0x2 },
10458 /* mute/unmute internal speaker according to the hp jacks and mute state */
10459 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10461 struct alc_spec *spec = codec->spec;
10464 if (force || !spec->sense_updated) {
10465 unsigned int present;
10466 /* need to execute and sync at first */
10467 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10468 /* check laptop HP jack */
10469 present = snd_hda_codec_read(codec, 0x14, 0,
10470 AC_VERB_GET_PIN_SENSE, 0);
10471 /* need to execute and sync at first */
10472 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10473 /* check docking HP jack */
10474 present |= snd_hda_codec_read(codec, 0x1b, 0,
10475 AC_VERB_GET_PIN_SENSE, 0);
10476 if (present & AC_PINSENSE_PRESENCE)
10477 spec->jack_present = 1;
10479 spec->jack_present = 0;
10480 spec->sense_updated = 1;
10482 /* unmute internal speaker only if both HPs are unplugged and
10483 * master switch is on
10485 if (spec->jack_present)
10486 mute = HDA_AMP_MUTE;
10488 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10489 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10490 HDA_AMP_MUTE, mute);
10493 /* unsolicited event for HP jack sensing */
10494 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10497 if ((res >> 26) != ALC_HP_EVENT)
10499 alc262_fujitsu_automute(codec, 1);
10502 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10504 alc262_fujitsu_automute(codec, 1);
10507 /* bind volumes of both NID 0x0c and 0x0d */
10508 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10509 .ops = &snd_hda_bind_vol,
10511 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10512 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10517 /* mute/unmute internal speaker according to the hp jack and mute state */
10518 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10520 struct alc_spec *spec = codec->spec;
10523 if (force || !spec->sense_updated) {
10524 unsigned int present_int_hp;
10525 /* need to execute and sync at first */
10526 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10527 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10528 AC_VERB_GET_PIN_SENSE, 0);
10529 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10530 spec->sense_updated = 1;
10532 if (spec->jack_present) {
10533 /* mute internal speaker */
10534 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10535 HDA_AMP_MUTE, HDA_AMP_MUTE);
10536 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10537 HDA_AMP_MUTE, HDA_AMP_MUTE);
10539 /* unmute internal speaker if necessary */
10540 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10541 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10542 HDA_AMP_MUTE, mute);
10543 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10544 HDA_AMP_MUTE, mute);
10548 /* unsolicited event for HP jack sensing */
10549 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10552 if ((res >> 26) != ALC_HP_EVENT)
10554 alc262_lenovo_3000_automute(codec, 1);
10557 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10558 int dir, int idx, long *valp)
10562 for (i = 0; i < 2; i++, valp++)
10563 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10565 *valp ? 0 : HDA_AMP_MUTE);
10569 /* bind hp and internal speaker mute (with plug check) */
10570 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10571 struct snd_ctl_elem_value *ucontrol)
10573 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10574 long *valp = ucontrol->value.integer.value;
10577 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10578 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10580 alc262_fujitsu_automute(codec, 0);
10584 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10585 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10587 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10588 .name = "Master Playback Switch",
10589 .info = snd_hda_mixer_amp_switch_info,
10590 .get = snd_hda_mixer_amp_switch_get,
10591 .put = alc262_fujitsu_master_sw_put,
10592 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10594 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10595 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10596 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10597 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10598 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10599 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10600 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10601 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10605 /* bind hp and internal speaker mute (with plug check) */
10606 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10607 struct snd_ctl_elem_value *ucontrol)
10609 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10610 long *valp = ucontrol->value.integer.value;
10613 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10615 alc262_lenovo_3000_automute(codec, 0);
10619 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10620 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10622 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10623 .name = "Master Playback Switch",
10624 .info = snd_hda_mixer_amp_switch_info,
10625 .get = snd_hda_mixer_amp_switch_get,
10626 .put = alc262_lenovo_3000_master_sw_put,
10627 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10629 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10630 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10631 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10632 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10633 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10634 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10635 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10636 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10640 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10641 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10642 ALC262_HIPPO_MASTER_SWITCH,
10643 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10644 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10645 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10646 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10647 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10648 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10652 /* additional init verbs for Benq laptops */
10653 static struct hda_verb alc262_EAPD_verbs[] = {
10654 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10655 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10659 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10660 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10661 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10663 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10664 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10668 /* Samsung Q1 Ultra Vista model setup */
10669 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10670 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10671 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10672 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10673 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10674 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10675 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10679 static struct hda_verb alc262_ultra_verbs[] = {
10681 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10682 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10683 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10685 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10686 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10687 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10688 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10690 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10692 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10693 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10694 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10696 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10697 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10698 /* ADC, choose mic */
10699 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10700 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10701 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10702 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10703 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10704 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10705 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10706 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10707 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10708 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10712 /* mute/unmute internal speaker according to the hp jack and mute state */
10713 static void alc262_ultra_automute(struct hda_codec *codec)
10715 struct alc_spec *spec = codec->spec;
10719 /* auto-mute only when HP is used as HP */
10720 if (!spec->cur_mux[0]) {
10721 unsigned int present;
10722 /* need to execute and sync at first */
10723 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10724 present = snd_hda_codec_read(codec, 0x15, 0,
10725 AC_VERB_GET_PIN_SENSE, 0);
10726 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10727 if (spec->jack_present)
10728 mute = HDA_AMP_MUTE;
10730 /* mute/unmute internal speaker */
10731 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10732 HDA_AMP_MUTE, mute);
10733 /* mute/unmute HP */
10734 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10735 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10738 /* unsolicited event for HP jack sensing */
10739 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10742 if ((res >> 26) != ALC880_HP_EVENT)
10744 alc262_ultra_automute(codec);
10747 static struct hda_input_mux alc262_ultra_capture_source = {
10751 { "Headphone", 0x7 },
10755 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10756 struct snd_ctl_elem_value *ucontrol)
10758 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10759 struct alc_spec *spec = codec->spec;
10762 ret = alc_mux_enum_put(kcontrol, ucontrol);
10765 /* reprogram the HP pin as mic or HP according to the input source */
10766 snd_hda_codec_write_cache(codec, 0x15, 0,
10767 AC_VERB_SET_PIN_WIDGET_CONTROL,
10768 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10769 alc262_ultra_automute(codec); /* mute/unmute HP */
10773 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10774 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10775 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10777 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10778 .name = "Capture Source",
10779 .info = alc_mux_enum_info,
10780 .get = alc_mux_enum_get,
10781 .put = alc262_ultra_mux_enum_put,
10786 /* add playback controls from the parsed DAC table */
10787 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10788 const struct auto_pin_cfg *cfg)
10793 spec->multiout.num_dacs = 1; /* only use one dac */
10794 spec->multiout.dac_nids = spec->private_dac_nids;
10795 spec->multiout.dac_nids[0] = 2;
10797 nid = cfg->line_out_pins[0];
10799 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10800 "Front Playback Volume",
10801 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10804 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10805 "Front Playback Switch",
10806 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10811 nid = cfg->speaker_pins[0];
10814 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10815 "Speaker Playback Volume",
10816 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10820 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10821 "Speaker Playback Switch",
10822 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10827 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10828 "Speaker Playback Switch",
10829 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10835 nid = cfg->hp_pins[0];
10837 /* spec->multiout.hp_nid = 2; */
10839 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10840 "Headphone Playback Volume",
10841 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10845 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10846 "Headphone Playback Switch",
10847 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10852 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10853 "Headphone Playback Switch",
10854 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10863 #define alc262_auto_create_input_ctls \
10864 alc880_auto_create_input_ctls
10867 * generic initialization of ADC, input mixers and output mixers
10869 static struct hda_verb alc262_volume_init_verbs[] = {
10871 * Unmute ADC0-2 and set the default input to mic-in
10873 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10874 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10875 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10876 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10877 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10878 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10880 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10882 * Note: PASD motherboards uses the Line In 2 as the input for
10883 * front panel mic (mic 2)
10885 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10886 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10887 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10888 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10889 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10890 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10893 * Set up output mixers (0x0c - 0x0f)
10895 /* set vol=0 to output mixers */
10896 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10897 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10898 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10900 /* set up input amps for analog loopback */
10901 /* Amp Indices: DAC = 0, mixer = 1 */
10902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10903 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10904 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10905 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10906 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10907 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10909 /* FIXME: use matrix-type input source selection */
10910 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10911 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10912 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10913 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10914 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10915 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10917 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10918 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10919 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10920 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10922 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10923 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10924 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10925 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10930 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10932 * Unmute ADC0-2 and set the default input to mic-in
10934 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10935 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10936 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10937 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10938 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10939 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10941 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10943 * Note: PASD motherboards uses the Line In 2 as the input for
10944 * front panel mic (mic 2)
10946 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10947 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10948 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10949 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10950 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10951 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10952 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10953 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10956 * Set up output mixers (0x0c - 0x0e)
10958 /* set vol=0 to output mixers */
10959 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10960 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10961 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10963 /* set up input amps for analog loopback */
10964 /* Amp Indices: DAC = 0, mixer = 1 */
10965 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10966 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10967 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10968 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10969 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10970 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10972 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10973 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10974 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10976 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10977 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10979 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10980 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10982 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10983 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10984 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10985 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10986 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10988 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10989 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10990 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10991 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10992 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10993 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10996 /* FIXME: use matrix-type input source selection */
10997 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
10998 /* Input mixer1: only unmute Mic */
10999 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11000 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11001 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11002 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11003 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11004 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11005 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11006 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11007 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11009 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11010 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11011 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11012 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11013 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11014 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11015 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11016 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11017 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11019 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11020 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11021 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11022 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11023 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11024 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11025 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11026 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11027 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11029 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11034 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11036 * Unmute ADC0-2 and set the default input to mic-in
11038 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11039 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11040 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11041 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11042 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11043 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11045 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11047 * Note: PASD motherboards uses the Line In 2 as the input for front
11048 * panel mic (mic 2)
11050 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11051 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11052 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11053 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11054 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11055 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11056 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11057 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11058 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11060 * Set up output mixers (0x0c - 0x0e)
11062 /* set vol=0 to output mixers */
11063 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11064 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11065 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11067 /* set up input amps for analog loopback */
11068 /* Amp Indices: DAC = 0, mixer = 1 */
11069 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11070 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11071 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11072 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11073 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11074 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11077 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11078 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11079 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11080 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11081 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11082 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11083 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11085 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11086 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11088 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11089 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11091 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11092 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11093 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11094 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11095 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11096 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11098 /* FIXME: use matrix-type input source selection */
11099 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11100 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11101 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11102 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11103 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11104 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11105 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11106 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11107 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11109 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11110 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11111 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11112 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11113 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11114 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11115 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11118 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11119 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11120 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11121 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11122 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11123 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11125 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11130 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11132 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11133 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11134 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11136 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11137 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11138 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11139 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11141 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11142 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11143 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11148 #ifdef CONFIG_SND_HDA_POWER_SAVE
11149 #define alc262_loopbacks alc880_loopbacks
11152 /* pcm configuration: identical with ALC880 */
11153 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11154 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11155 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11156 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11159 * BIOS auto configuration
11161 static int alc262_parse_auto_config(struct hda_codec *codec)
11163 struct alc_spec *spec = codec->spec;
11165 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11167 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11171 if (!spec->autocfg.line_outs) {
11172 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11173 spec->multiout.max_channels = 2;
11174 spec->no_analog = 1;
11177 return 0; /* can't find valid BIOS pin config */
11179 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11182 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11186 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11189 if (spec->autocfg.dig_outs) {
11190 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11191 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11193 if (spec->autocfg.dig_in_pin)
11194 spec->dig_in_nid = ALC262_DIGIN_NID;
11196 if (spec->kctls.list)
11197 add_mixer(spec, spec->kctls.list);
11199 add_verb(spec, alc262_volume_init_verbs);
11200 spec->num_mux_defs = 1;
11201 spec->input_mux = &spec->private_imux[0];
11203 err = alc_auto_add_mic_boost(codec);
11207 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11212 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11213 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11214 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11215 #define alc262_auto_init_input_src alc882_auto_init_input_src
11218 /* init callback for auto-configuration model -- overriding the default init */
11219 static void alc262_auto_init(struct hda_codec *codec)
11221 struct alc_spec *spec = codec->spec;
11222 alc262_auto_init_multi_out(codec);
11223 alc262_auto_init_hp_out(codec);
11224 alc262_auto_init_analog_input(codec);
11225 alc262_auto_init_input_src(codec);
11226 if (spec->unsol_event)
11227 alc_inithook(codec);
11231 * configuration and preset
11233 static const char *alc262_models[ALC262_MODEL_LAST] = {
11234 [ALC262_BASIC] = "basic",
11235 [ALC262_HIPPO] = "hippo",
11236 [ALC262_HIPPO_1] = "hippo_1",
11237 [ALC262_FUJITSU] = "fujitsu",
11238 [ALC262_HP_BPC] = "hp-bpc",
11239 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11240 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11241 [ALC262_HP_RP5700] = "hp-rp5700",
11242 [ALC262_BENQ_ED8] = "benq",
11243 [ALC262_BENQ_T31] = "benq-t31",
11244 [ALC262_SONY_ASSAMD] = "sony-assamd",
11245 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11246 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11247 [ALC262_ULTRA] = "ultra",
11248 [ALC262_LENOVO_3000] = "lenovo-3000",
11249 [ALC262_NEC] = "nec",
11250 [ALC262_TYAN] = "tyan",
11251 [ALC262_AUTO] = "auto",
11254 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11255 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11256 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11257 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11259 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11261 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11263 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11264 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11265 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11266 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11267 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11268 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11269 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11270 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11271 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11272 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11273 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11274 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11275 ALC262_HP_TC_T5735),
11276 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11277 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11278 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11279 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11280 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11281 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11282 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11283 ALC262_SONY_ASSAMD),
11284 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11285 ALC262_TOSHIBA_RX1),
11286 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11287 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11288 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11289 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11290 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11292 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11293 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11294 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11295 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11296 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11300 static struct alc_config_preset alc262_presets[] = {
11302 .mixers = { alc262_base_mixer },
11303 .init_verbs = { alc262_init_verbs },
11304 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11305 .dac_nids = alc262_dac_nids,
11307 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11308 .channel_mode = alc262_modes,
11309 .input_mux = &alc262_capture_source,
11312 .mixers = { alc262_hippo_mixer },
11313 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11314 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11315 .dac_nids = alc262_dac_nids,
11317 .dig_out_nid = ALC262_DIGOUT_NID,
11318 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11319 .channel_mode = alc262_modes,
11320 .input_mux = &alc262_capture_source,
11321 .unsol_event = alc262_hippo_unsol_event,
11322 .setup = alc262_hippo_setup,
11323 .init_hook = alc262_hippo_automute,
11325 [ALC262_HIPPO_1] = {
11326 .mixers = { alc262_hippo1_mixer },
11327 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11328 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11329 .dac_nids = alc262_dac_nids,
11331 .dig_out_nid = ALC262_DIGOUT_NID,
11332 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11333 .channel_mode = alc262_modes,
11334 .input_mux = &alc262_capture_source,
11335 .unsol_event = alc262_hippo_unsol_event,
11336 .setup = alc262_hippo1_setup,
11337 .init_hook = alc262_hippo_automute,
11339 [ALC262_FUJITSU] = {
11340 .mixers = { alc262_fujitsu_mixer },
11341 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11342 alc262_fujitsu_unsol_verbs },
11343 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11344 .dac_nids = alc262_dac_nids,
11346 .dig_out_nid = ALC262_DIGOUT_NID,
11347 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11348 .channel_mode = alc262_modes,
11349 .input_mux = &alc262_fujitsu_capture_source,
11350 .unsol_event = alc262_fujitsu_unsol_event,
11351 .init_hook = alc262_fujitsu_init_hook,
11353 [ALC262_HP_BPC] = {
11354 .mixers = { alc262_HP_BPC_mixer },
11355 .init_verbs = { alc262_HP_BPC_init_verbs },
11356 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11357 .dac_nids = alc262_dac_nids,
11359 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11360 .channel_mode = alc262_modes,
11361 .input_mux = &alc262_HP_capture_source,
11362 .unsol_event = alc262_hp_bpc_unsol_event,
11363 .init_hook = alc262_hp_bpc_automute,
11365 [ALC262_HP_BPC_D7000_WF] = {
11366 .mixers = { alc262_HP_BPC_WildWest_mixer },
11367 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11368 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11369 .dac_nids = alc262_dac_nids,
11371 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11372 .channel_mode = alc262_modes,
11373 .input_mux = &alc262_HP_D7000_capture_source,
11374 .unsol_event = alc262_hp_wildwest_unsol_event,
11375 .init_hook = alc262_hp_wildwest_automute,
11377 [ALC262_HP_BPC_D7000_WL] = {
11378 .mixers = { alc262_HP_BPC_WildWest_mixer,
11379 alc262_HP_BPC_WildWest_option_mixer },
11380 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11381 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11382 .dac_nids = alc262_dac_nids,
11384 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11385 .channel_mode = alc262_modes,
11386 .input_mux = &alc262_HP_D7000_capture_source,
11387 .unsol_event = alc262_hp_wildwest_unsol_event,
11388 .init_hook = alc262_hp_wildwest_automute,
11390 [ALC262_HP_TC_T5735] = {
11391 .mixers = { alc262_hp_t5735_mixer },
11392 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11393 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11394 .dac_nids = alc262_dac_nids,
11396 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11397 .channel_mode = alc262_modes,
11398 .input_mux = &alc262_capture_source,
11399 .unsol_event = alc_automute_amp_unsol_event,
11400 .setup = alc262_hp_t5735_setup,
11401 .init_hook = alc_automute_amp,
11403 [ALC262_HP_RP5700] = {
11404 .mixers = { alc262_hp_rp5700_mixer },
11405 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11406 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11407 .dac_nids = alc262_dac_nids,
11408 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11409 .channel_mode = alc262_modes,
11410 .input_mux = &alc262_hp_rp5700_capture_source,
11412 [ALC262_BENQ_ED8] = {
11413 .mixers = { alc262_base_mixer },
11414 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11415 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11416 .dac_nids = alc262_dac_nids,
11418 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11419 .channel_mode = alc262_modes,
11420 .input_mux = &alc262_capture_source,
11422 [ALC262_SONY_ASSAMD] = {
11423 .mixers = { alc262_sony_mixer },
11424 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11425 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11426 .dac_nids = alc262_dac_nids,
11428 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11429 .channel_mode = alc262_modes,
11430 .input_mux = &alc262_capture_source,
11431 .unsol_event = alc262_hippo_unsol_event,
11432 .setup = alc262_hippo_setup,
11433 .init_hook = alc262_hippo_automute,
11435 [ALC262_BENQ_T31] = {
11436 .mixers = { alc262_benq_t31_mixer },
11437 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11438 alc_hp15_unsol_verbs },
11439 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11440 .dac_nids = alc262_dac_nids,
11442 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11443 .channel_mode = alc262_modes,
11444 .input_mux = &alc262_capture_source,
11445 .unsol_event = alc262_hippo_unsol_event,
11446 .setup = alc262_hippo_setup,
11447 .init_hook = alc262_hippo_automute,
11450 .mixers = { alc262_ultra_mixer },
11451 .cap_mixer = alc262_ultra_capture_mixer,
11452 .init_verbs = { alc262_ultra_verbs },
11453 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11454 .dac_nids = alc262_dac_nids,
11455 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11456 .channel_mode = alc262_modes,
11457 .input_mux = &alc262_ultra_capture_source,
11458 .adc_nids = alc262_adc_nids, /* ADC0 */
11459 .capsrc_nids = alc262_capsrc_nids,
11460 .num_adc_nids = 1, /* single ADC */
11461 .unsol_event = alc262_ultra_unsol_event,
11462 .init_hook = alc262_ultra_automute,
11464 [ALC262_LENOVO_3000] = {
11465 .mixers = { alc262_lenovo_3000_mixer },
11466 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11467 alc262_lenovo_3000_unsol_verbs },
11468 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11469 .dac_nids = alc262_dac_nids,
11471 .dig_out_nid = ALC262_DIGOUT_NID,
11472 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11473 .channel_mode = alc262_modes,
11474 .input_mux = &alc262_fujitsu_capture_source,
11475 .unsol_event = alc262_lenovo_3000_unsol_event,
11478 .mixers = { alc262_nec_mixer },
11479 .init_verbs = { alc262_nec_verbs },
11480 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11481 .dac_nids = alc262_dac_nids,
11483 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11484 .channel_mode = alc262_modes,
11485 .input_mux = &alc262_capture_source,
11487 [ALC262_TOSHIBA_S06] = {
11488 .mixers = { alc262_toshiba_s06_mixer },
11489 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11490 alc262_eapd_verbs },
11491 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11492 .capsrc_nids = alc262_dmic_capsrc_nids,
11493 .dac_nids = alc262_dac_nids,
11494 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11495 .num_adc_nids = 1, /* single ADC */
11496 .dig_out_nid = ALC262_DIGOUT_NID,
11497 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11498 .channel_mode = alc262_modes,
11499 .unsol_event = alc_sku_unsol_event,
11500 .setup = alc262_toshiba_s06_setup,
11501 .init_hook = alc_inithook,
11503 [ALC262_TOSHIBA_RX1] = {
11504 .mixers = { alc262_toshiba_rx1_mixer },
11505 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11506 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11507 .dac_nids = alc262_dac_nids,
11509 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11510 .channel_mode = alc262_modes,
11511 .input_mux = &alc262_capture_source,
11512 .unsol_event = alc262_hippo_unsol_event,
11513 .setup = alc262_hippo_setup,
11514 .init_hook = alc262_hippo_automute,
11517 .mixers = { alc262_tyan_mixer },
11518 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11519 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11520 .dac_nids = alc262_dac_nids,
11522 .dig_out_nid = ALC262_DIGOUT_NID,
11523 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11524 .channel_mode = alc262_modes,
11525 .input_mux = &alc262_capture_source,
11526 .unsol_event = alc_automute_amp_unsol_event,
11527 .setup = alc262_tyan_setup,
11528 .init_hook = alc_automute_amp,
11532 static int patch_alc262(struct hda_codec *codec)
11534 struct alc_spec *spec;
11538 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11542 codec->spec = spec;
11544 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11549 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11550 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11551 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11552 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11556 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11558 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11562 if (board_config < 0) {
11563 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11565 board_config = ALC262_AUTO;
11568 if (board_config == ALC262_AUTO) {
11569 /* automatic parse from the BIOS config */
11570 err = alc262_parse_auto_config(codec);
11576 "hda_codec: Cannot set up configuration "
11577 "from BIOS. Using base mode...\n");
11578 board_config = ALC262_BASIC;
11582 if (!spec->no_analog) {
11583 err = snd_hda_attach_beep_device(codec, 0x1);
11590 if (board_config != ALC262_AUTO)
11591 setup_preset(codec, &alc262_presets[board_config]);
11593 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11594 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11596 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11597 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11599 if (!spec->adc_nids && spec->input_mux) {
11601 /* check whether the digital-mic has to be supported */
11602 for (i = 0; i < spec->input_mux->num_items; i++) {
11603 if (spec->input_mux->items[i].index >= 9)
11606 if (i < spec->input_mux->num_items) {
11607 /* use only ADC0 */
11608 spec->adc_nids = alc262_dmic_adc_nids;
11609 spec->num_adc_nids = 1;
11610 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11612 /* all analog inputs */
11613 /* check whether NID 0x07 is valid */
11614 unsigned int wcap = get_wcaps(codec, 0x07);
11617 wcap = get_wcaps_type(wcap);
11618 if (wcap != AC_WID_AUD_IN) {
11619 spec->adc_nids = alc262_adc_nids_alt;
11620 spec->num_adc_nids =
11621 ARRAY_SIZE(alc262_adc_nids_alt);
11622 spec->capsrc_nids = alc262_capsrc_nids_alt;
11624 spec->adc_nids = alc262_adc_nids;
11625 spec->num_adc_nids =
11626 ARRAY_SIZE(alc262_adc_nids);
11627 spec->capsrc_nids = alc262_capsrc_nids;
11631 if (!spec->cap_mixer && !spec->no_analog)
11632 set_capture_mixer(codec);
11633 if (!spec->no_analog)
11634 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11636 spec->vmaster_nid = 0x0c;
11638 codec->patch_ops = alc_patch_ops;
11639 if (board_config == ALC262_AUTO)
11640 spec->init_hook = alc262_auto_init;
11641 #ifdef CONFIG_SND_HDA_POWER_SAVE
11642 if (!spec->loopback.amplist)
11643 spec->loopback.amplist = alc262_loopbacks;
11645 codec->proc_widget_hook = print_realtek_coef;
11651 * ALC268 channel source setting (2 channel)
11653 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11654 #define alc268_modes alc260_modes
11656 static hda_nid_t alc268_dac_nids[2] = {
11661 static hda_nid_t alc268_adc_nids[2] = {
11666 static hda_nid_t alc268_adc_nids_alt[1] = {
11671 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11673 static struct snd_kcontrol_new alc268_base_mixer[] = {
11674 /* output mixer control */
11675 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11676 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11677 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11678 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11679 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11680 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11681 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11685 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11686 /* output mixer control */
11687 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11688 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11689 ALC262_HIPPO_MASTER_SWITCH,
11690 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11691 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11692 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11696 /* bind Beep switches of both NID 0x0f and 0x10 */
11697 static struct hda_bind_ctls alc268_bind_beep_sw = {
11698 .ops = &snd_hda_bind_sw,
11700 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11701 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11706 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11707 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11708 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11712 static struct hda_verb alc268_eapd_verbs[] = {
11713 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11714 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11718 /* Toshiba specific */
11719 static struct hda_verb alc268_toshiba_verbs[] = {
11720 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11724 /* Acer specific */
11725 /* bind volumes of both NID 0x02 and 0x03 */
11726 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11727 .ops = &snd_hda_bind_vol,
11729 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11730 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11735 /* mute/unmute internal speaker according to the hp jack and mute state */
11736 static void alc268_acer_automute(struct hda_codec *codec, int force)
11738 struct alc_spec *spec = codec->spec;
11741 if (force || !spec->sense_updated) {
11742 unsigned int present;
11743 present = snd_hda_codec_read(codec, 0x14, 0,
11744 AC_VERB_GET_PIN_SENSE, 0);
11745 spec->jack_present = (present & 0x80000000) != 0;
11746 spec->sense_updated = 1;
11748 if (spec->jack_present)
11749 mute = HDA_AMP_MUTE; /* mute internal speaker */
11750 else /* unmute internal speaker if necessary */
11751 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11752 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11753 HDA_AMP_MUTE, mute);
11757 /* bind hp and internal speaker mute (with plug check) */
11758 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11759 struct snd_ctl_elem_value *ucontrol)
11761 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11762 long *valp = ucontrol->value.integer.value;
11765 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11767 alc268_acer_automute(codec, 0);
11771 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11772 /* output mixer control */
11773 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11775 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11776 .name = "Master Playback Switch",
11777 .info = snd_hda_mixer_amp_switch_info,
11778 .get = snd_hda_mixer_amp_switch_get,
11779 .put = alc268_acer_master_sw_put,
11780 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11782 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11786 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11787 /* output mixer control */
11788 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11790 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11791 .name = "Master Playback Switch",
11792 .info = snd_hda_mixer_amp_switch_info,
11793 .get = snd_hda_mixer_amp_switch_get,
11794 .put = alc268_acer_master_sw_put,
11795 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11797 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11798 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11799 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11803 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11804 /* output mixer control */
11805 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11807 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11808 .name = "Master Playback Switch",
11809 .info = snd_hda_mixer_amp_switch_info,
11810 .get = snd_hda_mixer_amp_switch_get,
11811 .put = alc268_acer_master_sw_put,
11812 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11814 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11815 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11819 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11820 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11821 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11822 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11823 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11824 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11825 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11829 static struct hda_verb alc268_acer_verbs[] = {
11830 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11831 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11832 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11833 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11834 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11835 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11836 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11840 /* unsolicited event for HP jack sensing */
11841 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11842 #define alc268_toshiba_setup alc262_hippo_setup
11843 #define alc268_toshiba_automute alc262_hippo_automute
11845 static void alc268_acer_unsol_event(struct hda_codec *codec,
11848 if ((res >> 26) != ALC880_HP_EVENT)
11850 alc268_acer_automute(codec, 1);
11853 static void alc268_acer_init_hook(struct hda_codec *codec)
11855 alc268_acer_automute(codec, 1);
11858 /* toggle speaker-output according to the hp-jack state */
11859 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11861 unsigned int present;
11862 unsigned char bits;
11864 present = snd_hda_codec_read(codec, 0x15, 0,
11865 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11866 bits = present ? AMP_IN_MUTE(0) : 0;
11867 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11868 AMP_IN_MUTE(0), bits);
11869 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11870 AMP_IN_MUTE(0), bits);
11873 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11876 switch (res >> 26) {
11877 case ALC880_HP_EVENT:
11878 alc268_aspire_one_speaker_automute(codec);
11880 case ALC880_MIC_EVENT:
11881 alc_mic_automute(codec);
11886 static void alc268_acer_lc_setup(struct hda_codec *codec)
11888 struct alc_spec *spec = codec->spec;
11889 spec->ext_mic.pin = 0x18;
11890 spec->ext_mic.mux_idx = 0;
11891 spec->int_mic.pin = 0x12;
11892 spec->int_mic.mux_idx = 6;
11893 spec->auto_mic = 1;
11896 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11898 alc268_aspire_one_speaker_automute(codec);
11899 alc_mic_automute(codec);
11902 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11903 /* output mixer control */
11904 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11905 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11906 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11907 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11908 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11909 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11913 static struct hda_verb alc268_dell_verbs[] = {
11914 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11915 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11916 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11917 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11921 /* mute/unmute internal speaker according to the hp jack and mute state */
11922 static void alc268_dell_setup(struct hda_codec *codec)
11924 struct alc_spec *spec = codec->spec;
11926 spec->autocfg.hp_pins[0] = 0x15;
11927 spec->autocfg.speaker_pins[0] = 0x14;
11928 spec->ext_mic.pin = 0x18;
11929 spec->ext_mic.mux_idx = 0;
11930 spec->int_mic.pin = 0x19;
11931 spec->int_mic.mux_idx = 1;
11932 spec->auto_mic = 1;
11935 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11936 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11937 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11938 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11939 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11940 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11941 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11942 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11943 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11947 static struct hda_verb alc267_quanta_il1_verbs[] = {
11948 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11949 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11953 static void alc267_quanta_il1_setup(struct hda_codec *codec)
11955 struct alc_spec *spec = codec->spec;
11956 spec->autocfg.hp_pins[0] = 0x15;
11957 spec->autocfg.speaker_pins[0] = 0x14;
11958 spec->ext_mic.pin = 0x18;
11959 spec->ext_mic.mux_idx = 0;
11960 spec->int_mic.pin = 0x19;
11961 spec->int_mic.mux_idx = 1;
11962 spec->auto_mic = 1;
11966 * generic initialization of ADC, input mixers and output mixers
11968 static struct hda_verb alc268_base_init_verbs[] = {
11969 /* Unmute DAC0-1 and set vol = 0 */
11970 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11971 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11974 * Set up output mixers (0x0c - 0x0e)
11976 /* set vol=0 to output mixers */
11977 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11978 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11980 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11981 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11983 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11984 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11985 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11986 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11987 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11988 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11989 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11990 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11992 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11993 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11994 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11995 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11996 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11998 /* set PCBEEP vol = 0, mute connections */
11999 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12000 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12001 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12003 /* Unmute Selector 23h,24h and set the default input to mic-in */
12005 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12006 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12007 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12008 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12014 * generic initialization of ADC, input mixers and output mixers
12016 static struct hda_verb alc268_volume_init_verbs[] = {
12017 /* set output DAC */
12018 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12019 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12021 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12022 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12023 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12024 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12025 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12027 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12028 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12029 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12031 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12032 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12034 /* set PCBEEP vol = 0, mute connections */
12035 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12036 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12037 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12042 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12043 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12044 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12048 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12049 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12050 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12055 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12056 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12057 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12058 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12059 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12064 static struct hda_input_mux alc268_capture_source = {
12068 { "Front Mic", 0x1 },
12074 static struct hda_input_mux alc268_acer_capture_source = {
12078 { "Internal Mic", 0x1 },
12083 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12087 { "Internal Mic", 0x6 },
12092 #ifdef CONFIG_SND_DEBUG
12093 static struct snd_kcontrol_new alc268_test_mixer[] = {
12094 /* Volume widgets */
12095 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12096 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12097 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12098 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12099 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12100 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12101 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12102 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12103 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12104 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12105 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12106 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12107 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12108 /* The below appears problematic on some hardwares */
12109 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12110 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12111 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12112 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12113 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12115 /* Modes for retasking pin widgets */
12116 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12117 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12118 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12119 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12121 /* Controls for GPIO pins, assuming they are configured as outputs */
12122 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12123 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12124 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12125 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12127 /* Switches to allow the digital SPDIF output pin to be enabled.
12128 * The ALC268 does not have an SPDIF input.
12130 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12132 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12133 * this output to turn on an external amplifier.
12135 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12136 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12142 /* create input playback/capture controls for the given pin */
12143 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12144 const char *ctlname, int idx)
12150 sprintf(name, "%s Playback Volume", ctlname);
12162 if (spec->multiout.dac_nids[0] != dac &&
12163 spec->multiout.dac_nids[1] != dac) {
12164 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12165 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12169 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12172 sprintf(name, "%s Playback Switch", ctlname);
12174 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12175 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12177 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12178 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12184 /* add playback controls from the parsed DAC table */
12185 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12186 const struct auto_pin_cfg *cfg)
12191 spec->multiout.dac_nids = spec->private_dac_nids;
12193 nid = cfg->line_out_pins[0];
12196 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12200 err = alc268_new_analog_output(spec, nid, name, 0);
12205 nid = cfg->speaker_pins[0];
12207 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12208 "Speaker Playback Volume",
12209 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12213 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12217 nid = cfg->hp_pins[0];
12219 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12224 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12226 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12227 "Mono Playback Switch",
12228 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12235 /* create playback/capture controls for input pins */
12236 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12237 const struct auto_pin_cfg *cfg)
12239 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12242 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12244 struct alc_spec *spec = codec->spec;
12245 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12246 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12247 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12248 unsigned int dac_vol1, dac_vol2;
12251 snd_hda_codec_write(codec, speaker_nid, 0,
12252 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12253 snd_hda_codec_write(codec, 0x0f, 0,
12254 AC_VERB_SET_AMP_GAIN_MUTE,
12256 snd_hda_codec_write(codec, 0x10, 0,
12257 AC_VERB_SET_AMP_GAIN_MUTE,
12260 snd_hda_codec_write(codec, 0x0f, 0,
12261 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12262 snd_hda_codec_write(codec, 0x10, 0,
12263 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12266 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12267 if (line_nid == 0x14)
12268 dac_vol2 = AMP_OUT_ZERO;
12269 else if (line_nid == 0x15)
12270 dac_vol1 = AMP_OUT_ZERO;
12271 if (hp_nid == 0x14)
12272 dac_vol2 = AMP_OUT_ZERO;
12273 else if (hp_nid == 0x15)
12274 dac_vol1 = AMP_OUT_ZERO;
12275 if (line_nid != 0x16 || hp_nid != 0x16 ||
12276 spec->autocfg.line_out_pins[1] != 0x16 ||
12277 spec->autocfg.line_out_pins[2] != 0x16)
12278 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12280 snd_hda_codec_write(codec, 0x02, 0,
12281 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12282 snd_hda_codec_write(codec, 0x03, 0,
12283 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12286 /* pcm configuration: identical with ALC880 */
12287 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12288 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12289 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12290 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12293 * BIOS auto configuration
12295 static int alc268_parse_auto_config(struct hda_codec *codec)
12297 struct alc_spec *spec = codec->spec;
12299 static hda_nid_t alc268_ignore[] = { 0 };
12301 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12305 if (!spec->autocfg.line_outs) {
12306 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12307 spec->multiout.max_channels = 2;
12308 spec->no_analog = 1;
12311 return 0; /* can't find valid BIOS pin config */
12313 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12316 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12320 spec->multiout.max_channels = 2;
12323 /* digital only support output */
12324 if (spec->autocfg.dig_outs) {
12325 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12326 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12328 if (spec->kctls.list)
12329 add_mixer(spec, spec->kctls.list);
12331 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12332 add_mixer(spec, alc268_beep_mixer);
12334 add_verb(spec, alc268_volume_init_verbs);
12335 spec->num_mux_defs = 2;
12336 spec->input_mux = &spec->private_imux[0];
12338 err = alc_auto_add_mic_boost(codec);
12342 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12347 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12348 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12349 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12351 /* init callback for auto-configuration model -- overriding the default init */
12352 static void alc268_auto_init(struct hda_codec *codec)
12354 struct alc_spec *spec = codec->spec;
12355 alc268_auto_init_multi_out(codec);
12356 alc268_auto_init_hp_out(codec);
12357 alc268_auto_init_mono_speaker_out(codec);
12358 alc268_auto_init_analog_input(codec);
12359 if (spec->unsol_event)
12360 alc_inithook(codec);
12364 * configuration and preset
12366 static const char *alc268_models[ALC268_MODEL_LAST] = {
12367 [ALC267_QUANTA_IL1] = "quanta-il1",
12368 [ALC268_3ST] = "3stack",
12369 [ALC268_TOSHIBA] = "toshiba",
12370 [ALC268_ACER] = "acer",
12371 [ALC268_ACER_DMIC] = "acer-dmic",
12372 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12373 [ALC268_DELL] = "dell",
12374 [ALC268_ZEPTO] = "zepto",
12375 #ifdef CONFIG_SND_DEBUG
12376 [ALC268_TEST] = "test",
12378 [ALC268_AUTO] = "auto",
12381 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12382 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12383 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12384 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12385 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12386 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12387 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12388 ALC268_ACER_ASPIRE_ONE),
12389 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12390 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12391 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12393 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12394 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12395 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12396 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12397 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12398 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12402 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12403 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12404 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12405 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12406 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12411 static struct alc_config_preset alc268_presets[] = {
12412 [ALC267_QUANTA_IL1] = {
12413 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12414 alc268_capture_nosrc_mixer },
12415 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12416 alc267_quanta_il1_verbs },
12417 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12418 .dac_nids = alc268_dac_nids,
12419 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12420 .adc_nids = alc268_adc_nids_alt,
12422 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12423 .channel_mode = alc268_modes,
12424 .unsol_event = alc_sku_unsol_event,
12425 .setup = alc267_quanta_il1_setup,
12426 .init_hook = alc_inithook,
12429 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12430 alc268_beep_mixer },
12431 .init_verbs = { alc268_base_init_verbs },
12432 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12433 .dac_nids = alc268_dac_nids,
12434 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12435 .adc_nids = alc268_adc_nids_alt,
12436 .capsrc_nids = alc268_capsrc_nids,
12438 .dig_out_nid = ALC268_DIGOUT_NID,
12439 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12440 .channel_mode = alc268_modes,
12441 .input_mux = &alc268_capture_source,
12443 [ALC268_TOSHIBA] = {
12444 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12445 alc268_beep_mixer },
12446 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12447 alc268_toshiba_verbs },
12448 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12449 .dac_nids = alc268_dac_nids,
12450 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12451 .adc_nids = alc268_adc_nids_alt,
12452 .capsrc_nids = alc268_capsrc_nids,
12454 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12455 .channel_mode = alc268_modes,
12456 .input_mux = &alc268_capture_source,
12457 .unsol_event = alc268_toshiba_unsol_event,
12458 .setup = alc268_toshiba_setup,
12459 .init_hook = alc268_toshiba_automute,
12462 .mixers = { alc268_acer_mixer, alc268_capture_nosrc_mixer,
12463 alc268_beep_mixer },
12464 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12465 alc268_acer_verbs },
12466 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12467 .dac_nids = alc268_dac_nids,
12468 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12469 .adc_nids = alc268_adc_nids_alt,
12470 .capsrc_nids = alc268_capsrc_nids,
12472 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12473 .channel_mode = alc268_modes,
12474 .input_mux = &alc268_acer_capture_source,
12475 .unsol_event = alc268_acer_unsol_event,
12476 .init_hook = alc268_acer_init_hook,
12478 [ALC268_ACER_DMIC] = {
12479 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12480 alc268_beep_mixer },
12481 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12482 alc268_acer_verbs },
12483 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12484 .dac_nids = alc268_dac_nids,
12485 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12486 .adc_nids = alc268_adc_nids_alt,
12487 .capsrc_nids = alc268_capsrc_nids,
12489 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12490 .channel_mode = alc268_modes,
12491 .input_mux = &alc268_acer_dmic_capture_source,
12492 .unsol_event = alc268_acer_unsol_event,
12493 .init_hook = alc268_acer_init_hook,
12495 [ALC268_ACER_ASPIRE_ONE] = {
12496 .mixers = { alc268_acer_aspire_one_mixer,
12498 alc268_capture_nosrc_mixer },
12499 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12500 alc268_acer_aspire_one_verbs },
12501 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12502 .dac_nids = alc268_dac_nids,
12503 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12504 .adc_nids = alc268_adc_nids_alt,
12505 .capsrc_nids = alc268_capsrc_nids,
12507 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12508 .channel_mode = alc268_modes,
12509 .unsol_event = alc268_acer_lc_unsol_event,
12510 .setup = alc268_acer_lc_setup,
12511 .init_hook = alc268_acer_lc_init_hook,
12514 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12515 alc268_capture_nosrc_mixer },
12516 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12517 alc268_dell_verbs },
12518 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12519 .dac_nids = alc268_dac_nids,
12520 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12521 .adc_nids = alc268_adc_nids_alt,
12522 .capsrc_nids = alc268_capsrc_nids,
12524 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12525 .channel_mode = alc268_modes,
12526 .unsol_event = alc_sku_unsol_event,
12527 .setup = alc268_dell_setup,
12528 .init_hook = alc_inithook,
12531 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12532 alc268_beep_mixer },
12533 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12534 alc268_toshiba_verbs },
12535 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12536 .dac_nids = alc268_dac_nids,
12537 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12538 .adc_nids = alc268_adc_nids_alt,
12539 .capsrc_nids = alc268_capsrc_nids,
12541 .dig_out_nid = ALC268_DIGOUT_NID,
12542 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12543 .channel_mode = alc268_modes,
12544 .input_mux = &alc268_capture_source,
12545 .setup = alc268_toshiba_setup,
12546 .init_hook = alc268_toshiba_automute,
12548 #ifdef CONFIG_SND_DEBUG
12550 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12551 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12552 alc268_volume_init_verbs },
12553 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12554 .dac_nids = alc268_dac_nids,
12555 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12556 .adc_nids = alc268_adc_nids_alt,
12557 .capsrc_nids = alc268_capsrc_nids,
12559 .dig_out_nid = ALC268_DIGOUT_NID,
12560 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12561 .channel_mode = alc268_modes,
12562 .input_mux = &alc268_capture_source,
12567 static int patch_alc268(struct hda_codec *codec)
12569 struct alc_spec *spec;
12571 int i, has_beep, err;
12573 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12577 codec->spec = spec;
12579 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12583 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12584 board_config = snd_hda_check_board_codec_sid_config(codec,
12585 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12587 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12588 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12590 board_config = ALC268_AUTO;
12593 if (board_config == ALC268_AUTO) {
12594 /* automatic parse from the BIOS config */
12595 err = alc268_parse_auto_config(codec);
12601 "hda_codec: Cannot set up configuration "
12602 "from BIOS. Using base mode...\n");
12603 board_config = ALC268_3ST;
12607 if (board_config != ALC268_AUTO)
12608 setup_preset(codec, &alc268_presets[board_config]);
12610 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12611 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12612 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12614 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12617 for (i = 0; i < spec->num_mixers; i++) {
12618 if (spec->mixers[i] == alc268_beep_mixer) {
12625 err = snd_hda_attach_beep_device(codec, 0x1);
12630 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12631 /* override the amp caps for beep generator */
12632 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12633 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12634 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12635 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12636 (0 << AC_AMPCAP_MUTE_SHIFT));
12639 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12640 /* check whether NID 0x07 is valid */
12641 unsigned int wcap = get_wcaps(codec, 0x07);
12645 wcap = get_wcaps_type(wcap);
12646 if (spec->auto_mic ||
12647 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12648 spec->adc_nids = alc268_adc_nids_alt;
12649 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12650 if (spec->auto_mic || spec->input_mux->num_items == 1)
12651 add_mixer(spec, alc268_capture_nosrc_mixer);
12653 add_mixer(spec, alc268_capture_alt_mixer);
12655 spec->adc_nids = alc268_adc_nids;
12656 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12657 add_mixer(spec, alc268_capture_mixer);
12659 spec->capsrc_nids = alc268_capsrc_nids;
12660 /* set default input source */
12661 for (i = 0; i < spec->num_adc_nids; i++)
12662 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12663 0, AC_VERB_SET_CONNECT_SEL,
12664 i < spec->num_mux_defs ?
12665 spec->input_mux[i].items[0].index :
12666 spec->input_mux->items[0].index);
12669 spec->vmaster_nid = 0x02;
12671 codec->patch_ops = alc_patch_ops;
12672 if (board_config == ALC268_AUTO)
12673 spec->init_hook = alc268_auto_init;
12675 codec->proc_widget_hook = print_realtek_coef;
12681 * ALC269 channel source setting (2 channel)
12683 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12685 #define alc269_dac_nids alc260_dac_nids
12687 static hda_nid_t alc269_adc_nids[1] = {
12692 static hda_nid_t alc269_capsrc_nids[1] = {
12696 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12700 #define alc269_modes alc260_modes
12701 #define alc269_capture_source alc880_lg_lw_capture_source
12703 static struct snd_kcontrol_new alc269_base_mixer[] = {
12704 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12705 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12706 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12707 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12709 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12710 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12711 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12712 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12713 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12714 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12715 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12719 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12720 /* output mixer control */
12721 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12723 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12724 .name = "Master Playback Switch",
12725 .info = snd_hda_mixer_amp_switch_info,
12726 .get = snd_hda_mixer_amp_switch_get,
12727 .put = alc268_acer_master_sw_put,
12728 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12730 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12731 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12732 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12733 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12734 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12735 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12739 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12740 /* output mixer control */
12741 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12743 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12744 .name = "Master Playback Switch",
12745 .info = snd_hda_mixer_amp_switch_info,
12746 .get = snd_hda_mixer_amp_switch_get,
12747 .put = alc268_acer_master_sw_put,
12748 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12750 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12751 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12752 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12753 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12754 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12755 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12756 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12757 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12758 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12762 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12763 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12764 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12765 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12766 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12770 /* capture mixer elements */
12771 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12772 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12773 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12774 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12779 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12781 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12782 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12783 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12784 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12785 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12786 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12787 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12791 static struct hda_verb alc269_lifebook_verbs[] = {
12792 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12793 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12794 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12795 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12796 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12797 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12798 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12799 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12800 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12801 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12805 /* toggle speaker-output according to the hp-jack state */
12806 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12808 unsigned int present;
12809 unsigned char bits;
12811 present = snd_hda_codec_read(codec, 0x15, 0,
12812 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12813 bits = present ? AMP_IN_MUTE(0) : 0;
12814 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12815 AMP_IN_MUTE(0), bits);
12816 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12817 AMP_IN_MUTE(0), bits);
12819 snd_hda_codec_write(codec, 0x20, 0,
12820 AC_VERB_SET_COEF_INDEX, 0x0c);
12821 snd_hda_codec_write(codec, 0x20, 0,
12822 AC_VERB_SET_PROC_COEF, 0x680);
12824 snd_hda_codec_write(codec, 0x20, 0,
12825 AC_VERB_SET_COEF_INDEX, 0x0c);
12826 snd_hda_codec_write(codec, 0x20, 0,
12827 AC_VERB_SET_PROC_COEF, 0x480);
12830 /* toggle speaker-output according to the hp-jacks state */
12831 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12833 unsigned int present;
12834 unsigned char bits;
12836 /* Check laptop headphone socket */
12837 present = snd_hda_codec_read(codec, 0x15, 0,
12838 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12840 /* Check port replicator headphone socket */
12841 present |= snd_hda_codec_read(codec, 0x1a, 0,
12842 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12844 bits = present ? AMP_IN_MUTE(0) : 0;
12845 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12846 AMP_IN_MUTE(0), bits);
12847 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12848 AMP_IN_MUTE(0), bits);
12850 snd_hda_codec_write(codec, 0x20, 0,
12851 AC_VERB_SET_COEF_INDEX, 0x0c);
12852 snd_hda_codec_write(codec, 0x20, 0,
12853 AC_VERB_SET_PROC_COEF, 0x680);
12855 snd_hda_codec_write(codec, 0x20, 0,
12856 AC_VERB_SET_COEF_INDEX, 0x0c);
12857 snd_hda_codec_write(codec, 0x20, 0,
12858 AC_VERB_SET_PROC_COEF, 0x480);
12861 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12863 unsigned int present_laptop;
12864 unsigned int present_dock;
12866 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12867 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12869 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12870 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12872 /* Laptop mic port overrides dock mic port, design decision */
12874 snd_hda_codec_write(codec, 0x23, 0,
12875 AC_VERB_SET_CONNECT_SEL, 0x3);
12876 if (present_laptop)
12877 snd_hda_codec_write(codec, 0x23, 0,
12878 AC_VERB_SET_CONNECT_SEL, 0x0);
12879 if (!present_dock && !present_laptop)
12880 snd_hda_codec_write(codec, 0x23, 0,
12881 AC_VERB_SET_CONNECT_SEL, 0x1);
12884 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12887 switch (res >> 26) {
12888 case ALC880_HP_EVENT:
12889 alc269_quanta_fl1_speaker_automute(codec);
12891 case ALC880_MIC_EVENT:
12892 alc_mic_automute(codec);
12897 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12900 if ((res >> 26) == ALC880_HP_EVENT)
12901 alc269_lifebook_speaker_automute(codec);
12902 if ((res >> 26) == ALC880_MIC_EVENT)
12903 alc269_lifebook_mic_autoswitch(codec);
12906 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
12908 struct alc_spec *spec = codec->spec;
12909 spec->ext_mic.pin = 0x18;
12910 spec->ext_mic.mux_idx = 0;
12911 spec->int_mic.pin = 0x19;
12912 spec->int_mic.mux_idx = 1;
12913 spec->auto_mic = 1;
12916 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12918 alc269_quanta_fl1_speaker_automute(codec);
12919 alc_mic_automute(codec);
12922 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12924 alc269_lifebook_speaker_automute(codec);
12925 alc269_lifebook_mic_autoswitch(codec);
12928 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12929 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12930 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12931 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12932 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12933 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12934 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12935 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12939 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12940 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12941 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12942 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12943 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12944 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12945 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12949 /* toggle speaker-output according to the hp-jack state */
12950 static void alc269_speaker_automute(struct hda_codec *codec)
12952 unsigned int present;
12953 unsigned char bits;
12955 present = snd_hda_codec_read(codec, 0x15, 0,
12956 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12957 bits = present ? AMP_IN_MUTE(0) : 0;
12958 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12959 AMP_IN_MUTE(0), bits);
12960 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12961 AMP_IN_MUTE(0), bits);
12964 /* unsolicited event for HP jack sensing */
12965 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
12968 switch (res >> 26) {
12969 case ALC880_HP_EVENT:
12970 alc269_speaker_automute(codec);
12972 case ALC880_MIC_EVENT:
12973 alc_mic_automute(codec);
12978 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
12980 struct alc_spec *spec = codec->spec;
12981 spec->ext_mic.pin = 0x18;
12982 spec->ext_mic.mux_idx = 0;
12983 spec->int_mic.pin = 0x12;
12984 spec->int_mic.mux_idx = 5;
12985 spec->auto_mic = 1;
12988 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
12990 struct alc_spec *spec = codec->spec;
12991 spec->ext_mic.pin = 0x18;
12992 spec->ext_mic.mux_idx = 0;
12993 spec->int_mic.pin = 0x19;
12994 spec->int_mic.mux_idx = 1;
12995 spec->auto_mic = 1;
12998 static void alc269_eeepc_inithook(struct hda_codec *codec)
13000 alc269_speaker_automute(codec);
13001 alc_mic_automute(codec);
13005 * generic initialization of ADC, input mixers and output mixers
13007 static struct hda_verb alc269_init_verbs[] = {
13009 * Unmute ADC0 and set the default input to mic-in
13011 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13013 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13014 * analog-loopback mixer widget
13015 * Note: PASD motherboards uses the Line In 2 as the input for
13016 * front panel mic (mic 2)
13018 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13019 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13020 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13021 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13026 * Set up output mixers (0x0c - 0x0e)
13028 /* set vol=0 to output mixers */
13029 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13030 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13032 /* set up input amps for analog loopback */
13033 /* Amp Indices: DAC = 0, mixer = 1 */
13034 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13035 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13036 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13037 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13038 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13039 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13041 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13042 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13043 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13044 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13045 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13046 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13047 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13049 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13050 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13051 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13052 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13053 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13054 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13055 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13057 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13058 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13060 /* FIXME: use matrix-type input source selection */
13061 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13062 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13063 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13064 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13065 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13066 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13069 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13070 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13074 #define alc269_auto_create_multi_out_ctls \
13075 alc268_auto_create_multi_out_ctls
13076 #define alc269_auto_create_input_ctls \
13077 alc268_auto_create_input_ctls
13079 #ifdef CONFIG_SND_HDA_POWER_SAVE
13080 #define alc269_loopbacks alc880_loopbacks
13083 /* pcm configuration: identical with ALC880 */
13084 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13085 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13086 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13087 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13089 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13093 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13094 /* NID is set in alc_build_pcms */
13096 .open = alc880_playback_pcm_open,
13097 .prepare = alc880_playback_pcm_prepare,
13098 .cleanup = alc880_playback_pcm_cleanup
13102 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13106 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13107 /* NID is set in alc_build_pcms */
13111 * BIOS auto configuration
13113 static int alc269_parse_auto_config(struct hda_codec *codec)
13115 struct alc_spec *spec = codec->spec;
13117 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13119 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13124 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13127 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13131 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13133 if (spec->autocfg.dig_outs)
13134 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13136 if (spec->kctls.list)
13137 add_mixer(spec, spec->kctls.list);
13139 add_verb(spec, alc269_init_verbs);
13140 spec->num_mux_defs = 1;
13141 spec->input_mux = &spec->private_imux[0];
13142 /* set default input source */
13143 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13144 0, AC_VERB_SET_CONNECT_SEL,
13145 spec->input_mux->items[0].index);
13147 err = alc_auto_add_mic_boost(codec);
13151 if (!spec->cap_mixer && !spec->no_analog)
13152 set_capture_mixer(codec);
13154 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13159 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13160 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13161 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13164 /* init callback for auto-configuration model -- overriding the default init */
13165 static void alc269_auto_init(struct hda_codec *codec)
13167 struct alc_spec *spec = codec->spec;
13168 alc269_auto_init_multi_out(codec);
13169 alc269_auto_init_hp_out(codec);
13170 alc269_auto_init_analog_input(codec);
13171 if (spec->unsol_event)
13172 alc_inithook(codec);
13176 * configuration and preset
13178 static const char *alc269_models[ALC269_MODEL_LAST] = {
13179 [ALC269_BASIC] = "basic",
13180 [ALC269_QUANTA_FL1] = "quanta",
13181 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13182 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13183 [ALC269_FUJITSU] = "fujitsu",
13184 [ALC269_LIFEBOOK] = "lifebook"
13187 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13188 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13189 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13190 ALC269_ASUS_EEEPC_P703),
13191 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13192 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13193 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13194 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13195 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13196 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13197 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13198 ALC269_ASUS_EEEPC_P901),
13199 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13200 ALC269_ASUS_EEEPC_P901),
13201 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13202 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13203 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13207 static struct alc_config_preset alc269_presets[] = {
13209 .mixers = { alc269_base_mixer },
13210 .init_verbs = { alc269_init_verbs },
13211 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13212 .dac_nids = alc269_dac_nids,
13214 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13215 .channel_mode = alc269_modes,
13216 .input_mux = &alc269_capture_source,
13218 [ALC269_QUANTA_FL1] = {
13219 .mixers = { alc269_quanta_fl1_mixer },
13220 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13221 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13222 .dac_nids = alc269_dac_nids,
13224 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13225 .channel_mode = alc269_modes,
13226 .input_mux = &alc269_capture_source,
13227 .unsol_event = alc269_quanta_fl1_unsol_event,
13228 .setup = alc269_quanta_fl1_setup,
13229 .init_hook = alc269_quanta_fl1_init_hook,
13231 [ALC269_ASUS_EEEPC_P703] = {
13232 .mixers = { alc269_eeepc_mixer },
13233 .cap_mixer = alc269_epc_capture_mixer,
13234 .init_verbs = { alc269_init_verbs,
13235 alc269_eeepc_amic_init_verbs },
13236 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13237 .dac_nids = alc269_dac_nids,
13239 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13240 .channel_mode = alc269_modes,
13241 .unsol_event = alc269_eeepc_unsol_event,
13242 .setup = alc269_eeepc_amic_setup,
13243 .init_hook = alc269_eeepc_inithook,
13245 [ALC269_ASUS_EEEPC_P901] = {
13246 .mixers = { alc269_eeepc_mixer },
13247 .cap_mixer = alc269_epc_capture_mixer,
13248 .init_verbs = { alc269_init_verbs,
13249 alc269_eeepc_dmic_init_verbs },
13250 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13251 .dac_nids = alc269_dac_nids,
13253 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13254 .channel_mode = alc269_modes,
13255 .unsol_event = alc269_eeepc_unsol_event,
13256 .setup = alc269_eeepc_dmic_setup,
13257 .init_hook = alc269_eeepc_inithook,
13259 [ALC269_FUJITSU] = {
13260 .mixers = { alc269_fujitsu_mixer },
13261 .cap_mixer = alc269_epc_capture_mixer,
13262 .init_verbs = { alc269_init_verbs,
13263 alc269_eeepc_dmic_init_verbs },
13264 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13265 .dac_nids = alc269_dac_nids,
13267 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13268 .channel_mode = alc269_modes,
13269 .unsol_event = alc269_eeepc_unsol_event,
13270 .setup = alc269_eeepc_dmic_setup,
13271 .init_hook = alc269_eeepc_inithook,
13273 [ALC269_LIFEBOOK] = {
13274 .mixers = { alc269_lifebook_mixer },
13275 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13276 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13277 .dac_nids = alc269_dac_nids,
13279 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13280 .channel_mode = alc269_modes,
13281 .input_mux = &alc269_capture_source,
13282 .unsol_event = alc269_lifebook_unsol_event,
13283 .init_hook = alc269_lifebook_init_hook,
13287 static int patch_alc269(struct hda_codec *codec)
13289 struct alc_spec *spec;
13293 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13297 codec->spec = spec;
13299 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13301 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13305 if (board_config < 0) {
13306 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13308 board_config = ALC269_AUTO;
13311 if (board_config == ALC269_AUTO) {
13312 /* automatic parse from the BIOS config */
13313 err = alc269_parse_auto_config(codec);
13319 "hda_codec: Cannot set up configuration "
13320 "from BIOS. Using base mode...\n");
13321 board_config = ALC269_BASIC;
13325 err = snd_hda_attach_beep_device(codec, 0x1);
13331 if (board_config != ALC269_AUTO)
13332 setup_preset(codec, &alc269_presets[board_config]);
13334 if (codec->subsystem_id == 0x17aa3bf8) {
13335 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13336 * fix the sample rate of analog I/O to 44.1kHz
13338 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13339 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13341 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13342 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13344 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13345 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13347 spec->adc_nids = alc269_adc_nids;
13348 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13349 spec->capsrc_nids = alc269_capsrc_nids;
13350 if (!spec->cap_mixer)
13351 set_capture_mixer(codec);
13352 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13354 spec->vmaster_nid = 0x02;
13356 codec->patch_ops = alc_patch_ops;
13357 if (board_config == ALC269_AUTO)
13358 spec->init_hook = alc269_auto_init;
13359 #ifdef CONFIG_SND_HDA_POWER_SAVE
13360 if (!spec->loopback.amplist)
13361 spec->loopback.amplist = alc269_loopbacks;
13363 codec->proc_widget_hook = print_realtek_coef;
13369 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13373 * set the path ways for 2 channel output
13374 * need to set the codec line out and mic 1 pin widgets to inputs
13376 static struct hda_verb alc861_threestack_ch2_init[] = {
13377 /* set pin widget 1Ah (line in) for input */
13378 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13379 /* set pin widget 18h (mic1/2) for input, for mic also enable
13382 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13384 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13386 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13387 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13393 * need to set the codec line out and mic 1 pin widgets to outputs
13395 static struct hda_verb alc861_threestack_ch6_init[] = {
13396 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13397 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13398 /* set pin widget 18h (mic1) for output (CLFE)*/
13399 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13401 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13402 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13404 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13406 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13407 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13412 static struct hda_channel_mode alc861_threestack_modes[2] = {
13413 { 2, alc861_threestack_ch2_init },
13414 { 6, alc861_threestack_ch6_init },
13416 /* Set mic1 as input and unmute the mixer */
13417 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13418 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13419 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13422 /* Set mic1 as output and mute mixer */
13423 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13424 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13425 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13429 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13430 { 2, alc861_uniwill_m31_ch2_init },
13431 { 4, alc861_uniwill_m31_ch4_init },
13434 /* Set mic1 and line-in as input and unmute the mixer */
13435 static struct hda_verb alc861_asus_ch2_init[] = {
13436 /* set pin widget 1Ah (line in) for input */
13437 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13438 /* set pin widget 18h (mic1/2) for input, for mic also enable
13441 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13443 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13445 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13446 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13450 /* Set mic1 nad line-in as output and mute mixer */
13451 static struct hda_verb alc861_asus_ch6_init[] = {
13452 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13453 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13454 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13455 /* set pin widget 18h (mic1) for output (CLFE)*/
13456 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13457 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13458 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13459 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13461 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13463 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13464 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13469 static struct hda_channel_mode alc861_asus_modes[2] = {
13470 { 2, alc861_asus_ch2_init },
13471 { 6, alc861_asus_ch6_init },
13476 static struct snd_kcontrol_new alc861_base_mixer[] = {
13477 /* output mixer control */
13478 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13479 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13480 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13481 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13482 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13484 /*Input mixer control */
13485 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13486 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13487 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13488 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13489 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13490 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13491 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13492 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13493 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13494 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13499 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13500 /* output mixer control */
13501 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13502 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13503 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13504 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13505 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13507 /* Input mixer control */
13508 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13509 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13510 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13511 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13512 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13513 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13515 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13516 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13517 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13520 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13521 .name = "Channel Mode",
13522 .info = alc_ch_mode_info,
13523 .get = alc_ch_mode_get,
13524 .put = alc_ch_mode_put,
13525 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13530 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13531 /* output mixer control */
13532 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13533 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13534 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13539 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13540 /* output mixer control */
13541 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13542 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13543 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13544 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13545 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13547 /* Input mixer control */
13548 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13549 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13550 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13551 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13552 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13553 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13554 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13555 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13556 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13557 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13560 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13561 .name = "Channel Mode",
13562 .info = alc_ch_mode_info,
13563 .get = alc_ch_mode_get,
13564 .put = alc_ch_mode_put,
13565 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13570 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13571 /* output mixer control */
13572 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13573 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13574 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13575 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13576 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13578 /* Input mixer control */
13579 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13580 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13581 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13582 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13583 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13584 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13585 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13586 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13587 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13588 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13591 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13592 .name = "Channel Mode",
13593 .info = alc_ch_mode_info,
13594 .get = alc_ch_mode_get,
13595 .put = alc_ch_mode_put,
13596 .private_value = ARRAY_SIZE(alc861_asus_modes),
13601 /* additional mixer */
13602 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13603 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13604 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13609 * generic initialization of ADC, input mixers and output mixers
13611 static struct hda_verb alc861_base_init_verbs[] = {
13613 * Unmute ADC0 and set the default input to mic-in
13615 /* port-A for surround (rear panel) */
13616 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13617 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13618 /* port-B for mic-in (rear panel) with vref */
13619 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13620 /* port-C for line-in (rear panel) */
13621 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13622 /* port-D for Front */
13623 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13624 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13625 /* port-E for HP out (front panel) */
13626 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13627 /* route front PCM to HP */
13628 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13629 /* port-F for mic-in (front panel) with vref */
13630 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13631 /* port-G for CLFE (rear panel) */
13632 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13633 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13634 /* port-H for side (rear panel) */
13635 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13636 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13638 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13639 /* route front mic to ADC1*/
13640 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13641 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13643 /* Unmute DAC0~3 & spdif out*/
13644 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13645 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13646 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13647 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13648 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13650 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13651 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13652 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13653 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13654 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13656 /* Unmute Stereo Mixer 15 */
13657 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13658 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13659 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13660 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13662 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13663 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13664 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13665 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13666 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13667 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13668 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13669 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13670 /* hp used DAC 3 (Front) */
13671 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13672 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13677 static struct hda_verb alc861_threestack_init_verbs[] = {
13679 * Unmute ADC0 and set the default input to mic-in
13681 /* port-A for surround (rear panel) */
13682 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13683 /* port-B for mic-in (rear panel) with vref */
13684 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13685 /* port-C for line-in (rear panel) */
13686 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13687 /* port-D for Front */
13688 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13689 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13690 /* port-E for HP out (front panel) */
13691 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13692 /* route front PCM to HP */
13693 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13694 /* port-F for mic-in (front panel) with vref */
13695 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13696 /* port-G for CLFE (rear panel) */
13697 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13698 /* port-H for side (rear panel) */
13699 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13701 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13702 /* route front mic to ADC1*/
13703 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13704 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13705 /* Unmute DAC0~3 & spdif out*/
13706 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13707 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13708 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13709 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13710 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13712 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13713 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13714 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13715 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13716 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13718 /* Unmute Stereo Mixer 15 */
13719 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13720 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13721 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13722 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13724 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13725 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13726 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13727 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13728 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13729 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13730 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13731 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13732 /* hp used DAC 3 (Front) */
13733 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13734 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13738 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13740 * Unmute ADC0 and set the default input to mic-in
13742 /* port-A for surround (rear panel) */
13743 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13744 /* port-B for mic-in (rear panel) with vref */
13745 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13746 /* port-C for line-in (rear panel) */
13747 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13748 /* port-D for Front */
13749 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13750 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13751 /* port-E for HP out (front panel) */
13752 /* this has to be set to VREF80 */
13753 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13754 /* route front PCM to HP */
13755 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13756 /* port-F for mic-in (front panel) with vref */
13757 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13758 /* port-G for CLFE (rear panel) */
13759 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13760 /* port-H for side (rear panel) */
13761 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13763 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13764 /* route front mic to ADC1*/
13765 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13766 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13767 /* Unmute DAC0~3 & spdif out*/
13768 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13769 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13770 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13771 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13772 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13774 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13775 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13776 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13777 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13778 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13780 /* Unmute Stereo Mixer 15 */
13781 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13782 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13783 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13784 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13786 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13787 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13788 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13789 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13790 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13791 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13792 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13793 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13794 /* hp used DAC 3 (Front) */
13795 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13796 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13800 static struct hda_verb alc861_asus_init_verbs[] = {
13802 * Unmute ADC0 and set the default input to mic-in
13804 /* port-A for surround (rear panel)
13805 * according to codec#0 this is the HP jack
13807 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13808 /* route front PCM to HP */
13809 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13810 /* port-B for mic-in (rear panel) with vref */
13811 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13812 /* port-C for line-in (rear panel) */
13813 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13814 /* port-D for Front */
13815 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13816 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13817 /* port-E for HP out (front panel) */
13818 /* this has to be set to VREF80 */
13819 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13820 /* route front PCM to HP */
13821 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13822 /* port-F for mic-in (front panel) with vref */
13823 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13824 /* port-G for CLFE (rear panel) */
13825 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13826 /* port-H for side (rear panel) */
13827 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13829 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13830 /* route front mic to ADC1*/
13831 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13832 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13833 /* Unmute DAC0~3 & spdif out*/
13834 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13835 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13836 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13837 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13838 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13839 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13840 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13841 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13842 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13843 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13845 /* Unmute Stereo Mixer 15 */
13846 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13847 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13848 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13849 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13851 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13852 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13853 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13854 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13855 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13856 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13857 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13858 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13859 /* hp used DAC 3 (Front) */
13860 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13861 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13865 /* additional init verbs for ASUS laptops */
13866 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13867 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13868 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13873 * generic initialization of ADC, input mixers and output mixers
13875 static struct hda_verb alc861_auto_init_verbs[] = {
13877 * Unmute ADC0 and set the default input to mic-in
13879 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13880 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13882 /* Unmute DAC0~3 & spdif out*/
13883 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13884 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13885 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13886 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13887 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13889 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13890 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13891 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13892 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13893 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13895 /* Unmute Stereo Mixer 15 */
13896 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13897 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13898 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13899 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13901 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13902 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13903 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13904 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13905 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13906 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13907 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13908 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13910 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13911 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13912 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13913 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13914 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13915 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13916 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13917 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13919 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13924 static struct hda_verb alc861_toshiba_init_verbs[] = {
13925 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13930 /* toggle speaker-output according to the hp-jack state */
13931 static void alc861_toshiba_automute(struct hda_codec *codec)
13933 unsigned int present;
13935 present = snd_hda_codec_read(codec, 0x0f, 0,
13936 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13937 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13938 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13939 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13940 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13943 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13946 if ((res >> 26) == ALC880_HP_EVENT)
13947 alc861_toshiba_automute(codec);
13950 /* pcm configuration: identical with ALC880 */
13951 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13952 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13953 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13954 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13957 #define ALC861_DIGOUT_NID 0x07
13959 static struct hda_channel_mode alc861_8ch_modes[1] = {
13963 static hda_nid_t alc861_dac_nids[4] = {
13964 /* front, surround, clfe, side */
13965 0x03, 0x06, 0x05, 0x04
13968 static hda_nid_t alc660_dac_nids[3] = {
13969 /* front, clfe, surround */
13973 static hda_nid_t alc861_adc_nids[1] = {
13978 static struct hda_input_mux alc861_capture_source = {
13982 { "Front Mic", 0x3 },
13989 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
13991 struct alc_spec *spec = codec->spec;
13992 hda_nid_t mix, srcs[5];
13995 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
13997 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14000 for (i = 0; i < num; i++) {
14002 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14003 if (type != AC_WID_AUD_OUT)
14005 for (j = 0; j < spec->multiout.num_dacs; j++)
14006 if (spec->multiout.dac_nids[j] == srcs[i])
14008 if (j >= spec->multiout.num_dacs)
14014 /* fill in the dac_nids table from the parsed pin configuration */
14015 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14016 const struct auto_pin_cfg *cfg)
14018 struct alc_spec *spec = codec->spec;
14020 hda_nid_t nid, dac;
14022 spec->multiout.dac_nids = spec->private_dac_nids;
14023 for (i = 0; i < cfg->line_outs; i++) {
14024 nid = cfg->line_out_pins[i];
14025 dac = alc861_look_for_dac(codec, nid);
14028 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14033 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14034 hda_nid_t nid, unsigned int chs)
14037 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
14038 return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name,
14039 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14042 /* add playback controls from the parsed DAC table */
14043 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14044 const struct auto_pin_cfg *cfg)
14046 struct alc_spec *spec = codec->spec;
14047 static const char *chname[4] = {
14048 "Front", "Surround", NULL /*CLFE*/, "Side"
14053 if (cfg->line_outs == 1) {
14054 const char *pfx = NULL;
14057 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14060 nid = spec->multiout.dac_nids[0];
14061 return alc861_create_out_sw(codec, pfx, nid, 3);
14065 for (i = 0; i < cfg->line_outs; i++) {
14066 nid = spec->multiout.dac_nids[i];
14071 err = alc861_create_out_sw(codec, "Center", nid, 1);
14074 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14078 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14086 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14088 struct alc_spec *spec = codec->spec;
14095 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14096 nid = alc861_look_for_dac(codec, pin);
14098 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14101 spec->multiout.hp_nid = nid;
14107 /* create playback/capture controls for input pins */
14108 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14109 const struct auto_pin_cfg *cfg)
14111 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14114 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14116 int pin_type, hda_nid_t dac)
14118 hda_nid_t mix, srcs[5];
14121 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14123 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14125 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14127 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14130 for (i = 0; i < num; i++) {
14132 if (srcs[i] == dac || srcs[i] == 0x15)
14133 mute = AMP_IN_UNMUTE(i);
14135 mute = AMP_IN_MUTE(i);
14136 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14141 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14143 struct alc_spec *spec = codec->spec;
14146 for (i = 0; i < spec->autocfg.line_outs; i++) {
14147 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14148 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14150 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14151 spec->multiout.dac_nids[i]);
14155 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14157 struct alc_spec *spec = codec->spec;
14160 pin = spec->autocfg.hp_pins[0];
14162 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14163 spec->multiout.hp_nid);
14164 pin = spec->autocfg.speaker_pins[0];
14166 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT,
14167 spec->multiout.dac_nids[0]);
14170 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14172 struct alc_spec *spec = codec->spec;
14175 for (i = 0; i < AUTO_PIN_LAST; i++) {
14176 hda_nid_t nid = spec->autocfg.input_pins[i];
14177 if (nid >= 0x0c && nid <= 0x11)
14178 alc_set_input_pin(codec, nid, i);
14182 /* parse the BIOS configuration and set up the alc_spec */
14183 /* return 1 if successful, 0 if the proper config is not found,
14184 * or a negative error code
14186 static int alc861_parse_auto_config(struct hda_codec *codec)
14188 struct alc_spec *spec = codec->spec;
14190 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14192 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14196 if (!spec->autocfg.line_outs)
14197 return 0; /* can't find valid BIOS pin config */
14199 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14202 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14205 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14208 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14212 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14214 if (spec->autocfg.dig_outs)
14215 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14217 if (spec->kctls.list)
14218 add_mixer(spec, spec->kctls.list);
14220 add_verb(spec, alc861_auto_init_verbs);
14222 spec->num_mux_defs = 1;
14223 spec->input_mux = &spec->private_imux[0];
14225 spec->adc_nids = alc861_adc_nids;
14226 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14227 set_capture_mixer(codec);
14229 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14234 /* additional initialization for auto-configuration model */
14235 static void alc861_auto_init(struct hda_codec *codec)
14237 struct alc_spec *spec = codec->spec;
14238 alc861_auto_init_multi_out(codec);
14239 alc861_auto_init_hp_out(codec);
14240 alc861_auto_init_analog_input(codec);
14241 if (spec->unsol_event)
14242 alc_inithook(codec);
14245 #ifdef CONFIG_SND_HDA_POWER_SAVE
14246 static struct hda_amp_list alc861_loopbacks[] = {
14247 { 0x15, HDA_INPUT, 0 },
14248 { 0x15, HDA_INPUT, 1 },
14249 { 0x15, HDA_INPUT, 2 },
14250 { 0x15, HDA_INPUT, 3 },
14257 * configuration and preset
14259 static const char *alc861_models[ALC861_MODEL_LAST] = {
14260 [ALC861_3ST] = "3stack",
14261 [ALC660_3ST] = "3stack-660",
14262 [ALC861_3ST_DIG] = "3stack-dig",
14263 [ALC861_6ST_DIG] = "6stack-dig",
14264 [ALC861_UNIWILL_M31] = "uniwill-m31",
14265 [ALC861_TOSHIBA] = "toshiba",
14266 [ALC861_ASUS] = "asus",
14267 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14268 [ALC861_AUTO] = "auto",
14271 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14272 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14273 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14274 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14275 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14276 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14277 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14278 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14279 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14280 * Any other models that need this preset?
14282 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14283 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14284 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14285 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14286 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14287 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14288 /* FIXME: the below seems conflict */
14289 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14290 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14291 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14295 static struct alc_config_preset alc861_presets[] = {
14297 .mixers = { alc861_3ST_mixer },
14298 .init_verbs = { alc861_threestack_init_verbs },
14299 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14300 .dac_nids = alc861_dac_nids,
14301 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14302 .channel_mode = alc861_threestack_modes,
14304 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14305 .adc_nids = alc861_adc_nids,
14306 .input_mux = &alc861_capture_source,
14308 [ALC861_3ST_DIG] = {
14309 .mixers = { alc861_base_mixer },
14310 .init_verbs = { alc861_threestack_init_verbs },
14311 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14312 .dac_nids = alc861_dac_nids,
14313 .dig_out_nid = ALC861_DIGOUT_NID,
14314 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14315 .channel_mode = alc861_threestack_modes,
14317 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14318 .adc_nids = alc861_adc_nids,
14319 .input_mux = &alc861_capture_source,
14321 [ALC861_6ST_DIG] = {
14322 .mixers = { alc861_base_mixer },
14323 .init_verbs = { alc861_base_init_verbs },
14324 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14325 .dac_nids = alc861_dac_nids,
14326 .dig_out_nid = ALC861_DIGOUT_NID,
14327 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14328 .channel_mode = alc861_8ch_modes,
14329 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14330 .adc_nids = alc861_adc_nids,
14331 .input_mux = &alc861_capture_source,
14334 .mixers = { alc861_3ST_mixer },
14335 .init_verbs = { alc861_threestack_init_verbs },
14336 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14337 .dac_nids = alc660_dac_nids,
14338 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14339 .channel_mode = alc861_threestack_modes,
14341 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14342 .adc_nids = alc861_adc_nids,
14343 .input_mux = &alc861_capture_source,
14345 [ALC861_UNIWILL_M31] = {
14346 .mixers = { alc861_uniwill_m31_mixer },
14347 .init_verbs = { alc861_uniwill_m31_init_verbs },
14348 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14349 .dac_nids = alc861_dac_nids,
14350 .dig_out_nid = ALC861_DIGOUT_NID,
14351 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14352 .channel_mode = alc861_uniwill_m31_modes,
14354 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14355 .adc_nids = alc861_adc_nids,
14356 .input_mux = &alc861_capture_source,
14358 [ALC861_TOSHIBA] = {
14359 .mixers = { alc861_toshiba_mixer },
14360 .init_verbs = { alc861_base_init_verbs,
14361 alc861_toshiba_init_verbs },
14362 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14363 .dac_nids = alc861_dac_nids,
14364 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14365 .channel_mode = alc883_3ST_2ch_modes,
14366 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14367 .adc_nids = alc861_adc_nids,
14368 .input_mux = &alc861_capture_source,
14369 .unsol_event = alc861_toshiba_unsol_event,
14370 .init_hook = alc861_toshiba_automute,
14373 .mixers = { alc861_asus_mixer },
14374 .init_verbs = { alc861_asus_init_verbs },
14375 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14376 .dac_nids = alc861_dac_nids,
14377 .dig_out_nid = ALC861_DIGOUT_NID,
14378 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14379 .channel_mode = alc861_asus_modes,
14382 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14383 .adc_nids = alc861_adc_nids,
14384 .input_mux = &alc861_capture_source,
14386 [ALC861_ASUS_LAPTOP] = {
14387 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14388 .init_verbs = { alc861_asus_init_verbs,
14389 alc861_asus_laptop_init_verbs },
14390 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14391 .dac_nids = alc861_dac_nids,
14392 .dig_out_nid = ALC861_DIGOUT_NID,
14393 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14394 .channel_mode = alc883_3ST_2ch_modes,
14396 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14397 .adc_nids = alc861_adc_nids,
14398 .input_mux = &alc861_capture_source,
14403 static int patch_alc861(struct hda_codec *codec)
14405 struct alc_spec *spec;
14409 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14413 codec->spec = spec;
14415 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14419 if (board_config < 0) {
14420 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14422 board_config = ALC861_AUTO;
14425 if (board_config == ALC861_AUTO) {
14426 /* automatic parse from the BIOS config */
14427 err = alc861_parse_auto_config(codec);
14433 "hda_codec: Cannot set up configuration "
14434 "from BIOS. Using base mode...\n");
14435 board_config = ALC861_3ST_DIG;
14439 err = snd_hda_attach_beep_device(codec, 0x23);
14445 if (board_config != ALC861_AUTO)
14446 setup_preset(codec, &alc861_presets[board_config]);
14448 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14449 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14451 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14452 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14454 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14456 spec->vmaster_nid = 0x03;
14458 codec->patch_ops = alc_patch_ops;
14459 if (board_config == ALC861_AUTO)
14460 spec->init_hook = alc861_auto_init;
14461 #ifdef CONFIG_SND_HDA_POWER_SAVE
14462 if (!spec->loopback.amplist)
14463 spec->loopback.amplist = alc861_loopbacks;
14465 codec->proc_widget_hook = print_realtek_coef;
14471 * ALC861-VD support
14475 * In addition, an independent DAC
14477 #define ALC861VD_DIGOUT_NID 0x06
14479 static hda_nid_t alc861vd_dac_nids[4] = {
14480 /* front, surr, clfe, side surr */
14481 0x02, 0x03, 0x04, 0x05
14484 /* dac_nids for ALC660vd are in a different order - according to
14485 * Realtek's driver.
14486 * This should probably result in a different mixer for 6stack models
14487 * of ALC660vd codecs, but for now there is only 3stack mixer
14488 * - and it is the same as in 861vd.
14489 * adc_nids in ALC660vd are (is) the same as in 861vd
14491 static hda_nid_t alc660vd_dac_nids[3] = {
14492 /* front, rear, clfe, rear_surr */
14496 static hda_nid_t alc861vd_adc_nids[1] = {
14501 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14504 /* FIXME: should be a matrix-type input source selection */
14505 static struct hda_input_mux alc861vd_capture_source = {
14509 { "Front Mic", 0x1 },
14515 static struct hda_input_mux alc861vd_dallas_capture_source = {
14518 { "Ext Mic", 0x0 },
14519 { "Int Mic", 0x1 },
14523 static struct hda_input_mux alc861vd_hp_capture_source = {
14526 { "Front Mic", 0x0 },
14527 { "ATAPI Mic", 0x1 },
14534 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14541 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14542 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14543 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14544 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14545 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14552 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14553 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14554 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14555 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14556 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14560 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14561 { 6, alc861vd_6stack_ch6_init },
14562 { 8, alc861vd_6stack_ch8_init },
14565 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14567 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14568 .name = "Channel Mode",
14569 .info = alc_ch_mode_info,
14570 .get = alc_ch_mode_get,
14571 .put = alc_ch_mode_put,
14576 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14577 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14579 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14580 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14581 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14583 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14584 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14586 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14588 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14590 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14591 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14593 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14594 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14596 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14598 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14599 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14600 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14602 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14603 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14604 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14606 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14607 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14609 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14610 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14615 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14616 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14617 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14619 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14621 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14622 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14623 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14625 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14626 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14627 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14629 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14630 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14632 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14633 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14638 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14639 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14640 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14641 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14643 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14645 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14646 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14647 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14649 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14650 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14651 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14653 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14654 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14659 /* Pin assignment: Speaker=0x14, HP = 0x15,
14660 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14662 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14663 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14664 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14665 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14666 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14667 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14668 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14669 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14670 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14671 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14672 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14676 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14677 * Front Mic=0x18, ATAPI Mic = 0x19,
14679 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14680 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14681 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14682 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14683 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14684 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14685 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14686 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14687 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14693 * generic initialization of ADC, input mixers and output mixers
14695 static struct hda_verb alc861vd_volume_init_verbs[] = {
14697 * Unmute ADC0 and set the default input to mic-in
14699 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14700 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14702 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14703 * the analog-loopback mixer widget
14705 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14706 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14707 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14708 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14709 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14710 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14712 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14713 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14714 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14715 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14716 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14719 * Set up output mixers (0x02 - 0x05)
14721 /* set vol=0 to output mixers */
14722 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14723 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14724 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14725 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14727 /* set up input amps for analog loopback */
14728 /* Amp Indices: DAC = 0, mixer = 1 */
14729 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14730 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14731 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14732 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14733 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14734 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14735 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14736 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14742 * 3-stack pin configuration:
14743 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14745 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14747 * Set pin mode and muting
14749 /* set front pin widgets 0x14 for output */
14750 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14751 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14752 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14754 /* Mic (rear) pin: input vref at 80% */
14755 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14756 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14757 /* Front Mic pin: input vref at 80% */
14758 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14759 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14760 /* Line In pin: input */
14761 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14762 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14763 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14764 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14765 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14766 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14767 /* CD pin widget for input */
14768 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14774 * 6-stack pin configuration:
14776 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14778 * Set pin mode and muting
14780 /* set front pin widgets 0x14 for output */
14781 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14782 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14783 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14785 /* Rear Pin: output 1 (0x0d) */
14786 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14787 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14788 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14789 /* CLFE Pin: output 2 (0x0e) */
14790 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14791 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14792 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14793 /* Side Pin: output 3 (0x0f) */
14794 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14795 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14796 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14798 /* Mic (rear) pin: input vref at 80% */
14799 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14800 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14801 /* Front Mic pin: input vref at 80% */
14802 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14803 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14804 /* Line In pin: input */
14805 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14806 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14807 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14808 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14809 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14810 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14811 /* CD pin widget for input */
14812 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14817 static struct hda_verb alc861vd_eapd_verbs[] = {
14818 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14822 static struct hda_verb alc660vd_eapd_verbs[] = {
14823 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14824 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14828 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14829 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14830 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14831 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14832 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14833 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14837 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14839 unsigned int present;
14840 unsigned char bits;
14842 present = snd_hda_codec_read(codec, 0x18, 0,
14843 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14844 bits = present ? HDA_AMP_MUTE : 0;
14845 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14846 HDA_AMP_MUTE, bits);
14849 static void alc861vd_lenovo_setup(struct hda_codec *codec)
14851 struct alc_spec *spec = codec->spec;
14852 spec->autocfg.hp_pins[0] = 0x1b;
14853 spec->autocfg.speaker_pins[0] = 0x14;
14856 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14858 alc_automute_amp(codec);
14859 alc861vd_lenovo_mic_automute(codec);
14862 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14865 switch (res >> 26) {
14866 case ALC880_MIC_EVENT:
14867 alc861vd_lenovo_mic_automute(codec);
14870 alc_automute_amp_unsol_event(codec, res);
14875 static struct hda_verb alc861vd_dallas_verbs[] = {
14876 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14877 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14878 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14879 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14881 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14882 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14883 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14884 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14885 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14886 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14887 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14888 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14890 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14891 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14892 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14893 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14894 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14895 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14896 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14897 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14899 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14900 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14901 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14902 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14903 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14904 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14905 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14906 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14908 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14909 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14910 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14911 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14913 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14914 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14915 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14920 /* toggle speaker-output according to the hp-jack state */
14921 static void alc861vd_dallas_setup(struct hda_codec *codec)
14923 struct alc_spec *spec = codec->spec;
14925 spec->autocfg.hp_pins[0] = 0x15;
14926 spec->autocfg.speaker_pins[0] = 0x14;
14929 #ifdef CONFIG_SND_HDA_POWER_SAVE
14930 #define alc861vd_loopbacks alc880_loopbacks
14933 /* pcm configuration: identical with ALC880 */
14934 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14935 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14936 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14937 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14940 * configuration and preset
14942 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14943 [ALC660VD_3ST] = "3stack-660",
14944 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14945 [ALC660VD_ASUS_V1S] = "asus-v1s",
14946 [ALC861VD_3ST] = "3stack",
14947 [ALC861VD_3ST_DIG] = "3stack-digout",
14948 [ALC861VD_6ST_DIG] = "6stack-digout",
14949 [ALC861VD_LENOVO] = "lenovo",
14950 [ALC861VD_DALLAS] = "dallas",
14951 [ALC861VD_HP] = "hp",
14952 [ALC861VD_AUTO] = "auto",
14955 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14956 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14957 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14958 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14959 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14960 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14961 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14962 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14963 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14964 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14965 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
14966 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14967 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14968 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14969 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14970 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14974 static struct alc_config_preset alc861vd_presets[] = {
14976 .mixers = { alc861vd_3st_mixer },
14977 .init_verbs = { alc861vd_volume_init_verbs,
14978 alc861vd_3stack_init_verbs },
14979 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14980 .dac_nids = alc660vd_dac_nids,
14981 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14982 .channel_mode = alc861vd_3stack_2ch_modes,
14983 .input_mux = &alc861vd_capture_source,
14985 [ALC660VD_3ST_DIG] = {
14986 .mixers = { alc861vd_3st_mixer },
14987 .init_verbs = { alc861vd_volume_init_verbs,
14988 alc861vd_3stack_init_verbs },
14989 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14990 .dac_nids = alc660vd_dac_nids,
14991 .dig_out_nid = ALC861VD_DIGOUT_NID,
14992 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14993 .channel_mode = alc861vd_3stack_2ch_modes,
14994 .input_mux = &alc861vd_capture_source,
14997 .mixers = { alc861vd_3st_mixer },
14998 .init_verbs = { alc861vd_volume_init_verbs,
14999 alc861vd_3stack_init_verbs },
15000 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15001 .dac_nids = alc861vd_dac_nids,
15002 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15003 .channel_mode = alc861vd_3stack_2ch_modes,
15004 .input_mux = &alc861vd_capture_source,
15006 [ALC861VD_3ST_DIG] = {
15007 .mixers = { alc861vd_3st_mixer },
15008 .init_verbs = { alc861vd_volume_init_verbs,
15009 alc861vd_3stack_init_verbs },
15010 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15011 .dac_nids = alc861vd_dac_nids,
15012 .dig_out_nid = ALC861VD_DIGOUT_NID,
15013 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15014 .channel_mode = alc861vd_3stack_2ch_modes,
15015 .input_mux = &alc861vd_capture_source,
15017 [ALC861VD_6ST_DIG] = {
15018 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15019 .init_verbs = { alc861vd_volume_init_verbs,
15020 alc861vd_6stack_init_verbs },
15021 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15022 .dac_nids = alc861vd_dac_nids,
15023 .dig_out_nid = ALC861VD_DIGOUT_NID,
15024 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15025 .channel_mode = alc861vd_6stack_modes,
15026 .input_mux = &alc861vd_capture_source,
15028 [ALC861VD_LENOVO] = {
15029 .mixers = { alc861vd_lenovo_mixer },
15030 .init_verbs = { alc861vd_volume_init_verbs,
15031 alc861vd_3stack_init_verbs,
15032 alc861vd_eapd_verbs,
15033 alc861vd_lenovo_unsol_verbs },
15034 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15035 .dac_nids = alc660vd_dac_nids,
15036 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15037 .channel_mode = alc861vd_3stack_2ch_modes,
15038 .input_mux = &alc861vd_capture_source,
15039 .unsol_event = alc861vd_lenovo_unsol_event,
15040 .setup = alc861vd_lenovo_setup,
15041 .init_hook = alc861vd_lenovo_init_hook,
15043 [ALC861VD_DALLAS] = {
15044 .mixers = { alc861vd_dallas_mixer },
15045 .init_verbs = { alc861vd_dallas_verbs },
15046 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15047 .dac_nids = alc861vd_dac_nids,
15048 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15049 .channel_mode = alc861vd_3stack_2ch_modes,
15050 .input_mux = &alc861vd_dallas_capture_source,
15051 .unsol_event = alc_automute_amp_unsol_event,
15052 .setup = alc861vd_dallas_setup,
15053 .init_hook = alc_automute_amp,
15056 .mixers = { alc861vd_hp_mixer },
15057 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15058 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15059 .dac_nids = alc861vd_dac_nids,
15060 .dig_out_nid = ALC861VD_DIGOUT_NID,
15061 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15062 .channel_mode = alc861vd_3stack_2ch_modes,
15063 .input_mux = &alc861vd_hp_capture_source,
15064 .unsol_event = alc_automute_amp_unsol_event,
15065 .setup = alc861vd_dallas_setup,
15066 .init_hook = alc_automute_amp,
15068 [ALC660VD_ASUS_V1S] = {
15069 .mixers = { alc861vd_lenovo_mixer },
15070 .init_verbs = { alc861vd_volume_init_verbs,
15071 alc861vd_3stack_init_verbs,
15072 alc861vd_eapd_verbs,
15073 alc861vd_lenovo_unsol_verbs },
15074 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15075 .dac_nids = alc660vd_dac_nids,
15076 .dig_out_nid = ALC861VD_DIGOUT_NID,
15077 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15078 .channel_mode = alc861vd_3stack_2ch_modes,
15079 .input_mux = &alc861vd_capture_source,
15080 .unsol_event = alc861vd_lenovo_unsol_event,
15081 .setup = alc861vd_lenovo_setup,
15082 .init_hook = alc861vd_lenovo_init_hook,
15087 * BIOS auto configuration
15089 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15090 const struct auto_pin_cfg *cfg)
15092 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15096 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15097 hda_nid_t nid, int pin_type, int dac_idx)
15099 alc_set_pin_output(codec, nid, pin_type);
15102 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15104 struct alc_spec *spec = codec->spec;
15107 for (i = 0; i <= HDA_SIDE; i++) {
15108 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15109 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15111 alc861vd_auto_set_output_and_unmute(codec, nid,
15117 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15119 struct alc_spec *spec = codec->spec;
15122 pin = spec->autocfg.hp_pins[0];
15123 if (pin) /* connect to front and use dac 0 */
15124 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15125 pin = spec->autocfg.speaker_pins[0];
15127 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15130 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15132 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15134 struct alc_spec *spec = codec->spec;
15137 for (i = 0; i < AUTO_PIN_LAST; i++) {
15138 hda_nid_t nid = spec->autocfg.input_pins[i];
15139 if (alc_is_input_pin(codec, nid)) {
15140 alc_set_input_pin(codec, nid, i);
15141 if (nid != ALC861VD_PIN_CD_NID &&
15142 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15143 snd_hda_codec_write(codec, nid, 0,
15144 AC_VERB_SET_AMP_GAIN_MUTE,
15150 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15152 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15153 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15155 /* add playback controls from the parsed DAC table */
15156 /* Based on ALC880 version. But ALC861VD has separate,
15157 * different NIDs for mute/unmute switch and volume control */
15158 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15159 const struct auto_pin_cfg *cfg)
15162 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15163 hda_nid_t nid_v, nid_s;
15166 for (i = 0; i < cfg->line_outs; i++) {
15167 if (!spec->multiout.dac_nids[i])
15169 nid_v = alc861vd_idx_to_mixer_vol(
15171 spec->multiout.dac_nids[i]));
15172 nid_s = alc861vd_idx_to_mixer_switch(
15174 spec->multiout.dac_nids[i]));
15178 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15179 "Center Playback Volume",
15180 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15184 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15185 "LFE Playback Volume",
15186 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15190 err = add_control(spec, ALC_CTL_BIND_MUTE,
15191 "Center Playback Switch",
15192 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15196 err = add_control(spec, ALC_CTL_BIND_MUTE,
15197 "LFE Playback Switch",
15198 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15203 sprintf(name, "%s Playback Volume", chname[i]);
15204 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15205 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15209 sprintf(name, "%s Playback Switch", chname[i]);
15210 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15211 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15220 /* add playback controls for speaker and HP outputs */
15221 /* Based on ALC880 version. But ALC861VD has separate,
15222 * different NIDs for mute/unmute switch and volume control */
15223 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15224 hda_nid_t pin, const char *pfx)
15226 hda_nid_t nid_v, nid_s;
15233 if (alc880_is_fixed_pin(pin)) {
15234 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15235 /* specify the DAC as the extra output */
15236 if (!spec->multiout.hp_nid)
15237 spec->multiout.hp_nid = nid_v;
15239 spec->multiout.extra_out_nid[0] = nid_v;
15240 /* control HP volume/switch on the output mixer amp */
15241 nid_v = alc861vd_idx_to_mixer_vol(
15242 alc880_fixed_pin_idx(pin));
15243 nid_s = alc861vd_idx_to_mixer_switch(
15244 alc880_fixed_pin_idx(pin));
15246 sprintf(name, "%s Playback Volume", pfx);
15247 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15248 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15251 sprintf(name, "%s Playback Switch", pfx);
15252 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15253 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15256 } else if (alc880_is_multi_pin(pin)) {
15257 /* set manual connection */
15258 /* we have only a switch on HP-out PIN */
15259 sprintf(name, "%s Playback Switch", pfx);
15260 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15261 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15268 /* parse the BIOS configuration and set up the alc_spec
15269 * return 1 if successful, 0 if the proper config is not found,
15270 * or a negative error code
15271 * Based on ALC880 version - had to change it to override
15272 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15273 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15275 struct alc_spec *spec = codec->spec;
15277 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15279 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15283 if (!spec->autocfg.line_outs)
15284 return 0; /* can't find valid BIOS pin config */
15286 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15289 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15292 err = alc861vd_auto_create_extra_out(spec,
15293 spec->autocfg.speaker_pins[0],
15297 err = alc861vd_auto_create_extra_out(spec,
15298 spec->autocfg.hp_pins[0],
15302 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15306 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15308 if (spec->autocfg.dig_outs)
15309 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15311 if (spec->kctls.list)
15312 add_mixer(spec, spec->kctls.list);
15314 add_verb(spec, alc861vd_volume_init_verbs);
15316 spec->num_mux_defs = 1;
15317 spec->input_mux = &spec->private_imux[0];
15319 err = alc_auto_add_mic_boost(codec);
15323 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15328 /* additional initialization for auto-configuration model */
15329 static void alc861vd_auto_init(struct hda_codec *codec)
15331 struct alc_spec *spec = codec->spec;
15332 alc861vd_auto_init_multi_out(codec);
15333 alc861vd_auto_init_hp_out(codec);
15334 alc861vd_auto_init_analog_input(codec);
15335 alc861vd_auto_init_input_src(codec);
15336 if (spec->unsol_event)
15337 alc_inithook(codec);
15340 static int patch_alc861vd(struct hda_codec *codec)
15342 struct alc_spec *spec;
15343 int err, board_config;
15345 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15349 codec->spec = spec;
15351 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15355 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15356 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15358 board_config = ALC861VD_AUTO;
15361 if (board_config == ALC861VD_AUTO) {
15362 /* automatic parse from the BIOS config */
15363 err = alc861vd_parse_auto_config(codec);
15369 "hda_codec: Cannot set up configuration "
15370 "from BIOS. Using base mode...\n");
15371 board_config = ALC861VD_3ST;
15375 err = snd_hda_attach_beep_device(codec, 0x23);
15381 if (board_config != ALC861VD_AUTO)
15382 setup_preset(codec, &alc861vd_presets[board_config]);
15384 if (codec->vendor_id == 0x10ec0660) {
15385 /* always turn on EAPD */
15386 add_verb(spec, alc660vd_eapd_verbs);
15389 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15390 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15392 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15393 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15395 if (!spec->adc_nids) {
15396 spec->adc_nids = alc861vd_adc_nids;
15397 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15399 if (!spec->capsrc_nids)
15400 spec->capsrc_nids = alc861vd_capsrc_nids;
15402 set_capture_mixer(codec);
15403 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15405 spec->vmaster_nid = 0x02;
15407 codec->patch_ops = alc_patch_ops;
15409 if (board_config == ALC861VD_AUTO)
15410 spec->init_hook = alc861vd_auto_init;
15411 #ifdef CONFIG_SND_HDA_POWER_SAVE
15412 if (!spec->loopback.amplist)
15413 spec->loopback.amplist = alc861vd_loopbacks;
15415 codec->proc_widget_hook = print_realtek_coef;
15423 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15424 * configuration. Each pin widget can choose any input DACs and a mixer.
15425 * Each ADC is connected from a mixer of all inputs. This makes possible
15426 * 6-channel independent captures.
15428 * In addition, an independent DAC for the multi-playback (not used in this
15431 #define ALC662_DIGOUT_NID 0x06
15432 #define ALC662_DIGIN_NID 0x0a
15434 static hda_nid_t alc662_dac_nids[4] = {
15435 /* front, rear, clfe, rear_surr */
15439 static hda_nid_t alc272_dac_nids[2] = {
15443 static hda_nid_t alc662_adc_nids[2] = {
15448 static hda_nid_t alc272_adc_nids[1] = {
15453 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15454 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15458 /* FIXME: should be a matrix-type input source selection */
15459 static struct hda_input_mux alc662_capture_source = {
15463 { "Front Mic", 0x1 },
15469 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15477 static struct hda_input_mux alc663_capture_source = {
15481 { "Front Mic", 0x1 },
15486 #if 0 /* set to 1 for testing other input sources below */
15487 static struct hda_input_mux alc272_nc10_capture_source = {
15490 { "Autoselect Mic", 0x0 },
15491 { "Internal Mic", 0x1 },
15492 { "In-0x02", 0x2 },
15493 { "In-0x03", 0x3 },
15494 { "In-0x04", 0x4 },
15495 { "In-0x05", 0x5 },
15496 { "In-0x06", 0x6 },
15497 { "In-0x07", 0x7 },
15498 { "In-0x08", 0x8 },
15499 { "In-0x09", 0x9 },
15500 { "In-0x0a", 0x0a },
15501 { "In-0x0b", 0x0b },
15502 { "In-0x0c", 0x0c },
15503 { "In-0x0d", 0x0d },
15504 { "In-0x0e", 0x0e },
15505 { "In-0x0f", 0x0f },
15513 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15520 static struct hda_verb alc662_3ST_ch2_init[] = {
15521 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15522 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15523 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15524 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15531 static struct hda_verb alc662_3ST_ch6_init[] = {
15532 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15533 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15534 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15535 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15536 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15537 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15541 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15542 { 2, alc662_3ST_ch2_init },
15543 { 6, alc662_3ST_ch6_init },
15549 static struct hda_verb alc662_sixstack_ch6_init[] = {
15550 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15551 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15552 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15559 static struct hda_verb alc662_sixstack_ch8_init[] = {
15560 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15561 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15562 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15566 static struct hda_channel_mode alc662_5stack_modes[2] = {
15567 { 2, alc662_sixstack_ch6_init },
15568 { 6, alc662_sixstack_ch8_init },
15571 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15572 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15575 static struct snd_kcontrol_new alc662_base_mixer[] = {
15576 /* output mixer control */
15577 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15578 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15579 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15580 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15581 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15582 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15583 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15584 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15585 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15587 /*Input mixer control */
15588 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15589 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15590 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15591 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15592 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15593 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15594 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15595 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15599 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15600 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15601 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15602 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15603 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15604 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15605 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15606 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15607 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15608 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15609 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15610 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15614 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15615 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15616 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15617 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15618 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15619 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15620 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15621 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15622 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15623 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15624 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15625 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15626 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15627 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15628 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15629 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15630 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15631 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15635 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15636 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15637 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15638 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15639 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15640 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15641 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15642 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15643 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15644 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15648 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15649 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15650 ALC262_HIPPO_MASTER_SWITCH,
15652 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15653 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15654 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15656 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15657 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15658 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15662 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15663 ALC262_HIPPO_MASTER_SWITCH,
15664 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15665 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15666 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15667 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15668 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15669 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15670 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15676 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15677 .ops = &snd_hda_bind_vol,
15679 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15680 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15685 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15686 .ops = &snd_hda_bind_sw,
15688 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15689 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15694 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15695 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15696 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15697 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15698 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15702 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15703 .ops = &snd_hda_bind_sw,
15705 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15706 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15707 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15712 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15713 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15714 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15715 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15716 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15717 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15718 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15723 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15724 .ops = &snd_hda_bind_sw,
15726 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15727 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15728 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15733 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15734 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15735 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15736 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15737 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15738 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15739 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15743 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15744 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15745 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15746 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15747 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15748 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15749 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15750 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15754 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15755 .ops = &snd_hda_bind_vol,
15757 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15758 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15763 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15764 .ops = &snd_hda_bind_sw,
15766 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15767 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15772 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15773 HDA_BIND_VOL("Master Playback Volume",
15774 &alc663_asus_two_bind_master_vol),
15775 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15776 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15777 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15778 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15783 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15784 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15785 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15786 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15787 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15788 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15789 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15793 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15794 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15795 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15796 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15797 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15798 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15800 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15801 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15802 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15803 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15807 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15808 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15809 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15810 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15812 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15813 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15814 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15815 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15816 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15817 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15821 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15823 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15824 .name = "Channel Mode",
15825 .info = alc_ch_mode_info,
15826 .get = alc_ch_mode_get,
15827 .put = alc_ch_mode_put,
15832 static struct hda_verb alc662_init_verbs[] = {
15833 /* ADC: mute amp left and right */
15834 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15835 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15836 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15838 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15839 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15840 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15841 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15842 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15844 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15846 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15847 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15848 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15849 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15851 /* Front Pin: output 0 (0x0c) */
15852 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15853 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15855 /* Rear Pin: output 1 (0x0d) */
15856 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15857 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15859 /* CLFE Pin: output 2 (0x0e) */
15860 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15861 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15863 /* Mic (rear) pin: input vref at 80% */
15864 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15865 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15866 /* Front Mic pin: input vref at 80% */
15867 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15868 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15869 /* Line In pin: input */
15870 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15871 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15872 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15873 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15874 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15875 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15876 /* CD pin widget for input */
15877 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15879 /* FIXME: use matrix-type input source selection */
15880 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15882 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15883 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15885 /* always trun on EAPD */
15886 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15887 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15892 static struct hda_verb alc662_sue_init_verbs[] = {
15893 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15894 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15898 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15899 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15900 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15904 /* Set Unsolicited Event*/
15905 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15906 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15907 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15912 * generic initialization of ADC, input mixers and output mixers
15914 static struct hda_verb alc662_auto_init_verbs[] = {
15916 * Unmute ADC and set the default input to mic-in
15918 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15919 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15921 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15923 * Note: PASD motherboards uses the Line In 2 as the input for front
15924 * panel mic (mic 2)
15926 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15927 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15928 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15929 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15930 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15934 * Set up output mixers (0x0c - 0x0f)
15936 /* set vol=0 to output mixers */
15937 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15938 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15939 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15941 /* set up input amps for analog loopback */
15942 /* Amp Indices: DAC = 0, mixer = 1 */
15943 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15944 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15945 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15946 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15947 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15948 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15951 /* FIXME: use matrix-type input source selection */
15952 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15954 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15955 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15959 /* additional verbs for ALC663 */
15960 static struct hda_verb alc663_auto_init_verbs[] = {
15961 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15962 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15966 static struct hda_verb alc663_m51va_init_verbs[] = {
15967 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15968 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15969 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15970 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15971 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15972 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15973 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15974 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15975 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15979 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15980 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15981 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15982 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15983 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15984 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15985 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15986 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15990 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15991 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15992 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15993 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15994 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15995 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15996 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15997 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15998 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16002 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16003 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16004 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16005 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16006 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16007 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16008 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16009 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16013 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16014 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16015 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16016 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16017 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16018 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16019 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16020 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16021 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16022 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16023 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16024 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16025 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16029 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16030 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16031 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16032 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16033 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16034 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16035 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16036 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16039 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16040 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16041 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16045 static struct hda_verb alc663_g71v_init_verbs[] = {
16046 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16047 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16048 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16050 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16051 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16052 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16054 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16055 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16056 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16060 static struct hda_verb alc663_g50v_init_verbs[] = {
16061 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16062 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16063 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16065 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16066 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16070 static struct hda_verb alc662_ecs_init_verbs[] = {
16071 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16072 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16073 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16074 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16078 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16079 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16080 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16081 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16082 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16083 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16084 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16085 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16088 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16089 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16093 static struct hda_verb alc272_dell_init_verbs[] = {
16094 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16095 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16096 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16097 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16098 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16099 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16100 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16101 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16102 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16103 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16104 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16108 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16109 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16110 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16114 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16115 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16116 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16120 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16122 unsigned int present;
16123 unsigned char bits;
16125 present = snd_hda_codec_read(codec, 0x14, 0,
16126 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16127 bits = present ? HDA_AMP_MUTE : 0;
16128 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16129 HDA_AMP_MUTE, bits);
16132 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16134 unsigned int present;
16135 unsigned char bits;
16137 present = snd_hda_codec_read(codec, 0x1b, 0,
16138 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16139 bits = present ? HDA_AMP_MUTE : 0;
16140 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16141 HDA_AMP_MUTE, bits);
16142 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16143 HDA_AMP_MUTE, bits);
16146 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16149 if ((res >> 26) == ALC880_HP_EVENT)
16150 alc662_lenovo_101e_all_automute(codec);
16151 if ((res >> 26) == ALC880_FRONT_EVENT)
16152 alc662_lenovo_101e_ispeaker_automute(codec);
16155 /* unsolicited event for HP jack sensing */
16156 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16159 if ((res >> 26) == ALC880_MIC_EVENT)
16160 alc_mic_automute(codec);
16162 alc262_hippo_unsol_event(codec, res);
16165 static void alc662_eeepc_setup(struct hda_codec *codec)
16167 struct alc_spec *spec = codec->spec;
16169 alc262_hippo1_setup(codec);
16170 spec->ext_mic.pin = 0x18;
16171 spec->ext_mic.mux_idx = 0;
16172 spec->int_mic.pin = 0x19;
16173 spec->int_mic.mux_idx = 1;
16174 spec->auto_mic = 1;
16177 static void alc662_eeepc_inithook(struct hda_codec *codec)
16179 alc262_hippo_automute(codec);
16180 alc_mic_automute(codec);
16183 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16185 struct alc_spec *spec = codec->spec;
16187 spec->autocfg.hp_pins[0] = 0x14;
16188 spec->autocfg.speaker_pins[0] = 0x1b;
16191 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16193 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16195 unsigned int present;
16196 unsigned char bits;
16198 present = snd_hda_codec_read(codec, 0x21, 0,
16199 AC_VERB_GET_PIN_SENSE, 0)
16200 & AC_PINSENSE_PRESENCE;
16201 bits = present ? HDA_AMP_MUTE : 0;
16202 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16203 AMP_IN_MUTE(0), bits);
16204 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16205 AMP_IN_MUTE(0), bits);
16208 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16210 unsigned int present;
16211 unsigned char bits;
16213 present = snd_hda_codec_read(codec, 0x21, 0,
16214 AC_VERB_GET_PIN_SENSE, 0)
16215 & AC_PINSENSE_PRESENCE;
16216 bits = present ? HDA_AMP_MUTE : 0;
16217 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16218 AMP_IN_MUTE(0), bits);
16219 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16220 AMP_IN_MUTE(0), bits);
16221 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16222 AMP_IN_MUTE(0), bits);
16223 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16224 AMP_IN_MUTE(0), bits);
16227 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16229 unsigned int present;
16230 unsigned char bits;
16232 present = snd_hda_codec_read(codec, 0x15, 0,
16233 AC_VERB_GET_PIN_SENSE, 0)
16234 & AC_PINSENSE_PRESENCE;
16235 bits = present ? HDA_AMP_MUTE : 0;
16236 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16237 AMP_IN_MUTE(0), bits);
16238 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16239 AMP_IN_MUTE(0), bits);
16240 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16241 AMP_IN_MUTE(0), bits);
16242 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16243 AMP_IN_MUTE(0), bits);
16246 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16248 unsigned int present;
16249 unsigned char bits;
16251 present = snd_hda_codec_read(codec, 0x1b, 0,
16252 AC_VERB_GET_PIN_SENSE, 0)
16253 & AC_PINSENSE_PRESENCE;
16254 bits = present ? 0 : PIN_OUT;
16255 snd_hda_codec_write(codec, 0x14, 0,
16256 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16259 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16261 unsigned int present1, present2;
16263 present1 = snd_hda_codec_read(codec, 0x21, 0,
16264 AC_VERB_GET_PIN_SENSE, 0)
16265 & AC_PINSENSE_PRESENCE;
16266 present2 = snd_hda_codec_read(codec, 0x15, 0,
16267 AC_VERB_GET_PIN_SENSE, 0)
16268 & AC_PINSENSE_PRESENCE;
16270 if (present1 || present2) {
16271 snd_hda_codec_write_cache(codec, 0x14, 0,
16272 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16274 snd_hda_codec_write_cache(codec, 0x14, 0,
16275 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16279 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16281 unsigned int present1, present2;
16283 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16284 AC_VERB_GET_PIN_SENSE, 0)
16285 & AC_PINSENSE_PRESENCE;
16286 present2 = snd_hda_codec_read(codec, 0x15, 0,
16287 AC_VERB_GET_PIN_SENSE, 0)
16288 & AC_PINSENSE_PRESENCE;
16290 if (present1 || present2) {
16291 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16292 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16293 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16294 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16296 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16297 AMP_IN_MUTE(0), 0);
16298 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16299 AMP_IN_MUTE(0), 0);
16303 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16306 switch (res >> 26) {
16307 case ALC880_HP_EVENT:
16308 alc663_m51va_speaker_automute(codec);
16310 case ALC880_MIC_EVENT:
16311 alc_mic_automute(codec);
16316 static void alc663_m51va_setup(struct hda_codec *codec)
16318 struct alc_spec *spec = codec->spec;
16319 spec->ext_mic.pin = 0x18;
16320 spec->ext_mic.mux_idx = 0;
16321 spec->int_mic.pin = 0x12;
16322 spec->int_mic.mux_idx = 1;
16323 spec->auto_mic = 1;
16326 static void alc663_m51va_inithook(struct hda_codec *codec)
16328 alc663_m51va_speaker_automute(codec);
16329 alc_mic_automute(codec);
16332 /* ***************** Mode1 ******************************/
16333 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16334 #define alc663_mode1_setup alc663_m51va_setup
16335 #define alc663_mode1_inithook alc663_m51va_inithook
16337 /* ***************** Mode2 ******************************/
16338 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16341 switch (res >> 26) {
16342 case ALC880_HP_EVENT:
16343 alc662_f5z_speaker_automute(codec);
16345 case ALC880_MIC_EVENT:
16346 alc_mic_automute(codec);
16351 #define alc662_mode2_setup alc663_m51va_setup
16353 static void alc662_mode2_inithook(struct hda_codec *codec)
16355 alc662_f5z_speaker_automute(codec);
16356 alc_mic_automute(codec);
16358 /* ***************** Mode3 ******************************/
16359 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16362 switch (res >> 26) {
16363 case ALC880_HP_EVENT:
16364 alc663_two_hp_m1_speaker_automute(codec);
16366 case ALC880_MIC_EVENT:
16367 alc_mic_automute(codec);
16372 #define alc663_mode3_setup alc663_m51va_setup
16374 static void alc663_mode3_inithook(struct hda_codec *codec)
16376 alc663_two_hp_m1_speaker_automute(codec);
16377 alc_mic_automute(codec);
16379 /* ***************** Mode4 ******************************/
16380 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16383 switch (res >> 26) {
16384 case ALC880_HP_EVENT:
16385 alc663_21jd_two_speaker_automute(codec);
16387 case ALC880_MIC_EVENT:
16388 alc_mic_automute(codec);
16393 #define alc663_mode4_setup alc663_m51va_setup
16395 static void alc663_mode4_inithook(struct hda_codec *codec)
16397 alc663_21jd_two_speaker_automute(codec);
16398 alc_mic_automute(codec);
16400 /* ***************** Mode5 ******************************/
16401 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16404 switch (res >> 26) {
16405 case ALC880_HP_EVENT:
16406 alc663_15jd_two_speaker_automute(codec);
16408 case ALC880_MIC_EVENT:
16409 alc_mic_automute(codec);
16414 #define alc663_mode5_setup alc663_m51va_setup
16416 static void alc663_mode5_inithook(struct hda_codec *codec)
16418 alc663_15jd_two_speaker_automute(codec);
16419 alc_mic_automute(codec);
16421 /* ***************** Mode6 ******************************/
16422 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16425 switch (res >> 26) {
16426 case ALC880_HP_EVENT:
16427 alc663_two_hp_m2_speaker_automute(codec);
16429 case ALC880_MIC_EVENT:
16430 alc_mic_automute(codec);
16435 #define alc663_mode6_setup alc663_m51va_setup
16437 static void alc663_mode6_inithook(struct hda_codec *codec)
16439 alc663_two_hp_m2_speaker_automute(codec);
16440 alc_mic_automute(codec);
16443 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16445 unsigned int present;
16446 unsigned char bits;
16448 present = snd_hda_codec_read(codec, 0x21, 0,
16449 AC_VERB_GET_PIN_SENSE, 0)
16450 & AC_PINSENSE_PRESENCE;
16451 bits = present ? HDA_AMP_MUTE : 0;
16452 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16453 HDA_AMP_MUTE, bits);
16454 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16455 HDA_AMP_MUTE, bits);
16458 static void alc663_g71v_front_automute(struct hda_codec *codec)
16460 unsigned int present;
16461 unsigned char bits;
16463 present = snd_hda_codec_read(codec, 0x15, 0,
16464 AC_VERB_GET_PIN_SENSE, 0)
16465 & AC_PINSENSE_PRESENCE;
16466 bits = present ? HDA_AMP_MUTE : 0;
16467 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16468 HDA_AMP_MUTE, bits);
16471 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16474 switch (res >> 26) {
16475 case ALC880_HP_EVENT:
16476 alc663_g71v_hp_automute(codec);
16478 case ALC880_FRONT_EVENT:
16479 alc663_g71v_front_automute(codec);
16481 case ALC880_MIC_EVENT:
16482 alc_mic_automute(codec);
16487 #define alc663_g71v_setup alc663_m51va_setup
16489 static void alc663_g71v_inithook(struct hda_codec *codec)
16491 alc663_g71v_front_automute(codec);
16492 alc663_g71v_hp_automute(codec);
16493 alc_mic_automute(codec);
16496 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16499 switch (res >> 26) {
16500 case ALC880_HP_EVENT:
16501 alc663_m51va_speaker_automute(codec);
16503 case ALC880_MIC_EVENT:
16504 alc_mic_automute(codec);
16509 #define alc663_g50v_setup alc663_m51va_setup
16511 static void alc663_g50v_inithook(struct hda_codec *codec)
16513 alc663_m51va_speaker_automute(codec);
16514 alc_mic_automute(codec);
16517 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16518 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16519 ALC262_HIPPO_MASTER_SWITCH,
16521 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16522 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16523 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16525 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16526 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16527 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16531 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16532 /* Master Playback automatically created from Speaker and Headphone */
16533 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16534 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16535 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16536 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16538 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16539 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16540 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16542 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16543 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16544 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16548 #ifdef CONFIG_SND_HDA_POWER_SAVE
16549 #define alc662_loopbacks alc880_loopbacks
16553 /* pcm configuration: identical with ALC880 */
16554 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16555 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16556 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16557 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16560 * configuration and preset
16562 static const char *alc662_models[ALC662_MODEL_LAST] = {
16563 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16564 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16565 [ALC662_3ST_6ch] = "3stack-6ch",
16566 [ALC662_5ST_DIG] = "6stack-dig",
16567 [ALC662_LENOVO_101E] = "lenovo-101e",
16568 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16569 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16570 [ALC662_ECS] = "ecs",
16571 [ALC663_ASUS_M51VA] = "m51va",
16572 [ALC663_ASUS_G71V] = "g71v",
16573 [ALC663_ASUS_H13] = "h13",
16574 [ALC663_ASUS_G50V] = "g50v",
16575 [ALC663_ASUS_MODE1] = "asus-mode1",
16576 [ALC662_ASUS_MODE2] = "asus-mode2",
16577 [ALC663_ASUS_MODE3] = "asus-mode3",
16578 [ALC663_ASUS_MODE4] = "asus-mode4",
16579 [ALC663_ASUS_MODE5] = "asus-mode5",
16580 [ALC663_ASUS_MODE6] = "asus-mode6",
16581 [ALC272_DELL] = "dell",
16582 [ALC272_DELL_ZM1] = "dell-zm1",
16583 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16584 [ALC662_AUTO] = "auto",
16587 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16588 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16589 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16590 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16591 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16592 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16593 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16594 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16595 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16596 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16597 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16598 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16599 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16600 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16601 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16602 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16603 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16604 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16605 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16606 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16607 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16608 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16609 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16610 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16611 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16612 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16613 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16614 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16615 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16616 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16617 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16618 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16619 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16620 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16621 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16622 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16623 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16624 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16625 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16626 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16627 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16628 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16629 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16630 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16631 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16632 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16633 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16634 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16635 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16636 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16637 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16638 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16639 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16640 ALC662_3ST_6ch_DIG),
16641 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16642 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16643 ALC662_3ST_6ch_DIG),
16644 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16645 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16646 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16647 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16648 ALC662_3ST_6ch_DIG),
16649 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16654 static struct alc_config_preset alc662_presets[] = {
16655 [ALC662_3ST_2ch_DIG] = {
16656 .mixers = { alc662_3ST_2ch_mixer },
16657 .init_verbs = { alc662_init_verbs },
16658 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16659 .dac_nids = alc662_dac_nids,
16660 .dig_out_nid = ALC662_DIGOUT_NID,
16661 .dig_in_nid = ALC662_DIGIN_NID,
16662 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16663 .channel_mode = alc662_3ST_2ch_modes,
16664 .input_mux = &alc662_capture_source,
16666 [ALC662_3ST_6ch_DIG] = {
16667 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16668 .init_verbs = { alc662_init_verbs },
16669 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16670 .dac_nids = alc662_dac_nids,
16671 .dig_out_nid = ALC662_DIGOUT_NID,
16672 .dig_in_nid = ALC662_DIGIN_NID,
16673 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16674 .channel_mode = alc662_3ST_6ch_modes,
16676 .input_mux = &alc662_capture_source,
16678 [ALC662_3ST_6ch] = {
16679 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16680 .init_verbs = { alc662_init_verbs },
16681 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16682 .dac_nids = alc662_dac_nids,
16683 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16684 .channel_mode = alc662_3ST_6ch_modes,
16686 .input_mux = &alc662_capture_source,
16688 [ALC662_5ST_DIG] = {
16689 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16690 .init_verbs = { alc662_init_verbs },
16691 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16692 .dac_nids = alc662_dac_nids,
16693 .dig_out_nid = ALC662_DIGOUT_NID,
16694 .dig_in_nid = ALC662_DIGIN_NID,
16695 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16696 .channel_mode = alc662_5stack_modes,
16697 .input_mux = &alc662_capture_source,
16699 [ALC662_LENOVO_101E] = {
16700 .mixers = { alc662_lenovo_101e_mixer },
16701 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16702 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16703 .dac_nids = alc662_dac_nids,
16704 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16705 .channel_mode = alc662_3ST_2ch_modes,
16706 .input_mux = &alc662_lenovo_101e_capture_source,
16707 .unsol_event = alc662_lenovo_101e_unsol_event,
16708 .init_hook = alc662_lenovo_101e_all_automute,
16710 [ALC662_ASUS_EEEPC_P701] = {
16711 .mixers = { alc662_eeepc_p701_mixer },
16712 .init_verbs = { alc662_init_verbs,
16713 alc662_eeepc_sue_init_verbs },
16714 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16715 .dac_nids = alc662_dac_nids,
16716 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16717 .channel_mode = alc662_3ST_2ch_modes,
16718 .unsol_event = alc662_eeepc_unsol_event,
16719 .setup = alc662_eeepc_setup,
16720 .init_hook = alc662_eeepc_inithook,
16722 [ALC662_ASUS_EEEPC_EP20] = {
16723 .mixers = { alc662_eeepc_ep20_mixer,
16724 alc662_chmode_mixer },
16725 .init_verbs = { alc662_init_verbs,
16726 alc662_eeepc_ep20_sue_init_verbs },
16727 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16728 .dac_nids = alc662_dac_nids,
16729 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16730 .channel_mode = alc662_3ST_6ch_modes,
16731 .input_mux = &alc662_lenovo_101e_capture_source,
16732 .unsol_event = alc662_eeepc_unsol_event,
16733 .setup = alc662_eeepc_ep20_setup,
16734 .init_hook = alc662_eeepc_ep20_inithook,
16737 .mixers = { alc662_ecs_mixer },
16738 .init_verbs = { alc662_init_verbs,
16739 alc662_ecs_init_verbs },
16740 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16741 .dac_nids = alc662_dac_nids,
16742 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16743 .channel_mode = alc662_3ST_2ch_modes,
16744 .unsol_event = alc662_eeepc_unsol_event,
16745 .setup = alc662_eeepc_setup,
16746 .init_hook = alc662_eeepc_inithook,
16748 [ALC663_ASUS_M51VA] = {
16749 .mixers = { alc663_m51va_mixer },
16750 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16751 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16752 .dac_nids = alc662_dac_nids,
16753 .dig_out_nid = ALC662_DIGOUT_NID,
16754 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16755 .channel_mode = alc662_3ST_2ch_modes,
16756 .unsol_event = alc663_m51va_unsol_event,
16757 .setup = alc663_m51va_setup,
16758 .init_hook = alc663_m51va_inithook,
16760 [ALC663_ASUS_G71V] = {
16761 .mixers = { alc663_g71v_mixer },
16762 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16763 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16764 .dac_nids = alc662_dac_nids,
16765 .dig_out_nid = ALC662_DIGOUT_NID,
16766 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16767 .channel_mode = alc662_3ST_2ch_modes,
16768 .unsol_event = alc663_g71v_unsol_event,
16769 .setup = alc663_g71v_setup,
16770 .init_hook = alc663_g71v_inithook,
16772 [ALC663_ASUS_H13] = {
16773 .mixers = { alc663_m51va_mixer },
16774 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16775 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16776 .dac_nids = alc662_dac_nids,
16777 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16778 .channel_mode = alc662_3ST_2ch_modes,
16779 .unsol_event = alc663_m51va_unsol_event,
16780 .init_hook = alc663_m51va_inithook,
16782 [ALC663_ASUS_G50V] = {
16783 .mixers = { alc663_g50v_mixer },
16784 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16785 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16786 .dac_nids = alc662_dac_nids,
16787 .dig_out_nid = ALC662_DIGOUT_NID,
16788 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16789 .channel_mode = alc662_3ST_6ch_modes,
16790 .input_mux = &alc663_capture_source,
16791 .unsol_event = alc663_g50v_unsol_event,
16792 .setup = alc663_g50v_setup,
16793 .init_hook = alc663_g50v_inithook,
16795 [ALC663_ASUS_MODE1] = {
16796 .mixers = { alc663_m51va_mixer },
16797 .cap_mixer = alc662_auto_capture_mixer,
16798 .init_verbs = { alc662_init_verbs,
16799 alc663_21jd_amic_init_verbs },
16800 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16802 .dac_nids = alc662_dac_nids,
16803 .dig_out_nid = ALC662_DIGOUT_NID,
16804 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16805 .channel_mode = alc662_3ST_2ch_modes,
16806 .unsol_event = alc663_mode1_unsol_event,
16807 .setup = alc663_mode1_setup,
16808 .init_hook = alc663_mode1_inithook,
16810 [ALC662_ASUS_MODE2] = {
16811 .mixers = { alc662_1bjd_mixer },
16812 .cap_mixer = alc662_auto_capture_mixer,
16813 .init_verbs = { alc662_init_verbs,
16814 alc662_1bjd_amic_init_verbs },
16815 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16816 .dac_nids = alc662_dac_nids,
16817 .dig_out_nid = ALC662_DIGOUT_NID,
16818 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16819 .channel_mode = alc662_3ST_2ch_modes,
16820 .unsol_event = alc662_mode2_unsol_event,
16821 .setup = alc662_mode2_setup,
16822 .init_hook = alc662_mode2_inithook,
16824 [ALC663_ASUS_MODE3] = {
16825 .mixers = { alc663_two_hp_m1_mixer },
16826 .cap_mixer = alc662_auto_capture_mixer,
16827 .init_verbs = { alc662_init_verbs,
16828 alc663_two_hp_amic_m1_init_verbs },
16829 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16831 .dac_nids = alc662_dac_nids,
16832 .dig_out_nid = ALC662_DIGOUT_NID,
16833 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16834 .channel_mode = alc662_3ST_2ch_modes,
16835 .unsol_event = alc663_mode3_unsol_event,
16836 .setup = alc663_mode3_setup,
16837 .init_hook = alc663_mode3_inithook,
16839 [ALC663_ASUS_MODE4] = {
16840 .mixers = { alc663_asus_21jd_clfe_mixer },
16841 .cap_mixer = alc662_auto_capture_mixer,
16842 .init_verbs = { alc662_init_verbs,
16843 alc663_21jd_amic_init_verbs},
16844 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16846 .dac_nids = alc662_dac_nids,
16847 .dig_out_nid = ALC662_DIGOUT_NID,
16848 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16849 .channel_mode = alc662_3ST_2ch_modes,
16850 .unsol_event = alc663_mode4_unsol_event,
16851 .setup = alc663_mode4_setup,
16852 .init_hook = alc663_mode4_inithook,
16854 [ALC663_ASUS_MODE5] = {
16855 .mixers = { alc663_asus_15jd_clfe_mixer },
16856 .cap_mixer = alc662_auto_capture_mixer,
16857 .init_verbs = { alc662_init_verbs,
16858 alc663_15jd_amic_init_verbs },
16859 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16861 .dac_nids = alc662_dac_nids,
16862 .dig_out_nid = ALC662_DIGOUT_NID,
16863 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16864 .channel_mode = alc662_3ST_2ch_modes,
16865 .unsol_event = alc663_mode5_unsol_event,
16866 .setup = alc663_mode5_setup,
16867 .init_hook = alc663_mode5_inithook,
16869 [ALC663_ASUS_MODE6] = {
16870 .mixers = { alc663_two_hp_m2_mixer },
16871 .cap_mixer = alc662_auto_capture_mixer,
16872 .init_verbs = { alc662_init_verbs,
16873 alc663_two_hp_amic_m2_init_verbs },
16874 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16876 .dac_nids = alc662_dac_nids,
16877 .dig_out_nid = ALC662_DIGOUT_NID,
16878 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16879 .channel_mode = alc662_3ST_2ch_modes,
16880 .unsol_event = alc663_mode6_unsol_event,
16881 .setup = alc663_mode6_setup,
16882 .init_hook = alc663_mode6_inithook,
16885 .mixers = { alc663_m51va_mixer },
16886 .cap_mixer = alc272_auto_capture_mixer,
16887 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16888 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16889 .dac_nids = alc662_dac_nids,
16890 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16891 .adc_nids = alc272_adc_nids,
16892 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16893 .capsrc_nids = alc272_capsrc_nids,
16894 .channel_mode = alc662_3ST_2ch_modes,
16895 .unsol_event = alc663_m51va_unsol_event,
16896 .setup = alc663_m51va_setup,
16897 .init_hook = alc663_m51va_inithook,
16899 [ALC272_DELL_ZM1] = {
16900 .mixers = { alc663_m51va_mixer },
16901 .cap_mixer = alc662_auto_capture_mixer,
16902 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16903 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16904 .dac_nids = alc662_dac_nids,
16905 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16906 .adc_nids = alc662_adc_nids,
16908 .capsrc_nids = alc662_capsrc_nids,
16909 .channel_mode = alc662_3ST_2ch_modes,
16910 .unsol_event = alc663_m51va_unsol_event,
16911 .setup = alc663_m51va_setup,
16912 .init_hook = alc663_m51va_inithook,
16914 [ALC272_SAMSUNG_NC10] = {
16915 .mixers = { alc272_nc10_mixer },
16916 .init_verbs = { alc662_init_verbs,
16917 alc663_21jd_amic_init_verbs },
16918 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16919 .dac_nids = alc272_dac_nids,
16920 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16921 .channel_mode = alc662_3ST_2ch_modes,
16922 /*.input_mux = &alc272_nc10_capture_source,*/
16923 .unsol_event = alc663_mode4_unsol_event,
16924 .setup = alc663_mode4_setup,
16925 .init_hook = alc663_mode4_inithook,
16931 * BIOS auto configuration
16934 /* add playback controls from the parsed DAC table */
16935 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16936 const struct auto_pin_cfg *cfg)
16939 static const char *chname[4] = {
16940 "Front", "Surround", NULL /*CLFE*/, "Side"
16945 for (i = 0; i < cfg->line_outs; i++) {
16946 if (!spec->multiout.dac_nids[i])
16948 nid = alc880_idx_to_dac(i);
16951 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16952 "Center Playback Volume",
16953 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16957 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16958 "LFE Playback Volume",
16959 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16963 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16964 "Center Playback Switch",
16965 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16969 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16970 "LFE Playback Switch",
16971 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16976 sprintf(name, "%s Playback Volume", chname[i]);
16977 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16978 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16982 sprintf(name, "%s Playback Switch", chname[i]);
16983 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16984 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16993 /* add playback controls for speaker and HP outputs */
16994 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17005 /* ALC663 has a mono output pin on 0x17 */
17006 sprintf(name, "%s Playback Switch", pfx);
17007 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17008 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17012 if (alc880_is_fixed_pin(pin)) {
17013 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17014 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17015 /* specify the DAC as the extra output */
17016 if (!spec->multiout.hp_nid)
17017 spec->multiout.hp_nid = nid;
17019 spec->multiout.extra_out_nid[0] = nid;
17020 /* control HP volume/switch on the output mixer amp */
17021 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17022 sprintf(name, "%s Playback Volume", pfx);
17023 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17024 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17027 sprintf(name, "%s Playback Switch", pfx);
17028 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17029 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17032 } else if (alc880_is_multi_pin(pin)) {
17033 /* set manual connection */
17034 /* we have only a switch on HP-out PIN */
17035 sprintf(name, "%s Playback Switch", pfx);
17036 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17037 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17044 /* create playback/capture controls for input pins */
17045 #define alc662_auto_create_input_ctls \
17046 alc880_auto_create_input_ctls
17048 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17049 hda_nid_t nid, int pin_type,
17052 alc_set_pin_output(codec, nid, pin_type);
17053 /* need the manual connection? */
17054 if (alc880_is_multi_pin(nid)) {
17055 struct alc_spec *spec = codec->spec;
17056 int idx = alc880_multi_pin_idx(nid);
17057 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17058 AC_VERB_SET_CONNECT_SEL,
17059 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17063 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17065 struct alc_spec *spec = codec->spec;
17068 for (i = 0; i <= HDA_SIDE; i++) {
17069 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17070 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17072 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17077 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17079 struct alc_spec *spec = codec->spec;
17082 pin = spec->autocfg.hp_pins[0];
17083 if (pin) /* connect to front */
17085 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17086 pin = spec->autocfg.speaker_pins[0];
17088 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17091 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17093 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17095 struct alc_spec *spec = codec->spec;
17098 for (i = 0; i < AUTO_PIN_LAST; i++) {
17099 hda_nid_t nid = spec->autocfg.input_pins[i];
17100 if (alc_is_input_pin(codec, nid)) {
17101 alc_set_input_pin(codec, nid, i);
17102 if (nid != ALC662_PIN_CD_NID &&
17103 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17104 snd_hda_codec_write(codec, nid, 0,
17105 AC_VERB_SET_AMP_GAIN_MUTE,
17111 #define alc662_auto_init_input_src alc882_auto_init_input_src
17113 static int alc662_parse_auto_config(struct hda_codec *codec)
17115 struct alc_spec *spec = codec->spec;
17117 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17119 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17123 if (!spec->autocfg.line_outs)
17124 return 0; /* can't find valid BIOS pin config */
17126 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17129 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17132 err = alc662_auto_create_extra_out(spec,
17133 spec->autocfg.speaker_pins[0],
17137 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17141 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17145 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17147 if (spec->autocfg.dig_outs)
17148 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17150 if (spec->kctls.list)
17151 add_mixer(spec, spec->kctls.list);
17153 spec->num_mux_defs = 1;
17154 spec->input_mux = &spec->private_imux[0];
17156 add_verb(spec, alc662_auto_init_verbs);
17157 if (codec->vendor_id == 0x10ec0663)
17158 add_verb(spec, alc663_auto_init_verbs);
17160 err = alc_auto_add_mic_boost(codec);
17164 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17169 /* additional initialization for auto-configuration model */
17170 static void alc662_auto_init(struct hda_codec *codec)
17172 struct alc_spec *spec = codec->spec;
17173 alc662_auto_init_multi_out(codec);
17174 alc662_auto_init_hp_out(codec);
17175 alc662_auto_init_analog_input(codec);
17176 alc662_auto_init_input_src(codec);
17177 if (spec->unsol_event)
17178 alc_inithook(codec);
17181 static int patch_alc662(struct hda_codec *codec)
17183 struct alc_spec *spec;
17184 int err, board_config;
17186 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17190 codec->spec = spec;
17192 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17194 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17197 if (board_config < 0) {
17198 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17200 board_config = ALC662_AUTO;
17203 if (board_config == ALC662_AUTO) {
17204 /* automatic parse from the BIOS config */
17205 err = alc662_parse_auto_config(codec);
17211 "hda_codec: Cannot set up configuration "
17212 "from BIOS. Using base mode...\n");
17213 board_config = ALC662_3ST_2ch_DIG;
17217 err = snd_hda_attach_beep_device(codec, 0x1);
17223 if (board_config != ALC662_AUTO)
17224 setup_preset(codec, &alc662_presets[board_config]);
17226 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17227 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17229 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17230 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17232 if (!spec->adc_nids) {
17233 spec->adc_nids = alc662_adc_nids;
17234 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17236 if (!spec->capsrc_nids)
17237 spec->capsrc_nids = alc662_capsrc_nids;
17239 if (!spec->cap_mixer)
17240 set_capture_mixer(codec);
17241 if (codec->vendor_id == 0x10ec0662)
17242 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17244 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17246 spec->vmaster_nid = 0x02;
17248 codec->patch_ops = alc_patch_ops;
17249 if (board_config == ALC662_AUTO)
17250 spec->init_hook = alc662_auto_init;
17251 #ifdef CONFIG_SND_HDA_POWER_SAVE
17252 if (!spec->loopback.amplist)
17253 spec->loopback.amplist = alc662_loopbacks;
17255 codec->proc_widget_hook = print_realtek_coef;
17263 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17264 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17265 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17266 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17267 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17268 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17269 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17270 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17271 .patch = patch_alc861 },
17272 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17273 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17274 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17275 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17276 .patch = patch_alc882 },
17277 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17278 .patch = patch_alc662 },
17279 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17280 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17281 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17282 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17283 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17284 .patch = patch_alc882 },
17285 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17286 .patch = patch_alc882 },
17287 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17288 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17289 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17290 .patch = patch_alc882 },
17291 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17292 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17293 {} /* terminator */
17296 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17298 MODULE_LICENSE("GPL");
17299 MODULE_DESCRIPTION("Realtek HD-audio codec");
17301 static struct hda_codec_preset_list realtek_list = {
17302 .preset = snd_hda_preset_realtek,
17303 .owner = THIS_MODULE,
17306 static int __init patch_realtek_init(void)
17308 return snd_hda_add_codec_preset(&realtek_list);
17311 static void __exit patch_realtek_exit(void)
17313 snd_hda_delete_codec_preset(&realtek_list);
17316 module_init(patch_realtek_init)
17317 module_exit(patch_realtek_exit)