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,
4401 sprintf(name, "%s Playback Volume", chname[i]);
4402 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4403 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4407 sprintf(name, "%s Playback Switch", chname[i]);
4408 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4409 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4418 /* add playback controls for speaker and HP outputs */
4419 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4429 if (alc880_is_fixed_pin(pin)) {
4430 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4431 /* specify the DAC as the extra output */
4432 if (!spec->multiout.hp_nid)
4433 spec->multiout.hp_nid = nid;
4435 spec->multiout.extra_out_nid[0] = nid;
4436 /* control HP volume/switch on the output mixer amp */
4437 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4438 sprintf(name, "%s Playback Volume", pfx);
4439 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4440 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4443 sprintf(name, "%s Playback Switch", pfx);
4444 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4445 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4448 } else if (alc880_is_multi_pin(pin)) {
4449 /* set manual connection */
4450 /* we have only a switch on HP-out PIN */
4451 sprintf(name, "%s Playback Switch", pfx);
4452 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4453 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4460 /* create input playback/capture controls for the given pin */
4461 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4462 const char *ctlname,
4463 int idx, hda_nid_t mix_nid)
4468 sprintf(name, "%s Playback Volume", ctlname);
4469 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4470 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4473 sprintf(name, "%s Playback Switch", ctlname);
4474 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4475 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4481 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4483 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4484 return (pincap & AC_PINCAP_IN) != 0;
4487 /* create playback/capture controls for input pins */
4488 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4489 const struct auto_pin_cfg *cfg,
4491 hda_nid_t cap1, hda_nid_t cap2)
4493 struct alc_spec *spec = codec->spec;
4494 struct hda_input_mux *imux = &spec->private_imux[0];
4497 for (i = 0; i < AUTO_PIN_LAST; i++) {
4500 pin = cfg->input_pins[i];
4501 if (!alc_is_input_pin(codec, pin))
4505 idx = get_connection_index(codec, mixer, pin);
4507 err = new_analog_input(spec, pin,
4508 auto_pin_cfg_labels[i],
4517 idx = get_connection_index(codec, cap1, pin);
4518 if (idx < 0 && cap2)
4519 idx = get_connection_index(codec, cap2, pin);
4521 imux->items[imux->num_items].label =
4522 auto_pin_cfg_labels[i];
4523 imux->items[imux->num_items].index = idx;
4530 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4531 const struct auto_pin_cfg *cfg)
4533 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4536 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4537 unsigned int pin_type)
4539 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4542 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4546 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4547 hda_nid_t nid, int pin_type,
4550 alc_set_pin_output(codec, nid, pin_type);
4551 /* need the manual connection? */
4552 if (alc880_is_multi_pin(nid)) {
4553 struct alc_spec *spec = codec->spec;
4554 int idx = alc880_multi_pin_idx(nid);
4555 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4556 AC_VERB_SET_CONNECT_SEL,
4557 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4561 static int get_pin_type(int line_out_type)
4563 if (line_out_type == AUTO_PIN_HP_OUT)
4569 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4571 struct alc_spec *spec = codec->spec;
4574 for (i = 0; i < spec->autocfg.line_outs; i++) {
4575 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4576 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4577 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4581 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4583 struct alc_spec *spec = codec->spec;
4586 pin = spec->autocfg.speaker_pins[0];
4587 if (pin) /* connect to front */
4588 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4589 pin = spec->autocfg.hp_pins[0];
4590 if (pin) /* connect to front */
4591 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4594 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4596 struct alc_spec *spec = codec->spec;
4599 for (i = 0; i < AUTO_PIN_LAST; i++) {
4600 hda_nid_t nid = spec->autocfg.input_pins[i];
4601 if (alc_is_input_pin(codec, nid)) {
4602 alc_set_input_pin(codec, nid, i);
4603 if (nid != ALC880_PIN_CD_NID &&
4604 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4605 snd_hda_codec_write(codec, nid, 0,
4606 AC_VERB_SET_AMP_GAIN_MUTE,
4612 /* parse the BIOS configuration and set up the alc_spec */
4613 /* return 1 if successful, 0 if the proper config is not found,
4614 * or a negative error code
4616 static int alc880_parse_auto_config(struct hda_codec *codec)
4618 struct alc_spec *spec = codec->spec;
4620 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4622 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4626 if (!spec->autocfg.line_outs)
4627 return 0; /* can't find valid BIOS pin config */
4629 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4632 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4635 err = alc880_auto_create_extra_out(spec,
4636 spec->autocfg.speaker_pins[0],
4640 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4644 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4648 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4650 /* check multiple SPDIF-out (for recent codecs) */
4651 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4653 err = snd_hda_get_connections(codec,
4654 spec->autocfg.dig_out_pins[i],
4659 spec->multiout.dig_out_nid = dig_nid;
4661 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4662 spec->slave_dig_outs[i - 1] = dig_nid;
4663 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4667 if (spec->autocfg.dig_in_pin)
4668 spec->dig_in_nid = ALC880_DIGIN_NID;
4670 if (spec->kctls.list)
4671 add_mixer(spec, spec->kctls.list);
4673 add_verb(spec, alc880_volume_init_verbs);
4675 spec->num_mux_defs = 1;
4676 spec->input_mux = &spec->private_imux[0];
4678 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4683 /* additional initialization for auto-configuration model */
4684 static void alc880_auto_init(struct hda_codec *codec)
4686 struct alc_spec *spec = codec->spec;
4687 alc880_auto_init_multi_out(codec);
4688 alc880_auto_init_extra_out(codec);
4689 alc880_auto_init_analog_input(codec);
4690 if (spec->unsol_event)
4691 alc_inithook(codec);
4694 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4695 * one of two digital mic pins, e.g. on ALC272
4697 static void fixup_automic_adc(struct hda_codec *codec)
4699 struct alc_spec *spec = codec->spec;
4702 for (i = 0; i < spec->num_adc_nids; i++) {
4703 hda_nid_t cap = spec->capsrc_nids ?
4704 spec->capsrc_nids[i] : spec->adc_nids[i];
4707 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4710 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4713 spec->int_mic.mux_idx = iidx;
4714 spec->ext_mic.mux_idx = eidx;
4715 if (spec->capsrc_nids)
4716 spec->capsrc_nids += i;
4717 spec->adc_nids += i;
4718 spec->num_adc_nids = 1;
4721 snd_printd(KERN_INFO "hda_codec: %s: "
4722 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4723 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4724 spec->auto_mic = 0; /* disable auto-mic to be sure */
4727 static void set_capture_mixer(struct hda_codec *codec)
4729 struct alc_spec *spec = codec->spec;
4730 static struct snd_kcontrol_new *caps[2][3] = {
4731 { alc_capture_mixer_nosrc1,
4732 alc_capture_mixer_nosrc2,
4733 alc_capture_mixer_nosrc3 },
4734 { alc_capture_mixer1,
4736 alc_capture_mixer3 },
4738 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4740 if (spec->auto_mic) {
4742 fixup_automic_adc(codec);
4743 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4747 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4751 #define set_beep_amp(spec, nid, idx, dir) \
4752 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4755 * OK, here we have finally the patch for ALC880
4758 static int patch_alc880(struct hda_codec *codec)
4760 struct alc_spec *spec;
4764 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4770 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4773 if (board_config < 0) {
4774 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4776 board_config = ALC880_AUTO;
4779 if (board_config == ALC880_AUTO) {
4780 /* automatic parse from the BIOS config */
4781 err = alc880_parse_auto_config(codec);
4787 "hda_codec: Cannot set up configuration "
4788 "from BIOS. Using 3-stack mode...\n");
4789 board_config = ALC880_3ST;
4793 err = snd_hda_attach_beep_device(codec, 0x1);
4799 if (board_config != ALC880_AUTO)
4800 setup_preset(codec, &alc880_presets[board_config]);
4802 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4803 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4804 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4806 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4807 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4809 if (!spec->adc_nids && spec->input_mux) {
4810 /* check whether NID 0x07 is valid */
4811 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4813 wcap = get_wcaps_type(wcap);
4814 if (wcap != AC_WID_AUD_IN) {
4815 spec->adc_nids = alc880_adc_nids_alt;
4816 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4818 spec->adc_nids = alc880_adc_nids;
4819 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4822 set_capture_mixer(codec);
4823 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4825 spec->vmaster_nid = 0x0c;
4827 codec->patch_ops = alc_patch_ops;
4828 if (board_config == ALC880_AUTO)
4829 spec->init_hook = alc880_auto_init;
4830 #ifdef CONFIG_SND_HDA_POWER_SAVE
4831 if (!spec->loopback.amplist)
4832 spec->loopback.amplist = alc880_loopbacks;
4834 codec->proc_widget_hook = print_realtek_coef;
4844 static hda_nid_t alc260_dac_nids[1] = {
4849 static hda_nid_t alc260_adc_nids[1] = {
4854 static hda_nid_t alc260_adc_nids_alt[1] = {
4859 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4860 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4862 static hda_nid_t alc260_dual_adc_nids[2] = {
4867 #define ALC260_DIGOUT_NID 0x03
4868 #define ALC260_DIGIN_NID 0x06
4870 static struct hda_input_mux alc260_capture_source = {
4874 { "Front Mic", 0x1 },
4880 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4881 * headphone jack and the internal CD lines since these are the only pins at
4882 * which audio can appear. For flexibility, also allow the option of
4883 * recording the mixer output on the second ADC (ADC0 doesn't have a
4884 * connection to the mixer output).
4886 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4890 { "Mic/Line", 0x0 },
4892 { "Headphone", 0x2 },
4898 { "Mic/Line", 0x0 },
4900 { "Headphone", 0x2 },
4907 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4908 * the Fujitsu S702x, but jacks are marked differently.
4910 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4917 { "Headphone", 0x5 },
4926 { "Headphone", 0x6 },
4932 /* Maxdata Favorit 100XS */
4933 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4937 { "Line/Mic", 0x0 },
4944 { "Line/Mic", 0x0 },
4952 * This is just place-holder, so there's something for alc_build_pcms to look
4953 * at when it calculates the maximum number of channels. ALC260 has no mixer
4954 * element which allows changing the channel mode, so the verb list is
4957 static struct hda_channel_mode alc260_modes[1] = {
4962 /* Mixer combinations
4964 * basic: base_output + input + pc_beep + capture
4965 * HP: base_output + input + capture_alt
4966 * HP_3013: hp_3013 + input + capture
4967 * fujitsu: fujitsu + capture
4968 * acer: acer + capture
4971 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4972 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4973 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4974 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4975 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4976 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4977 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4981 static struct snd_kcontrol_new alc260_input_mixer[] = {
4982 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4983 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4984 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4985 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4986 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4987 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4988 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4989 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4993 /* update HP, line and mono out pins according to the master switch */
4994 static void alc260_hp_master_update(struct hda_codec *codec,
4995 hda_nid_t hp, hda_nid_t line,
4998 struct alc_spec *spec = codec->spec;
4999 unsigned int val = spec->master_sw ? PIN_HP : 0;
5000 /* change HP and line-out pins */
5001 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5003 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5005 /* mono (speaker) depending on the HP jack sense */
5006 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5007 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5011 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5012 struct snd_ctl_elem_value *ucontrol)
5014 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5015 struct alc_spec *spec = codec->spec;
5016 *ucontrol->value.integer.value = spec->master_sw;
5020 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5021 struct snd_ctl_elem_value *ucontrol)
5023 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5024 struct alc_spec *spec = codec->spec;
5025 int val = !!*ucontrol->value.integer.value;
5026 hda_nid_t hp, line, mono;
5028 if (val == spec->master_sw)
5030 spec->master_sw = val;
5031 hp = (kcontrol->private_value >> 16) & 0xff;
5032 line = (kcontrol->private_value >> 8) & 0xff;
5033 mono = kcontrol->private_value & 0xff;
5034 alc260_hp_master_update(codec, hp, line, mono);
5038 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5040 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5041 .name = "Master Playback Switch",
5042 .info = snd_ctl_boolean_mono_info,
5043 .get = alc260_hp_master_sw_get,
5044 .put = alc260_hp_master_sw_put,
5045 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5047 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5048 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5049 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5050 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5051 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5053 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5057 static struct hda_verb alc260_hp_unsol_verbs[] = {
5058 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5062 static void alc260_hp_automute(struct hda_codec *codec)
5064 struct alc_spec *spec = codec->spec;
5065 unsigned int present;
5067 present = snd_hda_codec_read(codec, 0x10, 0,
5068 AC_VERB_GET_PIN_SENSE, 0);
5069 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5070 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5073 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5075 if ((res >> 26) == ALC880_HP_EVENT)
5076 alc260_hp_automute(codec);
5079 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5081 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5082 .name = "Master Playback Switch",
5083 .info = snd_ctl_boolean_mono_info,
5084 .get = alc260_hp_master_sw_get,
5085 .put = alc260_hp_master_sw_put,
5086 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5088 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5089 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5090 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5091 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5092 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5093 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5094 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5095 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5099 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5100 .ops = &snd_hda_bind_vol,
5102 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5103 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5104 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5109 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5110 .ops = &snd_hda_bind_sw,
5112 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5113 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5118 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5119 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5120 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5121 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5122 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5126 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5127 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5131 static void alc260_hp_3013_automute(struct hda_codec *codec)
5133 struct alc_spec *spec = codec->spec;
5134 unsigned int present;
5136 present = snd_hda_codec_read(codec, 0x15, 0,
5137 AC_VERB_GET_PIN_SENSE, 0);
5138 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5139 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5142 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5145 if ((res >> 26) == ALC880_HP_EVENT)
5146 alc260_hp_3013_automute(codec);
5149 static void alc260_hp_3012_automute(struct hda_codec *codec)
5151 unsigned int present, bits;
5153 present = snd_hda_codec_read(codec, 0x10, 0,
5154 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
5156 bits = present ? 0 : PIN_OUT;
5157 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5159 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5161 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5165 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5168 if ((res >> 26) == ALC880_HP_EVENT)
5169 alc260_hp_3012_automute(codec);
5172 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5173 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5175 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5176 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5177 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5178 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5179 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5180 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5181 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5182 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5183 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5184 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5185 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5189 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5190 * versions of the ALC260 don't act on requests to enable mic bias from NID
5191 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5192 * datasheet doesn't mention this restriction. At this stage it's not clear
5193 * whether this behaviour is intentional or is a hardware bug in chip
5194 * revisions available in early 2006. Therefore for now allow the
5195 * "Headphone Jack Mode" control to span all choices, but if it turns out
5196 * that the lack of mic bias for this NID is intentional we could change the
5197 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5199 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5200 * don't appear to make the mic bias available from the "line" jack, even
5201 * though the NID used for this jack (0x14) can supply it. The theory is
5202 * that perhaps Acer have included blocking capacitors between the ALC260
5203 * and the output jack. If this turns out to be the case for all such
5204 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5205 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5207 * The C20x Tablet series have a mono internal speaker which is controlled
5208 * via the chip's Mono sum widget and pin complex, so include the necessary
5209 * controls for such models. On models without a "mono speaker" the control
5210 * won't do anything.
5212 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5213 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5214 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5215 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5216 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5218 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5220 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5221 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5222 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5223 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5224 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5225 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5226 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5227 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5231 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5233 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5234 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5235 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5236 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5237 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5238 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5239 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5243 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5244 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5246 static struct snd_kcontrol_new alc260_will_mixer[] = {
5247 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5248 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5250 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5251 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5252 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5253 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5254 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5255 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5256 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5260 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5261 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5263 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5264 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5265 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5266 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5267 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5268 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5269 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5270 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5271 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5272 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5273 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5278 * initialization verbs
5280 static struct hda_verb alc260_init_verbs[] = {
5281 /* Line In pin widget for input */
5282 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5283 /* CD pin widget for input */
5284 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5285 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5286 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5287 /* Mic2 (front panel) pin widget for input and vref at 80% */
5288 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5289 /* LINE-2 is used for line-out in rear */
5290 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5291 /* select line-out */
5292 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5294 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5296 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5298 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5299 /* mute capture amp left and right */
5300 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5301 /* set connection select to line in (default select for this ADC) */
5302 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5303 /* mute capture amp left and right */
5304 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5305 /* set connection select to line in (default select for this ADC) */
5306 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5307 /* set vol=0 Line-Out mixer amp left and right */
5308 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5309 /* unmute pin widget amp left and right (no gain on this amp) */
5310 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5311 /* set vol=0 HP mixer amp left and right */
5312 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5313 /* unmute pin widget amp left and right (no gain on this amp) */
5314 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5315 /* set vol=0 Mono mixer amp left and right */
5316 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5317 /* unmute pin widget amp left and right (no gain on this amp) */
5318 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5319 /* unmute LINE-2 out pin */
5320 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5321 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5324 /* mute analog inputs */
5325 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5326 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5327 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5330 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5331 /* mute Front out path */
5332 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5333 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5334 /* mute Headphone out path */
5335 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5336 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5337 /* mute Mono out path */
5338 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5339 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5343 #if 0 /* should be identical with alc260_init_verbs? */
5344 static struct hda_verb alc260_hp_init_verbs[] = {
5345 /* Headphone and output */
5346 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5348 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5349 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5350 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5351 /* Mic2 (front panel) pin widget for input and vref at 80% */
5352 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5353 /* Line In pin widget for input */
5354 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5355 /* Line-2 pin widget for output */
5356 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5357 /* CD pin widget for input */
5358 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5359 /* unmute amp left and right */
5360 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5361 /* set connection select to line in (default select for this ADC) */
5362 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5363 /* unmute Line-Out mixer amp left and right (volume = 0) */
5364 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5365 /* mute pin widget amp left and right (no gain on this amp) */
5366 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5367 /* unmute HP mixer amp left and right (volume = 0) */
5368 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5369 /* mute pin widget amp left and right (no gain on this amp) */
5370 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5371 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5374 /* mute analog inputs */
5375 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5376 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5377 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5378 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5379 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5380 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5381 /* Unmute Front out path */
5382 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5383 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5384 /* Unmute Headphone out path */
5385 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5386 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5387 /* Unmute Mono out path */
5388 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5389 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5394 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5395 /* Line out and output */
5396 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5398 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5399 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5400 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5401 /* Mic2 (front panel) pin widget for input and vref at 80% */
5402 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5403 /* Line In pin widget for input */
5404 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5405 /* Headphone pin widget for output */
5406 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5407 /* CD pin widget for input */
5408 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5409 /* unmute amp left and right */
5410 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5411 /* set connection select to line in (default select for this ADC) */
5412 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5413 /* unmute Line-Out mixer amp left and right (volume = 0) */
5414 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5415 /* mute pin widget amp left and right (no gain on this amp) */
5416 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5417 /* unmute HP mixer amp left and right (volume = 0) */
5418 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5419 /* mute pin widget amp left and right (no gain on this amp) */
5420 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5421 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5424 /* mute analog inputs */
5425 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5426 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5427 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5428 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5429 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5430 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5431 /* Unmute Front out path */
5432 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5433 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5434 /* Unmute Headphone out path */
5435 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5436 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5437 /* Unmute Mono out path */
5438 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5439 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5443 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5444 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5445 * audio = 0x16, internal speaker = 0x10.
5447 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5448 /* Disable all GPIOs */
5449 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5450 /* Internal speaker is connected to headphone pin */
5451 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5452 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5453 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5454 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5455 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5456 /* Ensure all other unused pins are disabled and muted. */
5457 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5458 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5459 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5460 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5461 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5462 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5463 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5464 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5466 /* Disable digital (SPDIF) pins */
5467 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5468 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5470 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5471 * when acting as an output.
5473 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5475 /* Start with output sum widgets muted and their output gains at min */
5476 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5477 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5478 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5479 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5480 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5481 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5482 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5483 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5484 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5486 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5487 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5488 /* Unmute Line1 pin widget output buffer since it starts as an output.
5489 * If the pin mode is changed by the user the pin mode control will
5490 * take care of enabling the pin's input/output buffers as needed.
5491 * Therefore there's no need to enable the input buffer at this
5494 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5495 /* Unmute input buffer of pin widget used for Line-in (no equiv
5498 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5500 /* Mute capture amp left and right */
5501 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5502 /* Set ADC connection select to match default mixer setting - line
5505 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5507 /* Do the same for the second ADC: mute capture input amp and
5508 * set ADC connection to line in (on mic1 pin)
5510 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5511 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5513 /* Mute all inputs to mixer widget (even unconnected ones) */
5514 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5515 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5516 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5517 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5518 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5519 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5520 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5521 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5526 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5527 * similar laptops (adapted from Fujitsu init verbs).
5529 static struct hda_verb alc260_acer_init_verbs[] = {
5530 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5531 * the headphone jack. Turn this on and rely on the standard mute
5532 * methods whenever the user wants to turn these outputs off.
5534 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5535 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5536 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5537 /* Internal speaker/Headphone jack is connected to Line-out pin */
5538 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5539 /* Internal microphone/Mic jack is connected to Mic1 pin */
5540 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5541 /* Line In jack is connected to Line1 pin */
5542 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5543 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5544 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5545 /* Ensure all other unused pins are disabled and muted. */
5546 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5547 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5548 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5549 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5550 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5551 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5552 /* Disable digital (SPDIF) pins */
5553 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5554 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5556 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5557 * bus when acting as outputs.
5559 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5560 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5562 /* Start with output sum widgets muted and their output gains at min */
5563 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5564 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5565 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5566 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5567 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5568 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5569 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5570 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5571 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5573 /* Unmute Line-out pin widget amp left and right
5574 * (no equiv mixer ctrl)
5576 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5577 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5578 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5579 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5580 * inputs. If the pin mode is changed by the user the pin mode control
5581 * will take care of enabling the pin's input/output buffers as needed.
5582 * Therefore there's no need to enable the input buffer at this
5585 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5586 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5588 /* Mute capture amp left and right */
5589 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5590 /* Set ADC connection select to match default mixer setting - mic
5593 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5595 /* Do similar with the second ADC: mute capture input amp and
5596 * set ADC connection to mic to match ALSA's default state.
5598 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5599 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5601 /* Mute all inputs to mixer widget (even unconnected ones) */
5602 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5603 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5604 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5605 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5606 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5607 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5608 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5609 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5614 /* Initialisation sequence for Maxdata Favorit 100XS
5615 * (adapted from Acer init verbs).
5617 static struct hda_verb alc260_favorit100_init_verbs[] = {
5618 /* GPIO 0 enables the output jack.
5619 * Turn this on and rely on the standard mute
5620 * methods whenever the user wants to turn these outputs off.
5622 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5623 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5624 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5625 /* Line/Mic input jack is connected to Mic1 pin */
5626 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5627 /* Ensure all other unused pins are disabled and muted. */
5628 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5629 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5630 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5631 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5632 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5633 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5634 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5635 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5636 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5637 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5638 /* Disable digital (SPDIF) pins */
5639 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5640 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5642 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5643 * bus when acting as outputs.
5645 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5646 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5648 /* Start with output sum widgets muted and their output gains at min */
5649 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5650 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5651 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5652 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5653 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5654 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5655 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5656 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5657 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5659 /* Unmute Line-out pin widget amp left and right
5660 * (no equiv mixer ctrl)
5662 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5663 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5664 * inputs. If the pin mode is changed by the user the pin mode control
5665 * will take care of enabling the pin's input/output buffers as needed.
5666 * Therefore there's no need to enable the input buffer at this
5669 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5671 /* Mute capture amp left and right */
5672 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5673 /* Set ADC connection select to match default mixer setting - mic
5676 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5678 /* Do similar with the second ADC: mute capture input amp and
5679 * set ADC connection to mic to match ALSA's default state.
5681 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5682 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5684 /* Mute all inputs to mixer widget (even unconnected ones) */
5685 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5686 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5687 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5688 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5689 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5690 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5692 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5697 static struct hda_verb alc260_will_verbs[] = {
5698 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5699 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5700 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5701 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5702 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5703 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5707 static struct hda_verb alc260_replacer_672v_verbs[] = {
5708 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5709 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5710 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5712 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5713 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5714 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5716 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5720 /* toggle speaker-output according to the hp-jack state */
5721 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5723 unsigned int present;
5725 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5726 present = snd_hda_codec_read(codec, 0x0f, 0,
5727 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5729 snd_hda_codec_write_cache(codec, 0x01, 0,
5730 AC_VERB_SET_GPIO_DATA, 1);
5731 snd_hda_codec_write_cache(codec, 0x0f, 0,
5732 AC_VERB_SET_PIN_WIDGET_CONTROL,
5735 snd_hda_codec_write_cache(codec, 0x01, 0,
5736 AC_VERB_SET_GPIO_DATA, 0);
5737 snd_hda_codec_write_cache(codec, 0x0f, 0,
5738 AC_VERB_SET_PIN_WIDGET_CONTROL,
5743 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5746 if ((res >> 26) == ALC880_HP_EVENT)
5747 alc260_replacer_672v_automute(codec);
5750 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5751 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5752 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5753 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5754 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5755 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5756 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5757 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5758 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5759 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5760 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5764 /* Test configuration for debugging, modelled after the ALC880 test
5767 #ifdef CONFIG_SND_DEBUG
5768 static hda_nid_t alc260_test_dac_nids[1] = {
5771 static hda_nid_t alc260_test_adc_nids[2] = {
5774 /* For testing the ALC260, each input MUX needs its own definition since
5775 * the signal assignments are different. This assumes that the first ADC
5778 static struct hda_input_mux alc260_test_capture_sources[2] = {
5782 { "MIC1 pin", 0x0 },
5783 { "MIC2 pin", 0x1 },
5784 { "LINE1 pin", 0x2 },
5785 { "LINE2 pin", 0x3 },
5787 { "LINE-OUT pin", 0x5 },
5788 { "HP-OUT pin", 0x6 },
5794 { "MIC1 pin", 0x0 },
5795 { "MIC2 pin", 0x1 },
5796 { "LINE1 pin", 0x2 },
5797 { "LINE2 pin", 0x3 },
5800 { "LINE-OUT pin", 0x6 },
5801 { "HP-OUT pin", 0x7 },
5805 static struct snd_kcontrol_new alc260_test_mixer[] = {
5806 /* Output driver widgets */
5807 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5808 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5809 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5810 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5811 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5812 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5814 /* Modes for retasking pin widgets
5815 * Note: the ALC260 doesn't seem to act on requests to enable mic
5816 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5817 * mention this restriction. At this stage it's not clear whether
5818 * this behaviour is intentional or is a hardware bug in chip
5819 * revisions available at least up until early 2006. Therefore for
5820 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5821 * choices, but if it turns out that the lack of mic bias for these
5822 * NIDs is intentional we could change their modes from
5823 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5825 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5826 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5827 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5828 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5829 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5830 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5832 /* Loopback mixer controls */
5833 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5834 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5835 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5836 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5837 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5838 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5839 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5840 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5841 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5842 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5843 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5844 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5845 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5846 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5848 /* Controls for GPIO pins, assuming they are configured as outputs */
5849 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5850 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5851 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5852 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5854 /* Switches to allow the digital IO pins to be enabled. The datasheet
5855 * is ambigious as to which NID is which; testing on laptops which
5856 * make this output available should provide clarification.
5858 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5859 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5861 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5862 * this output to turn on an external amplifier.
5864 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5865 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5869 static struct hda_verb alc260_test_init_verbs[] = {
5870 /* Enable all GPIOs as outputs with an initial value of 0 */
5871 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5872 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5873 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5875 /* Enable retasking pins as output, initially without power amp */
5876 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5877 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5878 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5879 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5880 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5881 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5883 /* Disable digital (SPDIF) pins initially, but users can enable
5884 * them via a mixer switch. In the case of SPDIF-out, this initverb
5885 * payload also sets the generation to 0, output to be in "consumer"
5886 * PCM format, copyright asserted, no pre-emphasis and no validity
5889 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5890 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5892 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5893 * OUT1 sum bus when acting as an output.
5895 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5896 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5897 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5898 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5900 /* Start with output sum widgets muted and their output gains at min */
5901 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5902 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5903 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5904 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5905 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5906 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5907 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5908 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5909 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5911 /* Unmute retasking pin widget output buffers since the default
5912 * state appears to be output. As the pin mode is changed by the
5913 * user the pin mode control will take care of enabling the pin's
5914 * input/output buffers as needed.
5916 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5917 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5918 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5919 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5920 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5921 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5922 /* Also unmute the mono-out pin widget */
5923 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5925 /* Mute capture amp left and right */
5926 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5927 /* Set ADC connection select to match default mixer setting (mic1
5930 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5932 /* Do the same for the second ADC: mute capture input amp and
5933 * set ADC connection to mic1 pin
5935 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5936 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5938 /* Mute all inputs to mixer widget (even unconnected ones) */
5939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5942 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5943 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5944 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5945 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5946 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5952 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5953 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5955 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5956 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5959 * for BIOS auto-configuration
5962 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5963 const char *pfx, int *vol_bits)
5966 unsigned long vol_val, sw_val;
5970 if (nid >= 0x0f && nid < 0x11) {
5971 nid_vol = nid - 0x7;
5972 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5973 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5974 } else if (nid == 0x11) {
5975 nid_vol = nid - 0x7;
5976 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5977 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5978 } else if (nid >= 0x12 && nid <= 0x15) {
5980 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5981 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5985 if (!(*vol_bits & (1 << nid_vol))) {
5986 /* first control for the volume widget */
5987 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5988 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5991 *vol_bits |= (1 << nid_vol);
5993 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5994 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
6000 /* add playback controls from the parsed DAC table */
6001 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6002 const struct auto_pin_cfg *cfg)
6008 spec->multiout.num_dacs = 1;
6009 spec->multiout.dac_nids = spec->private_dac_nids;
6010 spec->multiout.dac_nids[0] = 0x02;
6012 nid = cfg->line_out_pins[0];
6014 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
6019 nid = cfg->speaker_pins[0];
6021 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6026 nid = cfg->hp_pins[0];
6028 err = alc260_add_playback_controls(spec, nid, "Headphone",
6036 /* create playback/capture controls for input pins */
6037 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6038 const struct auto_pin_cfg *cfg)
6040 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6043 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6044 hda_nid_t nid, int pin_type,
6047 alc_set_pin_output(codec, nid, pin_type);
6048 /* need the manual connection? */
6050 int idx = nid - 0x12;
6051 snd_hda_codec_write(codec, idx + 0x0b, 0,
6052 AC_VERB_SET_CONNECT_SEL, sel_idx);
6056 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6058 struct alc_spec *spec = codec->spec;
6061 nid = spec->autocfg.line_out_pins[0];
6063 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6064 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6067 nid = spec->autocfg.speaker_pins[0];
6069 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6071 nid = spec->autocfg.hp_pins[0];
6073 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6076 #define ALC260_PIN_CD_NID 0x16
6077 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6079 struct alc_spec *spec = codec->spec;
6082 for (i = 0; i < AUTO_PIN_LAST; i++) {
6083 hda_nid_t nid = spec->autocfg.input_pins[i];
6085 alc_set_input_pin(codec, nid, i);
6086 if (nid != ALC260_PIN_CD_NID &&
6087 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6088 snd_hda_codec_write(codec, nid, 0,
6089 AC_VERB_SET_AMP_GAIN_MUTE,
6096 * generic initialization of ADC, input mixers and output mixers
6098 static struct hda_verb alc260_volume_init_verbs[] = {
6100 * Unmute ADC0-1 and set the default input to mic-in
6102 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6103 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6104 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6105 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6107 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6109 * Note: PASD motherboards uses the Line In 2 as the input for
6110 * front panel mic (mic 2)
6112 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6113 /* mute analog inputs */
6114 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6115 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6118 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6121 * Set up output mixers (0x08 - 0x0a)
6123 /* set vol=0 to output mixers */
6124 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6125 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6126 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6127 /* set up input amps for analog loopback */
6128 /* Amp Indices: DAC = 0, mixer = 1 */
6129 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6130 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6131 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6132 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6133 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6134 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6139 static int alc260_parse_auto_config(struct hda_codec *codec)
6141 struct alc_spec *spec = codec->spec;
6143 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6145 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6149 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6152 if (!spec->kctls.list)
6153 return 0; /* can't find valid BIOS pin config */
6154 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6158 spec->multiout.max_channels = 2;
6160 if (spec->autocfg.dig_outs)
6161 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6162 if (spec->kctls.list)
6163 add_mixer(spec, spec->kctls.list);
6165 add_verb(spec, alc260_volume_init_verbs);
6167 spec->num_mux_defs = 1;
6168 spec->input_mux = &spec->private_imux[0];
6170 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6175 /* additional initialization for auto-configuration model */
6176 static void alc260_auto_init(struct hda_codec *codec)
6178 struct alc_spec *spec = codec->spec;
6179 alc260_auto_init_multi_out(codec);
6180 alc260_auto_init_analog_input(codec);
6181 if (spec->unsol_event)
6182 alc_inithook(codec);
6185 #ifdef CONFIG_SND_HDA_POWER_SAVE
6186 static struct hda_amp_list alc260_loopbacks[] = {
6187 { 0x07, HDA_INPUT, 0 },
6188 { 0x07, HDA_INPUT, 1 },
6189 { 0x07, HDA_INPUT, 2 },
6190 { 0x07, HDA_INPUT, 3 },
6191 { 0x07, HDA_INPUT, 4 },
6197 * ALC260 configurations
6199 static const char *alc260_models[ALC260_MODEL_LAST] = {
6200 [ALC260_BASIC] = "basic",
6202 [ALC260_HP_3013] = "hp-3013",
6203 [ALC260_HP_DC7600] = "hp-dc7600",
6204 [ALC260_FUJITSU_S702X] = "fujitsu",
6205 [ALC260_ACER] = "acer",
6206 [ALC260_WILL] = "will",
6207 [ALC260_REPLACER_672V] = "replacer",
6208 [ALC260_FAVORIT100] = "favorit100",
6209 #ifdef CONFIG_SND_DEBUG
6210 [ALC260_TEST] = "test",
6212 [ALC260_AUTO] = "auto",
6215 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6216 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6217 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6218 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6219 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6220 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6221 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6222 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6223 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6224 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6225 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6226 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6227 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6228 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6229 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6230 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6231 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6232 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6233 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6234 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6238 static struct alc_config_preset alc260_presets[] = {
6240 .mixers = { alc260_base_output_mixer,
6241 alc260_input_mixer },
6242 .init_verbs = { alc260_init_verbs },
6243 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6244 .dac_nids = alc260_dac_nids,
6245 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6246 .adc_nids = alc260_adc_nids,
6247 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6248 .channel_mode = alc260_modes,
6249 .input_mux = &alc260_capture_source,
6252 .mixers = { alc260_hp_output_mixer,
6253 alc260_input_mixer },
6254 .init_verbs = { alc260_init_verbs,
6255 alc260_hp_unsol_verbs },
6256 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6257 .dac_nids = alc260_dac_nids,
6258 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6259 .adc_nids = alc260_adc_nids_alt,
6260 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6261 .channel_mode = alc260_modes,
6262 .input_mux = &alc260_capture_source,
6263 .unsol_event = alc260_hp_unsol_event,
6264 .init_hook = alc260_hp_automute,
6266 [ALC260_HP_DC7600] = {
6267 .mixers = { alc260_hp_dc7600_mixer,
6268 alc260_input_mixer },
6269 .init_verbs = { alc260_init_verbs,
6270 alc260_hp_dc7600_verbs },
6271 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6272 .dac_nids = alc260_dac_nids,
6273 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6274 .adc_nids = alc260_adc_nids_alt,
6275 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6276 .channel_mode = alc260_modes,
6277 .input_mux = &alc260_capture_source,
6278 .unsol_event = alc260_hp_3012_unsol_event,
6279 .init_hook = alc260_hp_3012_automute,
6281 [ALC260_HP_3013] = {
6282 .mixers = { alc260_hp_3013_mixer,
6283 alc260_input_mixer },
6284 .init_verbs = { alc260_hp_3013_init_verbs,
6285 alc260_hp_3013_unsol_verbs },
6286 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6287 .dac_nids = alc260_dac_nids,
6288 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6289 .adc_nids = alc260_adc_nids_alt,
6290 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6291 .channel_mode = alc260_modes,
6292 .input_mux = &alc260_capture_source,
6293 .unsol_event = alc260_hp_3013_unsol_event,
6294 .init_hook = alc260_hp_3013_automute,
6296 [ALC260_FUJITSU_S702X] = {
6297 .mixers = { alc260_fujitsu_mixer },
6298 .init_verbs = { alc260_fujitsu_init_verbs },
6299 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6300 .dac_nids = alc260_dac_nids,
6301 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6302 .adc_nids = alc260_dual_adc_nids,
6303 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6304 .channel_mode = alc260_modes,
6305 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6306 .input_mux = alc260_fujitsu_capture_sources,
6309 .mixers = { alc260_acer_mixer },
6310 .init_verbs = { alc260_acer_init_verbs },
6311 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6312 .dac_nids = alc260_dac_nids,
6313 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6314 .adc_nids = alc260_dual_adc_nids,
6315 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6316 .channel_mode = alc260_modes,
6317 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6318 .input_mux = alc260_acer_capture_sources,
6320 [ALC260_FAVORIT100] = {
6321 .mixers = { alc260_favorit100_mixer },
6322 .init_verbs = { alc260_favorit100_init_verbs },
6323 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6324 .dac_nids = alc260_dac_nids,
6325 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6326 .adc_nids = alc260_dual_adc_nids,
6327 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6328 .channel_mode = alc260_modes,
6329 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6330 .input_mux = alc260_favorit100_capture_sources,
6333 .mixers = { alc260_will_mixer },
6334 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6335 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6336 .dac_nids = alc260_dac_nids,
6337 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6338 .adc_nids = alc260_adc_nids,
6339 .dig_out_nid = ALC260_DIGOUT_NID,
6340 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6341 .channel_mode = alc260_modes,
6342 .input_mux = &alc260_capture_source,
6344 [ALC260_REPLACER_672V] = {
6345 .mixers = { alc260_replacer_672v_mixer },
6346 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6347 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6348 .dac_nids = alc260_dac_nids,
6349 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6350 .adc_nids = alc260_adc_nids,
6351 .dig_out_nid = ALC260_DIGOUT_NID,
6352 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6353 .channel_mode = alc260_modes,
6354 .input_mux = &alc260_capture_source,
6355 .unsol_event = alc260_replacer_672v_unsol_event,
6356 .init_hook = alc260_replacer_672v_automute,
6358 #ifdef CONFIG_SND_DEBUG
6360 .mixers = { alc260_test_mixer },
6361 .init_verbs = { alc260_test_init_verbs },
6362 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6363 .dac_nids = alc260_test_dac_nids,
6364 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6365 .adc_nids = alc260_test_adc_nids,
6366 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6367 .channel_mode = alc260_modes,
6368 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6369 .input_mux = alc260_test_capture_sources,
6374 static int patch_alc260(struct hda_codec *codec)
6376 struct alc_spec *spec;
6377 int err, board_config;
6379 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6385 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6388 if (board_config < 0) {
6389 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6391 board_config = ALC260_AUTO;
6394 if (board_config == ALC260_AUTO) {
6395 /* automatic parse from the BIOS config */
6396 err = alc260_parse_auto_config(codec);
6402 "hda_codec: Cannot set up configuration "
6403 "from BIOS. Using base mode...\n");
6404 board_config = ALC260_BASIC;
6408 err = snd_hda_attach_beep_device(codec, 0x1);
6414 if (board_config != ALC260_AUTO)
6415 setup_preset(codec, &alc260_presets[board_config]);
6417 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6418 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6420 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6421 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6423 if (!spec->adc_nids && spec->input_mux) {
6424 /* check whether NID 0x04 is valid */
6425 unsigned int wcap = get_wcaps(codec, 0x04);
6426 wcap = get_wcaps_type(wcap);
6428 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6429 spec->adc_nids = alc260_adc_nids_alt;
6430 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6432 spec->adc_nids = alc260_adc_nids;
6433 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6436 set_capture_mixer(codec);
6437 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6439 spec->vmaster_nid = 0x08;
6441 codec->patch_ops = alc_patch_ops;
6442 if (board_config == ALC260_AUTO)
6443 spec->init_hook = alc260_auto_init;
6444 #ifdef CONFIG_SND_HDA_POWER_SAVE
6445 if (!spec->loopback.amplist)
6446 spec->loopback.amplist = alc260_loopbacks;
6448 codec->proc_widget_hook = print_realtek_coef;
6455 * ALC882/883/885/888/889 support
6457 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6458 * configuration. Each pin widget can choose any input DACs and a mixer.
6459 * Each ADC is connected from a mixer of all inputs. This makes possible
6460 * 6-channel independent captures.
6462 * In addition, an independent DAC for the multi-playback (not used in this
6465 #define ALC882_DIGOUT_NID 0x06
6466 #define ALC882_DIGIN_NID 0x0a
6467 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6468 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6469 #define ALC1200_DIGOUT_NID 0x10
6472 static struct hda_channel_mode alc882_ch_modes[1] = {
6477 static hda_nid_t alc882_dac_nids[4] = {
6478 /* front, rear, clfe, rear_surr */
6479 0x02, 0x03, 0x04, 0x05
6481 #define alc883_dac_nids alc882_dac_nids
6484 #define alc882_adc_nids alc880_adc_nids
6485 #define alc882_adc_nids_alt alc880_adc_nids_alt
6486 #define alc883_adc_nids alc882_adc_nids_alt
6487 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6488 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6489 #define alc889_adc_nids alc880_adc_nids
6491 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6492 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6493 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6494 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6495 #define alc889_capsrc_nids alc882_capsrc_nids
6498 /* FIXME: should be a matrix-type input source selection */
6500 static struct hda_input_mux alc882_capture_source = {
6504 { "Front Mic", 0x1 },
6510 #define alc883_capture_source alc882_capture_source
6512 static struct hda_input_mux alc889_capture_source = {
6515 { "Front Mic", 0x0 },
6521 static struct hda_input_mux mb5_capture_source = {
6530 static struct hda_input_mux alc883_3stack_6ch_intel = {
6534 { "Front Mic", 0x0 },
6540 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6548 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6558 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6566 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6570 { "Front Mic", 0x1 },
6575 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6583 static struct hda_input_mux alc889A_mb31_capture_source = {
6587 /* Front Mic (0x01) unused */
6589 /* Line 2 (0x03) unused */
6590 /* CD (0x04) unsused? */
6597 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6604 static struct hda_verb alc882_3ST_ch2_init[] = {
6605 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6606 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6607 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6608 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6615 static struct hda_verb alc882_3ST_ch4_init[] = {
6616 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6617 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6618 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6619 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6620 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6627 static struct hda_verb alc882_3ST_ch6_init[] = {
6628 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6629 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6630 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6631 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6632 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6633 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6637 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6638 { 2, alc882_3ST_ch2_init },
6639 { 4, alc882_3ST_ch4_init },
6640 { 6, alc882_3ST_ch6_init },
6643 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6648 static struct hda_verb alc882_sixstack_ch6_init[] = {
6649 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6650 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6651 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6652 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6659 static struct hda_verb alc882_sixstack_ch8_init[] = {
6660 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6661 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6662 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6663 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6667 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6668 { 6, alc882_sixstack_ch6_init },
6669 { 8, alc882_sixstack_ch8_init },
6673 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6679 static struct hda_verb alc885_mbp_ch2_init[] = {
6680 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6681 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6682 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6689 static struct hda_verb alc885_mbp_ch6_init[] = {
6690 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6691 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6692 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6693 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6694 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6698 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6699 { 2, alc885_mbp_ch2_init },
6700 { 6, alc885_mbp_ch6_init },
6705 * Speakers/Woofer/HP = Front
6708 static struct hda_verb alc885_mb5_ch2_init[] = {
6709 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6710 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6716 * Speakers/HP = Front
6720 static struct hda_verb alc885_mb5_ch6_init[] = {
6721 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6722 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6723 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6727 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6728 { 2, alc885_mb5_ch2_init },
6729 { 6, alc885_mb5_ch6_init },
6736 static struct hda_verb alc883_4ST_ch2_init[] = {
6737 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6738 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6739 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6740 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6741 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6742 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6749 static struct hda_verb alc883_4ST_ch4_init[] = {
6750 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6751 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6752 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6753 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6754 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6755 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6756 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6763 static struct hda_verb alc883_4ST_ch6_init[] = {
6764 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6765 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6766 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6767 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6768 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6769 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6770 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6771 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6778 static struct hda_verb alc883_4ST_ch8_init[] = {
6779 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6780 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6781 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6782 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6783 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6784 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6785 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6786 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6787 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6791 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6792 { 2, alc883_4ST_ch2_init },
6793 { 4, alc883_4ST_ch4_init },
6794 { 6, alc883_4ST_ch6_init },
6795 { 8, alc883_4ST_ch8_init },
6802 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6803 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6804 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6805 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6806 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6813 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6814 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6815 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6816 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6817 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6818 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6825 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6826 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6827 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6828 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6829 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6830 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6831 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6835 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6836 { 2, alc883_3ST_ch2_intel_init },
6837 { 4, alc883_3ST_ch4_intel_init },
6838 { 6, alc883_3ST_ch6_intel_init },
6844 static struct hda_verb alc889_ch2_intel_init[] = {
6845 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6846 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6847 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6848 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6849 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6850 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6857 static struct hda_verb alc889_ch6_intel_init[] = {
6858 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6859 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6860 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6861 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6862 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6863 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6870 static struct hda_verb alc889_ch8_intel_init[] = {
6871 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6872 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6873 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6874 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6875 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6876 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6877 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6881 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6882 { 2, alc889_ch2_intel_init },
6883 { 6, alc889_ch6_intel_init },
6884 { 8, alc889_ch8_intel_init },
6890 static struct hda_verb alc883_sixstack_ch6_init[] = {
6891 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6892 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6893 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6894 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6901 static struct hda_verb alc883_sixstack_ch8_init[] = {
6902 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6903 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6904 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6905 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6909 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6910 { 6, alc883_sixstack_ch6_init },
6911 { 8, alc883_sixstack_ch8_init },
6915 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6916 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6918 static struct snd_kcontrol_new alc882_base_mixer[] = {
6919 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6920 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6921 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6922 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6923 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6924 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6925 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6926 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6927 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6928 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6929 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6930 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6931 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6932 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6933 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6934 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6935 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6936 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6937 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6938 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6939 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6943 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6944 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6945 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6946 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6947 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6948 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6949 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6950 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6951 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6952 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6953 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6957 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6958 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6959 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6960 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6961 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6962 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6963 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6964 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6965 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6966 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6967 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6968 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6969 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6970 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6971 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6975 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6976 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6977 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6978 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6979 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6980 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6981 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6982 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6983 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6988 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6989 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6990 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6991 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6992 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6993 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6994 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6995 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6996 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6997 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6998 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6999 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7000 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7001 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7005 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7006 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7008 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7009 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7010 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7011 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7012 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7013 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7014 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7015 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7016 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7017 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7018 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7019 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7020 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7021 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7025 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7026 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7027 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7028 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7029 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7030 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7031 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7032 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7033 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7034 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7035 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7039 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7041 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7042 .name = "Channel Mode",
7043 .info = alc_ch_mode_info,
7044 .get = alc_ch_mode_get,
7045 .put = alc_ch_mode_put,
7050 static struct hda_verb alc882_base_init_verbs[] = {
7051 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7052 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7053 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7054 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7056 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7057 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7058 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7060 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7061 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7062 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7064 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7065 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7066 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7068 /* mute analog input loopbacks */
7069 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7070 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7071 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7072 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7073 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7075 /* Front Pin: output 0 (0x0c) */
7076 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7077 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7078 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7079 /* Rear Pin: output 1 (0x0d) */
7080 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7081 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7082 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7083 /* CLFE Pin: output 2 (0x0e) */
7084 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7085 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7086 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7087 /* Side Pin: output 3 (0x0f) */
7088 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7089 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7090 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7091 /* Mic (rear) pin: input vref at 80% */
7092 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7093 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7094 /* Front Mic pin: input vref at 80% */
7095 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7096 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7097 /* Line In pin: input */
7098 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7099 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7100 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7101 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7102 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7103 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7104 /* CD pin widget for input */
7105 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7107 /* FIXME: use matrix-type input source selection */
7108 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7110 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7111 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7112 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7113 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7115 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7116 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7118 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7119 /* ADC2: mute amp left and right */
7120 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7121 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7122 /* ADC3: mute amp left and right */
7123 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7124 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7129 static struct hda_verb alc882_adc1_init_verbs[] = {
7130 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7131 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7132 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7133 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7134 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7135 /* ADC1: mute amp left and right */
7136 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7137 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7141 static struct hda_verb alc882_eapd_verbs[] = {
7142 /* change to EAPD mode */
7143 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7144 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7148 static struct hda_verb alc889_eapd_verbs[] = {
7149 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7150 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7154 static struct hda_verb alc_hp15_unsol_verbs[] = {
7155 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7156 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7160 static struct hda_verb alc885_init_verbs[] = {
7161 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7164 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7166 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7167 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7168 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7170 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7171 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7172 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7174 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7175 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7176 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7178 /* mute analog input loopbacks */
7179 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7180 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7181 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7183 /* Front HP Pin: output 0 (0x0c) */
7184 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7185 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7186 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7187 /* Front Pin: output 0 (0x0c) */
7188 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7189 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7190 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7191 /* Rear Pin: output 1 (0x0d) */
7192 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7193 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7194 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7195 /* CLFE Pin: output 2 (0x0e) */
7196 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7197 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7198 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7199 /* Side Pin: output 3 (0x0f) */
7200 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7201 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7202 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7203 /* Mic (rear) pin: input vref at 80% */
7204 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7205 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7206 /* Front Mic pin: input vref at 80% */
7207 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7208 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7209 /* Line In pin: input */
7210 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7211 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7213 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7215 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7216 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7217 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7219 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7220 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7221 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7223 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7224 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7225 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7226 /* ADC2: mute amp left and right */
7227 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7228 /* ADC3: mute amp left and right */
7229 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7234 static struct hda_verb alc885_init_input_verbs[] = {
7235 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7236 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7237 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7242 /* Unmute Selector 24h and set the default input to front mic */
7243 static struct hda_verb alc889_init_input_verbs[] = {
7244 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7245 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7250 #define alc883_init_verbs alc882_base_init_verbs
7253 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7254 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7255 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7256 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7257 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7258 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7259 /* FIXME: this looks suspicious...
7260 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7261 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7266 static struct hda_verb alc882_macpro_init_verbs[] = {
7267 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7268 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7269 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7270 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7271 /* Front Pin: output 0 (0x0c) */
7272 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7273 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7274 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7275 /* Front Mic pin: input vref at 80% */
7276 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7277 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7278 /* Speaker: output */
7279 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7280 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7281 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7282 /* Headphone output (output 0 - 0x0c) */
7283 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7284 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7285 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7287 /* FIXME: use matrix-type input source selection */
7288 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7289 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7290 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7291 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7292 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7293 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7295 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7296 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7297 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7300 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7301 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7303 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7304 /* ADC1: mute amp left and right */
7305 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7306 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7307 /* ADC2: mute amp left and right */
7308 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7309 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7310 /* ADC3: mute amp left and right */
7311 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7312 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7318 static struct hda_verb alc885_mb5_init_verbs[] = {
7320 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7321 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7322 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7323 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7325 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7326 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7327 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7328 /* Surround mixer */
7329 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7330 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7331 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7333 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7334 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7335 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7337 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7338 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7339 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7340 /* Front Pin (0x0c) */
7341 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7342 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7343 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7344 /* LFE Pin (0x0e) */
7345 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7346 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7347 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7349 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7350 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7351 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7352 /* Front Mic pin: input vref at 80% */
7353 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7354 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7356 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7357 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7359 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7360 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7361 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7362 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7366 /* Macbook Pro rev3 */
7367 static struct hda_verb alc885_mbp3_init_verbs[] = {
7368 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7369 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7370 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7371 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7373 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7374 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7375 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7376 /* Front Pin: output 0 (0x0c) */
7377 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7378 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7379 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7380 /* HP Pin: output 0 (0x0d) */
7381 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7382 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7383 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7384 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7385 /* Mic (rear) pin: input vref at 80% */
7386 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7387 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7388 /* Front Mic pin: input vref at 80% */
7389 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7390 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7391 /* Line In pin: use output 1 when in LineOut mode */
7392 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7393 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7394 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7396 /* FIXME: use matrix-type input source selection */
7397 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7398 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7400 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7401 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7402 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7404 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7405 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7406 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7407 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7409 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7412 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7413 /* ADC1: mute amp left and right */
7414 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7415 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7416 /* ADC2: mute amp left and right */
7417 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7418 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7419 /* ADC3: mute amp left and right */
7420 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7421 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7426 /* iMac 24 mixer. */
7427 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7428 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7429 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7433 /* iMac 24 init verbs. */
7434 static struct hda_verb alc885_imac24_init_verbs[] = {
7435 /* Internal speakers: output 0 (0x0c) */
7436 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7437 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7438 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7439 /* Internal speakers: output 0 (0x0c) */
7440 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7441 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7442 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7443 /* Headphone: output 0 (0x0c) */
7444 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7445 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7446 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7447 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7448 /* Front Mic: input vref at 80% */
7449 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7450 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7454 /* Toggle speaker-output according to the hp-jack state */
7455 static void alc885_imac24_setup(struct hda_codec *codec)
7457 struct alc_spec *spec = codec->spec;
7459 spec->autocfg.hp_pins[0] = 0x14;
7460 spec->autocfg.speaker_pins[0] = 0x18;
7461 spec->autocfg.speaker_pins[1] = 0x1a;
7464 static void alc885_mbp3_setup(struct hda_codec *codec)
7466 struct alc_spec *spec = codec->spec;
7468 spec->autocfg.hp_pins[0] = 0x15;
7469 spec->autocfg.speaker_pins[0] = 0x14;
7473 static struct hda_verb alc882_targa_verbs[] = {
7474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7477 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7478 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7480 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7481 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7482 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7484 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7488 /* toggle speaker-output according to the hp-jack state */
7489 static void alc882_targa_automute(struct hda_codec *codec)
7491 struct alc_spec *spec = codec->spec;
7492 alc_automute_amp(codec);
7493 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7494 spec->jack_present ? 1 : 3);
7497 static void alc882_targa_setup(struct hda_codec *codec)
7499 struct alc_spec *spec = codec->spec;
7501 spec->autocfg.hp_pins[0] = 0x14;
7502 spec->autocfg.speaker_pins[0] = 0x1b;
7505 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7507 if ((res >> 26) == ALC880_HP_EVENT)
7508 alc882_targa_automute(codec);
7511 static struct hda_verb alc882_asus_a7j_verbs[] = {
7512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7513 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7515 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7516 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7517 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7519 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7520 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7521 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7523 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7524 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7525 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7529 static struct hda_verb alc882_asus_a7m_verbs[] = {
7530 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7531 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7533 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7534 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7535 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7537 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7538 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7539 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7541 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7542 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7543 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7547 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7549 unsigned int gpiostate, gpiomask, gpiodir;
7551 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7552 AC_VERB_GET_GPIO_DATA, 0);
7555 gpiostate |= (1 << pin);
7557 gpiostate &= ~(1 << pin);
7559 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7560 AC_VERB_GET_GPIO_MASK, 0);
7561 gpiomask |= (1 << pin);
7563 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7564 AC_VERB_GET_GPIO_DIRECTION, 0);
7565 gpiodir |= (1 << pin);
7568 snd_hda_codec_write(codec, codec->afg, 0,
7569 AC_VERB_SET_GPIO_MASK, gpiomask);
7570 snd_hda_codec_write(codec, codec->afg, 0,
7571 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7575 snd_hda_codec_write(codec, codec->afg, 0,
7576 AC_VERB_SET_GPIO_DATA, gpiostate);
7579 /* set up GPIO at initialization */
7580 static void alc885_macpro_init_hook(struct hda_codec *codec)
7582 alc882_gpio_mute(codec, 0, 0);
7583 alc882_gpio_mute(codec, 1, 0);
7586 /* set up GPIO and update auto-muting at initialization */
7587 static void alc885_imac24_init_hook(struct hda_codec *codec)
7589 alc885_macpro_init_hook(codec);
7590 alc_automute_amp(codec);
7594 * generic initialization of ADC, input mixers and output mixers
7596 static struct hda_verb alc883_auto_init_verbs[] = {
7598 * Unmute ADC0-2 and set the default input to mic-in
7600 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7601 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7602 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7603 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7605 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7607 * Note: PASD motherboards uses the Line In 2 as the input for
7608 * front panel mic (mic 2)
7610 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7615 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7618 * Set up output mixers (0x0c - 0x0f)
7620 /* set vol=0 to output mixers */
7621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7622 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7623 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7624 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7625 /* set up input amps for analog loopback */
7626 /* Amp Indices: DAC = 0, mixer = 1 */
7627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7628 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7630 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7632 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7633 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7634 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7635 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7636 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7638 /* FIXME: use matrix-type input source selection */
7639 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7641 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7642 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7643 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7644 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7646 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7647 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7648 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7654 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7655 static struct hda_verb alc889A_mb31_ch2_init[] = {
7656 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7657 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7658 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7659 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7663 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7664 static struct hda_verb alc889A_mb31_ch4_init[] = {
7665 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7666 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7667 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7668 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7672 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7673 static struct hda_verb alc889A_mb31_ch5_init[] = {
7674 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7675 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7676 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7677 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7681 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7682 static struct hda_verb alc889A_mb31_ch6_init[] = {
7683 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7684 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7685 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7686 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7690 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7691 { 2, alc889A_mb31_ch2_init },
7692 { 4, alc889A_mb31_ch4_init },
7693 { 5, alc889A_mb31_ch5_init },
7694 { 6, alc889A_mb31_ch6_init },
7697 static struct hda_verb alc883_medion_eapd_verbs[] = {
7698 /* eanable EAPD on medion laptop */
7699 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7700 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7704 #define alc883_base_mixer alc882_base_mixer
7706 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7707 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7708 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7709 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7710 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7711 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7712 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7713 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7714 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7715 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7716 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7717 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7718 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7719 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7723 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7724 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7725 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7726 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7727 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7728 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7729 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7730 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7731 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7732 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7733 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7737 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7738 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7739 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7740 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7741 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7742 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7743 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7744 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7745 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7746 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7747 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7751 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7752 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7753 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7754 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7755 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7756 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7757 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7758 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7760 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7762 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7763 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7764 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7768 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7769 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7770 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7771 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7772 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7773 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7774 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7775 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7776 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7777 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7778 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7779 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7780 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7781 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7782 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7783 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7784 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7785 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7786 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7787 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7791 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7792 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7793 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7794 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7795 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7796 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7798 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7799 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7800 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7801 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7802 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7803 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7804 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7805 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7806 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7807 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7808 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7809 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7810 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7811 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7815 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7816 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7817 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7818 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7819 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7820 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7822 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7823 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7824 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7825 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7826 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7827 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7828 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7829 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7830 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7831 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7832 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7833 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7834 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7835 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7839 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7840 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7841 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7842 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7843 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7844 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7845 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7846 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7847 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7848 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7849 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7850 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7851 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7852 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7853 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7854 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7855 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7856 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7857 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7858 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7862 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7863 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7864 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7865 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7866 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7867 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7868 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7869 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7870 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7871 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7872 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7873 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7874 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7875 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7876 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7877 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7878 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7882 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7883 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7884 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7885 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7886 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7887 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7888 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7889 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7890 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7891 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7892 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7893 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7897 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7898 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7899 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7900 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7901 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7902 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7903 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7904 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7905 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7909 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7910 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7911 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7912 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7913 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7914 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7915 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7916 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7917 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7918 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7922 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7923 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7924 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7925 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7926 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7927 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7930 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7931 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7935 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7936 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7937 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7938 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7939 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7940 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7942 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7943 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7947 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
7948 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7949 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7950 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7951 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
7952 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7953 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7954 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7955 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7956 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7957 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7958 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7962 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7963 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7964 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7965 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7966 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7967 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7968 0x0d, 1, 0x0, HDA_OUTPUT),
7969 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7970 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7971 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7972 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7973 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7974 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7975 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7976 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7977 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7978 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7979 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7980 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7981 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7982 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7983 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7987 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
7989 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7990 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7991 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7992 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7993 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
7995 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
7996 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
7997 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
7998 /* Output switches */
7999 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8000 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8001 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8003 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8004 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8006 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8007 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8008 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8009 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8013 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8014 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8015 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8016 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8017 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8018 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8019 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8023 static struct hda_bind_ctls alc883_bind_cap_vol = {
8024 .ops = &snd_hda_bind_vol,
8026 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8027 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8032 static struct hda_bind_ctls alc883_bind_cap_switch = {
8033 .ops = &snd_hda_bind_sw,
8035 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8036 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8041 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8042 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8043 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8044 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8045 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8046 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8047 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8048 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8049 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8053 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8054 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8055 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8057 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8058 /* .name = "Capture Source", */
8059 .name = "Input Source",
8061 .info = alc_mux_enum_info,
8062 .get = alc_mux_enum_get,
8063 .put = alc_mux_enum_put,
8068 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8070 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8071 .name = "Channel Mode",
8072 .info = alc_ch_mode_info,
8073 .get = alc_ch_mode_get,
8074 .put = alc_ch_mode_put,
8079 /* toggle speaker-output according to the hp-jack state */
8080 static void alc883_mitac_setup(struct hda_codec *codec)
8082 struct alc_spec *spec = codec->spec;
8084 spec->autocfg.hp_pins[0] = 0x15;
8085 spec->autocfg.speaker_pins[0] = 0x14;
8086 spec->autocfg.speaker_pins[1] = 0x17;
8089 /* auto-toggle front mic */
8091 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8093 unsigned int present;
8096 present = snd_hda_codec_read(codec, 0x18, 0,
8097 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8098 bits = present ? HDA_AMP_MUTE : 0;
8099 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8103 static struct hda_verb alc883_mitac_verbs[] = {
8105 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8106 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8108 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8109 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8111 /* enable unsolicited event */
8112 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8113 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8118 static struct hda_verb alc883_clevo_m720_verbs[] = {
8120 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8121 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8123 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8124 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8126 /* enable unsolicited event */
8127 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8128 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8133 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8135 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8136 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8138 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8139 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8141 /* enable unsolicited event */
8142 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8147 static struct hda_verb alc883_targa_verbs[] = {
8148 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8149 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8151 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8152 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8154 /* Connect Line-Out side jack (SPDIF) to Side */
8155 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8156 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8157 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8158 /* Connect Mic jack to CLFE */
8159 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8160 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8161 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8162 /* Connect Line-in jack to Surround */
8163 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8164 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8165 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8166 /* Connect HP out jack to Front */
8167 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8168 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8169 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8171 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8176 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8177 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8178 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8179 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8183 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8184 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8185 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8186 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8187 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8191 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8192 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8193 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8194 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8195 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8196 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8200 static struct hda_verb alc883_haier_w66_verbs[] = {
8201 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8202 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8204 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8206 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8207 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8208 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8209 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8213 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8214 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8215 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8216 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8217 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8218 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8219 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8220 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8221 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8225 static struct hda_verb alc888_6st_dell_verbs[] = {
8226 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8230 static struct hda_verb alc883_vaiott_verbs[] = {
8232 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8233 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8235 /* enable unsolicited event */
8236 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8241 static void alc888_3st_hp_setup(struct hda_codec *codec)
8243 struct alc_spec *spec = codec->spec;
8245 spec->autocfg.hp_pins[0] = 0x1b;
8246 spec->autocfg.speaker_pins[0] = 0x14;
8247 spec->autocfg.speaker_pins[1] = 0x16;
8248 spec->autocfg.speaker_pins[2] = 0x18;
8251 static struct hda_verb alc888_3st_hp_verbs[] = {
8252 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8253 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8254 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8255 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8262 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8263 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8264 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8265 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8266 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8273 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8274 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8275 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8276 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8277 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8278 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8285 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8286 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8287 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8288 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8289 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8290 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8291 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8295 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8296 { 2, alc888_3st_hp_2ch_init },
8297 { 4, alc888_3st_hp_4ch_init },
8298 { 6, alc888_3st_hp_6ch_init },
8301 /* toggle front-jack and RCA according to the hp-jack state */
8302 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8304 unsigned int present;
8306 present = snd_hda_codec_read(codec, 0x1b, 0,
8307 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8308 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8309 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8310 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8311 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8314 /* toggle RCA according to the front-jack state */
8315 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8317 unsigned int present;
8319 present = snd_hda_codec_read(codec, 0x14, 0,
8320 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8321 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8322 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8325 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8328 if ((res >> 26) == ALC880_HP_EVENT)
8329 alc888_lenovo_ms7195_front_automute(codec);
8330 if ((res >> 26) == ALC880_FRONT_EVENT)
8331 alc888_lenovo_ms7195_rca_automute(codec);
8334 static struct hda_verb alc883_medion_md2_verbs[] = {
8335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8336 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8338 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8340 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8344 /* toggle speaker-output according to the hp-jack state */
8345 static void alc883_medion_md2_setup(struct hda_codec *codec)
8347 struct alc_spec *spec = codec->spec;
8349 spec->autocfg.hp_pins[0] = 0x14;
8350 spec->autocfg.speaker_pins[0] = 0x15;
8353 /* toggle speaker-output according to the hp-jack state */
8354 #define alc883_targa_init_hook alc882_targa_init_hook
8355 #define alc883_targa_unsol_event alc882_targa_unsol_event
8357 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8359 unsigned int present;
8361 present = snd_hda_codec_read(codec, 0x18, 0,
8362 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8363 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8364 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8367 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8369 struct alc_spec *spec = codec->spec;
8371 spec->autocfg.hp_pins[0] = 0x15;
8372 spec->autocfg.speaker_pins[0] = 0x14;
8375 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8377 alc_automute_amp(codec);
8378 alc883_clevo_m720_mic_automute(codec);
8381 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8384 switch (res >> 26) {
8385 case ALC880_MIC_EVENT:
8386 alc883_clevo_m720_mic_automute(codec);
8389 alc_automute_amp_unsol_event(codec, res);
8394 /* toggle speaker-output according to the hp-jack state */
8395 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8397 struct alc_spec *spec = codec->spec;
8399 spec->autocfg.hp_pins[0] = 0x14;
8400 spec->autocfg.speaker_pins[0] = 0x15;
8403 static void alc883_haier_w66_setup(struct hda_codec *codec)
8405 struct alc_spec *spec = codec->spec;
8407 spec->autocfg.hp_pins[0] = 0x1b;
8408 spec->autocfg.speaker_pins[0] = 0x14;
8411 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8413 unsigned int present;
8416 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8417 & AC_PINSENSE_PRESENCE;
8418 bits = present ? HDA_AMP_MUTE : 0;
8419 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8420 HDA_AMP_MUTE, bits);
8423 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8425 unsigned int present;
8428 present = snd_hda_codec_read(codec, 0x1b, 0,
8429 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8430 bits = present ? HDA_AMP_MUTE : 0;
8431 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8432 HDA_AMP_MUTE, bits);
8433 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8434 HDA_AMP_MUTE, bits);
8437 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8440 if ((res >> 26) == ALC880_HP_EVENT)
8441 alc883_lenovo_101e_all_automute(codec);
8442 if ((res >> 26) == ALC880_FRONT_EVENT)
8443 alc883_lenovo_101e_ispeaker_automute(codec);
8446 /* toggle speaker-output according to the hp-jack state */
8447 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8449 struct alc_spec *spec = codec->spec;
8451 spec->autocfg.hp_pins[0] = 0x14;
8452 spec->autocfg.speaker_pins[0] = 0x15;
8453 spec->autocfg.speaker_pins[1] = 0x16;
8456 static struct hda_verb alc883_acer_eapd_verbs[] = {
8457 /* HP Pin: output 0 (0x0c) */
8458 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8459 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8460 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8461 /* Front Pin: output 0 (0x0c) */
8462 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8463 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8464 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8465 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8466 /* eanable EAPD on medion laptop */
8467 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8468 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8469 /* enable unsolicited event */
8470 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8474 static void alc888_6st_dell_setup(struct hda_codec *codec)
8476 struct alc_spec *spec = codec->spec;
8478 spec->autocfg.hp_pins[0] = 0x1b;
8479 spec->autocfg.speaker_pins[0] = 0x14;
8480 spec->autocfg.speaker_pins[1] = 0x15;
8481 spec->autocfg.speaker_pins[2] = 0x16;
8482 spec->autocfg.speaker_pins[3] = 0x17;
8485 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8487 struct alc_spec *spec = codec->spec;
8489 spec->autocfg.hp_pins[0] = 0x1b;
8490 spec->autocfg.speaker_pins[0] = 0x14;
8491 spec->autocfg.speaker_pins[1] = 0x15;
8492 spec->autocfg.speaker_pins[2] = 0x16;
8493 spec->autocfg.speaker_pins[3] = 0x17;
8494 spec->autocfg.speaker_pins[4] = 0x1a;
8497 static void alc883_vaiott_setup(struct hda_codec *codec)
8499 struct alc_spec *spec = codec->spec;
8501 spec->autocfg.hp_pins[0] = 0x15;
8502 spec->autocfg.speaker_pins[0] = 0x14;
8503 spec->autocfg.speaker_pins[1] = 0x17;
8506 static struct hda_verb alc888_asus_m90v_verbs[] = {
8507 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8508 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8509 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8510 /* enable unsolicited event */
8511 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8512 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8516 static void alc883_mode2_setup(struct hda_codec *codec)
8518 struct alc_spec *spec = codec->spec;
8520 spec->autocfg.hp_pins[0] = 0x1b;
8521 spec->autocfg.speaker_pins[0] = 0x14;
8522 spec->autocfg.speaker_pins[1] = 0x15;
8523 spec->autocfg.speaker_pins[2] = 0x16;
8524 spec->ext_mic.pin = 0x18;
8525 spec->int_mic.pin = 0x19;
8526 spec->ext_mic.mux_idx = 0;
8527 spec->int_mic.mux_idx = 1;
8531 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8532 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8533 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8534 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8535 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8536 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8537 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8538 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8539 /* enable unsolicited event */
8540 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8544 static void alc883_eee1601_inithook(struct hda_codec *codec)
8546 struct alc_spec *spec = codec->spec;
8548 spec->autocfg.hp_pins[0] = 0x14;
8549 spec->autocfg.speaker_pins[0] = 0x1b;
8550 alc_automute_pin(codec);
8553 static struct hda_verb alc889A_mb31_verbs[] = {
8554 /* Init rear pin (used as headphone output) */
8555 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8556 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8557 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8558 /* Init line pin (used as output in 4ch and 6ch mode) */
8559 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8560 /* Init line 2 pin (used as headphone out by default) */
8561 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8562 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8566 /* Mute speakers according to the headphone jack state */
8567 static void alc889A_mb31_automute(struct hda_codec *codec)
8569 unsigned int present;
8571 /* Mute only in 2ch or 4ch mode */
8572 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8574 present = snd_hda_codec_read(codec, 0x15, 0,
8575 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8576 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8577 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8578 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8579 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8583 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8585 if ((res >> 26) == ALC880_HP_EVENT)
8586 alc889A_mb31_automute(codec);
8590 #ifdef CONFIG_SND_HDA_POWER_SAVE
8591 #define alc882_loopbacks alc880_loopbacks
8594 /* pcm configuration: identical with ALC880 */
8595 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8596 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8597 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8598 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8600 static hda_nid_t alc883_slave_dig_outs[] = {
8601 ALC1200_DIGOUT_NID, 0,
8604 static hda_nid_t alc1200_slave_dig_outs[] = {
8605 ALC883_DIGOUT_NID, 0,
8609 * configuration and preset
8611 static const char *alc882_models[ALC882_MODEL_LAST] = {
8612 [ALC882_3ST_DIG] = "3stack-dig",
8613 [ALC882_6ST_DIG] = "6stack-dig",
8614 [ALC882_ARIMA] = "arima",
8615 [ALC882_W2JC] = "w2jc",
8616 [ALC882_TARGA] = "targa",
8617 [ALC882_ASUS_A7J] = "asus-a7j",
8618 [ALC882_ASUS_A7M] = "asus-a7m",
8619 [ALC885_MACPRO] = "macpro",
8620 [ALC885_MB5] = "mb5",
8621 [ALC885_MBP3] = "mbp3",
8622 [ALC885_IMAC24] = "imac24",
8623 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8624 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8625 [ALC883_3ST_6ch] = "3stack-6ch",
8626 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8627 [ALC883_TARGA_DIG] = "targa-dig",
8628 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8629 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8630 [ALC883_ACER] = "acer",
8631 [ALC883_ACER_ASPIRE] = "acer-aspire",
8632 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8633 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8634 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8635 [ALC883_MEDION] = "medion",
8636 [ALC883_MEDION_MD2] = "medion-md2",
8637 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8638 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8639 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8640 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8641 [ALC888_LENOVO_SKY] = "lenovo-sky",
8642 [ALC883_HAIER_W66] = "haier-w66",
8643 [ALC888_3ST_HP] = "3stack-hp",
8644 [ALC888_6ST_DELL] = "6stack-dell",
8645 [ALC883_MITAC] = "mitac",
8646 [ALC883_CLEVO_M720] = "clevo-m720",
8647 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8648 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8649 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8650 [ALC889A_INTEL] = "intel-alc889a",
8651 [ALC889_INTEL] = "intel-x58",
8652 [ALC1200_ASUS_P5Q] = "asus-p5q",
8653 [ALC889A_MB31] = "mb31",
8654 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8655 [ALC882_AUTO] = "auto",
8658 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8659 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8661 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8662 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8663 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8664 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8665 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8666 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8667 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8668 ALC888_ACER_ASPIRE_4930G),
8669 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8670 ALC888_ACER_ASPIRE_4930G),
8671 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8672 ALC888_ACER_ASPIRE_8930G),
8673 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8674 ALC888_ACER_ASPIRE_8930G),
8675 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8676 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8677 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8678 ALC888_ACER_ASPIRE_6530G),
8679 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8680 ALC888_ACER_ASPIRE_6530G),
8681 /* default Acer -- disabled as it causes more problems.
8682 * model=auto should work fine now
8684 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8686 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8688 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8689 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8690 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8691 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8692 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8693 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8695 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8696 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8697 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8698 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8699 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8700 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8701 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8702 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8703 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8704 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8705 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8707 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8708 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8709 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8710 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8711 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8712 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8713 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8714 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8715 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8717 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8718 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8719 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8720 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8721 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8722 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8723 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8724 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8725 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8726 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8727 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8728 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8729 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8730 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8731 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8732 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8733 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8734 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8735 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8736 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8737 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8738 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8739 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8740 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8741 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8742 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8743 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8744 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8745 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8747 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8748 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8749 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8750 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8751 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8752 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8753 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8754 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8755 ALC883_FUJITSU_PI2515),
8756 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8757 ALC888_FUJITSU_XA3530),
8758 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8759 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8760 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8761 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8762 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8763 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8764 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8765 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8766 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8768 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8769 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8770 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8771 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8772 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8773 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8774 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8779 /* codec SSID table for Intel Mac */
8780 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8781 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8782 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8783 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8784 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8785 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8786 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8787 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8788 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8789 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8790 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8791 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8792 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8793 * no perfect solution yet
8795 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8799 static struct alc_config_preset alc882_presets[] = {
8800 [ALC882_3ST_DIG] = {
8801 .mixers = { alc882_base_mixer },
8802 .init_verbs = { alc882_base_init_verbs,
8803 alc882_adc1_init_verbs },
8804 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8805 .dac_nids = alc882_dac_nids,
8806 .dig_out_nid = ALC882_DIGOUT_NID,
8807 .dig_in_nid = ALC882_DIGIN_NID,
8808 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8809 .channel_mode = alc882_ch_modes,
8811 .input_mux = &alc882_capture_source,
8813 [ALC882_6ST_DIG] = {
8814 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8815 .init_verbs = { alc882_base_init_verbs,
8816 alc882_adc1_init_verbs },
8817 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8818 .dac_nids = alc882_dac_nids,
8819 .dig_out_nid = ALC882_DIGOUT_NID,
8820 .dig_in_nid = ALC882_DIGIN_NID,
8821 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8822 .channel_mode = alc882_sixstack_modes,
8823 .input_mux = &alc882_capture_source,
8826 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8827 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8828 alc882_eapd_verbs },
8829 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8830 .dac_nids = alc882_dac_nids,
8831 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8832 .channel_mode = alc882_sixstack_modes,
8833 .input_mux = &alc882_capture_source,
8836 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8837 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8838 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8839 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8840 .dac_nids = alc882_dac_nids,
8841 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8842 .channel_mode = alc880_threestack_modes,
8844 .input_mux = &alc882_capture_source,
8845 .dig_out_nid = ALC882_DIGOUT_NID,
8848 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8849 .init_verbs = { alc885_mbp3_init_verbs,
8850 alc880_gpio1_init_verbs },
8851 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8852 .dac_nids = alc882_dac_nids,
8853 .channel_mode = alc885_mbp_6ch_modes,
8854 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
8855 .input_mux = &alc882_capture_source,
8856 .dig_out_nid = ALC882_DIGOUT_NID,
8857 .dig_in_nid = ALC882_DIGIN_NID,
8858 .unsol_event = alc_automute_amp_unsol_event,
8859 .setup = alc885_mbp3_setup,
8860 .init_hook = alc_automute_amp,
8863 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8864 .init_verbs = { alc885_mb5_init_verbs,
8865 alc880_gpio1_init_verbs },
8866 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8867 .dac_nids = alc882_dac_nids,
8868 .channel_mode = alc885_mb5_6ch_modes,
8869 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8870 .input_mux = &mb5_capture_source,
8871 .dig_out_nid = ALC882_DIGOUT_NID,
8872 .dig_in_nid = ALC882_DIGIN_NID,
8875 .mixers = { alc882_macpro_mixer },
8876 .init_verbs = { alc882_macpro_init_verbs },
8877 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8878 .dac_nids = alc882_dac_nids,
8879 .dig_out_nid = ALC882_DIGOUT_NID,
8880 .dig_in_nid = ALC882_DIGIN_NID,
8881 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8882 .channel_mode = alc882_ch_modes,
8883 .input_mux = &alc882_capture_source,
8884 .init_hook = alc885_macpro_init_hook,
8887 .mixers = { alc885_imac24_mixer },
8888 .init_verbs = { alc885_imac24_init_verbs },
8889 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8890 .dac_nids = alc882_dac_nids,
8891 .dig_out_nid = ALC882_DIGOUT_NID,
8892 .dig_in_nid = ALC882_DIGIN_NID,
8893 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8894 .channel_mode = alc882_ch_modes,
8895 .input_mux = &alc882_capture_source,
8896 .unsol_event = alc_automute_amp_unsol_event,
8897 .setup = alc885_imac24_setup,
8898 .init_hook = alc885_imac24_init_hook,
8901 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
8902 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8903 alc880_gpio3_init_verbs, alc882_targa_verbs},
8904 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8905 .dac_nids = alc882_dac_nids,
8906 .dig_out_nid = ALC882_DIGOUT_NID,
8907 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8908 .adc_nids = alc882_adc_nids,
8909 .capsrc_nids = alc882_capsrc_nids,
8910 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8911 .channel_mode = alc882_3ST_6ch_modes,
8913 .input_mux = &alc882_capture_source,
8914 .unsol_event = alc882_targa_unsol_event,
8915 .setup = alc882_targa_setup,
8916 .init_hook = alc882_targa_automute,
8918 [ALC882_ASUS_A7J] = {
8919 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
8920 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8921 alc882_asus_a7j_verbs},
8922 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8923 .dac_nids = alc882_dac_nids,
8924 .dig_out_nid = ALC882_DIGOUT_NID,
8925 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8926 .adc_nids = alc882_adc_nids,
8927 .capsrc_nids = alc882_capsrc_nids,
8928 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8929 .channel_mode = alc882_3ST_6ch_modes,
8931 .input_mux = &alc882_capture_source,
8933 [ALC882_ASUS_A7M] = {
8934 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
8935 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8936 alc882_eapd_verbs, alc880_gpio1_init_verbs,
8937 alc882_asus_a7m_verbs },
8938 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8939 .dac_nids = alc882_dac_nids,
8940 .dig_out_nid = ALC882_DIGOUT_NID,
8941 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8942 .channel_mode = alc880_threestack_modes,
8944 .input_mux = &alc882_capture_source,
8946 [ALC883_3ST_2ch_DIG] = {
8947 .mixers = { alc883_3ST_2ch_mixer },
8948 .init_verbs = { alc883_init_verbs },
8949 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8950 .dac_nids = alc883_dac_nids,
8951 .dig_out_nid = ALC883_DIGOUT_NID,
8952 .dig_in_nid = ALC883_DIGIN_NID,
8953 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8954 .channel_mode = alc883_3ST_2ch_modes,
8955 .input_mux = &alc883_capture_source,
8957 [ALC883_3ST_6ch_DIG] = {
8958 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8959 .init_verbs = { alc883_init_verbs },
8960 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8961 .dac_nids = alc883_dac_nids,
8962 .dig_out_nid = ALC883_DIGOUT_NID,
8963 .dig_in_nid = ALC883_DIGIN_NID,
8964 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8965 .channel_mode = alc883_3ST_6ch_modes,
8967 .input_mux = &alc883_capture_source,
8969 [ALC883_3ST_6ch] = {
8970 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8971 .init_verbs = { alc883_init_verbs },
8972 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8973 .dac_nids = alc883_dac_nids,
8974 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8975 .channel_mode = alc883_3ST_6ch_modes,
8977 .input_mux = &alc883_capture_source,
8979 [ALC883_3ST_6ch_INTEL] = {
8980 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8981 .init_verbs = { alc883_init_verbs },
8982 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8983 .dac_nids = alc883_dac_nids,
8984 .dig_out_nid = ALC883_DIGOUT_NID,
8985 .dig_in_nid = ALC883_DIGIN_NID,
8986 .slave_dig_outs = alc883_slave_dig_outs,
8987 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8988 .channel_mode = alc883_3ST_6ch_intel_modes,
8990 .input_mux = &alc883_3stack_6ch_intel,
8993 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
8994 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
8995 alc_hp15_unsol_verbs },
8996 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8997 .dac_nids = alc883_dac_nids,
8998 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
8999 .adc_nids = alc889_adc_nids,
9000 .dig_out_nid = ALC883_DIGOUT_NID,
9001 .dig_in_nid = ALC883_DIGIN_NID,
9002 .slave_dig_outs = alc883_slave_dig_outs,
9003 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9004 .channel_mode = alc889_8ch_intel_modes,
9005 .capsrc_nids = alc889_capsrc_nids,
9006 .input_mux = &alc889_capture_source,
9007 .setup = alc889_automute_setup,
9008 .init_hook = alc_automute_amp,
9009 .unsol_event = alc_automute_amp_unsol_event,
9013 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9014 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9015 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9016 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9017 .dac_nids = alc883_dac_nids,
9018 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9019 .adc_nids = alc889_adc_nids,
9020 .dig_out_nid = ALC883_DIGOUT_NID,
9021 .dig_in_nid = ALC883_DIGIN_NID,
9022 .slave_dig_outs = alc883_slave_dig_outs,
9023 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9024 .channel_mode = alc889_8ch_intel_modes,
9025 .capsrc_nids = alc889_capsrc_nids,
9026 .input_mux = &alc889_capture_source,
9027 .setup = alc889_automute_setup,
9028 .init_hook = alc889_intel_init_hook,
9029 .unsol_event = alc_automute_amp_unsol_event,
9032 [ALC883_6ST_DIG] = {
9033 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9034 .init_verbs = { alc883_init_verbs },
9035 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9036 .dac_nids = alc883_dac_nids,
9037 .dig_out_nid = ALC883_DIGOUT_NID,
9038 .dig_in_nid = ALC883_DIGIN_NID,
9039 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9040 .channel_mode = alc883_sixstack_modes,
9041 .input_mux = &alc883_capture_source,
9043 [ALC883_TARGA_DIG] = {
9044 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9045 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9046 alc883_targa_verbs},
9047 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9048 .dac_nids = alc883_dac_nids,
9049 .dig_out_nid = ALC883_DIGOUT_NID,
9050 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9051 .channel_mode = alc883_3ST_6ch_modes,
9053 .input_mux = &alc883_capture_source,
9054 .unsol_event = alc883_targa_unsol_event,
9055 .setup = alc882_targa_setup,
9056 .init_hook = alc882_targa_automute,
9058 [ALC883_TARGA_2ch_DIG] = {
9059 .mixers = { alc883_targa_2ch_mixer},
9060 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9061 alc883_targa_verbs},
9062 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9063 .dac_nids = alc883_dac_nids,
9064 .adc_nids = alc883_adc_nids_alt,
9065 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9066 .dig_out_nid = ALC883_DIGOUT_NID,
9067 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9068 .channel_mode = alc883_3ST_2ch_modes,
9069 .input_mux = &alc883_capture_source,
9070 .unsol_event = alc883_targa_unsol_event,
9071 .setup = alc882_targa_setup,
9072 .init_hook = alc882_targa_automute,
9074 [ALC883_TARGA_8ch_DIG] = {
9075 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9076 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9077 alc883_targa_verbs },
9078 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9079 .dac_nids = alc883_dac_nids,
9080 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9081 .adc_nids = alc883_adc_nids_rev,
9082 .capsrc_nids = alc883_capsrc_nids_rev,
9083 .dig_out_nid = ALC883_DIGOUT_NID,
9084 .dig_in_nid = ALC883_DIGIN_NID,
9085 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9086 .channel_mode = alc883_4ST_8ch_modes,
9088 .input_mux = &alc883_capture_source,
9089 .unsol_event = alc883_targa_unsol_event,
9090 .setup = alc882_targa_setup,
9091 .init_hook = alc882_targa_automute,
9094 .mixers = { alc883_base_mixer },
9095 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9096 * and the headphone jack. Turn this on and rely on the
9097 * standard mute methods whenever the user wants to turn
9098 * these outputs off.
9100 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9101 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9102 .dac_nids = alc883_dac_nids,
9103 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9104 .channel_mode = alc883_3ST_2ch_modes,
9105 .input_mux = &alc883_capture_source,
9107 [ALC883_ACER_ASPIRE] = {
9108 .mixers = { alc883_acer_aspire_mixer },
9109 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9110 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9111 .dac_nids = alc883_dac_nids,
9112 .dig_out_nid = ALC883_DIGOUT_NID,
9113 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9114 .channel_mode = alc883_3ST_2ch_modes,
9115 .input_mux = &alc883_capture_source,
9116 .unsol_event = alc_automute_amp_unsol_event,
9117 .setup = alc883_acer_aspire_setup,
9118 .init_hook = alc_automute_amp,
9120 [ALC888_ACER_ASPIRE_4930G] = {
9121 .mixers = { alc888_base_mixer,
9122 alc883_chmode_mixer },
9123 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9124 alc888_acer_aspire_4930g_verbs },
9125 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9126 .dac_nids = alc883_dac_nids,
9127 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9128 .adc_nids = alc883_adc_nids_rev,
9129 .capsrc_nids = alc883_capsrc_nids_rev,
9130 .dig_out_nid = ALC883_DIGOUT_NID,
9131 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9132 .channel_mode = alc883_3ST_6ch_modes,
9135 ARRAY_SIZE(alc888_2_capture_sources),
9136 .input_mux = alc888_2_capture_sources,
9137 .unsol_event = alc_automute_amp_unsol_event,
9138 .setup = alc888_acer_aspire_4930g_setup,
9139 .init_hook = alc_automute_amp,
9141 [ALC888_ACER_ASPIRE_6530G] = {
9142 .mixers = { alc888_acer_aspire_6530_mixer },
9143 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9144 alc888_acer_aspire_6530g_verbs },
9145 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9146 .dac_nids = alc883_dac_nids,
9147 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9148 .adc_nids = alc883_adc_nids_rev,
9149 .capsrc_nids = alc883_capsrc_nids_rev,
9150 .dig_out_nid = ALC883_DIGOUT_NID,
9151 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9152 .channel_mode = alc883_3ST_2ch_modes,
9154 ARRAY_SIZE(alc888_2_capture_sources),
9155 .input_mux = alc888_acer_aspire_6530_sources,
9156 .unsol_event = alc_automute_amp_unsol_event,
9157 .setup = alc888_acer_aspire_6530g_setup,
9158 .init_hook = alc_automute_amp,
9160 [ALC888_ACER_ASPIRE_8930G] = {
9161 .mixers = { alc888_base_mixer,
9162 alc883_chmode_mixer },
9163 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9164 alc889_acer_aspire_8930g_verbs },
9165 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9166 .dac_nids = alc883_dac_nids,
9167 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9168 .adc_nids = alc889_adc_nids,
9169 .capsrc_nids = alc889_capsrc_nids,
9170 .dig_out_nid = ALC883_DIGOUT_NID,
9171 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9172 .channel_mode = alc883_3ST_6ch_modes,
9174 .const_channel_count = 6,
9176 ARRAY_SIZE(alc889_capture_sources),
9177 .input_mux = alc889_capture_sources,
9178 .unsol_event = alc_automute_amp_unsol_event,
9179 .setup = alc889_acer_aspire_8930g_setup,
9180 .init_hook = alc_automute_amp,
9183 .mixers = { alc883_fivestack_mixer,
9184 alc883_chmode_mixer },
9185 .init_verbs = { alc883_init_verbs,
9186 alc883_medion_eapd_verbs },
9187 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9188 .dac_nids = alc883_dac_nids,
9189 .adc_nids = alc883_adc_nids_alt,
9190 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9191 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9192 .channel_mode = alc883_sixstack_modes,
9193 .input_mux = &alc883_capture_source,
9195 [ALC883_MEDION_MD2] = {
9196 .mixers = { alc883_medion_md2_mixer},
9197 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9198 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9199 .dac_nids = alc883_dac_nids,
9200 .dig_out_nid = ALC883_DIGOUT_NID,
9201 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9202 .channel_mode = alc883_3ST_2ch_modes,
9203 .input_mux = &alc883_capture_source,
9204 .unsol_event = alc_automute_amp_unsol_event,
9205 .setup = alc883_medion_md2_setup,
9206 .init_hook = alc_automute_amp,
9208 [ALC883_LAPTOP_EAPD] = {
9209 .mixers = { alc883_base_mixer },
9210 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9211 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9212 .dac_nids = alc883_dac_nids,
9213 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9214 .channel_mode = alc883_3ST_2ch_modes,
9215 .input_mux = &alc883_capture_source,
9217 [ALC883_CLEVO_M720] = {
9218 .mixers = { alc883_clevo_m720_mixer },
9219 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9220 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9221 .dac_nids = alc883_dac_nids,
9222 .dig_out_nid = ALC883_DIGOUT_NID,
9223 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9224 .channel_mode = alc883_3ST_2ch_modes,
9225 .input_mux = &alc883_capture_source,
9226 .unsol_event = alc883_clevo_m720_unsol_event,
9227 .setup = alc883_clevo_m720_setup,
9228 .init_hook = alc883_clevo_m720_init_hook,
9230 [ALC883_LENOVO_101E_2ch] = {
9231 .mixers = { alc883_lenovo_101e_2ch_mixer},
9232 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9233 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9234 .dac_nids = alc883_dac_nids,
9235 .adc_nids = alc883_adc_nids_alt,
9236 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9237 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9238 .channel_mode = alc883_3ST_2ch_modes,
9239 .input_mux = &alc883_lenovo_101e_capture_source,
9240 .unsol_event = alc883_lenovo_101e_unsol_event,
9241 .init_hook = alc883_lenovo_101e_all_automute,
9243 [ALC883_LENOVO_NB0763] = {
9244 .mixers = { alc883_lenovo_nb0763_mixer },
9245 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9246 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9247 .dac_nids = alc883_dac_nids,
9248 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9249 .channel_mode = alc883_3ST_2ch_modes,
9251 .input_mux = &alc883_lenovo_nb0763_capture_source,
9252 .unsol_event = alc_automute_amp_unsol_event,
9253 .setup = alc883_medion_md2_setup,
9254 .init_hook = alc_automute_amp,
9256 [ALC888_LENOVO_MS7195_DIG] = {
9257 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9258 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9259 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9260 .dac_nids = alc883_dac_nids,
9261 .dig_out_nid = ALC883_DIGOUT_NID,
9262 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9263 .channel_mode = alc883_3ST_6ch_modes,
9265 .input_mux = &alc883_capture_source,
9266 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9267 .init_hook = alc888_lenovo_ms7195_front_automute,
9269 [ALC883_HAIER_W66] = {
9270 .mixers = { alc883_targa_2ch_mixer},
9271 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9272 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9273 .dac_nids = alc883_dac_nids,
9274 .dig_out_nid = ALC883_DIGOUT_NID,
9275 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9276 .channel_mode = alc883_3ST_2ch_modes,
9277 .input_mux = &alc883_capture_source,
9278 .unsol_event = alc_automute_amp_unsol_event,
9279 .setup = alc883_haier_w66_setup,
9280 .init_hook = alc_automute_amp,
9283 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9284 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9285 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9286 .dac_nids = alc883_dac_nids,
9287 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9288 .channel_mode = alc888_3st_hp_modes,
9290 .input_mux = &alc883_capture_source,
9291 .unsol_event = alc_automute_amp_unsol_event,
9292 .setup = alc888_3st_hp_setup,
9293 .init_hook = alc_automute_amp,
9295 [ALC888_6ST_DELL] = {
9296 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9297 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9298 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9299 .dac_nids = alc883_dac_nids,
9300 .dig_out_nid = ALC883_DIGOUT_NID,
9301 .dig_in_nid = ALC883_DIGIN_NID,
9302 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9303 .channel_mode = alc883_sixstack_modes,
9304 .input_mux = &alc883_capture_source,
9305 .unsol_event = alc_automute_amp_unsol_event,
9306 .setup = alc888_6st_dell_setup,
9307 .init_hook = alc_automute_amp,
9310 .mixers = { alc883_mitac_mixer },
9311 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9312 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9313 .dac_nids = alc883_dac_nids,
9314 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9315 .channel_mode = alc883_3ST_2ch_modes,
9316 .input_mux = &alc883_capture_source,
9317 .unsol_event = alc_automute_amp_unsol_event,
9318 .setup = alc883_mitac_setup,
9319 .init_hook = alc_automute_amp,
9321 [ALC883_FUJITSU_PI2515] = {
9322 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9323 .init_verbs = { alc883_init_verbs,
9324 alc883_2ch_fujitsu_pi2515_verbs},
9325 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9326 .dac_nids = alc883_dac_nids,
9327 .dig_out_nid = ALC883_DIGOUT_NID,
9328 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9329 .channel_mode = alc883_3ST_2ch_modes,
9330 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9331 .unsol_event = alc_automute_amp_unsol_event,
9332 .setup = alc883_2ch_fujitsu_pi2515_setup,
9333 .init_hook = alc_automute_amp,
9335 [ALC888_FUJITSU_XA3530] = {
9336 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9337 .init_verbs = { alc883_init_verbs,
9338 alc888_fujitsu_xa3530_verbs },
9339 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9340 .dac_nids = alc883_dac_nids,
9341 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9342 .adc_nids = alc883_adc_nids_rev,
9343 .capsrc_nids = alc883_capsrc_nids_rev,
9344 .dig_out_nid = ALC883_DIGOUT_NID,
9345 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9346 .channel_mode = alc888_4ST_8ch_intel_modes,
9348 ARRAY_SIZE(alc888_2_capture_sources),
9349 .input_mux = alc888_2_capture_sources,
9350 .unsol_event = alc_automute_amp_unsol_event,
9351 .setup = alc888_fujitsu_xa3530_setup,
9352 .init_hook = alc_automute_amp,
9354 [ALC888_LENOVO_SKY] = {
9355 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9356 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9357 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9358 .dac_nids = alc883_dac_nids,
9359 .dig_out_nid = ALC883_DIGOUT_NID,
9360 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9361 .channel_mode = alc883_sixstack_modes,
9363 .input_mux = &alc883_lenovo_sky_capture_source,
9364 .unsol_event = alc_automute_amp_unsol_event,
9365 .setup = alc888_lenovo_sky_setup,
9366 .init_hook = alc_automute_amp,
9368 [ALC888_ASUS_M90V] = {
9369 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9370 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9371 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9372 .dac_nids = alc883_dac_nids,
9373 .dig_out_nid = ALC883_DIGOUT_NID,
9374 .dig_in_nid = ALC883_DIGIN_NID,
9375 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9376 .channel_mode = alc883_3ST_6ch_modes,
9378 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9379 .unsol_event = alc_sku_unsol_event,
9380 .setup = alc883_mode2_setup,
9381 .init_hook = alc_inithook,
9383 [ALC888_ASUS_EEE1601] = {
9384 .mixers = { alc883_asus_eee1601_mixer },
9385 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9386 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9387 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9388 .dac_nids = alc883_dac_nids,
9389 .dig_out_nid = ALC883_DIGOUT_NID,
9390 .dig_in_nid = ALC883_DIGIN_NID,
9391 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9392 .channel_mode = alc883_3ST_2ch_modes,
9394 .input_mux = &alc883_asus_eee1601_capture_source,
9395 .unsol_event = alc_sku_unsol_event,
9396 .init_hook = alc883_eee1601_inithook,
9398 [ALC1200_ASUS_P5Q] = {
9399 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9400 .init_verbs = { alc883_init_verbs },
9401 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9402 .dac_nids = alc883_dac_nids,
9403 .dig_out_nid = ALC1200_DIGOUT_NID,
9404 .dig_in_nid = ALC883_DIGIN_NID,
9405 .slave_dig_outs = alc1200_slave_dig_outs,
9406 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9407 .channel_mode = alc883_sixstack_modes,
9408 .input_mux = &alc883_capture_source,
9411 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9412 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9413 alc880_gpio1_init_verbs },
9414 .adc_nids = alc883_adc_nids,
9415 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9416 .dac_nids = alc883_dac_nids,
9417 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9418 .channel_mode = alc889A_mb31_6ch_modes,
9419 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9420 .input_mux = &alc889A_mb31_capture_source,
9421 .dig_out_nid = ALC883_DIGOUT_NID,
9422 .unsol_event = alc889A_mb31_unsol_event,
9423 .init_hook = alc889A_mb31_automute,
9425 [ALC883_SONY_VAIO_TT] = {
9426 .mixers = { alc883_vaiott_mixer },
9427 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9428 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9429 .dac_nids = alc883_dac_nids,
9430 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9431 .channel_mode = alc883_3ST_2ch_modes,
9432 .input_mux = &alc883_capture_source,
9433 .unsol_event = alc_automute_amp_unsol_event,
9434 .setup = alc883_vaiott_setup,
9435 .init_hook = alc_automute_amp,
9444 PINFIX_ABIT_AW9D_MAX
9447 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9448 { 0x15, 0x01080104 }, /* side */
9449 { 0x16, 0x01011012 }, /* rear */
9450 { 0x17, 0x01016011 }, /* clfe */
9454 static const struct alc_pincfg *alc882_pin_fixes[] = {
9455 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
9458 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
9459 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9464 * BIOS auto configuration
9466 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9467 const struct auto_pin_cfg *cfg)
9469 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9472 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9473 hda_nid_t nid, int pin_type,
9477 struct alc_spec *spec = codec->spec;
9480 alc_set_pin_output(codec, nid, pin_type);
9481 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9484 idx = spec->multiout.dac_nids[dac_idx] - 2;
9485 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9489 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9491 struct alc_spec *spec = codec->spec;
9494 for (i = 0; i <= HDA_SIDE; i++) {
9495 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9496 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9498 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9503 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9505 struct alc_spec *spec = codec->spec;
9508 pin = spec->autocfg.hp_pins[0];
9509 if (pin) /* connect to front */
9511 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9512 pin = spec->autocfg.speaker_pins[0];
9514 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9517 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9519 struct alc_spec *spec = codec->spec;
9522 for (i = 0; i < AUTO_PIN_LAST; i++) {
9523 hda_nid_t nid = spec->autocfg.input_pins[i];
9526 alc_set_input_pin(codec, nid, i);
9527 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9528 snd_hda_codec_write(codec, nid, 0,
9529 AC_VERB_SET_AMP_GAIN_MUTE,
9534 static void alc882_auto_init_input_src(struct hda_codec *codec)
9536 struct alc_spec *spec = codec->spec;
9539 for (c = 0; c < spec->num_adc_nids; c++) {
9540 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9541 hda_nid_t nid = spec->capsrc_nids[c];
9542 unsigned int mux_idx;
9543 const struct hda_input_mux *imux;
9544 int conns, mute, idx, item;
9546 conns = snd_hda_get_connections(codec, nid, conn_list,
9547 ARRAY_SIZE(conn_list));
9550 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9551 imux = &spec->input_mux[mux_idx];
9552 for (idx = 0; idx < conns; idx++) {
9553 /* if the current connection is the selected one,
9554 * unmute it as default - otherwise mute it
9556 mute = AMP_IN_MUTE(idx);
9557 for (item = 0; item < imux->num_items; item++) {
9558 if (imux->items[item].index == idx) {
9559 if (spec->cur_mux[c] == item)
9560 mute = AMP_IN_UNMUTE(idx);
9564 /* check if we have a selector or mixer
9565 * we could check for the widget type instead, but
9566 * just check for Amp-In presence (in case of mixer
9567 * without amp-in there is something wrong, this
9568 * function shouldn't be used or capsrc nid is wrong)
9570 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9571 snd_hda_codec_write(codec, nid, 0,
9572 AC_VERB_SET_AMP_GAIN_MUTE,
9574 else if (mute != AMP_IN_MUTE(idx))
9575 snd_hda_codec_write(codec, nid, 0,
9576 AC_VERB_SET_CONNECT_SEL,
9582 /* add mic boosts if needed */
9583 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9585 struct alc_spec *spec = codec->spec;
9589 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9590 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9591 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9593 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9597 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9598 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9599 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9601 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9608 /* almost identical with ALC880 parser... */
9609 static int alc882_parse_auto_config(struct hda_codec *codec)
9611 struct alc_spec *spec = codec->spec;
9612 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9615 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9619 if (!spec->autocfg.line_outs)
9620 return 0; /* can't find valid BIOS pin config */
9622 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9625 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9628 err = alc880_auto_create_extra_out(spec,
9629 spec->autocfg.speaker_pins[0],
9633 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9637 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9641 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9643 /* check multiple SPDIF-out (for recent codecs) */
9644 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9646 err = snd_hda_get_connections(codec,
9647 spec->autocfg.dig_out_pins[i],
9652 spec->multiout.dig_out_nid = dig_nid;
9654 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9655 spec->slave_dig_outs[i - 1] = dig_nid;
9656 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
9660 if (spec->autocfg.dig_in_pin)
9661 spec->dig_in_nid = ALC880_DIGIN_NID;
9663 if (spec->kctls.list)
9664 add_mixer(spec, spec->kctls.list);
9666 add_verb(spec, alc883_auto_init_verbs);
9667 /* if ADC 0x07 is available, initialize it, too */
9668 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9669 add_verb(spec, alc882_adc1_init_verbs);
9671 spec->num_mux_defs = 1;
9672 spec->input_mux = &spec->private_imux[0];
9674 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9676 err = alc_auto_add_mic_boost(codec);
9680 return 1; /* config found */
9683 /* additional initialization for auto-configuration model */
9684 static void alc882_auto_init(struct hda_codec *codec)
9686 struct alc_spec *spec = codec->spec;
9687 alc882_auto_init_multi_out(codec);
9688 alc882_auto_init_hp_out(codec);
9689 alc882_auto_init_analog_input(codec);
9690 alc882_auto_init_input_src(codec);
9691 if (spec->unsol_event)
9692 alc_inithook(codec);
9695 static int patch_alc882(struct hda_codec *codec)
9697 struct alc_spec *spec;
9698 int err, board_config;
9700 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9706 switch (codec->vendor_id) {
9711 /* ALC883 and variants */
9712 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9716 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9720 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9721 board_config = snd_hda_check_board_codec_sid_config(codec,
9722 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9724 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9725 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9727 board_config = ALC882_AUTO;
9730 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
9732 if (board_config == ALC882_AUTO) {
9733 /* automatic parse from the BIOS config */
9734 err = alc882_parse_auto_config(codec);
9740 "hda_codec: Cannot set up configuration "
9741 "from BIOS. Using base mode...\n");
9742 board_config = ALC882_3ST_DIG;
9746 err = snd_hda_attach_beep_device(codec, 0x1);
9752 if (board_config != ALC882_AUTO)
9753 setup_preset(codec, &alc882_presets[board_config]);
9755 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9756 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9757 /* FIXME: setup DAC5 */
9758 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9759 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9761 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9762 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9764 if (codec->vendor_id == 0x10ec0888)
9765 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9767 if (!spec->adc_nids && spec->input_mux) {
9769 spec->num_adc_nids = 0;
9770 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9772 hda_nid_t nid = alc882_adc_nids[i];
9773 unsigned int wcap = get_wcaps(codec, nid);
9775 wcap = get_wcaps_type(wcap);
9776 if (wcap != AC_WID_AUD_IN)
9778 spec->private_adc_nids[spec->num_adc_nids] = nid;
9779 err = snd_hda_get_connections(codec, nid, &cap, 1);
9782 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9783 spec->num_adc_nids++;
9785 spec->adc_nids = spec->private_adc_nids;
9786 spec->capsrc_nids = spec->private_capsrc_nids;
9789 set_capture_mixer(codec);
9790 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9792 spec->vmaster_nid = 0x0c;
9794 codec->patch_ops = alc_patch_ops;
9795 if (board_config == ALC882_AUTO)
9796 spec->init_hook = alc882_auto_init;
9797 #ifdef CONFIG_SND_HDA_POWER_SAVE
9798 if (!spec->loopback.amplist)
9799 spec->loopback.amplist = alc882_loopbacks;
9801 codec->proc_widget_hook = print_realtek_coef;
9811 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9812 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9814 #define alc262_dac_nids alc260_dac_nids
9815 #define alc262_adc_nids alc882_adc_nids
9816 #define alc262_adc_nids_alt alc882_adc_nids_alt
9817 #define alc262_capsrc_nids alc882_capsrc_nids
9818 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9820 #define alc262_modes alc260_modes
9821 #define alc262_capture_source alc882_capture_source
9823 static hda_nid_t alc262_dmic_adc_nids[1] = {
9828 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9830 static struct snd_kcontrol_new alc262_base_mixer[] = {
9831 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9832 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9833 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9834 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9835 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9836 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9838 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9839 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9840 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9841 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9842 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9843 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9844 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9845 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9846 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9850 /* update HP, line and mono-out pins according to the master switch */
9851 static void alc262_hp_master_update(struct hda_codec *codec)
9853 struct alc_spec *spec = codec->spec;
9854 int val = spec->master_sw;
9857 snd_hda_codec_write_cache(codec, 0x1b, 0,
9858 AC_VERB_SET_PIN_WIDGET_CONTROL,
9860 snd_hda_codec_write_cache(codec, 0x15, 0,
9861 AC_VERB_SET_PIN_WIDGET_CONTROL,
9863 /* mono (speaker) depending on the HP jack sense */
9864 val = val && !spec->jack_present;
9865 snd_hda_codec_write_cache(codec, 0x16, 0,
9866 AC_VERB_SET_PIN_WIDGET_CONTROL,
9870 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9872 struct alc_spec *spec = codec->spec;
9873 unsigned int presence;
9874 presence = snd_hda_codec_read(codec, 0x1b, 0,
9875 AC_VERB_GET_PIN_SENSE, 0);
9876 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9877 alc262_hp_master_update(codec);
9880 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9882 if ((res >> 26) != ALC880_HP_EVENT)
9884 alc262_hp_bpc_automute(codec);
9887 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9889 struct alc_spec *spec = codec->spec;
9890 unsigned int presence;
9891 presence = snd_hda_codec_read(codec, 0x15, 0,
9892 AC_VERB_GET_PIN_SENSE, 0);
9893 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9894 alc262_hp_master_update(codec);
9897 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9900 if ((res >> 26) != ALC880_HP_EVENT)
9902 alc262_hp_wildwest_automute(codec);
9905 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9907 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9908 struct snd_ctl_elem_value *ucontrol)
9910 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9911 struct alc_spec *spec = codec->spec;
9912 int val = !!*ucontrol->value.integer.value;
9914 if (val == spec->master_sw)
9916 spec->master_sw = val;
9917 alc262_hp_master_update(codec);
9921 #define ALC262_HP_MASTER_SWITCH \
9923 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9924 .name = "Master Playback Switch", \
9925 .info = snd_ctl_boolean_mono_info, \
9926 .get = alc262_hp_master_sw_get, \
9927 .put = alc262_hp_master_sw_put, \
9930 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9931 ALC262_HP_MASTER_SWITCH,
9932 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9933 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9934 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9935 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9937 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9939 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9940 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9941 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9942 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9943 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9944 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9945 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9946 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9947 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9948 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9949 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9950 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9954 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9955 ALC262_HP_MASTER_SWITCH,
9956 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9957 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9958 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9959 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9960 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9962 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9964 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9965 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9966 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9968 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9969 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9970 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9974 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9975 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9976 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9977 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9981 /* mute/unmute internal speaker according to the hp jack and mute state */
9982 static void alc262_hp_t5735_setup(struct hda_codec *codec)
9984 struct alc_spec *spec = codec->spec;
9986 spec->autocfg.hp_pins[0] = 0x15;
9987 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9990 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9991 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9992 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9993 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9994 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9995 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9996 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9997 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10001 static struct hda_verb alc262_hp_t5735_verbs[] = {
10002 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10003 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10005 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10009 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10010 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10011 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10012 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10013 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10014 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10015 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10019 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10020 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10021 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10022 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10023 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10024 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10025 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10026 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10027 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10028 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10033 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10040 /* bind hp and internal speaker mute (with plug check) as master switch */
10041 static void alc262_hippo_master_update(struct hda_codec *codec)
10043 struct alc_spec *spec = codec->spec;
10044 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10045 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10046 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10050 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10051 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10052 HDA_AMP_MUTE, mute);
10053 /* mute internal speaker per jack sense */
10054 if (spec->jack_present)
10055 mute = HDA_AMP_MUTE;
10057 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10058 HDA_AMP_MUTE, mute);
10059 if (speaker_nid && speaker_nid != line_nid)
10060 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10061 HDA_AMP_MUTE, mute);
10064 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10066 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10067 struct snd_ctl_elem_value *ucontrol)
10069 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10070 struct alc_spec *spec = codec->spec;
10071 int val = !!*ucontrol->value.integer.value;
10073 if (val == spec->master_sw)
10075 spec->master_sw = val;
10076 alc262_hippo_master_update(codec);
10080 #define ALC262_HIPPO_MASTER_SWITCH \
10082 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10083 .name = "Master Playback Switch", \
10084 .info = snd_ctl_boolean_mono_info, \
10085 .get = alc262_hippo_master_sw_get, \
10086 .put = alc262_hippo_master_sw_put, \
10089 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10090 ALC262_HIPPO_MASTER_SWITCH,
10091 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10092 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10093 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10094 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10095 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10096 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10097 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10098 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10099 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10100 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10101 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10102 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10106 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10107 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10108 ALC262_HIPPO_MASTER_SWITCH,
10109 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10110 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10111 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10112 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10113 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10114 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10115 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10116 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10117 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10118 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10122 /* mute/unmute internal speaker according to the hp jack and mute state */
10123 static void alc262_hippo_automute(struct hda_codec *codec)
10125 struct alc_spec *spec = codec->spec;
10126 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10127 unsigned int present;
10129 /* need to execute and sync at first */
10130 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10131 present = snd_hda_codec_read(codec, hp_nid, 0,
10132 AC_VERB_GET_PIN_SENSE, 0);
10133 spec->jack_present = (present & 0x80000000) != 0;
10134 alc262_hippo_master_update(codec);
10137 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10139 if ((res >> 26) != ALC880_HP_EVENT)
10141 alc262_hippo_automute(codec);
10144 static void alc262_hippo_setup(struct hda_codec *codec)
10146 struct alc_spec *spec = codec->spec;
10148 spec->autocfg.hp_pins[0] = 0x15;
10149 spec->autocfg.speaker_pins[0] = 0x14;
10152 static void alc262_hippo1_setup(struct hda_codec *codec)
10154 struct alc_spec *spec = codec->spec;
10156 spec->autocfg.hp_pins[0] = 0x1b;
10157 spec->autocfg.speaker_pins[0] = 0x14;
10161 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10162 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10163 ALC262_HIPPO_MASTER_SWITCH,
10164 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10165 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10166 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10167 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10171 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10172 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10173 ALC262_HIPPO_MASTER_SWITCH,
10174 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10175 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10176 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10177 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10178 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10182 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10183 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10184 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10185 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10186 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10187 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10188 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10189 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10190 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10191 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10192 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10193 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10194 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10198 static struct hda_verb alc262_tyan_verbs[] = {
10199 /* Headphone automute */
10200 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10201 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10202 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10204 /* P11 AUX_IN, white 4-pin connector */
10205 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10206 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10207 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10208 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10213 /* unsolicited event for HP jack sensing */
10214 static void alc262_tyan_setup(struct hda_codec *codec)
10216 struct alc_spec *spec = codec->spec;
10218 spec->autocfg.hp_pins[0] = 0x1b;
10219 spec->autocfg.speaker_pins[0] = 0x15;
10223 #define alc262_capture_mixer alc882_capture_mixer
10224 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10227 * generic initialization of ADC, input mixers and output mixers
10229 static struct hda_verb alc262_init_verbs[] = {
10231 * Unmute ADC0-2 and set the default input to mic-in
10233 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10234 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10235 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10236 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10237 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10238 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10240 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10242 * Note: PASD motherboards uses the Line In 2 as the input for
10243 * front panel mic (mic 2)
10245 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10246 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10247 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10248 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10249 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10253 * Set up output mixers (0x0c - 0x0e)
10255 /* set vol=0 to output mixers */
10256 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10257 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10258 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10259 /* set up input amps for analog loopback */
10260 /* Amp Indices: DAC = 0, mixer = 1 */
10261 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10262 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10263 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10264 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10265 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10266 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10268 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10269 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10270 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10271 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10272 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10273 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10275 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10276 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10277 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10278 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10279 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10281 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10282 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10284 /* FIXME: use matrix-type input source selection */
10285 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10286 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10287 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10288 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10289 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10290 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10292 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10293 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10294 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10295 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10297 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10298 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10299 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10300 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10305 static struct hda_verb alc262_eapd_verbs[] = {
10306 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10307 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10311 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10312 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10313 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10314 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10316 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10317 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10321 static struct hda_verb alc262_sony_unsol_verbs[] = {
10322 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10323 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10324 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10326 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10327 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10331 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10332 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10333 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10334 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10335 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10336 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10340 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10341 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10342 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10343 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10344 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10345 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10346 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10347 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10348 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10352 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10354 struct alc_spec *spec = codec->spec;
10356 spec->autocfg.hp_pins[0] = 0x15;
10357 spec->autocfg.speaker_pins[0] = 0x14;
10358 spec->ext_mic.pin = 0x18;
10359 spec->ext_mic.mux_idx = 0;
10360 spec->int_mic.pin = 0x12;
10361 spec->int_mic.mux_idx = 9;
10362 spec->auto_mic = 1;
10368 * 0x16 = internal speaker
10369 * 0x18 = external mic
10372 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10373 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10374 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10378 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10380 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10381 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10385 static struct hda_verb alc262_nec_verbs[] = {
10386 /* Unmute Speaker */
10387 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10390 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10391 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10393 /* External mic to headphone */
10394 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10395 /* External mic to speaker */
10396 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10402 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10403 * 0x1b = port replicator headphone out
10406 #define ALC_HP_EVENT 0x37
10408 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10409 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10410 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10411 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10412 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10416 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
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_input_mux alc262_fujitsu_capture_source = {
10426 { "Int Mic", 0x1 },
10431 static struct hda_input_mux alc262_HP_capture_source = {
10435 { "Front Mic", 0x1 },
10442 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10446 { "Front Mic", 0x2 },
10452 /* mute/unmute internal speaker according to the hp jacks and mute state */
10453 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10455 struct alc_spec *spec = codec->spec;
10458 if (force || !spec->sense_updated) {
10459 unsigned int present;
10460 /* need to execute and sync at first */
10461 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10462 /* check laptop HP jack */
10463 present = snd_hda_codec_read(codec, 0x14, 0,
10464 AC_VERB_GET_PIN_SENSE, 0);
10465 /* need to execute and sync at first */
10466 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10467 /* check docking HP jack */
10468 present |= snd_hda_codec_read(codec, 0x1b, 0,
10469 AC_VERB_GET_PIN_SENSE, 0);
10470 if (present & AC_PINSENSE_PRESENCE)
10471 spec->jack_present = 1;
10473 spec->jack_present = 0;
10474 spec->sense_updated = 1;
10476 /* unmute internal speaker only if both HPs are unplugged and
10477 * master switch is on
10479 if (spec->jack_present)
10480 mute = HDA_AMP_MUTE;
10482 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10483 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10484 HDA_AMP_MUTE, mute);
10487 /* unsolicited event for HP jack sensing */
10488 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10491 if ((res >> 26) != ALC_HP_EVENT)
10493 alc262_fujitsu_automute(codec, 1);
10496 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10498 alc262_fujitsu_automute(codec, 1);
10501 /* bind volumes of both NID 0x0c and 0x0d */
10502 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10503 .ops = &snd_hda_bind_vol,
10505 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10506 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10511 /* mute/unmute internal speaker according to the hp jack and mute state */
10512 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10514 struct alc_spec *spec = codec->spec;
10517 if (force || !spec->sense_updated) {
10518 unsigned int present_int_hp;
10519 /* need to execute and sync at first */
10520 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10521 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10522 AC_VERB_GET_PIN_SENSE, 0);
10523 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10524 spec->sense_updated = 1;
10526 if (spec->jack_present) {
10527 /* mute internal speaker */
10528 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10529 HDA_AMP_MUTE, HDA_AMP_MUTE);
10530 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10531 HDA_AMP_MUTE, HDA_AMP_MUTE);
10533 /* unmute internal speaker if necessary */
10534 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10535 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10536 HDA_AMP_MUTE, mute);
10537 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10538 HDA_AMP_MUTE, mute);
10542 /* unsolicited event for HP jack sensing */
10543 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10546 if ((res >> 26) != ALC_HP_EVENT)
10548 alc262_lenovo_3000_automute(codec, 1);
10551 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10552 int dir, int idx, long *valp)
10556 for (i = 0; i < 2; i++, valp++)
10557 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10559 *valp ? 0 : HDA_AMP_MUTE);
10563 /* bind hp and internal speaker mute (with plug check) */
10564 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10565 struct snd_ctl_elem_value *ucontrol)
10567 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10568 long *valp = ucontrol->value.integer.value;
10571 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10572 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10574 alc262_fujitsu_automute(codec, 0);
10578 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10579 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10581 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10582 .name = "Master Playback Switch",
10583 .info = snd_hda_mixer_amp_switch_info,
10584 .get = snd_hda_mixer_amp_switch_get,
10585 .put = alc262_fujitsu_master_sw_put,
10586 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10588 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10589 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10590 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10591 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10592 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10593 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10594 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10595 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10599 /* bind hp and internal speaker mute (with plug check) */
10600 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10601 struct snd_ctl_elem_value *ucontrol)
10603 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10604 long *valp = ucontrol->value.integer.value;
10607 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10609 alc262_lenovo_3000_automute(codec, 0);
10613 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10614 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10616 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10617 .name = "Master Playback Switch",
10618 .info = snd_hda_mixer_amp_switch_info,
10619 .get = snd_hda_mixer_amp_switch_get,
10620 .put = alc262_lenovo_3000_master_sw_put,
10621 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10623 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10624 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10625 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10626 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10627 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10628 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10629 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10630 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10634 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10635 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10636 ALC262_HIPPO_MASTER_SWITCH,
10637 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10638 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10639 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10640 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10641 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10642 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10646 /* additional init verbs for Benq laptops */
10647 static struct hda_verb alc262_EAPD_verbs[] = {
10648 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10649 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10653 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10654 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10655 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10657 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10658 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10662 /* Samsung Q1 Ultra Vista model setup */
10663 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10664 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10665 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10666 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10667 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10668 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10669 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10673 static struct hda_verb alc262_ultra_verbs[] = {
10675 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10676 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10677 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10679 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10680 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10681 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10682 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10684 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10685 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10686 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10687 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10688 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10690 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10691 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10692 /* ADC, choose mic */
10693 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10694 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10695 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10696 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10697 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10698 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10699 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10700 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10701 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10702 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10706 /* mute/unmute internal speaker according to the hp jack and mute state */
10707 static void alc262_ultra_automute(struct hda_codec *codec)
10709 struct alc_spec *spec = codec->spec;
10713 /* auto-mute only when HP is used as HP */
10714 if (!spec->cur_mux[0]) {
10715 unsigned int present;
10716 /* need to execute and sync at first */
10717 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10718 present = snd_hda_codec_read(codec, 0x15, 0,
10719 AC_VERB_GET_PIN_SENSE, 0);
10720 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10721 if (spec->jack_present)
10722 mute = HDA_AMP_MUTE;
10724 /* mute/unmute internal speaker */
10725 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10726 HDA_AMP_MUTE, mute);
10727 /* mute/unmute HP */
10728 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10729 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10732 /* unsolicited event for HP jack sensing */
10733 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10736 if ((res >> 26) != ALC880_HP_EVENT)
10738 alc262_ultra_automute(codec);
10741 static struct hda_input_mux alc262_ultra_capture_source = {
10745 { "Headphone", 0x7 },
10749 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10750 struct snd_ctl_elem_value *ucontrol)
10752 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10753 struct alc_spec *spec = codec->spec;
10756 ret = alc_mux_enum_put(kcontrol, ucontrol);
10759 /* reprogram the HP pin as mic or HP according to the input source */
10760 snd_hda_codec_write_cache(codec, 0x15, 0,
10761 AC_VERB_SET_PIN_WIDGET_CONTROL,
10762 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10763 alc262_ultra_automute(codec); /* mute/unmute HP */
10767 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10768 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10769 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10771 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10772 .name = "Capture Source",
10773 .info = alc_mux_enum_info,
10774 .get = alc_mux_enum_get,
10775 .put = alc262_ultra_mux_enum_put,
10780 /* add playback controls from the parsed DAC table */
10781 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10782 const struct auto_pin_cfg *cfg)
10787 spec->multiout.num_dacs = 1; /* only use one dac */
10788 spec->multiout.dac_nids = spec->private_dac_nids;
10789 spec->multiout.dac_nids[0] = 2;
10791 nid = cfg->line_out_pins[0];
10793 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10794 "Front Playback Volume",
10795 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10798 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10799 "Front Playback Switch",
10800 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10805 nid = cfg->speaker_pins[0];
10808 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10809 "Speaker Playback Volume",
10810 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10814 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10815 "Speaker Playback Switch",
10816 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10821 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10822 "Speaker Playback Switch",
10823 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10829 nid = cfg->hp_pins[0];
10831 /* spec->multiout.hp_nid = 2; */
10833 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10834 "Headphone Playback Volume",
10835 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10839 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10840 "Headphone Playback Switch",
10841 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10846 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10847 "Headphone Playback Switch",
10848 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10857 #define alc262_auto_create_input_ctls \
10858 alc880_auto_create_input_ctls
10861 * generic initialization of ADC, input mixers and output mixers
10863 static struct hda_verb alc262_volume_init_verbs[] = {
10865 * Unmute ADC0-2 and set the default input to mic-in
10867 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10868 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10869 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10870 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10871 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10872 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10874 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10876 * Note: PASD motherboards uses the Line In 2 as the input for
10877 * front panel mic (mic 2)
10879 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10881 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10882 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10883 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10884 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10887 * Set up output mixers (0x0c - 0x0f)
10889 /* set vol=0 to output mixers */
10890 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10891 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10892 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10894 /* set up input amps for analog loopback */
10895 /* Amp Indices: DAC = 0, mixer = 1 */
10896 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10897 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10898 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10899 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10900 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10901 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10903 /* FIXME: use matrix-type input source selection */
10904 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10905 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10906 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10907 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10908 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10909 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10911 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10912 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10913 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10914 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10916 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10917 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10918 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10919 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10924 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10926 * Unmute ADC0-2 and set the default input to mic-in
10928 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10929 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10930 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10931 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10932 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10933 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10935 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10937 * Note: PASD motherboards uses the Line In 2 as the input for
10938 * front panel mic (mic 2)
10940 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10941 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10942 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10943 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10944 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10945 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10946 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10947 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10950 * Set up output mixers (0x0c - 0x0e)
10952 /* set vol=0 to output mixers */
10953 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10954 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10955 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10957 /* set up input amps for analog loopback */
10958 /* Amp Indices: DAC = 0, mixer = 1 */
10959 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10960 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10961 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10962 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10963 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10964 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10966 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10967 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10968 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10970 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10971 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10973 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10974 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10976 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10977 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10978 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10979 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10980 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10982 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10983 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10984 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10985 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10986 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10987 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10990 /* FIXME: use matrix-type input source selection */
10991 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
10992 /* Input mixer1: only unmute Mic */
10993 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10994 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10995 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10996 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10997 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10998 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10999 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11000 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11001 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11003 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11004 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11005 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11006 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11007 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11008 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11009 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11010 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11011 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11013 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11014 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11015 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11016 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11017 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11018 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11019 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11020 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11021 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11023 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11028 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11030 * Unmute ADC0-2 and set the default input to mic-in
11032 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11033 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11034 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11035 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11036 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11037 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11039 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11041 * Note: PASD motherboards uses the Line In 2 as the input for front
11042 * panel mic (mic 2)
11044 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11045 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11046 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11047 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11048 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11049 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11050 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11051 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11052 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11054 * Set up output mixers (0x0c - 0x0e)
11056 /* set vol=0 to output mixers */
11057 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11058 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11059 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11061 /* set up input amps for analog loopback */
11062 /* Amp Indices: DAC = 0, mixer = 1 */
11063 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11064 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11065 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11066 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11067 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11068 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11071 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11072 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11073 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11074 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11075 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11076 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11077 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11079 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11080 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11082 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11083 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11085 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11086 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11087 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11088 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11089 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11090 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11092 /* FIXME: use matrix-type input source selection */
11093 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11094 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11095 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11096 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11097 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11098 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11099 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11100 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11101 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11103 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11104 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11105 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11106 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11107 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11108 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11109 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11111 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11112 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11113 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11114 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11115 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11116 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11119 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11124 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11126 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11127 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11128 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11130 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11131 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11132 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11133 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11135 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11136 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11137 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11142 #ifdef CONFIG_SND_HDA_POWER_SAVE
11143 #define alc262_loopbacks alc880_loopbacks
11146 /* pcm configuration: identical with ALC880 */
11147 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11148 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11149 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11150 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11153 * BIOS auto configuration
11155 static int alc262_parse_auto_config(struct hda_codec *codec)
11157 struct alc_spec *spec = codec->spec;
11159 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11161 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11165 if (!spec->autocfg.line_outs) {
11166 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11167 spec->multiout.max_channels = 2;
11168 spec->no_analog = 1;
11171 return 0; /* can't find valid BIOS pin config */
11173 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11176 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11180 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11183 if (spec->autocfg.dig_outs) {
11184 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11185 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11187 if (spec->autocfg.dig_in_pin)
11188 spec->dig_in_nid = ALC262_DIGIN_NID;
11190 if (spec->kctls.list)
11191 add_mixer(spec, spec->kctls.list);
11193 add_verb(spec, alc262_volume_init_verbs);
11194 spec->num_mux_defs = 1;
11195 spec->input_mux = &spec->private_imux[0];
11197 err = alc_auto_add_mic_boost(codec);
11201 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11206 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11207 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11208 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11209 #define alc262_auto_init_input_src alc882_auto_init_input_src
11212 /* init callback for auto-configuration model -- overriding the default init */
11213 static void alc262_auto_init(struct hda_codec *codec)
11215 struct alc_spec *spec = codec->spec;
11216 alc262_auto_init_multi_out(codec);
11217 alc262_auto_init_hp_out(codec);
11218 alc262_auto_init_analog_input(codec);
11219 alc262_auto_init_input_src(codec);
11220 if (spec->unsol_event)
11221 alc_inithook(codec);
11225 * configuration and preset
11227 static const char *alc262_models[ALC262_MODEL_LAST] = {
11228 [ALC262_BASIC] = "basic",
11229 [ALC262_HIPPO] = "hippo",
11230 [ALC262_HIPPO_1] = "hippo_1",
11231 [ALC262_FUJITSU] = "fujitsu",
11232 [ALC262_HP_BPC] = "hp-bpc",
11233 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11234 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11235 [ALC262_HP_RP5700] = "hp-rp5700",
11236 [ALC262_BENQ_ED8] = "benq",
11237 [ALC262_BENQ_T31] = "benq-t31",
11238 [ALC262_SONY_ASSAMD] = "sony-assamd",
11239 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11240 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11241 [ALC262_ULTRA] = "ultra",
11242 [ALC262_LENOVO_3000] = "lenovo-3000",
11243 [ALC262_NEC] = "nec",
11244 [ALC262_TYAN] = "tyan",
11245 [ALC262_AUTO] = "auto",
11248 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11249 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11250 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11251 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11253 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11255 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11257 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11258 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11259 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11260 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11261 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11262 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11263 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11264 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11265 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11266 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11267 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11268 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11269 ALC262_HP_TC_T5735),
11270 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11271 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11272 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11273 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11274 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11275 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11276 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11277 ALC262_SONY_ASSAMD),
11278 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11279 ALC262_TOSHIBA_RX1),
11280 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11281 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11282 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11283 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11284 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11286 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11287 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11288 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11289 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11290 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11294 static struct alc_config_preset alc262_presets[] = {
11296 .mixers = { alc262_base_mixer },
11297 .init_verbs = { alc262_init_verbs },
11298 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11299 .dac_nids = alc262_dac_nids,
11301 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11302 .channel_mode = alc262_modes,
11303 .input_mux = &alc262_capture_source,
11306 .mixers = { alc262_hippo_mixer },
11307 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11308 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11309 .dac_nids = alc262_dac_nids,
11311 .dig_out_nid = ALC262_DIGOUT_NID,
11312 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11313 .channel_mode = alc262_modes,
11314 .input_mux = &alc262_capture_source,
11315 .unsol_event = alc262_hippo_unsol_event,
11316 .setup = alc262_hippo_setup,
11317 .init_hook = alc262_hippo_automute,
11319 [ALC262_HIPPO_1] = {
11320 .mixers = { alc262_hippo1_mixer },
11321 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11322 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11323 .dac_nids = alc262_dac_nids,
11325 .dig_out_nid = ALC262_DIGOUT_NID,
11326 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11327 .channel_mode = alc262_modes,
11328 .input_mux = &alc262_capture_source,
11329 .unsol_event = alc262_hippo_unsol_event,
11330 .setup = alc262_hippo1_setup,
11331 .init_hook = alc262_hippo_automute,
11333 [ALC262_FUJITSU] = {
11334 .mixers = { alc262_fujitsu_mixer },
11335 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11336 alc262_fujitsu_unsol_verbs },
11337 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11338 .dac_nids = alc262_dac_nids,
11340 .dig_out_nid = ALC262_DIGOUT_NID,
11341 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11342 .channel_mode = alc262_modes,
11343 .input_mux = &alc262_fujitsu_capture_source,
11344 .unsol_event = alc262_fujitsu_unsol_event,
11345 .init_hook = alc262_fujitsu_init_hook,
11347 [ALC262_HP_BPC] = {
11348 .mixers = { alc262_HP_BPC_mixer },
11349 .init_verbs = { alc262_HP_BPC_init_verbs },
11350 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11351 .dac_nids = alc262_dac_nids,
11353 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11354 .channel_mode = alc262_modes,
11355 .input_mux = &alc262_HP_capture_source,
11356 .unsol_event = alc262_hp_bpc_unsol_event,
11357 .init_hook = alc262_hp_bpc_automute,
11359 [ALC262_HP_BPC_D7000_WF] = {
11360 .mixers = { alc262_HP_BPC_WildWest_mixer },
11361 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11362 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11363 .dac_nids = alc262_dac_nids,
11365 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11366 .channel_mode = alc262_modes,
11367 .input_mux = &alc262_HP_D7000_capture_source,
11368 .unsol_event = alc262_hp_wildwest_unsol_event,
11369 .init_hook = alc262_hp_wildwest_automute,
11371 [ALC262_HP_BPC_D7000_WL] = {
11372 .mixers = { alc262_HP_BPC_WildWest_mixer,
11373 alc262_HP_BPC_WildWest_option_mixer },
11374 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11375 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11376 .dac_nids = alc262_dac_nids,
11378 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11379 .channel_mode = alc262_modes,
11380 .input_mux = &alc262_HP_D7000_capture_source,
11381 .unsol_event = alc262_hp_wildwest_unsol_event,
11382 .init_hook = alc262_hp_wildwest_automute,
11384 [ALC262_HP_TC_T5735] = {
11385 .mixers = { alc262_hp_t5735_mixer },
11386 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11387 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11388 .dac_nids = alc262_dac_nids,
11390 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11391 .channel_mode = alc262_modes,
11392 .input_mux = &alc262_capture_source,
11393 .unsol_event = alc_automute_amp_unsol_event,
11394 .setup = alc262_hp_t5735_setup,
11395 .init_hook = alc_automute_amp,
11397 [ALC262_HP_RP5700] = {
11398 .mixers = { alc262_hp_rp5700_mixer },
11399 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11400 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11401 .dac_nids = alc262_dac_nids,
11402 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11403 .channel_mode = alc262_modes,
11404 .input_mux = &alc262_hp_rp5700_capture_source,
11406 [ALC262_BENQ_ED8] = {
11407 .mixers = { alc262_base_mixer },
11408 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11409 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11410 .dac_nids = alc262_dac_nids,
11412 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11413 .channel_mode = alc262_modes,
11414 .input_mux = &alc262_capture_source,
11416 [ALC262_SONY_ASSAMD] = {
11417 .mixers = { alc262_sony_mixer },
11418 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11419 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11420 .dac_nids = alc262_dac_nids,
11422 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11423 .channel_mode = alc262_modes,
11424 .input_mux = &alc262_capture_source,
11425 .unsol_event = alc262_hippo_unsol_event,
11426 .setup = alc262_hippo_setup,
11427 .init_hook = alc262_hippo_automute,
11429 [ALC262_BENQ_T31] = {
11430 .mixers = { alc262_benq_t31_mixer },
11431 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11432 alc_hp15_unsol_verbs },
11433 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11434 .dac_nids = alc262_dac_nids,
11436 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11437 .channel_mode = alc262_modes,
11438 .input_mux = &alc262_capture_source,
11439 .unsol_event = alc262_hippo_unsol_event,
11440 .setup = alc262_hippo_setup,
11441 .init_hook = alc262_hippo_automute,
11444 .mixers = { alc262_ultra_mixer },
11445 .cap_mixer = alc262_ultra_capture_mixer,
11446 .init_verbs = { alc262_ultra_verbs },
11447 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11448 .dac_nids = alc262_dac_nids,
11449 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11450 .channel_mode = alc262_modes,
11451 .input_mux = &alc262_ultra_capture_source,
11452 .adc_nids = alc262_adc_nids, /* ADC0 */
11453 .capsrc_nids = alc262_capsrc_nids,
11454 .num_adc_nids = 1, /* single ADC */
11455 .unsol_event = alc262_ultra_unsol_event,
11456 .init_hook = alc262_ultra_automute,
11458 [ALC262_LENOVO_3000] = {
11459 .mixers = { alc262_lenovo_3000_mixer },
11460 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11461 alc262_lenovo_3000_unsol_verbs },
11462 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11463 .dac_nids = alc262_dac_nids,
11465 .dig_out_nid = ALC262_DIGOUT_NID,
11466 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11467 .channel_mode = alc262_modes,
11468 .input_mux = &alc262_fujitsu_capture_source,
11469 .unsol_event = alc262_lenovo_3000_unsol_event,
11472 .mixers = { alc262_nec_mixer },
11473 .init_verbs = { alc262_nec_verbs },
11474 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11475 .dac_nids = alc262_dac_nids,
11477 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11478 .channel_mode = alc262_modes,
11479 .input_mux = &alc262_capture_source,
11481 [ALC262_TOSHIBA_S06] = {
11482 .mixers = { alc262_toshiba_s06_mixer },
11483 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11484 alc262_eapd_verbs },
11485 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11486 .capsrc_nids = alc262_dmic_capsrc_nids,
11487 .dac_nids = alc262_dac_nids,
11488 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11489 .num_adc_nids = 1, /* single ADC */
11490 .dig_out_nid = ALC262_DIGOUT_NID,
11491 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11492 .channel_mode = alc262_modes,
11493 .unsol_event = alc_sku_unsol_event,
11494 .setup = alc262_toshiba_s06_setup,
11495 .init_hook = alc_inithook,
11497 [ALC262_TOSHIBA_RX1] = {
11498 .mixers = { alc262_toshiba_rx1_mixer },
11499 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11500 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11501 .dac_nids = alc262_dac_nids,
11503 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11504 .channel_mode = alc262_modes,
11505 .input_mux = &alc262_capture_source,
11506 .unsol_event = alc262_hippo_unsol_event,
11507 .setup = alc262_hippo_setup,
11508 .init_hook = alc262_hippo_automute,
11511 .mixers = { alc262_tyan_mixer },
11512 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11513 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11514 .dac_nids = alc262_dac_nids,
11516 .dig_out_nid = ALC262_DIGOUT_NID,
11517 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11518 .channel_mode = alc262_modes,
11519 .input_mux = &alc262_capture_source,
11520 .unsol_event = alc_automute_amp_unsol_event,
11521 .setup = alc262_tyan_setup,
11522 .init_hook = alc_automute_amp,
11526 static int patch_alc262(struct hda_codec *codec)
11528 struct alc_spec *spec;
11532 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11536 codec->spec = spec;
11538 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11543 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11544 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11545 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11546 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11550 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11552 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11556 if (board_config < 0) {
11557 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11559 board_config = ALC262_AUTO;
11562 if (board_config == ALC262_AUTO) {
11563 /* automatic parse from the BIOS config */
11564 err = alc262_parse_auto_config(codec);
11570 "hda_codec: Cannot set up configuration "
11571 "from BIOS. Using base mode...\n");
11572 board_config = ALC262_BASIC;
11576 if (!spec->no_analog) {
11577 err = snd_hda_attach_beep_device(codec, 0x1);
11584 if (board_config != ALC262_AUTO)
11585 setup_preset(codec, &alc262_presets[board_config]);
11587 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11588 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11590 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11591 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11593 if (!spec->adc_nids && spec->input_mux) {
11595 /* check whether the digital-mic has to be supported */
11596 for (i = 0; i < spec->input_mux->num_items; i++) {
11597 if (spec->input_mux->items[i].index >= 9)
11600 if (i < spec->input_mux->num_items) {
11601 /* use only ADC0 */
11602 spec->adc_nids = alc262_dmic_adc_nids;
11603 spec->num_adc_nids = 1;
11604 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11606 /* all analog inputs */
11607 /* check whether NID 0x07 is valid */
11608 unsigned int wcap = get_wcaps(codec, 0x07);
11611 wcap = get_wcaps_type(wcap);
11612 if (wcap != AC_WID_AUD_IN) {
11613 spec->adc_nids = alc262_adc_nids_alt;
11614 spec->num_adc_nids =
11615 ARRAY_SIZE(alc262_adc_nids_alt);
11616 spec->capsrc_nids = alc262_capsrc_nids_alt;
11618 spec->adc_nids = alc262_adc_nids;
11619 spec->num_adc_nids =
11620 ARRAY_SIZE(alc262_adc_nids);
11621 spec->capsrc_nids = alc262_capsrc_nids;
11625 if (!spec->cap_mixer && !spec->no_analog)
11626 set_capture_mixer(codec);
11627 if (!spec->no_analog)
11628 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11630 spec->vmaster_nid = 0x0c;
11632 codec->patch_ops = alc_patch_ops;
11633 if (board_config == ALC262_AUTO)
11634 spec->init_hook = alc262_auto_init;
11635 #ifdef CONFIG_SND_HDA_POWER_SAVE
11636 if (!spec->loopback.amplist)
11637 spec->loopback.amplist = alc262_loopbacks;
11639 codec->proc_widget_hook = print_realtek_coef;
11645 * ALC268 channel source setting (2 channel)
11647 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11648 #define alc268_modes alc260_modes
11650 static hda_nid_t alc268_dac_nids[2] = {
11655 static hda_nid_t alc268_adc_nids[2] = {
11660 static hda_nid_t alc268_adc_nids_alt[1] = {
11665 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11667 static struct snd_kcontrol_new alc268_base_mixer[] = {
11668 /* output mixer control */
11669 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11670 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11671 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11672 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11673 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11674 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11675 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11679 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11680 /* output mixer control */
11681 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11682 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11683 ALC262_HIPPO_MASTER_SWITCH,
11684 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11685 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11686 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11690 /* bind Beep switches of both NID 0x0f and 0x10 */
11691 static struct hda_bind_ctls alc268_bind_beep_sw = {
11692 .ops = &snd_hda_bind_sw,
11694 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11695 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11700 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11701 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11702 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11706 static struct hda_verb alc268_eapd_verbs[] = {
11707 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11708 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11712 /* Toshiba specific */
11713 static struct hda_verb alc268_toshiba_verbs[] = {
11714 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11718 /* Acer specific */
11719 /* bind volumes of both NID 0x02 and 0x03 */
11720 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11721 .ops = &snd_hda_bind_vol,
11723 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11724 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11729 /* mute/unmute internal speaker according to the hp jack and mute state */
11730 static void alc268_acer_automute(struct hda_codec *codec, int force)
11732 struct alc_spec *spec = codec->spec;
11735 if (force || !spec->sense_updated) {
11736 unsigned int present;
11737 present = snd_hda_codec_read(codec, 0x14, 0,
11738 AC_VERB_GET_PIN_SENSE, 0);
11739 spec->jack_present = (present & 0x80000000) != 0;
11740 spec->sense_updated = 1;
11742 if (spec->jack_present)
11743 mute = HDA_AMP_MUTE; /* mute internal speaker */
11744 else /* unmute internal speaker if necessary */
11745 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11746 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11747 HDA_AMP_MUTE, mute);
11751 /* bind hp and internal speaker mute (with plug check) */
11752 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11753 struct snd_ctl_elem_value *ucontrol)
11755 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11756 long *valp = ucontrol->value.integer.value;
11759 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11761 alc268_acer_automute(codec, 0);
11765 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11766 /* output mixer control */
11767 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11769 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11770 .name = "Master Playback Switch",
11771 .info = snd_hda_mixer_amp_switch_info,
11772 .get = snd_hda_mixer_amp_switch_get,
11773 .put = alc268_acer_master_sw_put,
11774 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11776 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11780 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11781 /* output mixer control */
11782 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11784 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11785 .name = "Master Playback Switch",
11786 .info = snd_hda_mixer_amp_switch_info,
11787 .get = snd_hda_mixer_amp_switch_get,
11788 .put = alc268_acer_master_sw_put,
11789 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11791 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11792 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11793 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11797 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11798 /* output mixer control */
11799 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11801 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11802 .name = "Master Playback Switch",
11803 .info = snd_hda_mixer_amp_switch_info,
11804 .get = snd_hda_mixer_amp_switch_get,
11805 .put = alc268_acer_master_sw_put,
11806 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11808 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11809 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11813 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11814 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11815 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11816 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11817 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11818 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11819 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11823 static struct hda_verb alc268_acer_verbs[] = {
11824 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11825 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11826 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11827 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11828 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11829 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11830 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11834 /* unsolicited event for HP jack sensing */
11835 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11836 #define alc268_toshiba_setup alc262_hippo_setup
11837 #define alc268_toshiba_automute alc262_hippo_automute
11839 static void alc268_acer_unsol_event(struct hda_codec *codec,
11842 if ((res >> 26) != ALC880_HP_EVENT)
11844 alc268_acer_automute(codec, 1);
11847 static void alc268_acer_init_hook(struct hda_codec *codec)
11849 alc268_acer_automute(codec, 1);
11852 /* toggle speaker-output according to the hp-jack state */
11853 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11855 unsigned int present;
11856 unsigned char bits;
11858 present = snd_hda_codec_read(codec, 0x15, 0,
11859 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11860 bits = present ? AMP_IN_MUTE(0) : 0;
11861 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11862 AMP_IN_MUTE(0), bits);
11863 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11864 AMP_IN_MUTE(0), bits);
11867 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11870 switch (res >> 26) {
11871 case ALC880_HP_EVENT:
11872 alc268_aspire_one_speaker_automute(codec);
11874 case ALC880_MIC_EVENT:
11875 alc_mic_automute(codec);
11880 static void alc268_acer_lc_setup(struct hda_codec *codec)
11882 struct alc_spec *spec = codec->spec;
11883 spec->ext_mic.pin = 0x18;
11884 spec->ext_mic.mux_idx = 0;
11885 spec->int_mic.pin = 0x12;
11886 spec->int_mic.mux_idx = 6;
11887 spec->auto_mic = 1;
11890 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11892 alc268_aspire_one_speaker_automute(codec);
11893 alc_mic_automute(codec);
11896 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11897 /* output mixer control */
11898 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11899 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11900 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11901 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11902 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11903 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11907 static struct hda_verb alc268_dell_verbs[] = {
11908 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11909 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11910 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11911 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11915 /* mute/unmute internal speaker according to the hp jack and mute state */
11916 static void alc268_dell_setup(struct hda_codec *codec)
11918 struct alc_spec *spec = codec->spec;
11920 spec->autocfg.hp_pins[0] = 0x15;
11921 spec->autocfg.speaker_pins[0] = 0x14;
11922 spec->ext_mic.pin = 0x18;
11923 spec->ext_mic.mux_idx = 0;
11924 spec->int_mic.pin = 0x19;
11925 spec->int_mic.mux_idx = 1;
11926 spec->auto_mic = 1;
11929 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11930 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11931 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11932 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11933 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11934 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11935 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11936 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11937 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11941 static struct hda_verb alc267_quanta_il1_verbs[] = {
11942 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11943 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11947 static void alc267_quanta_il1_setup(struct hda_codec *codec)
11949 struct alc_spec *spec = codec->spec;
11950 spec->autocfg.hp_pins[0] = 0x15;
11951 spec->autocfg.speaker_pins[0] = 0x14;
11952 spec->ext_mic.pin = 0x18;
11953 spec->ext_mic.mux_idx = 0;
11954 spec->int_mic.pin = 0x19;
11955 spec->int_mic.mux_idx = 1;
11956 spec->auto_mic = 1;
11960 * generic initialization of ADC, input mixers and output mixers
11962 static struct hda_verb alc268_base_init_verbs[] = {
11963 /* Unmute DAC0-1 and set vol = 0 */
11964 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11965 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11968 * Set up output mixers (0x0c - 0x0e)
11970 /* set vol=0 to output mixers */
11971 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11972 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11974 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11975 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11977 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11978 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11979 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11980 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11981 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11982 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11983 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11984 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11986 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11987 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11988 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11989 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11990 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11992 /* set PCBEEP vol = 0, mute connections */
11993 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11994 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11995 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11997 /* Unmute Selector 23h,24h and set the default input to mic-in */
11999 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12000 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12001 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12002 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12008 * generic initialization of ADC, input mixers and output mixers
12010 static struct hda_verb alc268_volume_init_verbs[] = {
12011 /* set output DAC */
12012 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12013 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12015 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12016 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12017 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12018 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12019 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12021 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12022 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12023 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12025 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12026 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12028 /* set PCBEEP vol = 0, mute connections */
12029 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12030 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12031 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12036 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12037 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12038 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12042 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12043 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12044 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12049 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12050 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12051 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12052 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12053 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12058 static struct hda_input_mux alc268_capture_source = {
12062 { "Front Mic", 0x1 },
12068 static struct hda_input_mux alc268_acer_capture_source = {
12072 { "Internal Mic", 0x1 },
12077 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12081 { "Internal Mic", 0x6 },
12086 #ifdef CONFIG_SND_DEBUG
12087 static struct snd_kcontrol_new alc268_test_mixer[] = {
12088 /* Volume widgets */
12089 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12090 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12091 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12092 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12093 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12094 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12095 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12096 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12097 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12098 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12099 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12100 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12101 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12102 /* The below appears problematic on some hardwares */
12103 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12104 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12105 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12106 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12107 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12109 /* Modes for retasking pin widgets */
12110 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12111 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12112 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12113 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12115 /* Controls for GPIO pins, assuming they are configured as outputs */
12116 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12117 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12118 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12119 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12121 /* Switches to allow the digital SPDIF output pin to be enabled.
12122 * The ALC268 does not have an SPDIF input.
12124 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12126 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12127 * this output to turn on an external amplifier.
12129 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12130 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12136 /* create input playback/capture controls for the given pin */
12137 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12138 const char *ctlname, int idx)
12144 sprintf(name, "%s Playback Volume", ctlname);
12156 if (spec->multiout.dac_nids[0] != dac &&
12157 spec->multiout.dac_nids[1] != dac) {
12158 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12159 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12163 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12166 sprintf(name, "%s Playback Switch", ctlname);
12168 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12169 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12171 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12172 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12178 /* add playback controls from the parsed DAC table */
12179 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12180 const struct auto_pin_cfg *cfg)
12185 spec->multiout.dac_nids = spec->private_dac_nids;
12187 nid = cfg->line_out_pins[0];
12190 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12194 err = alc268_new_analog_output(spec, nid, name, 0);
12199 nid = cfg->speaker_pins[0];
12201 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12202 "Speaker Playback Volume",
12203 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12207 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12211 nid = cfg->hp_pins[0];
12213 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12218 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12220 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12221 "Mono Playback Switch",
12222 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12229 /* create playback/capture controls for input pins */
12230 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12231 const struct auto_pin_cfg *cfg)
12233 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12236 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12238 struct alc_spec *spec = codec->spec;
12239 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12240 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12241 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12242 unsigned int dac_vol1, dac_vol2;
12245 snd_hda_codec_write(codec, speaker_nid, 0,
12246 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12247 snd_hda_codec_write(codec, 0x0f, 0,
12248 AC_VERB_SET_AMP_GAIN_MUTE,
12250 snd_hda_codec_write(codec, 0x10, 0,
12251 AC_VERB_SET_AMP_GAIN_MUTE,
12254 snd_hda_codec_write(codec, 0x0f, 0,
12255 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12256 snd_hda_codec_write(codec, 0x10, 0,
12257 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12260 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12261 if (line_nid == 0x14)
12262 dac_vol2 = AMP_OUT_ZERO;
12263 else if (line_nid == 0x15)
12264 dac_vol1 = AMP_OUT_ZERO;
12265 if (hp_nid == 0x14)
12266 dac_vol2 = AMP_OUT_ZERO;
12267 else if (hp_nid == 0x15)
12268 dac_vol1 = AMP_OUT_ZERO;
12269 if (line_nid != 0x16 || hp_nid != 0x16 ||
12270 spec->autocfg.line_out_pins[1] != 0x16 ||
12271 spec->autocfg.line_out_pins[2] != 0x16)
12272 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12274 snd_hda_codec_write(codec, 0x02, 0,
12275 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12276 snd_hda_codec_write(codec, 0x03, 0,
12277 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12280 /* pcm configuration: identical with ALC880 */
12281 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12282 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12283 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12284 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12287 * BIOS auto configuration
12289 static int alc268_parse_auto_config(struct hda_codec *codec)
12291 struct alc_spec *spec = codec->spec;
12293 static hda_nid_t alc268_ignore[] = { 0 };
12295 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12299 if (!spec->autocfg.line_outs) {
12300 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12301 spec->multiout.max_channels = 2;
12302 spec->no_analog = 1;
12305 return 0; /* can't find valid BIOS pin config */
12307 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12310 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12314 spec->multiout.max_channels = 2;
12317 /* digital only support output */
12318 if (spec->autocfg.dig_outs) {
12319 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12320 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12322 if (spec->kctls.list)
12323 add_mixer(spec, spec->kctls.list);
12325 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12326 add_mixer(spec, alc268_beep_mixer);
12328 add_verb(spec, alc268_volume_init_verbs);
12329 spec->num_mux_defs = 2;
12330 spec->input_mux = &spec->private_imux[0];
12332 err = alc_auto_add_mic_boost(codec);
12336 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12341 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12342 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12343 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12345 /* init callback for auto-configuration model -- overriding the default init */
12346 static void alc268_auto_init(struct hda_codec *codec)
12348 struct alc_spec *spec = codec->spec;
12349 alc268_auto_init_multi_out(codec);
12350 alc268_auto_init_hp_out(codec);
12351 alc268_auto_init_mono_speaker_out(codec);
12352 alc268_auto_init_analog_input(codec);
12353 if (spec->unsol_event)
12354 alc_inithook(codec);
12358 * configuration and preset
12360 static const char *alc268_models[ALC268_MODEL_LAST] = {
12361 [ALC267_QUANTA_IL1] = "quanta-il1",
12362 [ALC268_3ST] = "3stack",
12363 [ALC268_TOSHIBA] = "toshiba",
12364 [ALC268_ACER] = "acer",
12365 [ALC268_ACER_DMIC] = "acer-dmic",
12366 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12367 [ALC268_DELL] = "dell",
12368 [ALC268_ZEPTO] = "zepto",
12369 #ifdef CONFIG_SND_DEBUG
12370 [ALC268_TEST] = "test",
12372 [ALC268_AUTO] = "auto",
12375 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12376 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12377 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12378 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12379 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12380 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12381 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12382 ALC268_ACER_ASPIRE_ONE),
12383 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12384 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12385 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12387 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12388 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12389 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12390 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12391 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12392 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12396 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12397 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12398 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12399 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12400 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12405 static struct alc_config_preset alc268_presets[] = {
12406 [ALC267_QUANTA_IL1] = {
12407 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12408 alc268_capture_nosrc_mixer },
12409 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12410 alc267_quanta_il1_verbs },
12411 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12412 .dac_nids = alc268_dac_nids,
12413 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12414 .adc_nids = alc268_adc_nids_alt,
12416 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12417 .channel_mode = alc268_modes,
12418 .unsol_event = alc_sku_unsol_event,
12419 .setup = alc267_quanta_il1_setup,
12420 .init_hook = alc_inithook,
12423 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12424 alc268_beep_mixer },
12425 .init_verbs = { alc268_base_init_verbs },
12426 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12427 .dac_nids = alc268_dac_nids,
12428 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12429 .adc_nids = alc268_adc_nids_alt,
12430 .capsrc_nids = alc268_capsrc_nids,
12432 .dig_out_nid = ALC268_DIGOUT_NID,
12433 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12434 .channel_mode = alc268_modes,
12435 .input_mux = &alc268_capture_source,
12437 [ALC268_TOSHIBA] = {
12438 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12439 alc268_beep_mixer },
12440 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12441 alc268_toshiba_verbs },
12442 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12443 .dac_nids = alc268_dac_nids,
12444 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12445 .adc_nids = alc268_adc_nids_alt,
12446 .capsrc_nids = alc268_capsrc_nids,
12448 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12449 .channel_mode = alc268_modes,
12450 .input_mux = &alc268_capture_source,
12451 .unsol_event = alc268_toshiba_unsol_event,
12452 .setup = alc268_toshiba_setup,
12453 .init_hook = alc268_toshiba_automute,
12456 .mixers = { alc268_acer_mixer, alc268_capture_nosrc_mixer,
12457 alc268_beep_mixer },
12458 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12459 alc268_acer_verbs },
12460 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12461 .dac_nids = alc268_dac_nids,
12462 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12463 .adc_nids = alc268_adc_nids_alt,
12464 .capsrc_nids = alc268_capsrc_nids,
12466 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12467 .channel_mode = alc268_modes,
12468 .input_mux = &alc268_acer_capture_source,
12469 .unsol_event = alc268_acer_unsol_event,
12470 .init_hook = alc268_acer_init_hook,
12472 [ALC268_ACER_DMIC] = {
12473 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12474 alc268_beep_mixer },
12475 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12476 alc268_acer_verbs },
12477 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12478 .dac_nids = alc268_dac_nids,
12479 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12480 .adc_nids = alc268_adc_nids_alt,
12481 .capsrc_nids = alc268_capsrc_nids,
12483 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12484 .channel_mode = alc268_modes,
12485 .input_mux = &alc268_acer_dmic_capture_source,
12486 .unsol_event = alc268_acer_unsol_event,
12487 .init_hook = alc268_acer_init_hook,
12489 [ALC268_ACER_ASPIRE_ONE] = {
12490 .mixers = { alc268_acer_aspire_one_mixer,
12492 alc268_capture_nosrc_mixer },
12493 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12494 alc268_acer_aspire_one_verbs },
12495 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12496 .dac_nids = alc268_dac_nids,
12497 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12498 .adc_nids = alc268_adc_nids_alt,
12499 .capsrc_nids = alc268_capsrc_nids,
12501 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12502 .channel_mode = alc268_modes,
12503 .unsol_event = alc268_acer_lc_unsol_event,
12504 .setup = alc268_acer_lc_setup,
12505 .init_hook = alc268_acer_lc_init_hook,
12508 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12509 alc268_capture_nosrc_mixer },
12510 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12511 alc268_dell_verbs },
12512 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12513 .dac_nids = alc268_dac_nids,
12514 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12515 .adc_nids = alc268_adc_nids_alt,
12516 .capsrc_nids = alc268_capsrc_nids,
12518 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12519 .channel_mode = alc268_modes,
12520 .unsol_event = alc_sku_unsol_event,
12521 .setup = alc268_dell_setup,
12522 .init_hook = alc_inithook,
12525 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12526 alc268_beep_mixer },
12527 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12528 alc268_toshiba_verbs },
12529 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12530 .dac_nids = alc268_dac_nids,
12531 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12532 .adc_nids = alc268_adc_nids_alt,
12533 .capsrc_nids = alc268_capsrc_nids,
12535 .dig_out_nid = ALC268_DIGOUT_NID,
12536 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12537 .channel_mode = alc268_modes,
12538 .input_mux = &alc268_capture_source,
12539 .setup = alc268_toshiba_setup,
12540 .init_hook = alc268_toshiba_automute,
12542 #ifdef CONFIG_SND_DEBUG
12544 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12545 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12546 alc268_volume_init_verbs },
12547 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12548 .dac_nids = alc268_dac_nids,
12549 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12550 .adc_nids = alc268_adc_nids_alt,
12551 .capsrc_nids = alc268_capsrc_nids,
12553 .dig_out_nid = ALC268_DIGOUT_NID,
12554 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12555 .channel_mode = alc268_modes,
12556 .input_mux = &alc268_capture_source,
12561 static int patch_alc268(struct hda_codec *codec)
12563 struct alc_spec *spec;
12565 int i, has_beep, err;
12567 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12571 codec->spec = spec;
12573 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12577 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12578 board_config = snd_hda_check_board_codec_sid_config(codec,
12579 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12581 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12582 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12584 board_config = ALC268_AUTO;
12587 if (board_config == ALC268_AUTO) {
12588 /* automatic parse from the BIOS config */
12589 err = alc268_parse_auto_config(codec);
12595 "hda_codec: Cannot set up configuration "
12596 "from BIOS. Using base mode...\n");
12597 board_config = ALC268_3ST;
12601 if (board_config != ALC268_AUTO)
12602 setup_preset(codec, &alc268_presets[board_config]);
12604 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12605 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12606 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12608 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12611 for (i = 0; i < spec->num_mixers; i++) {
12612 if (spec->mixers[i] == alc268_beep_mixer) {
12619 err = snd_hda_attach_beep_device(codec, 0x1);
12624 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12625 /* override the amp caps for beep generator */
12626 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12627 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12628 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12629 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12630 (0 << AC_AMPCAP_MUTE_SHIFT));
12633 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12634 /* check whether NID 0x07 is valid */
12635 unsigned int wcap = get_wcaps(codec, 0x07);
12639 wcap = get_wcaps_type(wcap);
12640 if (spec->auto_mic ||
12641 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12642 spec->adc_nids = alc268_adc_nids_alt;
12643 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12644 if (spec->auto_mic || spec->input_mux->num_items == 1)
12645 add_mixer(spec, alc268_capture_nosrc_mixer);
12647 add_mixer(spec, alc268_capture_alt_mixer);
12649 spec->adc_nids = alc268_adc_nids;
12650 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12651 add_mixer(spec, alc268_capture_mixer);
12653 spec->capsrc_nids = alc268_capsrc_nids;
12654 /* set default input source */
12655 for (i = 0; i < spec->num_adc_nids; i++)
12656 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12657 0, AC_VERB_SET_CONNECT_SEL,
12658 i < spec->num_mux_defs ?
12659 spec->input_mux[i].items[0].index :
12660 spec->input_mux->items[0].index);
12663 spec->vmaster_nid = 0x02;
12665 codec->patch_ops = alc_patch_ops;
12666 if (board_config == ALC268_AUTO)
12667 spec->init_hook = alc268_auto_init;
12669 codec->proc_widget_hook = print_realtek_coef;
12675 * ALC269 channel source setting (2 channel)
12677 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12679 #define alc269_dac_nids alc260_dac_nids
12681 static hda_nid_t alc269_adc_nids[1] = {
12686 static hda_nid_t alc269_capsrc_nids[1] = {
12690 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12694 #define alc269_modes alc260_modes
12695 #define alc269_capture_source alc880_lg_lw_capture_source
12697 static struct snd_kcontrol_new alc269_base_mixer[] = {
12698 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12699 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12700 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12701 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12702 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12703 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12704 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12705 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12706 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12707 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12708 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12709 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12713 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12714 /* output mixer control */
12715 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12717 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12718 .name = "Master Playback Switch",
12719 .info = snd_hda_mixer_amp_switch_info,
12720 .get = snd_hda_mixer_amp_switch_get,
12721 .put = alc268_acer_master_sw_put,
12722 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12724 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12725 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12726 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12727 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12728 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12729 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12733 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12734 /* output mixer control */
12735 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12737 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12738 .name = "Master Playback Switch",
12739 .info = snd_hda_mixer_amp_switch_info,
12740 .get = snd_hda_mixer_amp_switch_get,
12741 .put = alc268_acer_master_sw_put,
12742 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12744 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12745 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12746 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12747 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12748 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12749 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12750 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12751 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12752 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12756 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12757 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12758 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12759 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12760 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12764 /* capture mixer elements */
12765 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12766 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12767 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12768 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12773 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12775 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12776 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12777 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12778 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12779 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12780 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12781 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12785 static struct hda_verb alc269_lifebook_verbs[] = {
12786 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12787 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12788 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12789 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12790 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12791 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12792 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12793 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12794 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12795 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12799 /* toggle speaker-output according to the hp-jack state */
12800 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12802 unsigned int present;
12803 unsigned char bits;
12805 present = snd_hda_codec_read(codec, 0x15, 0,
12806 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12807 bits = present ? AMP_IN_MUTE(0) : 0;
12808 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12809 AMP_IN_MUTE(0), bits);
12810 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12811 AMP_IN_MUTE(0), bits);
12813 snd_hda_codec_write(codec, 0x20, 0,
12814 AC_VERB_SET_COEF_INDEX, 0x0c);
12815 snd_hda_codec_write(codec, 0x20, 0,
12816 AC_VERB_SET_PROC_COEF, 0x680);
12818 snd_hda_codec_write(codec, 0x20, 0,
12819 AC_VERB_SET_COEF_INDEX, 0x0c);
12820 snd_hda_codec_write(codec, 0x20, 0,
12821 AC_VERB_SET_PROC_COEF, 0x480);
12824 /* toggle speaker-output according to the hp-jacks state */
12825 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12827 unsigned int present;
12828 unsigned char bits;
12830 /* Check laptop headphone socket */
12831 present = snd_hda_codec_read(codec, 0x15, 0,
12832 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12834 /* Check port replicator headphone socket */
12835 present |= snd_hda_codec_read(codec, 0x1a, 0,
12836 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12838 bits = present ? AMP_IN_MUTE(0) : 0;
12839 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12840 AMP_IN_MUTE(0), bits);
12841 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12842 AMP_IN_MUTE(0), bits);
12844 snd_hda_codec_write(codec, 0x20, 0,
12845 AC_VERB_SET_COEF_INDEX, 0x0c);
12846 snd_hda_codec_write(codec, 0x20, 0,
12847 AC_VERB_SET_PROC_COEF, 0x680);
12849 snd_hda_codec_write(codec, 0x20, 0,
12850 AC_VERB_SET_COEF_INDEX, 0x0c);
12851 snd_hda_codec_write(codec, 0x20, 0,
12852 AC_VERB_SET_PROC_COEF, 0x480);
12855 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12857 unsigned int present_laptop;
12858 unsigned int present_dock;
12860 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12861 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12863 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12864 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12866 /* Laptop mic port overrides dock mic port, design decision */
12868 snd_hda_codec_write(codec, 0x23, 0,
12869 AC_VERB_SET_CONNECT_SEL, 0x3);
12870 if (present_laptop)
12871 snd_hda_codec_write(codec, 0x23, 0,
12872 AC_VERB_SET_CONNECT_SEL, 0x0);
12873 if (!present_dock && !present_laptop)
12874 snd_hda_codec_write(codec, 0x23, 0,
12875 AC_VERB_SET_CONNECT_SEL, 0x1);
12878 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12881 switch (res >> 26) {
12882 case ALC880_HP_EVENT:
12883 alc269_quanta_fl1_speaker_automute(codec);
12885 case ALC880_MIC_EVENT:
12886 alc_mic_automute(codec);
12891 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12894 if ((res >> 26) == ALC880_HP_EVENT)
12895 alc269_lifebook_speaker_automute(codec);
12896 if ((res >> 26) == ALC880_MIC_EVENT)
12897 alc269_lifebook_mic_autoswitch(codec);
12900 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
12902 struct alc_spec *spec = codec->spec;
12903 spec->ext_mic.pin = 0x18;
12904 spec->ext_mic.mux_idx = 0;
12905 spec->int_mic.pin = 0x19;
12906 spec->int_mic.mux_idx = 1;
12907 spec->auto_mic = 1;
12910 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12912 alc269_quanta_fl1_speaker_automute(codec);
12913 alc_mic_automute(codec);
12916 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12918 alc269_lifebook_speaker_automute(codec);
12919 alc269_lifebook_mic_autoswitch(codec);
12922 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12923 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12924 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12925 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12926 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12927 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12928 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12929 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12933 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12934 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12935 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12936 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12937 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12938 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12939 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12943 /* toggle speaker-output according to the hp-jack state */
12944 static void alc269_speaker_automute(struct hda_codec *codec)
12946 unsigned int present;
12947 unsigned char bits;
12949 present = snd_hda_codec_read(codec, 0x15, 0,
12950 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12951 bits = present ? AMP_IN_MUTE(0) : 0;
12952 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12953 AMP_IN_MUTE(0), bits);
12954 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12955 AMP_IN_MUTE(0), bits);
12958 /* unsolicited event for HP jack sensing */
12959 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
12962 switch (res >> 26) {
12963 case ALC880_HP_EVENT:
12964 alc269_speaker_automute(codec);
12966 case ALC880_MIC_EVENT:
12967 alc_mic_automute(codec);
12972 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
12974 struct alc_spec *spec = codec->spec;
12975 spec->ext_mic.pin = 0x18;
12976 spec->ext_mic.mux_idx = 0;
12977 spec->int_mic.pin = 0x12;
12978 spec->int_mic.mux_idx = 5;
12979 spec->auto_mic = 1;
12982 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
12984 struct alc_spec *spec = codec->spec;
12985 spec->ext_mic.pin = 0x18;
12986 spec->ext_mic.mux_idx = 0;
12987 spec->int_mic.pin = 0x19;
12988 spec->int_mic.mux_idx = 1;
12989 spec->auto_mic = 1;
12992 static void alc269_eeepc_inithook(struct hda_codec *codec)
12994 alc269_speaker_automute(codec);
12995 alc_mic_automute(codec);
12999 * generic initialization of ADC, input mixers and output mixers
13001 static struct hda_verb alc269_init_verbs[] = {
13003 * Unmute ADC0 and set the default input to mic-in
13005 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13007 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13008 * analog-loopback mixer widget
13009 * Note: PASD motherboards uses the Line In 2 as the input for
13010 * front panel mic (mic 2)
13012 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13013 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13014 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13015 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13016 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13017 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13020 * Set up output mixers (0x0c - 0x0e)
13022 /* set vol=0 to output mixers */
13023 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13024 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13026 /* set up input amps for analog loopback */
13027 /* Amp Indices: DAC = 0, mixer = 1 */
13028 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13029 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13030 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13031 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13032 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13033 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13035 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13036 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13037 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13038 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13039 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13040 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13041 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13043 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13044 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13045 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13046 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13047 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13048 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13049 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13051 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13052 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13054 /* FIXME: use matrix-type input source selection */
13055 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13056 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13057 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13058 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13059 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13060 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13063 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13064 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13068 #define alc269_auto_create_multi_out_ctls \
13069 alc268_auto_create_multi_out_ctls
13070 #define alc269_auto_create_input_ctls \
13071 alc268_auto_create_input_ctls
13073 #ifdef CONFIG_SND_HDA_POWER_SAVE
13074 #define alc269_loopbacks alc880_loopbacks
13077 /* pcm configuration: identical with ALC880 */
13078 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13079 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13080 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13081 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13083 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13087 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13088 /* NID is set in alc_build_pcms */
13090 .open = alc880_playback_pcm_open,
13091 .prepare = alc880_playback_pcm_prepare,
13092 .cleanup = alc880_playback_pcm_cleanup
13096 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13100 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13101 /* NID is set in alc_build_pcms */
13105 * BIOS auto configuration
13107 static int alc269_parse_auto_config(struct hda_codec *codec)
13109 struct alc_spec *spec = codec->spec;
13111 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13113 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13118 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13121 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13125 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13127 if (spec->autocfg.dig_outs)
13128 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13130 if (spec->kctls.list)
13131 add_mixer(spec, spec->kctls.list);
13133 add_verb(spec, alc269_init_verbs);
13134 spec->num_mux_defs = 1;
13135 spec->input_mux = &spec->private_imux[0];
13136 /* set default input source */
13137 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13138 0, AC_VERB_SET_CONNECT_SEL,
13139 spec->input_mux->items[0].index);
13141 err = alc_auto_add_mic_boost(codec);
13145 if (!spec->cap_mixer && !spec->no_analog)
13146 set_capture_mixer(codec);
13148 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13153 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13154 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13155 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13158 /* init callback for auto-configuration model -- overriding the default init */
13159 static void alc269_auto_init(struct hda_codec *codec)
13161 struct alc_spec *spec = codec->spec;
13162 alc269_auto_init_multi_out(codec);
13163 alc269_auto_init_hp_out(codec);
13164 alc269_auto_init_analog_input(codec);
13165 if (spec->unsol_event)
13166 alc_inithook(codec);
13170 * configuration and preset
13172 static const char *alc269_models[ALC269_MODEL_LAST] = {
13173 [ALC269_BASIC] = "basic",
13174 [ALC269_QUANTA_FL1] = "quanta",
13175 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13176 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13177 [ALC269_FUJITSU] = "fujitsu",
13178 [ALC269_LIFEBOOK] = "lifebook"
13181 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13182 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13183 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13184 ALC269_ASUS_EEEPC_P703),
13185 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13186 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13187 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13188 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13189 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13190 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13191 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13192 ALC269_ASUS_EEEPC_P901),
13193 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13194 ALC269_ASUS_EEEPC_P901),
13195 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13196 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13197 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13201 static struct alc_config_preset alc269_presets[] = {
13203 .mixers = { alc269_base_mixer },
13204 .init_verbs = { alc269_init_verbs },
13205 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13206 .dac_nids = alc269_dac_nids,
13208 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13209 .channel_mode = alc269_modes,
13210 .input_mux = &alc269_capture_source,
13212 [ALC269_QUANTA_FL1] = {
13213 .mixers = { alc269_quanta_fl1_mixer },
13214 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13215 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13216 .dac_nids = alc269_dac_nids,
13218 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13219 .channel_mode = alc269_modes,
13220 .input_mux = &alc269_capture_source,
13221 .unsol_event = alc269_quanta_fl1_unsol_event,
13222 .setup = alc269_quanta_fl1_setup,
13223 .init_hook = alc269_quanta_fl1_init_hook,
13225 [ALC269_ASUS_EEEPC_P703] = {
13226 .mixers = { alc269_eeepc_mixer },
13227 .cap_mixer = alc269_epc_capture_mixer,
13228 .init_verbs = { alc269_init_verbs,
13229 alc269_eeepc_amic_init_verbs },
13230 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13231 .dac_nids = alc269_dac_nids,
13233 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13234 .channel_mode = alc269_modes,
13235 .unsol_event = alc269_eeepc_unsol_event,
13236 .setup = alc269_eeepc_amic_setup,
13237 .init_hook = alc269_eeepc_inithook,
13239 [ALC269_ASUS_EEEPC_P901] = {
13240 .mixers = { alc269_eeepc_mixer },
13241 .cap_mixer = alc269_epc_capture_mixer,
13242 .init_verbs = { alc269_init_verbs,
13243 alc269_eeepc_dmic_init_verbs },
13244 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13245 .dac_nids = alc269_dac_nids,
13247 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13248 .channel_mode = alc269_modes,
13249 .unsol_event = alc269_eeepc_unsol_event,
13250 .setup = alc269_eeepc_dmic_setup,
13251 .init_hook = alc269_eeepc_inithook,
13253 [ALC269_FUJITSU] = {
13254 .mixers = { alc269_fujitsu_mixer },
13255 .cap_mixer = alc269_epc_capture_mixer,
13256 .init_verbs = { alc269_init_verbs,
13257 alc269_eeepc_dmic_init_verbs },
13258 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13259 .dac_nids = alc269_dac_nids,
13261 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13262 .channel_mode = alc269_modes,
13263 .unsol_event = alc269_eeepc_unsol_event,
13264 .setup = alc269_eeepc_dmic_setup,
13265 .init_hook = alc269_eeepc_inithook,
13267 [ALC269_LIFEBOOK] = {
13268 .mixers = { alc269_lifebook_mixer },
13269 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13270 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13271 .dac_nids = alc269_dac_nids,
13273 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13274 .channel_mode = alc269_modes,
13275 .input_mux = &alc269_capture_source,
13276 .unsol_event = alc269_lifebook_unsol_event,
13277 .init_hook = alc269_lifebook_init_hook,
13281 static int patch_alc269(struct hda_codec *codec)
13283 struct alc_spec *spec;
13287 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13291 codec->spec = spec;
13293 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13295 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13299 if (board_config < 0) {
13300 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13302 board_config = ALC269_AUTO;
13305 if (board_config == ALC269_AUTO) {
13306 /* automatic parse from the BIOS config */
13307 err = alc269_parse_auto_config(codec);
13313 "hda_codec: Cannot set up configuration "
13314 "from BIOS. Using base mode...\n");
13315 board_config = ALC269_BASIC;
13319 err = snd_hda_attach_beep_device(codec, 0x1);
13325 if (board_config != ALC269_AUTO)
13326 setup_preset(codec, &alc269_presets[board_config]);
13328 if (codec->subsystem_id == 0x17aa3bf8) {
13329 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13330 * fix the sample rate of analog I/O to 44.1kHz
13332 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13333 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13335 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13336 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13338 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13339 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13341 spec->adc_nids = alc269_adc_nids;
13342 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13343 spec->capsrc_nids = alc269_capsrc_nids;
13344 if (!spec->cap_mixer)
13345 set_capture_mixer(codec);
13346 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13348 spec->vmaster_nid = 0x02;
13350 codec->patch_ops = alc_patch_ops;
13351 if (board_config == ALC269_AUTO)
13352 spec->init_hook = alc269_auto_init;
13353 #ifdef CONFIG_SND_HDA_POWER_SAVE
13354 if (!spec->loopback.amplist)
13355 spec->loopback.amplist = alc269_loopbacks;
13357 codec->proc_widget_hook = print_realtek_coef;
13363 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13367 * set the path ways for 2 channel output
13368 * need to set the codec line out and mic 1 pin widgets to inputs
13370 static struct hda_verb alc861_threestack_ch2_init[] = {
13371 /* set pin widget 1Ah (line in) for input */
13372 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13373 /* set pin widget 18h (mic1/2) for input, for mic also enable
13376 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13378 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13380 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13381 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13387 * need to set the codec line out and mic 1 pin widgets to outputs
13389 static struct hda_verb alc861_threestack_ch6_init[] = {
13390 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13391 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13392 /* set pin widget 18h (mic1) for output (CLFE)*/
13393 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13395 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13396 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13398 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13400 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13401 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13406 static struct hda_channel_mode alc861_threestack_modes[2] = {
13407 { 2, alc861_threestack_ch2_init },
13408 { 6, alc861_threestack_ch6_init },
13410 /* Set mic1 as input and unmute the mixer */
13411 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13412 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13413 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13416 /* Set mic1 as output and mute mixer */
13417 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13418 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13419 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13423 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13424 { 2, alc861_uniwill_m31_ch2_init },
13425 { 4, alc861_uniwill_m31_ch4_init },
13428 /* Set mic1 and line-in as input and unmute the mixer */
13429 static struct hda_verb alc861_asus_ch2_init[] = {
13430 /* set pin widget 1Ah (line in) for input */
13431 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13432 /* set pin widget 18h (mic1/2) for input, for mic also enable
13435 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13437 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13439 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13440 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13444 /* Set mic1 nad line-in as output and mute mixer */
13445 static struct hda_verb alc861_asus_ch6_init[] = {
13446 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13447 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13448 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13449 /* set pin widget 18h (mic1) for output (CLFE)*/
13450 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13451 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13452 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13453 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13455 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13457 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13458 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13463 static struct hda_channel_mode alc861_asus_modes[2] = {
13464 { 2, alc861_asus_ch2_init },
13465 { 6, alc861_asus_ch6_init },
13470 static struct snd_kcontrol_new alc861_base_mixer[] = {
13471 /* output mixer control */
13472 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13473 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13474 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13475 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13476 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13478 /*Input mixer control */
13479 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13480 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13481 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13482 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13483 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13484 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13485 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13486 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13487 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13488 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13493 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13494 /* output mixer control */
13495 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13496 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13497 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13498 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13499 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13501 /* Input mixer control */
13502 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13503 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13504 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13505 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13506 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13507 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13508 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13509 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13510 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13511 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13514 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13515 .name = "Channel Mode",
13516 .info = alc_ch_mode_info,
13517 .get = alc_ch_mode_get,
13518 .put = alc_ch_mode_put,
13519 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13524 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13525 /* output mixer control */
13526 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13527 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13528 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13533 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13534 /* output mixer control */
13535 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13536 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13537 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13538 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13539 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13541 /* Input mixer control */
13542 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13543 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13544 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13545 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13546 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13547 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13548 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13549 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13550 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13551 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13554 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13555 .name = "Channel Mode",
13556 .info = alc_ch_mode_info,
13557 .get = alc_ch_mode_get,
13558 .put = alc_ch_mode_put,
13559 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13564 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13565 /* output mixer control */
13566 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13567 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13568 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13569 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13570 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13572 /* Input mixer control */
13573 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13574 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13575 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13576 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13577 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13578 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13579 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13580 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13581 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13582 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13585 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13586 .name = "Channel Mode",
13587 .info = alc_ch_mode_info,
13588 .get = alc_ch_mode_get,
13589 .put = alc_ch_mode_put,
13590 .private_value = ARRAY_SIZE(alc861_asus_modes),
13595 /* additional mixer */
13596 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13597 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13598 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13603 * generic initialization of ADC, input mixers and output mixers
13605 static struct hda_verb alc861_base_init_verbs[] = {
13607 * Unmute ADC0 and set the default input to mic-in
13609 /* port-A for surround (rear panel) */
13610 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13611 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13612 /* port-B for mic-in (rear panel) with vref */
13613 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13614 /* port-C for line-in (rear panel) */
13615 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13616 /* port-D for Front */
13617 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13618 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13619 /* port-E for HP out (front panel) */
13620 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13621 /* route front PCM to HP */
13622 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13623 /* port-F for mic-in (front panel) with vref */
13624 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13625 /* port-G for CLFE (rear panel) */
13626 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13627 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13628 /* port-H for side (rear panel) */
13629 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13630 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13632 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13633 /* route front mic to ADC1*/
13634 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13635 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13637 /* Unmute DAC0~3 & spdif out*/
13638 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13639 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13640 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13641 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13642 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13644 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13645 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13646 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13647 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13648 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13650 /* Unmute Stereo Mixer 15 */
13651 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13652 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13653 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13654 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13656 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13657 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13658 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13659 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13660 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13661 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13662 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13663 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13664 /* hp used DAC 3 (Front) */
13665 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13666 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13671 static struct hda_verb alc861_threestack_init_verbs[] = {
13673 * Unmute ADC0 and set the default input to mic-in
13675 /* port-A for surround (rear panel) */
13676 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13677 /* port-B for mic-in (rear panel) with vref */
13678 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13679 /* port-C for line-in (rear panel) */
13680 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13681 /* port-D for Front */
13682 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13683 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13684 /* port-E for HP out (front panel) */
13685 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13686 /* route front PCM to HP */
13687 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13688 /* port-F for mic-in (front panel) with vref */
13689 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13690 /* port-G for CLFE (rear panel) */
13691 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13692 /* port-H for side (rear panel) */
13693 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13695 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13696 /* route front mic to ADC1*/
13697 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13698 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13699 /* Unmute DAC0~3 & spdif out*/
13700 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13701 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13702 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13703 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13704 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13706 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13707 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13708 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13709 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13710 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13712 /* Unmute Stereo Mixer 15 */
13713 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13714 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13715 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13716 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13718 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13719 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13720 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13721 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13722 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13723 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13724 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13725 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13726 /* hp used DAC 3 (Front) */
13727 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13728 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13732 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13734 * Unmute ADC0 and set the default input to mic-in
13736 /* port-A for surround (rear panel) */
13737 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13738 /* port-B for mic-in (rear panel) with vref */
13739 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13740 /* port-C for line-in (rear panel) */
13741 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13742 /* port-D for Front */
13743 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13744 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13745 /* port-E for HP out (front panel) */
13746 /* this has to be set to VREF80 */
13747 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13748 /* route front PCM to HP */
13749 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13750 /* port-F for mic-in (front panel) with vref */
13751 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13752 /* port-G for CLFE (rear panel) */
13753 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13754 /* port-H for side (rear panel) */
13755 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13757 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13758 /* route front mic to ADC1*/
13759 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13760 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13761 /* Unmute DAC0~3 & spdif out*/
13762 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13763 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13764 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13765 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13766 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13768 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13769 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13770 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13771 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13772 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13774 /* Unmute Stereo Mixer 15 */
13775 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13776 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13777 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13778 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13780 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13781 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13782 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13783 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13784 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13785 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13786 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13787 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13788 /* hp used DAC 3 (Front) */
13789 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13790 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13794 static struct hda_verb alc861_asus_init_verbs[] = {
13796 * Unmute ADC0 and set the default input to mic-in
13798 /* port-A for surround (rear panel)
13799 * according to codec#0 this is the HP jack
13801 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13802 /* route front PCM to HP */
13803 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13804 /* port-B for mic-in (rear panel) with vref */
13805 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13806 /* port-C for line-in (rear panel) */
13807 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13808 /* port-D for Front */
13809 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13810 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13811 /* port-E for HP out (front panel) */
13812 /* this has to be set to VREF80 */
13813 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13814 /* route front PCM to HP */
13815 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13816 /* port-F for mic-in (front panel) with vref */
13817 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13818 /* port-G for CLFE (rear panel) */
13819 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13820 /* port-H for side (rear panel) */
13821 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13823 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13824 /* route front mic to ADC1*/
13825 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13826 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13827 /* Unmute DAC0~3 & spdif out*/
13828 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13829 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13830 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13831 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13832 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13833 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13834 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13835 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13836 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13837 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13839 /* Unmute Stereo Mixer 15 */
13840 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13841 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13842 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13843 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13845 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13846 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13847 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13848 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13849 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13850 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13851 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13852 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13853 /* hp used DAC 3 (Front) */
13854 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13855 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13859 /* additional init verbs for ASUS laptops */
13860 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13861 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13862 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13867 * generic initialization of ADC, input mixers and output mixers
13869 static struct hda_verb alc861_auto_init_verbs[] = {
13871 * Unmute ADC0 and set the default input to mic-in
13873 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13874 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13876 /* Unmute DAC0~3 & spdif out*/
13877 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13878 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13879 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13880 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13881 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13883 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13884 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13885 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13886 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13887 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13889 /* Unmute Stereo Mixer 15 */
13890 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13891 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13892 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13893 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13895 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13896 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13897 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13898 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13899 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13900 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13901 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13902 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13904 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13905 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13906 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13907 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13908 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13909 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13910 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13911 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13913 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13918 static struct hda_verb alc861_toshiba_init_verbs[] = {
13919 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13924 /* toggle speaker-output according to the hp-jack state */
13925 static void alc861_toshiba_automute(struct hda_codec *codec)
13927 unsigned int present;
13929 present = snd_hda_codec_read(codec, 0x0f, 0,
13930 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13931 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13932 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13933 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13934 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13937 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13940 if ((res >> 26) == ALC880_HP_EVENT)
13941 alc861_toshiba_automute(codec);
13944 /* pcm configuration: identical with ALC880 */
13945 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13946 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13947 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13948 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13951 #define ALC861_DIGOUT_NID 0x07
13953 static struct hda_channel_mode alc861_8ch_modes[1] = {
13957 static hda_nid_t alc861_dac_nids[4] = {
13958 /* front, surround, clfe, side */
13959 0x03, 0x06, 0x05, 0x04
13962 static hda_nid_t alc660_dac_nids[3] = {
13963 /* front, clfe, surround */
13967 static hda_nid_t alc861_adc_nids[1] = {
13972 static struct hda_input_mux alc861_capture_source = {
13976 { "Front Mic", 0x3 },
13983 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
13985 struct alc_spec *spec = codec->spec;
13986 hda_nid_t mix, srcs[5];
13989 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
13991 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
13994 for (i = 0; i < num; i++) {
13996 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
13997 if (type != AC_WID_AUD_OUT)
13999 for (j = 0; j < spec->multiout.num_dacs; j++)
14000 if (spec->multiout.dac_nids[j] == srcs[i])
14002 if (j >= spec->multiout.num_dacs)
14008 /* fill in the dac_nids table from the parsed pin configuration */
14009 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14010 const struct auto_pin_cfg *cfg)
14012 struct alc_spec *spec = codec->spec;
14014 hda_nid_t nid, dac;
14016 spec->multiout.dac_nids = spec->private_dac_nids;
14017 for (i = 0; i < cfg->line_outs; i++) {
14018 nid = cfg->line_out_pins[i];
14019 dac = alc861_look_for_dac(codec, nid);
14022 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14027 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14028 hda_nid_t nid, unsigned int chs)
14031 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
14032 return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name,
14033 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14036 /* add playback controls from the parsed DAC table */
14037 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14038 const struct auto_pin_cfg *cfg)
14040 struct alc_spec *spec = codec->spec;
14041 static const char *chname[4] = {
14042 "Front", "Surround", NULL /*CLFE*/, "Side"
14047 if (cfg->line_outs == 1) {
14048 const char *pfx = NULL;
14051 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14054 nid = spec->multiout.dac_nids[0];
14055 return alc861_create_out_sw(codec, pfx, nid, 3);
14059 for (i = 0; i < cfg->line_outs; i++) {
14060 nid = spec->multiout.dac_nids[i];
14065 err = alc861_create_out_sw(codec, "Center", nid, 1);
14068 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14072 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14080 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14082 struct alc_spec *spec = codec->spec;
14089 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14090 nid = alc861_look_for_dac(codec, pin);
14092 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14095 spec->multiout.hp_nid = nid;
14101 /* create playback/capture controls for input pins */
14102 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14103 const struct auto_pin_cfg *cfg)
14105 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14108 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14110 int pin_type, hda_nid_t dac)
14112 hda_nid_t mix, srcs[5];
14115 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14117 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14119 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14121 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14124 for (i = 0; i < num; i++) {
14126 if (srcs[i] == dac || srcs[i] == 0x15)
14127 mute = AMP_IN_UNMUTE(i);
14129 mute = AMP_IN_MUTE(i);
14130 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14135 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14137 struct alc_spec *spec = codec->spec;
14140 for (i = 0; i < spec->autocfg.line_outs; i++) {
14141 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14142 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14144 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14145 spec->multiout.dac_nids[i]);
14149 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14151 struct alc_spec *spec = codec->spec;
14154 pin = spec->autocfg.hp_pins[0];
14156 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14157 spec->multiout.hp_nid);
14158 pin = spec->autocfg.speaker_pins[0];
14160 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT,
14161 spec->multiout.dac_nids[0]);
14164 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14166 struct alc_spec *spec = codec->spec;
14169 for (i = 0; i < AUTO_PIN_LAST; i++) {
14170 hda_nid_t nid = spec->autocfg.input_pins[i];
14171 if (nid >= 0x0c && nid <= 0x11)
14172 alc_set_input_pin(codec, nid, i);
14176 /* parse the BIOS configuration and set up the alc_spec */
14177 /* return 1 if successful, 0 if the proper config is not found,
14178 * or a negative error code
14180 static int alc861_parse_auto_config(struct hda_codec *codec)
14182 struct alc_spec *spec = codec->spec;
14184 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14186 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14190 if (!spec->autocfg.line_outs)
14191 return 0; /* can't find valid BIOS pin config */
14193 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14196 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14199 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14202 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14206 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14208 if (spec->autocfg.dig_outs)
14209 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14211 if (spec->kctls.list)
14212 add_mixer(spec, spec->kctls.list);
14214 add_verb(spec, alc861_auto_init_verbs);
14216 spec->num_mux_defs = 1;
14217 spec->input_mux = &spec->private_imux[0];
14219 spec->adc_nids = alc861_adc_nids;
14220 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14221 set_capture_mixer(codec);
14223 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14228 /* additional initialization for auto-configuration model */
14229 static void alc861_auto_init(struct hda_codec *codec)
14231 struct alc_spec *spec = codec->spec;
14232 alc861_auto_init_multi_out(codec);
14233 alc861_auto_init_hp_out(codec);
14234 alc861_auto_init_analog_input(codec);
14235 if (spec->unsol_event)
14236 alc_inithook(codec);
14239 #ifdef CONFIG_SND_HDA_POWER_SAVE
14240 static struct hda_amp_list alc861_loopbacks[] = {
14241 { 0x15, HDA_INPUT, 0 },
14242 { 0x15, HDA_INPUT, 1 },
14243 { 0x15, HDA_INPUT, 2 },
14244 { 0x15, HDA_INPUT, 3 },
14251 * configuration and preset
14253 static const char *alc861_models[ALC861_MODEL_LAST] = {
14254 [ALC861_3ST] = "3stack",
14255 [ALC660_3ST] = "3stack-660",
14256 [ALC861_3ST_DIG] = "3stack-dig",
14257 [ALC861_6ST_DIG] = "6stack-dig",
14258 [ALC861_UNIWILL_M31] = "uniwill-m31",
14259 [ALC861_TOSHIBA] = "toshiba",
14260 [ALC861_ASUS] = "asus",
14261 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14262 [ALC861_AUTO] = "auto",
14265 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14266 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14267 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14268 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14269 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14270 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14271 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14272 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14273 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14274 * Any other models that need this preset?
14276 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14277 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14278 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14279 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14280 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14281 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14282 /* FIXME: the below seems conflict */
14283 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14284 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14285 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14289 static struct alc_config_preset alc861_presets[] = {
14291 .mixers = { alc861_3ST_mixer },
14292 .init_verbs = { alc861_threestack_init_verbs },
14293 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14294 .dac_nids = alc861_dac_nids,
14295 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14296 .channel_mode = alc861_threestack_modes,
14298 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14299 .adc_nids = alc861_adc_nids,
14300 .input_mux = &alc861_capture_source,
14302 [ALC861_3ST_DIG] = {
14303 .mixers = { alc861_base_mixer },
14304 .init_verbs = { alc861_threestack_init_verbs },
14305 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14306 .dac_nids = alc861_dac_nids,
14307 .dig_out_nid = ALC861_DIGOUT_NID,
14308 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14309 .channel_mode = alc861_threestack_modes,
14311 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14312 .adc_nids = alc861_adc_nids,
14313 .input_mux = &alc861_capture_source,
14315 [ALC861_6ST_DIG] = {
14316 .mixers = { alc861_base_mixer },
14317 .init_verbs = { alc861_base_init_verbs },
14318 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14319 .dac_nids = alc861_dac_nids,
14320 .dig_out_nid = ALC861_DIGOUT_NID,
14321 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14322 .channel_mode = alc861_8ch_modes,
14323 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14324 .adc_nids = alc861_adc_nids,
14325 .input_mux = &alc861_capture_source,
14328 .mixers = { alc861_3ST_mixer },
14329 .init_verbs = { alc861_threestack_init_verbs },
14330 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14331 .dac_nids = alc660_dac_nids,
14332 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14333 .channel_mode = alc861_threestack_modes,
14335 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14336 .adc_nids = alc861_adc_nids,
14337 .input_mux = &alc861_capture_source,
14339 [ALC861_UNIWILL_M31] = {
14340 .mixers = { alc861_uniwill_m31_mixer },
14341 .init_verbs = { alc861_uniwill_m31_init_verbs },
14342 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14343 .dac_nids = alc861_dac_nids,
14344 .dig_out_nid = ALC861_DIGOUT_NID,
14345 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14346 .channel_mode = alc861_uniwill_m31_modes,
14348 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14349 .adc_nids = alc861_adc_nids,
14350 .input_mux = &alc861_capture_source,
14352 [ALC861_TOSHIBA] = {
14353 .mixers = { alc861_toshiba_mixer },
14354 .init_verbs = { alc861_base_init_verbs,
14355 alc861_toshiba_init_verbs },
14356 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14357 .dac_nids = alc861_dac_nids,
14358 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14359 .channel_mode = alc883_3ST_2ch_modes,
14360 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14361 .adc_nids = alc861_adc_nids,
14362 .input_mux = &alc861_capture_source,
14363 .unsol_event = alc861_toshiba_unsol_event,
14364 .init_hook = alc861_toshiba_automute,
14367 .mixers = { alc861_asus_mixer },
14368 .init_verbs = { alc861_asus_init_verbs },
14369 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14370 .dac_nids = alc861_dac_nids,
14371 .dig_out_nid = ALC861_DIGOUT_NID,
14372 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14373 .channel_mode = alc861_asus_modes,
14376 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14377 .adc_nids = alc861_adc_nids,
14378 .input_mux = &alc861_capture_source,
14380 [ALC861_ASUS_LAPTOP] = {
14381 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14382 .init_verbs = { alc861_asus_init_verbs,
14383 alc861_asus_laptop_init_verbs },
14384 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14385 .dac_nids = alc861_dac_nids,
14386 .dig_out_nid = ALC861_DIGOUT_NID,
14387 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14388 .channel_mode = alc883_3ST_2ch_modes,
14390 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14391 .adc_nids = alc861_adc_nids,
14392 .input_mux = &alc861_capture_source,
14397 static int patch_alc861(struct hda_codec *codec)
14399 struct alc_spec *spec;
14403 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14407 codec->spec = spec;
14409 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14413 if (board_config < 0) {
14414 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14416 board_config = ALC861_AUTO;
14419 if (board_config == ALC861_AUTO) {
14420 /* automatic parse from the BIOS config */
14421 err = alc861_parse_auto_config(codec);
14427 "hda_codec: Cannot set up configuration "
14428 "from BIOS. Using base mode...\n");
14429 board_config = ALC861_3ST_DIG;
14433 err = snd_hda_attach_beep_device(codec, 0x23);
14439 if (board_config != ALC861_AUTO)
14440 setup_preset(codec, &alc861_presets[board_config]);
14442 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14443 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14445 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14446 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14448 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14450 spec->vmaster_nid = 0x03;
14452 codec->patch_ops = alc_patch_ops;
14453 if (board_config == ALC861_AUTO)
14454 spec->init_hook = alc861_auto_init;
14455 #ifdef CONFIG_SND_HDA_POWER_SAVE
14456 if (!spec->loopback.amplist)
14457 spec->loopback.amplist = alc861_loopbacks;
14459 codec->proc_widget_hook = print_realtek_coef;
14465 * ALC861-VD support
14469 * In addition, an independent DAC
14471 #define ALC861VD_DIGOUT_NID 0x06
14473 static hda_nid_t alc861vd_dac_nids[4] = {
14474 /* front, surr, clfe, side surr */
14475 0x02, 0x03, 0x04, 0x05
14478 /* dac_nids for ALC660vd are in a different order - according to
14479 * Realtek's driver.
14480 * This should probably result in a different mixer for 6stack models
14481 * of ALC660vd codecs, but for now there is only 3stack mixer
14482 * - and it is the same as in 861vd.
14483 * adc_nids in ALC660vd are (is) the same as in 861vd
14485 static hda_nid_t alc660vd_dac_nids[3] = {
14486 /* front, rear, clfe, rear_surr */
14490 static hda_nid_t alc861vd_adc_nids[1] = {
14495 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14498 /* FIXME: should be a matrix-type input source selection */
14499 static struct hda_input_mux alc861vd_capture_source = {
14503 { "Front Mic", 0x1 },
14509 static struct hda_input_mux alc861vd_dallas_capture_source = {
14512 { "Ext Mic", 0x0 },
14513 { "Int Mic", 0x1 },
14517 static struct hda_input_mux alc861vd_hp_capture_source = {
14520 { "Front Mic", 0x0 },
14521 { "ATAPI Mic", 0x1 },
14528 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14535 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14536 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14537 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14538 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14539 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14546 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14547 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14548 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14549 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14550 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14554 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14555 { 6, alc861vd_6stack_ch6_init },
14556 { 8, alc861vd_6stack_ch8_init },
14559 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14561 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14562 .name = "Channel Mode",
14563 .info = alc_ch_mode_info,
14564 .get = alc_ch_mode_get,
14565 .put = alc_ch_mode_put,
14570 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14571 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14573 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14574 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14575 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14577 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14578 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14580 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14582 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14584 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14585 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14587 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14588 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14590 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14592 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14593 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14594 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14596 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14597 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14598 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14600 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14601 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14603 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14604 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14609 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14610 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14611 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14613 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14615 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14616 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14617 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14619 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14620 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14621 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14623 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14624 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14626 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14627 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14632 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14633 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14634 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14635 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14637 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14639 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14640 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14641 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14643 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14644 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14645 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14647 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14648 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14653 /* Pin assignment: Speaker=0x14, HP = 0x15,
14654 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14656 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14657 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14658 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14659 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14660 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14661 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14662 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14663 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14664 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14665 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14666 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14670 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14671 * Front Mic=0x18, ATAPI Mic = 0x19,
14673 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14674 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14675 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14676 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14677 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14678 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14679 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14680 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14681 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14687 * generic initialization of ADC, input mixers and output mixers
14689 static struct hda_verb alc861vd_volume_init_verbs[] = {
14691 * Unmute ADC0 and set the default input to mic-in
14693 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14694 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14696 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14697 * the analog-loopback mixer widget
14699 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14700 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14701 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14702 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14703 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14704 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14706 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14707 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14708 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14709 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14710 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14713 * Set up output mixers (0x02 - 0x05)
14715 /* set vol=0 to output mixers */
14716 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14717 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14718 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14719 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14721 /* set up input amps for analog loopback */
14722 /* Amp Indices: DAC = 0, mixer = 1 */
14723 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14725 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14726 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14727 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14728 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14729 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14730 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14736 * 3-stack pin configuration:
14737 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14739 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14741 * Set pin mode and muting
14743 /* set front pin widgets 0x14 for output */
14744 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14745 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14746 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14748 /* Mic (rear) pin: input vref at 80% */
14749 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14750 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14751 /* Front Mic pin: input vref at 80% */
14752 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14753 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14754 /* Line In pin: input */
14755 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14756 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14757 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14758 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14759 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14760 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14761 /* CD pin widget for input */
14762 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14768 * 6-stack pin configuration:
14770 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14772 * Set pin mode and muting
14774 /* set front pin widgets 0x14 for output */
14775 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14776 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14777 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14779 /* Rear Pin: output 1 (0x0d) */
14780 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14781 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14782 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14783 /* CLFE Pin: output 2 (0x0e) */
14784 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14785 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14786 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14787 /* Side Pin: output 3 (0x0f) */
14788 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14789 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14790 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14792 /* Mic (rear) pin: input vref at 80% */
14793 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14794 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14795 /* Front Mic pin: input vref at 80% */
14796 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14797 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14798 /* Line In pin: input */
14799 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14800 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14801 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14802 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14803 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14804 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14805 /* CD pin widget for input */
14806 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14811 static struct hda_verb alc861vd_eapd_verbs[] = {
14812 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14816 static struct hda_verb alc660vd_eapd_verbs[] = {
14817 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14818 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14822 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14823 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14824 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14825 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14826 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14827 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14831 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14833 unsigned int present;
14834 unsigned char bits;
14836 present = snd_hda_codec_read(codec, 0x18, 0,
14837 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14838 bits = present ? HDA_AMP_MUTE : 0;
14839 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14840 HDA_AMP_MUTE, bits);
14843 static void alc861vd_lenovo_setup(struct hda_codec *codec)
14845 struct alc_spec *spec = codec->spec;
14846 spec->autocfg.hp_pins[0] = 0x1b;
14847 spec->autocfg.speaker_pins[0] = 0x14;
14850 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14852 alc_automute_amp(codec);
14853 alc861vd_lenovo_mic_automute(codec);
14856 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14859 switch (res >> 26) {
14860 case ALC880_MIC_EVENT:
14861 alc861vd_lenovo_mic_automute(codec);
14864 alc_automute_amp_unsol_event(codec, res);
14869 static struct hda_verb alc861vd_dallas_verbs[] = {
14870 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14871 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14872 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14873 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14877 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14878 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14879 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14881 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14882 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14884 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14885 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14886 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14887 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14888 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14889 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14890 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14891 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14893 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14894 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14895 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14896 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14897 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14898 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14899 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14900 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14902 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14903 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14904 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14905 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14907 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14908 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14909 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14914 /* toggle speaker-output according to the hp-jack state */
14915 static void alc861vd_dallas_setup(struct hda_codec *codec)
14917 struct alc_spec *spec = codec->spec;
14919 spec->autocfg.hp_pins[0] = 0x15;
14920 spec->autocfg.speaker_pins[0] = 0x14;
14923 #ifdef CONFIG_SND_HDA_POWER_SAVE
14924 #define alc861vd_loopbacks alc880_loopbacks
14927 /* pcm configuration: identical with ALC880 */
14928 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14929 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14930 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14931 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14934 * configuration and preset
14936 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14937 [ALC660VD_3ST] = "3stack-660",
14938 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14939 [ALC660VD_ASUS_V1S] = "asus-v1s",
14940 [ALC861VD_3ST] = "3stack",
14941 [ALC861VD_3ST_DIG] = "3stack-digout",
14942 [ALC861VD_6ST_DIG] = "6stack-digout",
14943 [ALC861VD_LENOVO] = "lenovo",
14944 [ALC861VD_DALLAS] = "dallas",
14945 [ALC861VD_HP] = "hp",
14946 [ALC861VD_AUTO] = "auto",
14949 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14950 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14951 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14952 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14953 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14954 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14955 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14956 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14957 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14958 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14959 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
14960 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14961 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14962 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14963 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14964 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14968 static struct alc_config_preset alc861vd_presets[] = {
14970 .mixers = { alc861vd_3st_mixer },
14971 .init_verbs = { alc861vd_volume_init_verbs,
14972 alc861vd_3stack_init_verbs },
14973 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14974 .dac_nids = alc660vd_dac_nids,
14975 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14976 .channel_mode = alc861vd_3stack_2ch_modes,
14977 .input_mux = &alc861vd_capture_source,
14979 [ALC660VD_3ST_DIG] = {
14980 .mixers = { alc861vd_3st_mixer },
14981 .init_verbs = { alc861vd_volume_init_verbs,
14982 alc861vd_3stack_init_verbs },
14983 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14984 .dac_nids = alc660vd_dac_nids,
14985 .dig_out_nid = ALC861VD_DIGOUT_NID,
14986 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14987 .channel_mode = alc861vd_3stack_2ch_modes,
14988 .input_mux = &alc861vd_capture_source,
14991 .mixers = { alc861vd_3st_mixer },
14992 .init_verbs = { alc861vd_volume_init_verbs,
14993 alc861vd_3stack_init_verbs },
14994 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14995 .dac_nids = alc861vd_dac_nids,
14996 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14997 .channel_mode = alc861vd_3stack_2ch_modes,
14998 .input_mux = &alc861vd_capture_source,
15000 [ALC861VD_3ST_DIG] = {
15001 .mixers = { alc861vd_3st_mixer },
15002 .init_verbs = { alc861vd_volume_init_verbs,
15003 alc861vd_3stack_init_verbs },
15004 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15005 .dac_nids = alc861vd_dac_nids,
15006 .dig_out_nid = ALC861VD_DIGOUT_NID,
15007 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15008 .channel_mode = alc861vd_3stack_2ch_modes,
15009 .input_mux = &alc861vd_capture_source,
15011 [ALC861VD_6ST_DIG] = {
15012 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15013 .init_verbs = { alc861vd_volume_init_verbs,
15014 alc861vd_6stack_init_verbs },
15015 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15016 .dac_nids = alc861vd_dac_nids,
15017 .dig_out_nid = ALC861VD_DIGOUT_NID,
15018 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15019 .channel_mode = alc861vd_6stack_modes,
15020 .input_mux = &alc861vd_capture_source,
15022 [ALC861VD_LENOVO] = {
15023 .mixers = { alc861vd_lenovo_mixer },
15024 .init_verbs = { alc861vd_volume_init_verbs,
15025 alc861vd_3stack_init_verbs,
15026 alc861vd_eapd_verbs,
15027 alc861vd_lenovo_unsol_verbs },
15028 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15029 .dac_nids = alc660vd_dac_nids,
15030 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15031 .channel_mode = alc861vd_3stack_2ch_modes,
15032 .input_mux = &alc861vd_capture_source,
15033 .unsol_event = alc861vd_lenovo_unsol_event,
15034 .setup = alc861vd_lenovo_setup,
15035 .init_hook = alc861vd_lenovo_init_hook,
15037 [ALC861VD_DALLAS] = {
15038 .mixers = { alc861vd_dallas_mixer },
15039 .init_verbs = { alc861vd_dallas_verbs },
15040 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15041 .dac_nids = alc861vd_dac_nids,
15042 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15043 .channel_mode = alc861vd_3stack_2ch_modes,
15044 .input_mux = &alc861vd_dallas_capture_source,
15045 .unsol_event = alc_automute_amp_unsol_event,
15046 .setup = alc861vd_dallas_setup,
15047 .init_hook = alc_automute_amp,
15050 .mixers = { alc861vd_hp_mixer },
15051 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15052 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15053 .dac_nids = alc861vd_dac_nids,
15054 .dig_out_nid = ALC861VD_DIGOUT_NID,
15055 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15056 .channel_mode = alc861vd_3stack_2ch_modes,
15057 .input_mux = &alc861vd_hp_capture_source,
15058 .unsol_event = alc_automute_amp_unsol_event,
15059 .setup = alc861vd_dallas_setup,
15060 .init_hook = alc_automute_amp,
15062 [ALC660VD_ASUS_V1S] = {
15063 .mixers = { alc861vd_lenovo_mixer },
15064 .init_verbs = { alc861vd_volume_init_verbs,
15065 alc861vd_3stack_init_verbs,
15066 alc861vd_eapd_verbs,
15067 alc861vd_lenovo_unsol_verbs },
15068 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15069 .dac_nids = alc660vd_dac_nids,
15070 .dig_out_nid = ALC861VD_DIGOUT_NID,
15071 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15072 .channel_mode = alc861vd_3stack_2ch_modes,
15073 .input_mux = &alc861vd_capture_source,
15074 .unsol_event = alc861vd_lenovo_unsol_event,
15075 .setup = alc861vd_lenovo_setup,
15076 .init_hook = alc861vd_lenovo_init_hook,
15081 * BIOS auto configuration
15083 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15084 const struct auto_pin_cfg *cfg)
15086 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15090 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15091 hda_nid_t nid, int pin_type, int dac_idx)
15093 alc_set_pin_output(codec, nid, pin_type);
15096 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15098 struct alc_spec *spec = codec->spec;
15101 for (i = 0; i <= HDA_SIDE; i++) {
15102 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15103 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15105 alc861vd_auto_set_output_and_unmute(codec, nid,
15111 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15113 struct alc_spec *spec = codec->spec;
15116 pin = spec->autocfg.hp_pins[0];
15117 if (pin) /* connect to front and use dac 0 */
15118 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15119 pin = spec->autocfg.speaker_pins[0];
15121 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15124 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15126 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15128 struct alc_spec *spec = codec->spec;
15131 for (i = 0; i < AUTO_PIN_LAST; i++) {
15132 hda_nid_t nid = spec->autocfg.input_pins[i];
15133 if (alc_is_input_pin(codec, nid)) {
15134 alc_set_input_pin(codec, nid, i);
15135 if (nid != ALC861VD_PIN_CD_NID &&
15136 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15137 snd_hda_codec_write(codec, nid, 0,
15138 AC_VERB_SET_AMP_GAIN_MUTE,
15144 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15146 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15147 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15149 /* add playback controls from the parsed DAC table */
15150 /* Based on ALC880 version. But ALC861VD has separate,
15151 * different NIDs for mute/unmute switch and volume control */
15152 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15153 const struct auto_pin_cfg *cfg)
15156 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15157 hda_nid_t nid_v, nid_s;
15160 for (i = 0; i < cfg->line_outs; i++) {
15161 if (!spec->multiout.dac_nids[i])
15163 nid_v = alc861vd_idx_to_mixer_vol(
15165 spec->multiout.dac_nids[i]));
15166 nid_s = alc861vd_idx_to_mixer_switch(
15168 spec->multiout.dac_nids[i]));
15172 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15173 "Center Playback Volume",
15174 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15178 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15179 "LFE Playback Volume",
15180 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15184 err = add_control(spec, ALC_CTL_BIND_MUTE,
15185 "Center Playback Switch",
15186 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15190 err = add_control(spec, ALC_CTL_BIND_MUTE,
15191 "LFE Playback Switch",
15192 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15197 sprintf(name, "%s Playback Volume", chname[i]);
15198 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15199 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15203 sprintf(name, "%s Playback Switch", chname[i]);
15204 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15205 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15214 /* add playback controls for speaker and HP outputs */
15215 /* Based on ALC880 version. But ALC861VD has separate,
15216 * different NIDs for mute/unmute switch and volume control */
15217 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15218 hda_nid_t pin, const char *pfx)
15220 hda_nid_t nid_v, nid_s;
15227 if (alc880_is_fixed_pin(pin)) {
15228 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15229 /* specify the DAC as the extra output */
15230 if (!spec->multiout.hp_nid)
15231 spec->multiout.hp_nid = nid_v;
15233 spec->multiout.extra_out_nid[0] = nid_v;
15234 /* control HP volume/switch on the output mixer amp */
15235 nid_v = alc861vd_idx_to_mixer_vol(
15236 alc880_fixed_pin_idx(pin));
15237 nid_s = alc861vd_idx_to_mixer_switch(
15238 alc880_fixed_pin_idx(pin));
15240 sprintf(name, "%s Playback Volume", pfx);
15241 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15242 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15245 sprintf(name, "%s Playback Switch", pfx);
15246 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15247 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15250 } else if (alc880_is_multi_pin(pin)) {
15251 /* set manual connection */
15252 /* we have only a switch on HP-out PIN */
15253 sprintf(name, "%s Playback Switch", pfx);
15254 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15255 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15262 /* parse the BIOS configuration and set up the alc_spec
15263 * return 1 if successful, 0 if the proper config is not found,
15264 * or a negative error code
15265 * Based on ALC880 version - had to change it to override
15266 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15267 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15269 struct alc_spec *spec = codec->spec;
15271 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15273 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15277 if (!spec->autocfg.line_outs)
15278 return 0; /* can't find valid BIOS pin config */
15280 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15283 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15286 err = alc861vd_auto_create_extra_out(spec,
15287 spec->autocfg.speaker_pins[0],
15291 err = alc861vd_auto_create_extra_out(spec,
15292 spec->autocfg.hp_pins[0],
15296 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15300 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15302 if (spec->autocfg.dig_outs)
15303 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15305 if (spec->kctls.list)
15306 add_mixer(spec, spec->kctls.list);
15308 add_verb(spec, alc861vd_volume_init_verbs);
15310 spec->num_mux_defs = 1;
15311 spec->input_mux = &spec->private_imux[0];
15313 err = alc_auto_add_mic_boost(codec);
15317 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15322 /* additional initialization for auto-configuration model */
15323 static void alc861vd_auto_init(struct hda_codec *codec)
15325 struct alc_spec *spec = codec->spec;
15326 alc861vd_auto_init_multi_out(codec);
15327 alc861vd_auto_init_hp_out(codec);
15328 alc861vd_auto_init_analog_input(codec);
15329 alc861vd_auto_init_input_src(codec);
15330 if (spec->unsol_event)
15331 alc_inithook(codec);
15334 static int patch_alc861vd(struct hda_codec *codec)
15336 struct alc_spec *spec;
15337 int err, board_config;
15339 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15343 codec->spec = spec;
15345 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15349 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15350 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15352 board_config = ALC861VD_AUTO;
15355 if (board_config == ALC861VD_AUTO) {
15356 /* automatic parse from the BIOS config */
15357 err = alc861vd_parse_auto_config(codec);
15363 "hda_codec: Cannot set up configuration "
15364 "from BIOS. Using base mode...\n");
15365 board_config = ALC861VD_3ST;
15369 err = snd_hda_attach_beep_device(codec, 0x23);
15375 if (board_config != ALC861VD_AUTO)
15376 setup_preset(codec, &alc861vd_presets[board_config]);
15378 if (codec->vendor_id == 0x10ec0660) {
15379 /* always turn on EAPD */
15380 add_verb(spec, alc660vd_eapd_verbs);
15383 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15384 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15386 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15387 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15389 if (!spec->adc_nids) {
15390 spec->adc_nids = alc861vd_adc_nids;
15391 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15393 if (!spec->capsrc_nids)
15394 spec->capsrc_nids = alc861vd_capsrc_nids;
15396 set_capture_mixer(codec);
15397 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15399 spec->vmaster_nid = 0x02;
15401 codec->patch_ops = alc_patch_ops;
15403 if (board_config == ALC861VD_AUTO)
15404 spec->init_hook = alc861vd_auto_init;
15405 #ifdef CONFIG_SND_HDA_POWER_SAVE
15406 if (!spec->loopback.amplist)
15407 spec->loopback.amplist = alc861vd_loopbacks;
15409 codec->proc_widget_hook = print_realtek_coef;
15417 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15418 * configuration. Each pin widget can choose any input DACs and a mixer.
15419 * Each ADC is connected from a mixer of all inputs. This makes possible
15420 * 6-channel independent captures.
15422 * In addition, an independent DAC for the multi-playback (not used in this
15425 #define ALC662_DIGOUT_NID 0x06
15426 #define ALC662_DIGIN_NID 0x0a
15428 static hda_nid_t alc662_dac_nids[4] = {
15429 /* front, rear, clfe, rear_surr */
15433 static hda_nid_t alc272_dac_nids[2] = {
15437 static hda_nid_t alc662_adc_nids[2] = {
15442 static hda_nid_t alc272_adc_nids[1] = {
15447 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15448 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15452 /* FIXME: should be a matrix-type input source selection */
15453 static struct hda_input_mux alc662_capture_source = {
15457 { "Front Mic", 0x1 },
15463 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15471 static struct hda_input_mux alc663_capture_source = {
15475 { "Front Mic", 0x1 },
15480 #if 0 /* set to 1 for testing other input sources below */
15481 static struct hda_input_mux alc272_nc10_capture_source = {
15484 { "Autoselect Mic", 0x0 },
15485 { "Internal Mic", 0x1 },
15486 { "In-0x02", 0x2 },
15487 { "In-0x03", 0x3 },
15488 { "In-0x04", 0x4 },
15489 { "In-0x05", 0x5 },
15490 { "In-0x06", 0x6 },
15491 { "In-0x07", 0x7 },
15492 { "In-0x08", 0x8 },
15493 { "In-0x09", 0x9 },
15494 { "In-0x0a", 0x0a },
15495 { "In-0x0b", 0x0b },
15496 { "In-0x0c", 0x0c },
15497 { "In-0x0d", 0x0d },
15498 { "In-0x0e", 0x0e },
15499 { "In-0x0f", 0x0f },
15507 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15514 static struct hda_verb alc662_3ST_ch2_init[] = {
15515 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15516 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15517 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15518 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15525 static struct hda_verb alc662_3ST_ch6_init[] = {
15526 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15527 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15528 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15529 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15530 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15531 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15535 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15536 { 2, alc662_3ST_ch2_init },
15537 { 6, alc662_3ST_ch6_init },
15543 static struct hda_verb alc662_sixstack_ch6_init[] = {
15544 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15545 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15546 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15553 static struct hda_verb alc662_sixstack_ch8_init[] = {
15554 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15555 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15556 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15560 static struct hda_channel_mode alc662_5stack_modes[2] = {
15561 { 2, alc662_sixstack_ch6_init },
15562 { 6, alc662_sixstack_ch8_init },
15565 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15566 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15569 static struct snd_kcontrol_new alc662_base_mixer[] = {
15570 /* output mixer control */
15571 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15572 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15573 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15574 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15575 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15576 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15577 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15578 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15579 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15581 /*Input mixer control */
15582 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15583 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15584 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15585 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15586 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15587 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15588 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15589 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15593 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15594 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15595 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15596 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15597 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15598 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15599 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15600 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15601 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15602 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15603 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15604 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15608 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15609 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15610 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15611 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15612 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15613 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15614 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15615 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15616 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15617 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15618 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15619 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15620 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15621 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15622 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15623 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15624 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15625 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15629 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15630 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15631 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15632 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15633 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15634 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15635 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15636 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15637 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15638 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15642 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15643 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15644 ALC262_HIPPO_MASTER_SWITCH,
15646 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15647 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15648 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15650 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15651 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15652 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15656 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15657 ALC262_HIPPO_MASTER_SWITCH,
15658 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15659 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15660 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15661 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15662 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15663 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15664 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15665 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15666 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15670 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15671 .ops = &snd_hda_bind_vol,
15673 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15674 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15679 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15680 .ops = &snd_hda_bind_sw,
15682 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15683 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15688 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15689 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15690 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15691 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15692 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15696 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15697 .ops = &snd_hda_bind_sw,
15699 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15700 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15701 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15706 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15707 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15708 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15709 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15710 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15711 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15712 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15717 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15718 .ops = &snd_hda_bind_sw,
15720 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15721 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15722 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15727 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15728 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15729 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15730 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15731 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15732 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15733 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15737 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15738 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15739 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15740 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15741 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15742 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15743 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15744 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15748 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15749 .ops = &snd_hda_bind_vol,
15751 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15752 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15757 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15758 .ops = &snd_hda_bind_sw,
15760 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15761 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15766 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15767 HDA_BIND_VOL("Master Playback Volume",
15768 &alc663_asus_two_bind_master_vol),
15769 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15770 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15771 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15772 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15773 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15777 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15778 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15779 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15780 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15781 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15782 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15783 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15787 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15788 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15789 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15790 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15791 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15792 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15794 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15795 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15796 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15797 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15801 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15802 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15803 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15804 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15806 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15807 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15808 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15809 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15810 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15811 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15815 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15817 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15818 .name = "Channel Mode",
15819 .info = alc_ch_mode_info,
15820 .get = alc_ch_mode_get,
15821 .put = alc_ch_mode_put,
15826 static struct hda_verb alc662_init_verbs[] = {
15827 /* ADC: mute amp left and right */
15828 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15829 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15830 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15832 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15834 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15835 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15838 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15840 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15841 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15842 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15843 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15845 /* Front Pin: output 0 (0x0c) */
15846 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15847 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15849 /* Rear Pin: output 1 (0x0d) */
15850 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15851 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15853 /* CLFE Pin: output 2 (0x0e) */
15854 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15855 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15857 /* Mic (rear) pin: input vref at 80% */
15858 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15859 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15860 /* Front Mic pin: input vref at 80% */
15861 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15862 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15863 /* Line In pin: input */
15864 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15865 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15866 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15867 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15868 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15869 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15870 /* CD pin widget for input */
15871 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15873 /* FIXME: use matrix-type input source selection */
15874 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15876 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15877 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15879 /* always trun on EAPD */
15880 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15881 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15886 static struct hda_verb alc662_sue_init_verbs[] = {
15887 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15888 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15892 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15893 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15894 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15898 /* Set Unsolicited Event*/
15899 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15900 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15901 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15906 * generic initialization of ADC, input mixers and output mixers
15908 static struct hda_verb alc662_auto_init_verbs[] = {
15910 * Unmute ADC and set the default input to mic-in
15912 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15913 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15915 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15917 * Note: PASD motherboards uses the Line In 2 as the input for front
15918 * panel mic (mic 2)
15920 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15921 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15922 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15923 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15924 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15925 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15928 * Set up output mixers (0x0c - 0x0f)
15930 /* set vol=0 to output mixers */
15931 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15932 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15933 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15935 /* set up input amps for analog loopback */
15936 /* Amp Indices: DAC = 0, mixer = 1 */
15937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15938 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15939 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15940 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15941 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15942 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15945 /* FIXME: use matrix-type input source selection */
15946 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15948 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15949 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15953 /* additional verbs for ALC663 */
15954 static struct hda_verb alc663_auto_init_verbs[] = {
15955 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15956 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15960 static struct hda_verb alc663_m51va_init_verbs[] = {
15961 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15962 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15963 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15964 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15965 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15966 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15967 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15968 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15969 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15973 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15974 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15975 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15976 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15977 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15978 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15979 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15980 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15984 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15985 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15986 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15987 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15988 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15989 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15990 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15991 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15992 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15996 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15997 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15998 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15999 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16000 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16001 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16002 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16003 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16007 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16008 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16009 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16010 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16011 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16012 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16013 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16014 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16015 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16016 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16017 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16018 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16019 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16023 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16024 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16025 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16026 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16027 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16028 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16029 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16030 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16031 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16032 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16033 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16034 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16035 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16039 static struct hda_verb alc663_g71v_init_verbs[] = {
16040 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16041 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16042 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16044 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16045 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16046 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16048 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16049 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16050 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16054 static struct hda_verb alc663_g50v_init_verbs[] = {
16055 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16056 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16057 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16059 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16060 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16064 static struct hda_verb alc662_ecs_init_verbs[] = {
16065 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16066 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16067 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16068 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16072 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16073 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16074 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16075 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16076 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16077 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16078 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16079 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16081 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16082 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16083 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16087 static struct hda_verb alc272_dell_init_verbs[] = {
16088 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16089 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16090 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16091 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16092 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16093 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16094 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16095 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16096 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16097 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16098 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16102 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16103 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16104 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16108 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16109 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16110 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16114 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16116 unsigned int present;
16117 unsigned char bits;
16119 present = snd_hda_codec_read(codec, 0x14, 0,
16120 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16121 bits = present ? HDA_AMP_MUTE : 0;
16122 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16123 HDA_AMP_MUTE, bits);
16126 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16128 unsigned int present;
16129 unsigned char bits;
16131 present = snd_hda_codec_read(codec, 0x1b, 0,
16132 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16133 bits = present ? HDA_AMP_MUTE : 0;
16134 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16135 HDA_AMP_MUTE, bits);
16136 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16137 HDA_AMP_MUTE, bits);
16140 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16143 if ((res >> 26) == ALC880_HP_EVENT)
16144 alc662_lenovo_101e_all_automute(codec);
16145 if ((res >> 26) == ALC880_FRONT_EVENT)
16146 alc662_lenovo_101e_ispeaker_automute(codec);
16149 /* unsolicited event for HP jack sensing */
16150 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16153 if ((res >> 26) == ALC880_MIC_EVENT)
16154 alc_mic_automute(codec);
16156 alc262_hippo_unsol_event(codec, res);
16159 static void alc662_eeepc_setup(struct hda_codec *codec)
16161 struct alc_spec *spec = codec->spec;
16163 alc262_hippo1_setup(codec);
16164 spec->ext_mic.pin = 0x18;
16165 spec->ext_mic.mux_idx = 0;
16166 spec->int_mic.pin = 0x19;
16167 spec->int_mic.mux_idx = 1;
16168 spec->auto_mic = 1;
16171 static void alc662_eeepc_inithook(struct hda_codec *codec)
16173 alc262_hippo_automute(codec);
16174 alc_mic_automute(codec);
16177 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16179 struct alc_spec *spec = codec->spec;
16181 spec->autocfg.hp_pins[0] = 0x14;
16182 spec->autocfg.speaker_pins[0] = 0x1b;
16185 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16187 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16189 unsigned int present;
16190 unsigned char bits;
16192 present = snd_hda_codec_read(codec, 0x21, 0,
16193 AC_VERB_GET_PIN_SENSE, 0)
16194 & AC_PINSENSE_PRESENCE;
16195 bits = present ? HDA_AMP_MUTE : 0;
16196 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16197 AMP_IN_MUTE(0), bits);
16198 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16199 AMP_IN_MUTE(0), bits);
16202 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16204 unsigned int present;
16205 unsigned char bits;
16207 present = snd_hda_codec_read(codec, 0x21, 0,
16208 AC_VERB_GET_PIN_SENSE, 0)
16209 & AC_PINSENSE_PRESENCE;
16210 bits = present ? HDA_AMP_MUTE : 0;
16211 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16212 AMP_IN_MUTE(0), bits);
16213 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16214 AMP_IN_MUTE(0), bits);
16215 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16216 AMP_IN_MUTE(0), bits);
16217 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16218 AMP_IN_MUTE(0), bits);
16221 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16223 unsigned int present;
16224 unsigned char bits;
16226 present = snd_hda_codec_read(codec, 0x15, 0,
16227 AC_VERB_GET_PIN_SENSE, 0)
16228 & AC_PINSENSE_PRESENCE;
16229 bits = present ? HDA_AMP_MUTE : 0;
16230 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16231 AMP_IN_MUTE(0), bits);
16232 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16233 AMP_IN_MUTE(0), bits);
16234 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16235 AMP_IN_MUTE(0), bits);
16236 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16237 AMP_IN_MUTE(0), bits);
16240 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16242 unsigned int present;
16243 unsigned char bits;
16245 present = snd_hda_codec_read(codec, 0x1b, 0,
16246 AC_VERB_GET_PIN_SENSE, 0)
16247 & AC_PINSENSE_PRESENCE;
16248 bits = present ? 0 : PIN_OUT;
16249 snd_hda_codec_write(codec, 0x14, 0,
16250 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16253 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16255 unsigned int present1, present2;
16257 present1 = snd_hda_codec_read(codec, 0x21, 0,
16258 AC_VERB_GET_PIN_SENSE, 0)
16259 & AC_PINSENSE_PRESENCE;
16260 present2 = snd_hda_codec_read(codec, 0x15, 0,
16261 AC_VERB_GET_PIN_SENSE, 0)
16262 & AC_PINSENSE_PRESENCE;
16264 if (present1 || present2) {
16265 snd_hda_codec_write_cache(codec, 0x14, 0,
16266 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16268 snd_hda_codec_write_cache(codec, 0x14, 0,
16269 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16273 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16275 unsigned int present1, present2;
16277 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16278 AC_VERB_GET_PIN_SENSE, 0)
16279 & AC_PINSENSE_PRESENCE;
16280 present2 = snd_hda_codec_read(codec, 0x15, 0,
16281 AC_VERB_GET_PIN_SENSE, 0)
16282 & AC_PINSENSE_PRESENCE;
16284 if (present1 || present2) {
16285 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16286 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16287 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16288 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16290 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16291 AMP_IN_MUTE(0), 0);
16292 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16293 AMP_IN_MUTE(0), 0);
16297 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16300 switch (res >> 26) {
16301 case ALC880_HP_EVENT:
16302 alc663_m51va_speaker_automute(codec);
16304 case ALC880_MIC_EVENT:
16305 alc_mic_automute(codec);
16310 static void alc663_m51va_setup(struct hda_codec *codec)
16312 struct alc_spec *spec = codec->spec;
16313 spec->ext_mic.pin = 0x18;
16314 spec->ext_mic.mux_idx = 0;
16315 spec->int_mic.pin = 0x12;
16316 spec->int_mic.mux_idx = 1;
16317 spec->auto_mic = 1;
16320 static void alc663_m51va_inithook(struct hda_codec *codec)
16322 alc663_m51va_speaker_automute(codec);
16323 alc_mic_automute(codec);
16326 /* ***************** Mode1 ******************************/
16327 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16328 #define alc663_mode1_setup alc663_m51va_setup
16329 #define alc663_mode1_inithook alc663_m51va_inithook
16331 /* ***************** Mode2 ******************************/
16332 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16335 switch (res >> 26) {
16336 case ALC880_HP_EVENT:
16337 alc662_f5z_speaker_automute(codec);
16339 case ALC880_MIC_EVENT:
16340 alc_mic_automute(codec);
16345 #define alc662_mode2_setup alc663_m51va_setup
16347 static void alc662_mode2_inithook(struct hda_codec *codec)
16349 alc662_f5z_speaker_automute(codec);
16350 alc_mic_automute(codec);
16352 /* ***************** Mode3 ******************************/
16353 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16356 switch (res >> 26) {
16357 case ALC880_HP_EVENT:
16358 alc663_two_hp_m1_speaker_automute(codec);
16360 case ALC880_MIC_EVENT:
16361 alc_mic_automute(codec);
16366 #define alc663_mode3_setup alc663_m51va_setup
16368 static void alc663_mode3_inithook(struct hda_codec *codec)
16370 alc663_two_hp_m1_speaker_automute(codec);
16371 alc_mic_automute(codec);
16373 /* ***************** Mode4 ******************************/
16374 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16377 switch (res >> 26) {
16378 case ALC880_HP_EVENT:
16379 alc663_21jd_two_speaker_automute(codec);
16381 case ALC880_MIC_EVENT:
16382 alc_mic_automute(codec);
16387 #define alc663_mode4_setup alc663_m51va_setup
16389 static void alc663_mode4_inithook(struct hda_codec *codec)
16391 alc663_21jd_two_speaker_automute(codec);
16392 alc_mic_automute(codec);
16394 /* ***************** Mode5 ******************************/
16395 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16398 switch (res >> 26) {
16399 case ALC880_HP_EVENT:
16400 alc663_15jd_two_speaker_automute(codec);
16402 case ALC880_MIC_EVENT:
16403 alc_mic_automute(codec);
16408 #define alc663_mode5_setup alc663_m51va_setup
16410 static void alc663_mode5_inithook(struct hda_codec *codec)
16412 alc663_15jd_two_speaker_automute(codec);
16413 alc_mic_automute(codec);
16415 /* ***************** Mode6 ******************************/
16416 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16419 switch (res >> 26) {
16420 case ALC880_HP_EVENT:
16421 alc663_two_hp_m2_speaker_automute(codec);
16423 case ALC880_MIC_EVENT:
16424 alc_mic_automute(codec);
16429 #define alc663_mode6_setup alc663_m51va_setup
16431 static void alc663_mode6_inithook(struct hda_codec *codec)
16433 alc663_two_hp_m2_speaker_automute(codec);
16434 alc_mic_automute(codec);
16437 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16439 unsigned int present;
16440 unsigned char bits;
16442 present = snd_hda_codec_read(codec, 0x21, 0,
16443 AC_VERB_GET_PIN_SENSE, 0)
16444 & AC_PINSENSE_PRESENCE;
16445 bits = present ? HDA_AMP_MUTE : 0;
16446 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16447 HDA_AMP_MUTE, bits);
16448 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16449 HDA_AMP_MUTE, bits);
16452 static void alc663_g71v_front_automute(struct hda_codec *codec)
16454 unsigned int present;
16455 unsigned char bits;
16457 present = snd_hda_codec_read(codec, 0x15, 0,
16458 AC_VERB_GET_PIN_SENSE, 0)
16459 & AC_PINSENSE_PRESENCE;
16460 bits = present ? HDA_AMP_MUTE : 0;
16461 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16462 HDA_AMP_MUTE, bits);
16465 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16468 switch (res >> 26) {
16469 case ALC880_HP_EVENT:
16470 alc663_g71v_hp_automute(codec);
16472 case ALC880_FRONT_EVENT:
16473 alc663_g71v_front_automute(codec);
16475 case ALC880_MIC_EVENT:
16476 alc_mic_automute(codec);
16481 #define alc663_g71v_setup alc663_m51va_setup
16483 static void alc663_g71v_inithook(struct hda_codec *codec)
16485 alc663_g71v_front_automute(codec);
16486 alc663_g71v_hp_automute(codec);
16487 alc_mic_automute(codec);
16490 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16493 switch (res >> 26) {
16494 case ALC880_HP_EVENT:
16495 alc663_m51va_speaker_automute(codec);
16497 case ALC880_MIC_EVENT:
16498 alc_mic_automute(codec);
16503 #define alc663_g50v_setup alc663_m51va_setup
16505 static void alc663_g50v_inithook(struct hda_codec *codec)
16507 alc663_m51va_speaker_automute(codec);
16508 alc_mic_automute(codec);
16511 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16512 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16513 ALC262_HIPPO_MASTER_SWITCH,
16515 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16516 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16517 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16519 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16520 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16521 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16525 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16526 /* Master Playback automatically created from Speaker and Headphone */
16527 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16528 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16529 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16530 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16532 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16533 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16534 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16536 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16537 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16538 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16542 #ifdef CONFIG_SND_HDA_POWER_SAVE
16543 #define alc662_loopbacks alc880_loopbacks
16547 /* pcm configuration: identical with ALC880 */
16548 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16549 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16550 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16551 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16554 * configuration and preset
16556 static const char *alc662_models[ALC662_MODEL_LAST] = {
16557 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16558 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16559 [ALC662_3ST_6ch] = "3stack-6ch",
16560 [ALC662_5ST_DIG] = "6stack-dig",
16561 [ALC662_LENOVO_101E] = "lenovo-101e",
16562 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16563 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16564 [ALC662_ECS] = "ecs",
16565 [ALC663_ASUS_M51VA] = "m51va",
16566 [ALC663_ASUS_G71V] = "g71v",
16567 [ALC663_ASUS_H13] = "h13",
16568 [ALC663_ASUS_G50V] = "g50v",
16569 [ALC663_ASUS_MODE1] = "asus-mode1",
16570 [ALC662_ASUS_MODE2] = "asus-mode2",
16571 [ALC663_ASUS_MODE3] = "asus-mode3",
16572 [ALC663_ASUS_MODE4] = "asus-mode4",
16573 [ALC663_ASUS_MODE5] = "asus-mode5",
16574 [ALC663_ASUS_MODE6] = "asus-mode6",
16575 [ALC272_DELL] = "dell",
16576 [ALC272_DELL_ZM1] = "dell-zm1",
16577 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16578 [ALC662_AUTO] = "auto",
16581 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16582 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16583 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16584 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16585 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16586 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16587 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16588 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16589 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16590 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16591 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16592 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16593 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16594 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16595 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16596 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16597 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16598 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16599 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16600 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16601 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16602 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16603 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16604 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16605 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16606 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16607 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16608 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16609 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16610 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16611 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16612 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16613 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16614 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16615 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16616 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16617 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16618 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16619 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16620 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16621 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16622 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16623 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16624 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16625 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16626 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16627 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16628 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16629 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16630 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16631 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16632 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16633 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16634 ALC662_3ST_6ch_DIG),
16635 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16636 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16637 ALC662_3ST_6ch_DIG),
16638 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16639 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16640 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16641 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16642 ALC662_3ST_6ch_DIG),
16643 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16648 static struct alc_config_preset alc662_presets[] = {
16649 [ALC662_3ST_2ch_DIG] = {
16650 .mixers = { alc662_3ST_2ch_mixer },
16651 .init_verbs = { alc662_init_verbs },
16652 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16653 .dac_nids = alc662_dac_nids,
16654 .dig_out_nid = ALC662_DIGOUT_NID,
16655 .dig_in_nid = ALC662_DIGIN_NID,
16656 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16657 .channel_mode = alc662_3ST_2ch_modes,
16658 .input_mux = &alc662_capture_source,
16660 [ALC662_3ST_6ch_DIG] = {
16661 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16662 .init_verbs = { alc662_init_verbs },
16663 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16664 .dac_nids = alc662_dac_nids,
16665 .dig_out_nid = ALC662_DIGOUT_NID,
16666 .dig_in_nid = ALC662_DIGIN_NID,
16667 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16668 .channel_mode = alc662_3ST_6ch_modes,
16670 .input_mux = &alc662_capture_source,
16672 [ALC662_3ST_6ch] = {
16673 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16674 .init_verbs = { alc662_init_verbs },
16675 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16676 .dac_nids = alc662_dac_nids,
16677 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16678 .channel_mode = alc662_3ST_6ch_modes,
16680 .input_mux = &alc662_capture_source,
16682 [ALC662_5ST_DIG] = {
16683 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16684 .init_verbs = { alc662_init_verbs },
16685 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16686 .dac_nids = alc662_dac_nids,
16687 .dig_out_nid = ALC662_DIGOUT_NID,
16688 .dig_in_nid = ALC662_DIGIN_NID,
16689 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16690 .channel_mode = alc662_5stack_modes,
16691 .input_mux = &alc662_capture_source,
16693 [ALC662_LENOVO_101E] = {
16694 .mixers = { alc662_lenovo_101e_mixer },
16695 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16696 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16697 .dac_nids = alc662_dac_nids,
16698 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16699 .channel_mode = alc662_3ST_2ch_modes,
16700 .input_mux = &alc662_lenovo_101e_capture_source,
16701 .unsol_event = alc662_lenovo_101e_unsol_event,
16702 .init_hook = alc662_lenovo_101e_all_automute,
16704 [ALC662_ASUS_EEEPC_P701] = {
16705 .mixers = { alc662_eeepc_p701_mixer },
16706 .init_verbs = { alc662_init_verbs,
16707 alc662_eeepc_sue_init_verbs },
16708 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16709 .dac_nids = alc662_dac_nids,
16710 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16711 .channel_mode = alc662_3ST_2ch_modes,
16712 .unsol_event = alc662_eeepc_unsol_event,
16713 .setup = alc662_eeepc_setup,
16714 .init_hook = alc662_eeepc_inithook,
16716 [ALC662_ASUS_EEEPC_EP20] = {
16717 .mixers = { alc662_eeepc_ep20_mixer,
16718 alc662_chmode_mixer },
16719 .init_verbs = { alc662_init_verbs,
16720 alc662_eeepc_ep20_sue_init_verbs },
16721 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16722 .dac_nids = alc662_dac_nids,
16723 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16724 .channel_mode = alc662_3ST_6ch_modes,
16725 .input_mux = &alc662_lenovo_101e_capture_source,
16726 .unsol_event = alc662_eeepc_unsol_event,
16727 .setup = alc662_eeepc_ep20_setup,
16728 .init_hook = alc662_eeepc_ep20_inithook,
16731 .mixers = { alc662_ecs_mixer },
16732 .init_verbs = { alc662_init_verbs,
16733 alc662_ecs_init_verbs },
16734 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16735 .dac_nids = alc662_dac_nids,
16736 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16737 .channel_mode = alc662_3ST_2ch_modes,
16738 .unsol_event = alc662_eeepc_unsol_event,
16739 .setup = alc662_eeepc_setup,
16740 .init_hook = alc662_eeepc_inithook,
16742 [ALC663_ASUS_M51VA] = {
16743 .mixers = { alc663_m51va_mixer },
16744 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16745 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16746 .dac_nids = alc662_dac_nids,
16747 .dig_out_nid = ALC662_DIGOUT_NID,
16748 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16749 .channel_mode = alc662_3ST_2ch_modes,
16750 .unsol_event = alc663_m51va_unsol_event,
16751 .setup = alc663_m51va_setup,
16752 .init_hook = alc663_m51va_inithook,
16754 [ALC663_ASUS_G71V] = {
16755 .mixers = { alc663_g71v_mixer },
16756 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16757 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16758 .dac_nids = alc662_dac_nids,
16759 .dig_out_nid = ALC662_DIGOUT_NID,
16760 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16761 .channel_mode = alc662_3ST_2ch_modes,
16762 .unsol_event = alc663_g71v_unsol_event,
16763 .setup = alc663_g71v_setup,
16764 .init_hook = alc663_g71v_inithook,
16766 [ALC663_ASUS_H13] = {
16767 .mixers = { alc663_m51va_mixer },
16768 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16769 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16770 .dac_nids = alc662_dac_nids,
16771 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16772 .channel_mode = alc662_3ST_2ch_modes,
16773 .unsol_event = alc663_m51va_unsol_event,
16774 .init_hook = alc663_m51va_inithook,
16776 [ALC663_ASUS_G50V] = {
16777 .mixers = { alc663_g50v_mixer },
16778 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16779 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16780 .dac_nids = alc662_dac_nids,
16781 .dig_out_nid = ALC662_DIGOUT_NID,
16782 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16783 .channel_mode = alc662_3ST_6ch_modes,
16784 .input_mux = &alc663_capture_source,
16785 .unsol_event = alc663_g50v_unsol_event,
16786 .setup = alc663_g50v_setup,
16787 .init_hook = alc663_g50v_inithook,
16789 [ALC663_ASUS_MODE1] = {
16790 .mixers = { alc663_m51va_mixer },
16791 .cap_mixer = alc662_auto_capture_mixer,
16792 .init_verbs = { alc662_init_verbs,
16793 alc663_21jd_amic_init_verbs },
16794 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16796 .dac_nids = alc662_dac_nids,
16797 .dig_out_nid = ALC662_DIGOUT_NID,
16798 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16799 .channel_mode = alc662_3ST_2ch_modes,
16800 .unsol_event = alc663_mode1_unsol_event,
16801 .setup = alc663_mode1_setup,
16802 .init_hook = alc663_mode1_inithook,
16804 [ALC662_ASUS_MODE2] = {
16805 .mixers = { alc662_1bjd_mixer },
16806 .cap_mixer = alc662_auto_capture_mixer,
16807 .init_verbs = { alc662_init_verbs,
16808 alc662_1bjd_amic_init_verbs },
16809 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16810 .dac_nids = alc662_dac_nids,
16811 .dig_out_nid = ALC662_DIGOUT_NID,
16812 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16813 .channel_mode = alc662_3ST_2ch_modes,
16814 .unsol_event = alc662_mode2_unsol_event,
16815 .setup = alc662_mode2_setup,
16816 .init_hook = alc662_mode2_inithook,
16818 [ALC663_ASUS_MODE3] = {
16819 .mixers = { alc663_two_hp_m1_mixer },
16820 .cap_mixer = alc662_auto_capture_mixer,
16821 .init_verbs = { alc662_init_verbs,
16822 alc663_two_hp_amic_m1_init_verbs },
16823 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16825 .dac_nids = alc662_dac_nids,
16826 .dig_out_nid = ALC662_DIGOUT_NID,
16827 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16828 .channel_mode = alc662_3ST_2ch_modes,
16829 .unsol_event = alc663_mode3_unsol_event,
16830 .setup = alc663_mode3_setup,
16831 .init_hook = alc663_mode3_inithook,
16833 [ALC663_ASUS_MODE4] = {
16834 .mixers = { alc663_asus_21jd_clfe_mixer },
16835 .cap_mixer = alc662_auto_capture_mixer,
16836 .init_verbs = { alc662_init_verbs,
16837 alc663_21jd_amic_init_verbs},
16838 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16840 .dac_nids = alc662_dac_nids,
16841 .dig_out_nid = ALC662_DIGOUT_NID,
16842 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16843 .channel_mode = alc662_3ST_2ch_modes,
16844 .unsol_event = alc663_mode4_unsol_event,
16845 .setup = alc663_mode4_setup,
16846 .init_hook = alc663_mode4_inithook,
16848 [ALC663_ASUS_MODE5] = {
16849 .mixers = { alc663_asus_15jd_clfe_mixer },
16850 .cap_mixer = alc662_auto_capture_mixer,
16851 .init_verbs = { alc662_init_verbs,
16852 alc663_15jd_amic_init_verbs },
16853 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16855 .dac_nids = alc662_dac_nids,
16856 .dig_out_nid = ALC662_DIGOUT_NID,
16857 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16858 .channel_mode = alc662_3ST_2ch_modes,
16859 .unsol_event = alc663_mode5_unsol_event,
16860 .setup = alc663_mode5_setup,
16861 .init_hook = alc663_mode5_inithook,
16863 [ALC663_ASUS_MODE6] = {
16864 .mixers = { alc663_two_hp_m2_mixer },
16865 .cap_mixer = alc662_auto_capture_mixer,
16866 .init_verbs = { alc662_init_verbs,
16867 alc663_two_hp_amic_m2_init_verbs },
16868 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16870 .dac_nids = alc662_dac_nids,
16871 .dig_out_nid = ALC662_DIGOUT_NID,
16872 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16873 .channel_mode = alc662_3ST_2ch_modes,
16874 .unsol_event = alc663_mode6_unsol_event,
16875 .setup = alc663_mode6_setup,
16876 .init_hook = alc663_mode6_inithook,
16879 .mixers = { alc663_m51va_mixer },
16880 .cap_mixer = alc272_auto_capture_mixer,
16881 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16882 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16883 .dac_nids = alc662_dac_nids,
16884 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16885 .adc_nids = alc272_adc_nids,
16886 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16887 .capsrc_nids = alc272_capsrc_nids,
16888 .channel_mode = alc662_3ST_2ch_modes,
16889 .unsol_event = alc663_m51va_unsol_event,
16890 .setup = alc663_m51va_setup,
16891 .init_hook = alc663_m51va_inithook,
16893 [ALC272_DELL_ZM1] = {
16894 .mixers = { alc663_m51va_mixer },
16895 .cap_mixer = alc662_auto_capture_mixer,
16896 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16897 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16898 .dac_nids = alc662_dac_nids,
16899 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16900 .adc_nids = alc662_adc_nids,
16902 .capsrc_nids = alc662_capsrc_nids,
16903 .channel_mode = alc662_3ST_2ch_modes,
16904 .unsol_event = alc663_m51va_unsol_event,
16905 .setup = alc663_m51va_setup,
16906 .init_hook = alc663_m51va_inithook,
16908 [ALC272_SAMSUNG_NC10] = {
16909 .mixers = { alc272_nc10_mixer },
16910 .init_verbs = { alc662_init_verbs,
16911 alc663_21jd_amic_init_verbs },
16912 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16913 .dac_nids = alc272_dac_nids,
16914 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16915 .channel_mode = alc662_3ST_2ch_modes,
16916 /*.input_mux = &alc272_nc10_capture_source,*/
16917 .unsol_event = alc663_mode4_unsol_event,
16918 .setup = alc663_mode4_setup,
16919 .init_hook = alc663_mode4_inithook,
16925 * BIOS auto configuration
16928 /* add playback controls from the parsed DAC table */
16929 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16930 const struct auto_pin_cfg *cfg)
16933 static const char *chname[4] = {
16934 "Front", "Surround", NULL /*CLFE*/, "Side"
16939 for (i = 0; i < cfg->line_outs; i++) {
16940 if (!spec->multiout.dac_nids[i])
16942 nid = alc880_idx_to_dac(i);
16945 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16946 "Center Playback Volume",
16947 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16951 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16952 "LFE Playback Volume",
16953 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16957 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16958 "Center Playback Switch",
16959 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16963 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16964 "LFE Playback Switch",
16965 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16970 sprintf(name, "%s Playback Volume", chname[i]);
16971 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16972 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16976 sprintf(name, "%s Playback Switch", chname[i]);
16977 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16978 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16987 /* add playback controls for speaker and HP outputs */
16988 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16999 /* ALC663 has a mono output pin on 0x17 */
17000 sprintf(name, "%s Playback Switch", pfx);
17001 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17002 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17006 if (alc880_is_fixed_pin(pin)) {
17007 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17008 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17009 /* specify the DAC as the extra output */
17010 if (!spec->multiout.hp_nid)
17011 spec->multiout.hp_nid = nid;
17013 spec->multiout.extra_out_nid[0] = nid;
17014 /* control HP volume/switch on the output mixer amp */
17015 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17016 sprintf(name, "%s Playback Volume", pfx);
17017 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17018 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17021 sprintf(name, "%s Playback Switch", pfx);
17022 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17023 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17026 } else if (alc880_is_multi_pin(pin)) {
17027 /* set manual connection */
17028 /* we have only a switch on HP-out PIN */
17029 sprintf(name, "%s Playback Switch", pfx);
17030 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17031 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17038 /* create playback/capture controls for input pins */
17039 #define alc662_auto_create_input_ctls \
17040 alc880_auto_create_input_ctls
17042 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17043 hda_nid_t nid, int pin_type,
17046 alc_set_pin_output(codec, nid, pin_type);
17047 /* need the manual connection? */
17048 if (alc880_is_multi_pin(nid)) {
17049 struct alc_spec *spec = codec->spec;
17050 int idx = alc880_multi_pin_idx(nid);
17051 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17052 AC_VERB_SET_CONNECT_SEL,
17053 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17057 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17059 struct alc_spec *spec = codec->spec;
17062 for (i = 0; i <= HDA_SIDE; i++) {
17063 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17064 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17066 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17071 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17073 struct alc_spec *spec = codec->spec;
17076 pin = spec->autocfg.hp_pins[0];
17077 if (pin) /* connect to front */
17079 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17080 pin = spec->autocfg.speaker_pins[0];
17082 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17085 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17087 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17089 struct alc_spec *spec = codec->spec;
17092 for (i = 0; i < AUTO_PIN_LAST; i++) {
17093 hda_nid_t nid = spec->autocfg.input_pins[i];
17094 if (alc_is_input_pin(codec, nid)) {
17095 alc_set_input_pin(codec, nid, i);
17096 if (nid != ALC662_PIN_CD_NID &&
17097 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17098 snd_hda_codec_write(codec, nid, 0,
17099 AC_VERB_SET_AMP_GAIN_MUTE,
17105 #define alc662_auto_init_input_src alc882_auto_init_input_src
17107 static int alc662_parse_auto_config(struct hda_codec *codec)
17109 struct alc_spec *spec = codec->spec;
17111 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17113 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17117 if (!spec->autocfg.line_outs)
17118 return 0; /* can't find valid BIOS pin config */
17120 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17123 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17126 err = alc662_auto_create_extra_out(spec,
17127 spec->autocfg.speaker_pins[0],
17131 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17135 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17139 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17141 if (spec->autocfg.dig_outs)
17142 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17144 if (spec->kctls.list)
17145 add_mixer(spec, spec->kctls.list);
17147 spec->num_mux_defs = 1;
17148 spec->input_mux = &spec->private_imux[0];
17150 add_verb(spec, alc662_auto_init_verbs);
17151 if (codec->vendor_id == 0x10ec0663)
17152 add_verb(spec, alc663_auto_init_verbs);
17154 err = alc_auto_add_mic_boost(codec);
17158 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17163 /* additional initialization for auto-configuration model */
17164 static void alc662_auto_init(struct hda_codec *codec)
17166 struct alc_spec *spec = codec->spec;
17167 alc662_auto_init_multi_out(codec);
17168 alc662_auto_init_hp_out(codec);
17169 alc662_auto_init_analog_input(codec);
17170 alc662_auto_init_input_src(codec);
17171 if (spec->unsol_event)
17172 alc_inithook(codec);
17175 static int patch_alc662(struct hda_codec *codec)
17177 struct alc_spec *spec;
17178 int err, board_config;
17180 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17184 codec->spec = spec;
17186 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17188 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17191 if (board_config < 0) {
17192 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17194 board_config = ALC662_AUTO;
17197 if (board_config == ALC662_AUTO) {
17198 /* automatic parse from the BIOS config */
17199 err = alc662_parse_auto_config(codec);
17205 "hda_codec: Cannot set up configuration "
17206 "from BIOS. Using base mode...\n");
17207 board_config = ALC662_3ST_2ch_DIG;
17211 err = snd_hda_attach_beep_device(codec, 0x1);
17217 if (board_config != ALC662_AUTO)
17218 setup_preset(codec, &alc662_presets[board_config]);
17220 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17221 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17223 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17224 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17226 if (!spec->adc_nids) {
17227 spec->adc_nids = alc662_adc_nids;
17228 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17230 if (!spec->capsrc_nids)
17231 spec->capsrc_nids = alc662_capsrc_nids;
17233 if (!spec->cap_mixer)
17234 set_capture_mixer(codec);
17235 if (codec->vendor_id == 0x10ec0662)
17236 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17238 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17240 spec->vmaster_nid = 0x02;
17242 codec->patch_ops = alc_patch_ops;
17243 if (board_config == ALC662_AUTO)
17244 spec->init_hook = alc662_auto_init;
17245 #ifdef CONFIG_SND_HDA_POWER_SAVE
17246 if (!spec->loopback.amplist)
17247 spec->loopback.amplist = alc662_loopbacks;
17249 codec->proc_widget_hook = print_realtek_coef;
17257 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17258 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17259 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17260 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17261 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17262 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17263 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17264 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17265 .patch = patch_alc861 },
17266 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17267 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17268 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17269 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17270 .patch = patch_alc882 },
17271 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17272 .patch = patch_alc662 },
17273 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17274 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17275 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17276 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17277 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17278 .patch = patch_alc882 },
17279 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17280 .patch = patch_alc882 },
17281 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17282 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17283 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17284 .patch = patch_alc882 },
17285 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17286 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17287 {} /* terminator */
17290 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17292 MODULE_LICENSE("GPL");
17293 MODULE_DESCRIPTION("Realtek HD-audio codec");
17295 static struct hda_codec_preset_list realtek_list = {
17296 .preset = snd_hda_preset_realtek,
17297 .owner = THIS_MODULE,
17300 static int __init patch_realtek_init(void)
17302 return snd_hda_add_codec_preset(&realtek_list);
17305 static void __exit patch_realtek_exit(void)
17307 snd_hda_delete_codec_preset(&realtek_list);
17310 module_init(patch_realtek_init)
17311 module_exit(patch_realtek_exit)