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_is_input_pin(nid) ((nid) >= 0x18)
4315 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4316 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4317 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4318 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4319 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4320 #define ALC880_PIN_CD_NID 0x1c
4322 /* fill in the dac_nids table from the parsed pin configuration */
4323 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4324 const struct auto_pin_cfg *cfg)
4330 memset(assigned, 0, sizeof(assigned));
4331 spec->multiout.dac_nids = spec->private_dac_nids;
4333 /* check the pins hardwired to audio widget */
4334 for (i = 0; i < cfg->line_outs; i++) {
4335 nid = cfg->line_out_pins[i];
4336 if (alc880_is_fixed_pin(nid)) {
4337 int idx = alc880_fixed_pin_idx(nid);
4338 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4342 /* left pins can be connect to any audio widget */
4343 for (i = 0; i < cfg->line_outs; i++) {
4344 nid = cfg->line_out_pins[i];
4345 if (alc880_is_fixed_pin(nid))
4347 /* search for an empty channel */
4348 for (j = 0; j < cfg->line_outs; j++) {
4350 spec->multiout.dac_nids[i] =
4351 alc880_idx_to_dac(j);
4357 spec->multiout.num_dacs = cfg->line_outs;
4361 /* add playback controls from the parsed DAC table */
4362 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4363 const struct auto_pin_cfg *cfg)
4366 static const char *chname[4] = {
4367 "Front", "Surround", NULL /*CLFE*/, "Side"
4372 for (i = 0; i < cfg->line_outs; i++) {
4373 if (!spec->multiout.dac_nids[i])
4375 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4378 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4379 "Center Playback Volume",
4380 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4384 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4385 "LFE Playback Volume",
4386 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4390 err = add_control(spec, ALC_CTL_BIND_MUTE,
4391 "Center Playback Switch",
4392 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4396 err = add_control(spec, ALC_CTL_BIND_MUTE,
4397 "LFE Playback Switch",
4398 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4403 sprintf(name, "%s Playback Volume", chname[i]);
4404 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4405 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4409 sprintf(name, "%s Playback Switch", chname[i]);
4410 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4411 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4420 /* add playback controls for speaker and HP outputs */
4421 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4431 if (alc880_is_fixed_pin(pin)) {
4432 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4433 /* specify the DAC as the extra output */
4434 if (!spec->multiout.hp_nid)
4435 spec->multiout.hp_nid = nid;
4437 spec->multiout.extra_out_nid[0] = nid;
4438 /* control HP volume/switch on the output mixer amp */
4439 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4440 sprintf(name, "%s Playback Volume", pfx);
4441 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4442 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4445 sprintf(name, "%s Playback Switch", pfx);
4446 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4447 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4450 } else if (alc880_is_multi_pin(pin)) {
4451 /* set manual connection */
4452 /* we have only a switch on HP-out PIN */
4453 sprintf(name, "%s Playback Switch", pfx);
4454 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4455 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4462 /* create input playback/capture controls for the given pin */
4463 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4464 const char *ctlname,
4465 int idx, hda_nid_t mix_nid)
4470 sprintf(name, "%s Playback Volume", ctlname);
4471 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4472 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4475 sprintf(name, "%s Playback Switch", ctlname);
4476 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4477 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4483 /* create playback/capture controls for input pins */
4484 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4485 const struct auto_pin_cfg *cfg)
4487 struct hda_input_mux *imux = &spec->private_imux[0];
4490 for (i = 0; i < AUTO_PIN_LAST; i++) {
4491 if (alc880_is_input_pin(cfg->input_pins[i])) {
4492 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4493 err = new_analog_input(spec, cfg->input_pins[i],
4494 auto_pin_cfg_labels[i],
4498 imux->items[imux->num_items].label =
4499 auto_pin_cfg_labels[i];
4500 imux->items[imux->num_items].index =
4501 alc880_input_pin_idx(cfg->input_pins[i]);
4508 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4509 unsigned int pin_type)
4511 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4514 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4518 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4519 hda_nid_t nid, int pin_type,
4522 alc_set_pin_output(codec, nid, pin_type);
4523 /* need the manual connection? */
4524 if (alc880_is_multi_pin(nid)) {
4525 struct alc_spec *spec = codec->spec;
4526 int idx = alc880_multi_pin_idx(nid);
4527 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4528 AC_VERB_SET_CONNECT_SEL,
4529 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4533 static int get_pin_type(int line_out_type)
4535 if (line_out_type == AUTO_PIN_HP_OUT)
4541 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4543 struct alc_spec *spec = codec->spec;
4546 for (i = 0; i < spec->autocfg.line_outs; i++) {
4547 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4548 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4549 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4553 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4555 struct alc_spec *spec = codec->spec;
4558 pin = spec->autocfg.speaker_pins[0];
4559 if (pin) /* connect to front */
4560 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4561 pin = spec->autocfg.hp_pins[0];
4562 if (pin) /* connect to front */
4563 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4566 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4568 struct alc_spec *spec = codec->spec;
4571 for (i = 0; i < AUTO_PIN_LAST; i++) {
4572 hda_nid_t nid = spec->autocfg.input_pins[i];
4573 if (alc880_is_input_pin(nid)) {
4574 alc_set_input_pin(codec, nid, i);
4575 if (nid != ALC880_PIN_CD_NID &&
4576 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4577 snd_hda_codec_write(codec, nid, 0,
4578 AC_VERB_SET_AMP_GAIN_MUTE,
4584 /* parse the BIOS configuration and set up the alc_spec */
4585 /* return 1 if successful, 0 if the proper config is not found,
4586 * or a negative error code
4588 static int alc880_parse_auto_config(struct hda_codec *codec)
4590 struct alc_spec *spec = codec->spec;
4592 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4594 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4598 if (!spec->autocfg.line_outs)
4599 return 0; /* can't find valid BIOS pin config */
4601 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4604 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4607 err = alc880_auto_create_extra_out(spec,
4608 spec->autocfg.speaker_pins[0],
4612 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4616 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4620 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4622 /* check multiple SPDIF-out (for recent codecs) */
4623 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4625 err = snd_hda_get_connections(codec,
4626 spec->autocfg.dig_out_pins[i],
4631 spec->multiout.dig_out_nid = dig_nid;
4633 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4634 spec->slave_dig_outs[i - 1] = dig_nid;
4635 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4639 if (spec->autocfg.dig_in_pin)
4640 spec->dig_in_nid = ALC880_DIGIN_NID;
4642 if (spec->kctls.list)
4643 add_mixer(spec, spec->kctls.list);
4645 add_verb(spec, alc880_volume_init_verbs);
4647 spec->num_mux_defs = 1;
4648 spec->input_mux = &spec->private_imux[0];
4650 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4655 /* additional initialization for auto-configuration model */
4656 static void alc880_auto_init(struct hda_codec *codec)
4658 struct alc_spec *spec = codec->spec;
4659 alc880_auto_init_multi_out(codec);
4660 alc880_auto_init_extra_out(codec);
4661 alc880_auto_init_analog_input(codec);
4662 if (spec->unsol_event)
4663 alc_inithook(codec);
4666 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4667 * one of two digital mic pins, e.g. on ALC272
4669 static void fixup_automic_adc(struct hda_codec *codec)
4671 struct alc_spec *spec = codec->spec;
4674 for (i = 0; i < spec->num_adc_nids; i++) {
4675 hda_nid_t cap = spec->capsrc_nids ?
4676 spec->capsrc_nids[i] : spec->adc_nids[i];
4679 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4682 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4685 spec->int_mic.mux_idx = iidx;
4686 spec->ext_mic.mux_idx = eidx;
4687 if (spec->capsrc_nids)
4688 spec->capsrc_nids += i;
4689 spec->adc_nids += i;
4690 spec->num_adc_nids = 1;
4693 snd_printd(KERN_INFO "hda_codec: %s: "
4694 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4695 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4696 spec->auto_mic = 0; /* disable auto-mic to be sure */
4699 static void set_capture_mixer(struct hda_codec *codec)
4701 struct alc_spec *spec = codec->spec;
4702 static struct snd_kcontrol_new *caps[2][3] = {
4703 { alc_capture_mixer_nosrc1,
4704 alc_capture_mixer_nosrc2,
4705 alc_capture_mixer_nosrc3 },
4706 { alc_capture_mixer1,
4708 alc_capture_mixer3 },
4710 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4712 if (spec->auto_mic) {
4714 fixup_automic_adc(codec);
4715 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4719 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4723 #define set_beep_amp(spec, nid, idx, dir) \
4724 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4727 * OK, here we have finally the patch for ALC880
4730 static int patch_alc880(struct hda_codec *codec)
4732 struct alc_spec *spec;
4736 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4742 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4745 if (board_config < 0) {
4746 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4748 board_config = ALC880_AUTO;
4751 if (board_config == ALC880_AUTO) {
4752 /* automatic parse from the BIOS config */
4753 err = alc880_parse_auto_config(codec);
4759 "hda_codec: Cannot set up configuration "
4760 "from BIOS. Using 3-stack mode...\n");
4761 board_config = ALC880_3ST;
4765 err = snd_hda_attach_beep_device(codec, 0x1);
4771 if (board_config != ALC880_AUTO)
4772 setup_preset(codec, &alc880_presets[board_config]);
4774 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4775 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4776 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4778 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4779 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4781 if (!spec->adc_nids && spec->input_mux) {
4782 /* check whether NID 0x07 is valid */
4783 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4785 wcap = get_wcaps_type(wcap);
4786 if (wcap != AC_WID_AUD_IN) {
4787 spec->adc_nids = alc880_adc_nids_alt;
4788 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4790 spec->adc_nids = alc880_adc_nids;
4791 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4794 set_capture_mixer(codec);
4795 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4797 spec->vmaster_nid = 0x0c;
4799 codec->patch_ops = alc_patch_ops;
4800 if (board_config == ALC880_AUTO)
4801 spec->init_hook = alc880_auto_init;
4802 #ifdef CONFIG_SND_HDA_POWER_SAVE
4803 if (!spec->loopback.amplist)
4804 spec->loopback.amplist = alc880_loopbacks;
4806 codec->proc_widget_hook = print_realtek_coef;
4816 static hda_nid_t alc260_dac_nids[1] = {
4821 static hda_nid_t alc260_adc_nids[1] = {
4826 static hda_nid_t alc260_adc_nids_alt[1] = {
4831 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4832 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4834 static hda_nid_t alc260_dual_adc_nids[2] = {
4839 #define ALC260_DIGOUT_NID 0x03
4840 #define ALC260_DIGIN_NID 0x06
4842 static struct hda_input_mux alc260_capture_source = {
4846 { "Front Mic", 0x1 },
4852 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4853 * headphone jack and the internal CD lines since these are the only pins at
4854 * which audio can appear. For flexibility, also allow the option of
4855 * recording the mixer output on the second ADC (ADC0 doesn't have a
4856 * connection to the mixer output).
4858 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4862 { "Mic/Line", 0x0 },
4864 { "Headphone", 0x2 },
4870 { "Mic/Line", 0x0 },
4872 { "Headphone", 0x2 },
4879 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4880 * the Fujitsu S702x, but jacks are marked differently.
4882 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4889 { "Headphone", 0x5 },
4898 { "Headphone", 0x6 },
4904 /* Maxdata Favorit 100XS */
4905 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4909 { "Line/Mic", 0x0 },
4916 { "Line/Mic", 0x0 },
4924 * This is just place-holder, so there's something for alc_build_pcms to look
4925 * at when it calculates the maximum number of channels. ALC260 has no mixer
4926 * element which allows changing the channel mode, so the verb list is
4929 static struct hda_channel_mode alc260_modes[1] = {
4934 /* Mixer combinations
4936 * basic: base_output + input + pc_beep + capture
4937 * HP: base_output + input + capture_alt
4938 * HP_3013: hp_3013 + input + capture
4939 * fujitsu: fujitsu + capture
4940 * acer: acer + capture
4943 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4944 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4945 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4946 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4947 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4948 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4949 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4953 static struct snd_kcontrol_new alc260_input_mixer[] = {
4954 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4955 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4956 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4957 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4958 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4959 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4960 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4961 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4965 /* update HP, line and mono out pins according to the master switch */
4966 static void alc260_hp_master_update(struct hda_codec *codec,
4967 hda_nid_t hp, hda_nid_t line,
4970 struct alc_spec *spec = codec->spec;
4971 unsigned int val = spec->master_sw ? PIN_HP : 0;
4972 /* change HP and line-out pins */
4973 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4975 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4977 /* mono (speaker) depending on the HP jack sense */
4978 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4979 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4983 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4984 struct snd_ctl_elem_value *ucontrol)
4986 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4987 struct alc_spec *spec = codec->spec;
4988 *ucontrol->value.integer.value = spec->master_sw;
4992 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4993 struct snd_ctl_elem_value *ucontrol)
4995 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4996 struct alc_spec *spec = codec->spec;
4997 int val = !!*ucontrol->value.integer.value;
4998 hda_nid_t hp, line, mono;
5000 if (val == spec->master_sw)
5002 spec->master_sw = val;
5003 hp = (kcontrol->private_value >> 16) & 0xff;
5004 line = (kcontrol->private_value >> 8) & 0xff;
5005 mono = kcontrol->private_value & 0xff;
5006 alc260_hp_master_update(codec, hp, line, mono);
5010 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5012 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5013 .name = "Master Playback Switch",
5014 .info = snd_ctl_boolean_mono_info,
5015 .get = alc260_hp_master_sw_get,
5016 .put = alc260_hp_master_sw_put,
5017 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5019 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5020 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5021 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5022 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5023 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5025 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5029 static struct hda_verb alc260_hp_unsol_verbs[] = {
5030 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5034 static void alc260_hp_automute(struct hda_codec *codec)
5036 struct alc_spec *spec = codec->spec;
5037 unsigned int present;
5039 present = snd_hda_codec_read(codec, 0x10, 0,
5040 AC_VERB_GET_PIN_SENSE, 0);
5041 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5042 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5045 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5047 if ((res >> 26) == ALC880_HP_EVENT)
5048 alc260_hp_automute(codec);
5051 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5053 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5054 .name = "Master Playback Switch",
5055 .info = snd_ctl_boolean_mono_info,
5056 .get = alc260_hp_master_sw_get,
5057 .put = alc260_hp_master_sw_put,
5058 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5060 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5061 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5062 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5063 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5064 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5065 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5066 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5067 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5071 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5072 .ops = &snd_hda_bind_vol,
5074 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5075 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5076 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5081 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5082 .ops = &snd_hda_bind_sw,
5084 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5085 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5090 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5091 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5092 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5093 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5094 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5098 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5099 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5103 static void alc260_hp_3013_automute(struct hda_codec *codec)
5105 struct alc_spec *spec = codec->spec;
5106 unsigned int present;
5108 present = snd_hda_codec_read(codec, 0x15, 0,
5109 AC_VERB_GET_PIN_SENSE, 0);
5110 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5111 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5114 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5117 if ((res >> 26) == ALC880_HP_EVENT)
5118 alc260_hp_3013_automute(codec);
5121 static void alc260_hp_3012_automute(struct hda_codec *codec)
5123 unsigned int present, bits;
5125 present = snd_hda_codec_read(codec, 0x10, 0,
5126 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
5128 bits = present ? 0 : PIN_OUT;
5129 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5131 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5133 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5137 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5140 if ((res >> 26) == ALC880_HP_EVENT)
5141 alc260_hp_3012_automute(codec);
5144 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5145 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5147 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5148 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5149 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5150 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5151 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5152 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5153 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5154 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5155 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5156 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5157 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5161 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5162 * versions of the ALC260 don't act on requests to enable mic bias from NID
5163 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5164 * datasheet doesn't mention this restriction. At this stage it's not clear
5165 * whether this behaviour is intentional or is a hardware bug in chip
5166 * revisions available in early 2006. Therefore for now allow the
5167 * "Headphone Jack Mode" control to span all choices, but if it turns out
5168 * that the lack of mic bias for this NID is intentional we could change the
5169 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5171 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5172 * don't appear to make the mic bias available from the "line" jack, even
5173 * though the NID used for this jack (0x14) can supply it. The theory is
5174 * that perhaps Acer have included blocking capacitors between the ALC260
5175 * and the output jack. If this turns out to be the case for all such
5176 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5177 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5179 * The C20x Tablet series have a mono internal speaker which is controlled
5180 * via the chip's Mono sum widget and pin complex, so include the necessary
5181 * controls for such models. On models without a "mono speaker" the control
5182 * won't do anything.
5184 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5185 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5186 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5187 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5188 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5190 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5192 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5193 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5194 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5195 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5196 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5197 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5198 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5199 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5203 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5205 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5206 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5207 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5208 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5209 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5210 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5211 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5215 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5216 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5218 static struct snd_kcontrol_new alc260_will_mixer[] = {
5219 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5220 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5222 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5223 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5224 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5225 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5226 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5227 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5228 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5232 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5233 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5235 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5236 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5237 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5238 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5239 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5240 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5241 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5242 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5243 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5244 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5245 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5250 * initialization verbs
5252 static struct hda_verb alc260_init_verbs[] = {
5253 /* Line In pin widget for input */
5254 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5255 /* CD pin widget for input */
5256 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5257 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5258 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5259 /* Mic2 (front panel) pin widget for input and vref at 80% */
5260 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5261 /* LINE-2 is used for line-out in rear */
5262 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5263 /* select line-out */
5264 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5266 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5268 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5270 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5271 /* mute capture amp left and right */
5272 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5273 /* set connection select to line in (default select for this ADC) */
5274 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5275 /* mute capture amp left and right */
5276 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5277 /* set connection select to line in (default select for this ADC) */
5278 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5279 /* set vol=0 Line-Out mixer amp left and right */
5280 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5281 /* unmute pin widget amp left and right (no gain on this amp) */
5282 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5283 /* set vol=0 HP mixer amp left and right */
5284 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5285 /* unmute pin widget amp left and right (no gain on this amp) */
5286 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5287 /* set vol=0 Mono mixer amp left and right */
5288 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5289 /* unmute pin widget amp left and right (no gain on this amp) */
5290 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5291 /* unmute LINE-2 out pin */
5292 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5293 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5296 /* mute analog inputs */
5297 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5298 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5299 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5300 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5301 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5302 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5303 /* mute Front out path */
5304 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5305 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5306 /* mute Headphone out path */
5307 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5308 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5309 /* mute Mono out path */
5310 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5311 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5315 #if 0 /* should be identical with alc260_init_verbs? */
5316 static struct hda_verb alc260_hp_init_verbs[] = {
5317 /* Headphone and output */
5318 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5320 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5321 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5322 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5323 /* Mic2 (front panel) pin widget for input and vref at 80% */
5324 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5325 /* Line In pin widget for input */
5326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5327 /* Line-2 pin widget for output */
5328 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5329 /* CD pin widget for input */
5330 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5331 /* unmute amp left and right */
5332 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5333 /* set connection select to line in (default select for this ADC) */
5334 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5335 /* unmute Line-Out mixer amp left and right (volume = 0) */
5336 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5337 /* mute pin widget amp left and right (no gain on this amp) */
5338 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5339 /* unmute HP mixer amp left and right (volume = 0) */
5340 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5341 /* mute pin widget amp left and right (no gain on this amp) */
5342 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5343 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5346 /* mute analog inputs */
5347 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5348 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5349 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5350 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5351 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5352 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5353 /* Unmute Front out path */
5354 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5355 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5356 /* Unmute Headphone out path */
5357 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5358 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5359 /* Unmute Mono out path */
5360 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5361 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5366 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5367 /* Line out and output */
5368 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5370 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5371 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5372 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5373 /* Mic2 (front panel) pin widget for input and vref at 80% */
5374 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5375 /* Line In pin widget for input */
5376 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5377 /* Headphone pin widget for output */
5378 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5379 /* CD pin widget for input */
5380 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5381 /* unmute amp left and right */
5382 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5383 /* set connection select to line in (default select for this ADC) */
5384 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5385 /* unmute Line-Out mixer amp left and right (volume = 0) */
5386 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5387 /* mute pin widget amp left and right (no gain on this amp) */
5388 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5389 /* unmute HP mixer amp left and right (volume = 0) */
5390 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5391 /* mute pin widget amp left and right (no gain on this amp) */
5392 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5393 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5396 /* mute analog inputs */
5397 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5398 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5399 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5401 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5402 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5403 /* Unmute Front out path */
5404 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5405 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5406 /* Unmute Headphone out path */
5407 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5408 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5409 /* Unmute Mono out path */
5410 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5411 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5415 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5416 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5417 * audio = 0x16, internal speaker = 0x10.
5419 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5420 /* Disable all GPIOs */
5421 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5422 /* Internal speaker is connected to headphone pin */
5423 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5424 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5425 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5426 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5427 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5428 /* Ensure all other unused pins are disabled and muted. */
5429 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5430 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5431 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5432 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5433 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5434 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5435 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5436 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5438 /* Disable digital (SPDIF) pins */
5439 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5440 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5442 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5443 * when acting as an output.
5445 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5447 /* Start with output sum widgets muted and their output gains at min */
5448 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5449 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5450 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5451 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5452 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5453 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5454 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5455 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5456 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5458 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5459 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5460 /* Unmute Line1 pin widget output buffer since it starts as an output.
5461 * If the pin mode is changed by the user the pin mode control will
5462 * take care of enabling the pin's input/output buffers as needed.
5463 * Therefore there's no need to enable the input buffer at this
5466 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5467 /* Unmute input buffer of pin widget used for Line-in (no equiv
5470 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5472 /* Mute capture amp left and right */
5473 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5474 /* Set ADC connection select to match default mixer setting - line
5477 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5479 /* Do the same for the second ADC: mute capture input amp and
5480 * set ADC connection to line in (on mic1 pin)
5482 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5483 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5485 /* Mute all inputs to mixer widget (even unconnected ones) */
5486 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5489 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5490 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5491 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5492 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5493 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5498 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5499 * similar laptops (adapted from Fujitsu init verbs).
5501 static struct hda_verb alc260_acer_init_verbs[] = {
5502 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5503 * the headphone jack. Turn this on and rely on the standard mute
5504 * methods whenever the user wants to turn these outputs off.
5506 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5507 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5508 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5509 /* Internal speaker/Headphone jack is connected to Line-out pin */
5510 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5511 /* Internal microphone/Mic jack is connected to Mic1 pin */
5512 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5513 /* Line In jack is connected to Line1 pin */
5514 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5515 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5516 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5517 /* Ensure all other unused pins are disabled and muted. */
5518 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5519 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5520 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5521 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5522 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5523 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5524 /* Disable digital (SPDIF) pins */
5525 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5526 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5528 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5529 * bus when acting as outputs.
5531 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5532 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5534 /* Start with output sum widgets muted and their output gains at min */
5535 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5536 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5537 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5538 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5539 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5540 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5541 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5542 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5543 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5545 /* Unmute Line-out pin widget amp left and right
5546 * (no equiv mixer ctrl)
5548 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5549 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5550 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5551 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5552 * inputs. If the pin mode is changed by the user the pin mode control
5553 * will take care of enabling the pin's input/output buffers as needed.
5554 * Therefore there's no need to enable the input buffer at this
5557 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5558 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5560 /* Mute capture amp left and right */
5561 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5562 /* Set ADC connection select to match default mixer setting - mic
5565 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5567 /* Do similar with the second ADC: mute capture input amp and
5568 * set ADC connection to mic to match ALSA's default state.
5570 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5571 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5573 /* Mute all inputs to mixer widget (even unconnected ones) */
5574 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5575 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5576 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5577 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5578 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5579 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5586 /* Initialisation sequence for Maxdata Favorit 100XS
5587 * (adapted from Acer init verbs).
5589 static struct hda_verb alc260_favorit100_init_verbs[] = {
5590 /* GPIO 0 enables the output jack.
5591 * Turn this on and rely on the standard mute
5592 * methods whenever the user wants to turn these outputs off.
5594 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5595 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5596 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5597 /* Line/Mic input jack is connected to Mic1 pin */
5598 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5599 /* Ensure all other unused pins are disabled and muted. */
5600 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5601 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5602 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5603 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5604 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5605 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5606 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5607 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5608 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5609 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5610 /* Disable digital (SPDIF) pins */
5611 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5612 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5614 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5615 * bus when acting as outputs.
5617 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5618 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5620 /* Start with output sum widgets muted and their output gains at min */
5621 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5622 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5623 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5624 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5625 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5626 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5627 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5628 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5629 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5631 /* Unmute Line-out pin widget amp left and right
5632 * (no equiv mixer ctrl)
5634 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5635 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5636 * inputs. If the pin mode is changed by the user the pin mode control
5637 * will take care of enabling the pin's input/output buffers as needed.
5638 * Therefore there's no need to enable the input buffer at this
5641 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5643 /* Mute capture amp left and right */
5644 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5645 /* Set ADC connection select to match default mixer setting - mic
5648 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5650 /* Do similar with the second ADC: mute capture input amp and
5651 * set ADC connection to mic to match ALSA's default state.
5653 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5654 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5656 /* Mute all inputs to mixer widget (even unconnected ones) */
5657 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5658 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5659 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5660 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5661 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5662 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5663 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5664 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5669 static struct hda_verb alc260_will_verbs[] = {
5670 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5671 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5672 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5673 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5674 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5675 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5679 static struct hda_verb alc260_replacer_672v_verbs[] = {
5680 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5681 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5682 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5684 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5685 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5686 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5688 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5692 /* toggle speaker-output according to the hp-jack state */
5693 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5695 unsigned int present;
5697 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5698 present = snd_hda_codec_read(codec, 0x0f, 0,
5699 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5701 snd_hda_codec_write_cache(codec, 0x01, 0,
5702 AC_VERB_SET_GPIO_DATA, 1);
5703 snd_hda_codec_write_cache(codec, 0x0f, 0,
5704 AC_VERB_SET_PIN_WIDGET_CONTROL,
5707 snd_hda_codec_write_cache(codec, 0x01, 0,
5708 AC_VERB_SET_GPIO_DATA, 0);
5709 snd_hda_codec_write_cache(codec, 0x0f, 0,
5710 AC_VERB_SET_PIN_WIDGET_CONTROL,
5715 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5718 if ((res >> 26) == ALC880_HP_EVENT)
5719 alc260_replacer_672v_automute(codec);
5722 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5723 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5724 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5725 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5726 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5727 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5728 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5729 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5730 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5731 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5732 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5736 /* Test configuration for debugging, modelled after the ALC880 test
5739 #ifdef CONFIG_SND_DEBUG
5740 static hda_nid_t alc260_test_dac_nids[1] = {
5743 static hda_nid_t alc260_test_adc_nids[2] = {
5746 /* For testing the ALC260, each input MUX needs its own definition since
5747 * the signal assignments are different. This assumes that the first ADC
5750 static struct hda_input_mux alc260_test_capture_sources[2] = {
5754 { "MIC1 pin", 0x0 },
5755 { "MIC2 pin", 0x1 },
5756 { "LINE1 pin", 0x2 },
5757 { "LINE2 pin", 0x3 },
5759 { "LINE-OUT pin", 0x5 },
5760 { "HP-OUT pin", 0x6 },
5766 { "MIC1 pin", 0x0 },
5767 { "MIC2 pin", 0x1 },
5768 { "LINE1 pin", 0x2 },
5769 { "LINE2 pin", 0x3 },
5772 { "LINE-OUT pin", 0x6 },
5773 { "HP-OUT pin", 0x7 },
5777 static struct snd_kcontrol_new alc260_test_mixer[] = {
5778 /* Output driver widgets */
5779 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5780 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5781 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5782 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5783 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5784 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5786 /* Modes for retasking pin widgets
5787 * Note: the ALC260 doesn't seem to act on requests to enable mic
5788 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5789 * mention this restriction. At this stage it's not clear whether
5790 * this behaviour is intentional or is a hardware bug in chip
5791 * revisions available at least up until early 2006. Therefore for
5792 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5793 * choices, but if it turns out that the lack of mic bias for these
5794 * NIDs is intentional we could change their modes from
5795 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5797 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5798 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5799 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5800 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5801 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5802 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5804 /* Loopback mixer controls */
5805 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5806 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5807 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5808 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5809 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5810 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5811 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5812 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5813 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5814 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5815 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5816 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5817 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5818 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5820 /* Controls for GPIO pins, assuming they are configured as outputs */
5821 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5822 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5823 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5824 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5826 /* Switches to allow the digital IO pins to be enabled. The datasheet
5827 * is ambigious as to which NID is which; testing on laptops which
5828 * make this output available should provide clarification.
5830 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5831 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5833 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5834 * this output to turn on an external amplifier.
5836 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5837 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5841 static struct hda_verb alc260_test_init_verbs[] = {
5842 /* Enable all GPIOs as outputs with an initial value of 0 */
5843 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5844 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5845 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5847 /* Enable retasking pins as output, initially without power amp */
5848 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5849 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5850 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5851 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5852 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5853 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5855 /* Disable digital (SPDIF) pins initially, but users can enable
5856 * them via a mixer switch. In the case of SPDIF-out, this initverb
5857 * payload also sets the generation to 0, output to be in "consumer"
5858 * PCM format, copyright asserted, no pre-emphasis and no validity
5861 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5862 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5864 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5865 * OUT1 sum bus when acting as an output.
5867 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5868 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5869 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5870 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5872 /* Start with output sum widgets muted and their output gains at min */
5873 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5874 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5875 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5876 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5877 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5878 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5879 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5880 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5881 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5883 /* Unmute retasking pin widget output buffers since the default
5884 * state appears to be output. As the pin mode is changed by the
5885 * user the pin mode control will take care of enabling the pin's
5886 * input/output buffers as needed.
5888 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5889 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5890 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5891 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5892 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5893 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5894 /* Also unmute the mono-out pin widget */
5895 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5897 /* Mute capture amp left and right */
5898 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5899 /* Set ADC connection select to match default mixer setting (mic1
5902 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5904 /* Do the same for the second ADC: mute capture input amp and
5905 * set ADC connection to mic1 pin
5907 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5908 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5910 /* Mute all inputs to mixer widget (even unconnected ones) */
5911 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5912 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5913 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5914 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5915 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5917 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5918 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5924 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5925 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5927 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5928 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5931 * for BIOS auto-configuration
5934 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5935 const char *pfx, int *vol_bits)
5938 unsigned long vol_val, sw_val;
5942 if (nid >= 0x0f && nid < 0x11) {
5943 nid_vol = nid - 0x7;
5944 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5945 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5946 } else if (nid == 0x11) {
5947 nid_vol = nid - 0x7;
5948 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5949 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5950 } else if (nid >= 0x12 && nid <= 0x15) {
5952 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5953 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5957 if (!(*vol_bits & (1 << nid_vol))) {
5958 /* first control for the volume widget */
5959 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5960 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5963 *vol_bits |= (1 << nid_vol);
5965 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5966 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5972 /* add playback controls from the parsed DAC table */
5973 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5974 const struct auto_pin_cfg *cfg)
5980 spec->multiout.num_dacs = 1;
5981 spec->multiout.dac_nids = spec->private_dac_nids;
5982 spec->multiout.dac_nids[0] = 0x02;
5984 nid = cfg->line_out_pins[0];
5986 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5991 nid = cfg->speaker_pins[0];
5993 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5998 nid = cfg->hp_pins[0];
6000 err = alc260_add_playback_controls(spec, nid, "Headphone",
6008 /* create playback/capture controls for input pins */
6009 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
6010 const struct auto_pin_cfg *cfg)
6012 struct hda_input_mux *imux = &spec->private_imux[0];
6015 for (i = 0; i < AUTO_PIN_LAST; i++) {
6016 if (cfg->input_pins[i] >= 0x12) {
6017 idx = cfg->input_pins[i] - 0x12;
6018 err = new_analog_input(spec, cfg->input_pins[i],
6019 auto_pin_cfg_labels[i], idx,
6023 imux->items[imux->num_items].label =
6024 auto_pin_cfg_labels[i];
6025 imux->items[imux->num_items].index = idx;
6028 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
6029 idx = cfg->input_pins[i] - 0x09;
6030 err = new_analog_input(spec, cfg->input_pins[i],
6031 auto_pin_cfg_labels[i], idx,
6035 imux->items[imux->num_items].label =
6036 auto_pin_cfg_labels[i];
6037 imux->items[imux->num_items].index = idx;
6044 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6045 hda_nid_t nid, int pin_type,
6048 alc_set_pin_output(codec, nid, pin_type);
6049 /* need the manual connection? */
6051 int idx = nid - 0x12;
6052 snd_hda_codec_write(codec, idx + 0x0b, 0,
6053 AC_VERB_SET_CONNECT_SEL, sel_idx);
6057 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6059 struct alc_spec *spec = codec->spec;
6062 nid = spec->autocfg.line_out_pins[0];
6064 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6065 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6068 nid = spec->autocfg.speaker_pins[0];
6070 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6072 nid = spec->autocfg.hp_pins[0];
6074 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6077 #define ALC260_PIN_CD_NID 0x16
6078 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6080 struct alc_spec *spec = codec->spec;
6083 for (i = 0; i < AUTO_PIN_LAST; i++) {
6084 hda_nid_t nid = spec->autocfg.input_pins[i];
6086 alc_set_input_pin(codec, nid, i);
6087 if (nid != ALC260_PIN_CD_NID &&
6088 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6089 snd_hda_codec_write(codec, nid, 0,
6090 AC_VERB_SET_AMP_GAIN_MUTE,
6097 * generic initialization of ADC, input mixers and output mixers
6099 static struct hda_verb alc260_volume_init_verbs[] = {
6101 * Unmute ADC0-1 and set the default input to mic-in
6103 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6104 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6105 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6106 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6108 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6110 * Note: PASD motherboards uses the Line In 2 as the input for
6111 * front panel mic (mic 2)
6113 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6114 /* mute analog inputs */
6115 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6118 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6119 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6122 * Set up output mixers (0x08 - 0x0a)
6124 /* set vol=0 to output mixers */
6125 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6126 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6127 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6128 /* set up input amps for analog loopback */
6129 /* Amp Indices: DAC = 0, mixer = 1 */
6130 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6131 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6132 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6133 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6134 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6135 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6140 static int alc260_parse_auto_config(struct hda_codec *codec)
6142 struct alc_spec *spec = codec->spec;
6144 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6146 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6150 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6153 if (!spec->kctls.list)
6154 return 0; /* can't find valid BIOS pin config */
6155 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
6159 spec->multiout.max_channels = 2;
6161 if (spec->autocfg.dig_outs)
6162 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6163 if (spec->kctls.list)
6164 add_mixer(spec, spec->kctls.list);
6166 add_verb(spec, alc260_volume_init_verbs);
6168 spec->num_mux_defs = 1;
6169 spec->input_mux = &spec->private_imux[0];
6171 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6176 /* additional initialization for auto-configuration model */
6177 static void alc260_auto_init(struct hda_codec *codec)
6179 struct alc_spec *spec = codec->spec;
6180 alc260_auto_init_multi_out(codec);
6181 alc260_auto_init_analog_input(codec);
6182 if (spec->unsol_event)
6183 alc_inithook(codec);
6186 #ifdef CONFIG_SND_HDA_POWER_SAVE
6187 static struct hda_amp_list alc260_loopbacks[] = {
6188 { 0x07, HDA_INPUT, 0 },
6189 { 0x07, HDA_INPUT, 1 },
6190 { 0x07, HDA_INPUT, 2 },
6191 { 0x07, HDA_INPUT, 3 },
6192 { 0x07, HDA_INPUT, 4 },
6198 * ALC260 configurations
6200 static const char *alc260_models[ALC260_MODEL_LAST] = {
6201 [ALC260_BASIC] = "basic",
6203 [ALC260_HP_3013] = "hp-3013",
6204 [ALC260_HP_DC7600] = "hp-dc7600",
6205 [ALC260_FUJITSU_S702X] = "fujitsu",
6206 [ALC260_ACER] = "acer",
6207 [ALC260_WILL] = "will",
6208 [ALC260_REPLACER_672V] = "replacer",
6209 [ALC260_FAVORIT100] = "favorit100",
6210 #ifdef CONFIG_SND_DEBUG
6211 [ALC260_TEST] = "test",
6213 [ALC260_AUTO] = "auto",
6216 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6217 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6218 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6219 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6220 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6221 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6222 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6223 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6224 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6225 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6226 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6227 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6228 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6229 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6230 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6231 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6232 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6233 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6234 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6235 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6239 static struct alc_config_preset alc260_presets[] = {
6241 .mixers = { alc260_base_output_mixer,
6242 alc260_input_mixer },
6243 .init_verbs = { alc260_init_verbs },
6244 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6245 .dac_nids = alc260_dac_nids,
6246 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6247 .adc_nids = alc260_adc_nids,
6248 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6249 .channel_mode = alc260_modes,
6250 .input_mux = &alc260_capture_source,
6253 .mixers = { alc260_hp_output_mixer,
6254 alc260_input_mixer },
6255 .init_verbs = { alc260_init_verbs,
6256 alc260_hp_unsol_verbs },
6257 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6258 .dac_nids = alc260_dac_nids,
6259 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6260 .adc_nids = alc260_adc_nids_alt,
6261 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6262 .channel_mode = alc260_modes,
6263 .input_mux = &alc260_capture_source,
6264 .unsol_event = alc260_hp_unsol_event,
6265 .init_hook = alc260_hp_automute,
6267 [ALC260_HP_DC7600] = {
6268 .mixers = { alc260_hp_dc7600_mixer,
6269 alc260_input_mixer },
6270 .init_verbs = { alc260_init_verbs,
6271 alc260_hp_dc7600_verbs },
6272 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6273 .dac_nids = alc260_dac_nids,
6274 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6275 .adc_nids = alc260_adc_nids_alt,
6276 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6277 .channel_mode = alc260_modes,
6278 .input_mux = &alc260_capture_source,
6279 .unsol_event = alc260_hp_3012_unsol_event,
6280 .init_hook = alc260_hp_3012_automute,
6282 [ALC260_HP_3013] = {
6283 .mixers = { alc260_hp_3013_mixer,
6284 alc260_input_mixer },
6285 .init_verbs = { alc260_hp_3013_init_verbs,
6286 alc260_hp_3013_unsol_verbs },
6287 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6288 .dac_nids = alc260_dac_nids,
6289 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6290 .adc_nids = alc260_adc_nids_alt,
6291 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6292 .channel_mode = alc260_modes,
6293 .input_mux = &alc260_capture_source,
6294 .unsol_event = alc260_hp_3013_unsol_event,
6295 .init_hook = alc260_hp_3013_automute,
6297 [ALC260_FUJITSU_S702X] = {
6298 .mixers = { alc260_fujitsu_mixer },
6299 .init_verbs = { alc260_fujitsu_init_verbs },
6300 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6301 .dac_nids = alc260_dac_nids,
6302 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6303 .adc_nids = alc260_dual_adc_nids,
6304 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6305 .channel_mode = alc260_modes,
6306 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6307 .input_mux = alc260_fujitsu_capture_sources,
6310 .mixers = { alc260_acer_mixer },
6311 .init_verbs = { alc260_acer_init_verbs },
6312 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6313 .dac_nids = alc260_dac_nids,
6314 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6315 .adc_nids = alc260_dual_adc_nids,
6316 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6317 .channel_mode = alc260_modes,
6318 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6319 .input_mux = alc260_acer_capture_sources,
6321 [ALC260_FAVORIT100] = {
6322 .mixers = { alc260_favorit100_mixer },
6323 .init_verbs = { alc260_favorit100_init_verbs },
6324 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6325 .dac_nids = alc260_dac_nids,
6326 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6327 .adc_nids = alc260_dual_adc_nids,
6328 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6329 .channel_mode = alc260_modes,
6330 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6331 .input_mux = alc260_favorit100_capture_sources,
6334 .mixers = { alc260_will_mixer },
6335 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6336 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6337 .dac_nids = alc260_dac_nids,
6338 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6339 .adc_nids = alc260_adc_nids,
6340 .dig_out_nid = ALC260_DIGOUT_NID,
6341 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6342 .channel_mode = alc260_modes,
6343 .input_mux = &alc260_capture_source,
6345 [ALC260_REPLACER_672V] = {
6346 .mixers = { alc260_replacer_672v_mixer },
6347 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6348 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6349 .dac_nids = alc260_dac_nids,
6350 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6351 .adc_nids = alc260_adc_nids,
6352 .dig_out_nid = ALC260_DIGOUT_NID,
6353 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6354 .channel_mode = alc260_modes,
6355 .input_mux = &alc260_capture_source,
6356 .unsol_event = alc260_replacer_672v_unsol_event,
6357 .init_hook = alc260_replacer_672v_automute,
6359 #ifdef CONFIG_SND_DEBUG
6361 .mixers = { alc260_test_mixer },
6362 .init_verbs = { alc260_test_init_verbs },
6363 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6364 .dac_nids = alc260_test_dac_nids,
6365 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6366 .adc_nids = alc260_test_adc_nids,
6367 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6368 .channel_mode = alc260_modes,
6369 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6370 .input_mux = alc260_test_capture_sources,
6375 static int patch_alc260(struct hda_codec *codec)
6377 struct alc_spec *spec;
6378 int err, board_config;
6380 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6386 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6389 if (board_config < 0) {
6390 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6392 board_config = ALC260_AUTO;
6395 if (board_config == ALC260_AUTO) {
6396 /* automatic parse from the BIOS config */
6397 err = alc260_parse_auto_config(codec);
6403 "hda_codec: Cannot set up configuration "
6404 "from BIOS. Using base mode...\n");
6405 board_config = ALC260_BASIC;
6409 err = snd_hda_attach_beep_device(codec, 0x1);
6415 if (board_config != ALC260_AUTO)
6416 setup_preset(codec, &alc260_presets[board_config]);
6418 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6419 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6421 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6422 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6424 if (!spec->adc_nids && spec->input_mux) {
6425 /* check whether NID 0x04 is valid */
6426 unsigned int wcap = get_wcaps(codec, 0x04);
6427 wcap = get_wcaps_type(wcap);
6429 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6430 spec->adc_nids = alc260_adc_nids_alt;
6431 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6433 spec->adc_nids = alc260_adc_nids;
6434 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6437 set_capture_mixer(codec);
6438 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6440 spec->vmaster_nid = 0x08;
6442 codec->patch_ops = alc_patch_ops;
6443 if (board_config == ALC260_AUTO)
6444 spec->init_hook = alc260_auto_init;
6445 #ifdef CONFIG_SND_HDA_POWER_SAVE
6446 if (!spec->loopback.amplist)
6447 spec->loopback.amplist = alc260_loopbacks;
6449 codec->proc_widget_hook = print_realtek_coef;
6456 * ALC882/883/885/888/889 support
6458 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6459 * configuration. Each pin widget can choose any input DACs and a mixer.
6460 * Each ADC is connected from a mixer of all inputs. This makes possible
6461 * 6-channel independent captures.
6463 * In addition, an independent DAC for the multi-playback (not used in this
6466 #define ALC882_DIGOUT_NID 0x06
6467 #define ALC882_DIGIN_NID 0x0a
6468 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6469 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6470 #define ALC1200_DIGOUT_NID 0x10
6473 static struct hda_channel_mode alc882_ch_modes[1] = {
6478 static hda_nid_t alc882_dac_nids[4] = {
6479 /* front, rear, clfe, rear_surr */
6480 0x02, 0x03, 0x04, 0x05
6482 #define alc883_dac_nids alc882_dac_nids
6485 #define alc882_adc_nids alc880_adc_nids
6486 #define alc882_adc_nids_alt alc880_adc_nids_alt
6487 #define alc883_adc_nids alc882_adc_nids_alt
6488 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6489 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6490 #define alc889_adc_nids alc880_adc_nids
6492 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6493 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6494 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6495 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6496 #define alc889_capsrc_nids alc882_capsrc_nids
6499 /* FIXME: should be a matrix-type input source selection */
6501 static struct hda_input_mux alc882_capture_source = {
6505 { "Front Mic", 0x1 },
6511 #define alc883_capture_source alc882_capture_source
6513 static struct hda_input_mux alc889_capture_source = {
6516 { "Front Mic", 0x0 },
6522 static struct hda_input_mux mb5_capture_source = {
6531 static struct hda_input_mux alc883_3stack_6ch_intel = {
6535 { "Front Mic", 0x0 },
6541 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6549 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6559 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6567 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6571 { "Front Mic", 0x1 },
6576 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6584 static struct hda_input_mux alc889A_mb31_capture_source = {
6588 /* Front Mic (0x01) unused */
6590 /* Line 2 (0x03) unused */
6591 /* CD (0x04) unsused? */
6598 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6605 static struct hda_verb alc882_3ST_ch2_init[] = {
6606 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6607 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6608 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6609 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6616 static struct hda_verb alc882_3ST_ch4_init[] = {
6617 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6618 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6619 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6620 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6621 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6628 static struct hda_verb alc882_3ST_ch6_init[] = {
6629 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6630 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6631 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6632 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6633 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6634 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6638 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6639 { 2, alc882_3ST_ch2_init },
6640 { 4, alc882_3ST_ch4_init },
6641 { 6, alc882_3ST_ch6_init },
6644 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6649 static struct hda_verb alc882_sixstack_ch6_init[] = {
6650 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6651 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6652 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6653 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6660 static struct hda_verb alc882_sixstack_ch8_init[] = {
6661 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6662 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6663 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6664 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6668 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6669 { 6, alc882_sixstack_ch6_init },
6670 { 8, alc882_sixstack_ch8_init },
6674 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6680 static struct hda_verb alc885_mbp_ch2_init[] = {
6681 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6682 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6683 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6690 static struct hda_verb alc885_mbp_ch6_init[] = {
6691 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6692 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6693 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6694 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6695 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6699 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6700 { 2, alc885_mbp_ch2_init },
6701 { 6, alc885_mbp_ch6_init },
6706 * Speakers/Woofer/HP = Front
6709 static struct hda_verb alc885_mb5_ch2_init[] = {
6710 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6711 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6717 * Speakers/HP = Front
6721 static struct hda_verb alc885_mb5_ch6_init[] = {
6722 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6723 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6724 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6728 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6729 { 2, alc885_mb5_ch2_init },
6730 { 6, alc885_mb5_ch6_init },
6737 static struct hda_verb alc883_4ST_ch2_init[] = {
6738 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6739 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6740 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6741 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6742 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6743 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6750 static struct hda_verb alc883_4ST_ch4_init[] = {
6751 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6752 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6753 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6754 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6755 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6756 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6757 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6764 static struct hda_verb alc883_4ST_ch6_init[] = {
6765 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6766 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6767 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6768 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6769 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6770 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6771 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6772 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6779 static struct hda_verb alc883_4ST_ch8_init[] = {
6780 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6781 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6782 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6783 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6784 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6785 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6786 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6787 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6788 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6792 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6793 { 2, alc883_4ST_ch2_init },
6794 { 4, alc883_4ST_ch4_init },
6795 { 6, alc883_4ST_ch6_init },
6796 { 8, alc883_4ST_ch8_init },
6803 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6804 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6805 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6806 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6807 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6814 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6815 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6816 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6817 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6818 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6819 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6826 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6827 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6828 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6829 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6830 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6831 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6832 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6836 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6837 { 2, alc883_3ST_ch2_intel_init },
6838 { 4, alc883_3ST_ch4_intel_init },
6839 { 6, alc883_3ST_ch6_intel_init },
6845 static struct hda_verb alc889_ch2_intel_init[] = {
6846 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6847 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6848 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6849 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6850 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6851 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6858 static struct hda_verb alc889_ch6_intel_init[] = {
6859 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6860 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6861 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6862 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6863 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6864 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6871 static struct hda_verb alc889_ch8_intel_init[] = {
6872 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6873 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6874 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6875 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6876 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6877 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6878 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6882 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6883 { 2, alc889_ch2_intel_init },
6884 { 6, alc889_ch6_intel_init },
6885 { 8, alc889_ch8_intel_init },
6891 static struct hda_verb alc883_sixstack_ch6_init[] = {
6892 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6893 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6894 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6895 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6902 static struct hda_verb alc883_sixstack_ch8_init[] = {
6903 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6904 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6905 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6906 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6910 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6911 { 6, alc883_sixstack_ch6_init },
6912 { 8, alc883_sixstack_ch8_init },
6916 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6917 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6919 static struct snd_kcontrol_new alc882_base_mixer[] = {
6920 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6921 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6922 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6923 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6924 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6925 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6926 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6927 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6928 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6929 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6930 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6931 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6932 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6933 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6934 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6936 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6937 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6938 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6939 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6940 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6944 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6945 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6946 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6947 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6948 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6949 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6950 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6951 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6952 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6953 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6954 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6958 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6959 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6960 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6961 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6962 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6963 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6964 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6965 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6966 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6968 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6970 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6971 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6972 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6976 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6977 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6978 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6979 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6980 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6981 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6982 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6983 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6984 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6985 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6989 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6990 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6991 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6992 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6993 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6994 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6995 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6996 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6999 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7000 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7001 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7002 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7006 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7007 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7009 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7010 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7011 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7012 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7013 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7014 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7015 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7016 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7017 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7018 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7019 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7022 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7026 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7027 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7028 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7029 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7030 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7031 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7032 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7033 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7034 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7035 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7036 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7040 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7042 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7043 .name = "Channel Mode",
7044 .info = alc_ch_mode_info,
7045 .get = alc_ch_mode_get,
7046 .put = alc_ch_mode_put,
7051 static struct hda_verb alc882_base_init_verbs[] = {
7052 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7053 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7054 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7055 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7057 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7058 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7059 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7061 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7062 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7063 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7065 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7066 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7067 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7069 /* mute analog input loopbacks */
7070 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7071 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7072 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7073 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7074 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7076 /* Front Pin: output 0 (0x0c) */
7077 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7078 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7079 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7080 /* Rear Pin: output 1 (0x0d) */
7081 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7082 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7083 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7084 /* CLFE Pin: output 2 (0x0e) */
7085 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7086 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7087 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7088 /* Side Pin: output 3 (0x0f) */
7089 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7090 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7091 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7092 /* Mic (rear) pin: input vref at 80% */
7093 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7094 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7095 /* Front Mic pin: input vref at 80% */
7096 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7097 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7098 /* Line In pin: input */
7099 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7100 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7101 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7102 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7103 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7104 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7105 /* CD pin widget for input */
7106 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7108 /* FIXME: use matrix-type input source selection */
7109 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7111 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7112 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7113 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7114 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7116 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7118 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7119 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7120 /* ADC2: mute amp left and right */
7121 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7122 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7123 /* ADC3: mute amp left and right */
7124 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7125 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7130 static struct hda_verb alc882_adc1_init_verbs[] = {
7131 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7132 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7133 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7134 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7135 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7136 /* ADC1: mute amp left and right */
7137 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7138 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7142 static struct hda_verb alc882_eapd_verbs[] = {
7143 /* change to EAPD mode */
7144 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7145 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7149 static struct hda_verb alc889_eapd_verbs[] = {
7150 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7151 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7155 static struct hda_verb alc_hp15_unsol_verbs[] = {
7156 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7157 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7161 static struct hda_verb alc885_init_verbs[] = {
7162 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7164 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7165 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7167 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7168 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7169 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7171 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7172 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7173 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7175 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7176 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7177 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7179 /* mute analog input loopbacks */
7180 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7181 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7182 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7184 /* Front HP Pin: output 0 (0x0c) */
7185 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7186 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7187 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7188 /* Front Pin: output 0 (0x0c) */
7189 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7190 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7191 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7192 /* Rear Pin: output 1 (0x0d) */
7193 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7194 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7195 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7196 /* CLFE Pin: output 2 (0x0e) */
7197 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7198 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7199 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7200 /* Side Pin: output 3 (0x0f) */
7201 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7202 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7203 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7204 /* Mic (rear) pin: input vref at 80% */
7205 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7206 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7207 /* Front Mic pin: input vref at 80% */
7208 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7209 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7210 /* Line In pin: input */
7211 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7212 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7214 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7216 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7217 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7218 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7220 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7221 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7222 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7224 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7225 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7226 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7227 /* ADC2: mute amp left and right */
7228 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7229 /* ADC3: mute amp left and right */
7230 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7235 static struct hda_verb alc885_init_input_verbs[] = {
7236 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7237 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7238 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7243 /* Unmute Selector 24h and set the default input to front mic */
7244 static struct hda_verb alc889_init_input_verbs[] = {
7245 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7246 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7251 #define alc883_init_verbs alc882_base_init_verbs
7254 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7255 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7256 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7257 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7258 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7259 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7260 /* FIXME: this looks suspicious...
7261 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7262 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7267 static struct hda_verb alc882_macpro_init_verbs[] = {
7268 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7269 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7270 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7271 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7272 /* Front Pin: output 0 (0x0c) */
7273 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7274 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7275 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7276 /* Front Mic pin: input vref at 80% */
7277 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7278 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7279 /* Speaker: output */
7280 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7281 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7282 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7283 /* Headphone output (output 0 - 0x0c) */
7284 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7285 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7286 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7288 /* FIXME: use matrix-type input source selection */
7289 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7290 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7291 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7292 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7293 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7294 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7296 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7297 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7299 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7301 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7303 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7304 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7305 /* ADC1: mute amp left and right */
7306 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7307 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7308 /* ADC2: mute amp left and right */
7309 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7310 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7311 /* ADC3: mute amp left and right */
7312 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7313 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7319 static struct hda_verb alc885_mb5_init_verbs[] = {
7321 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7322 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7323 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7324 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7326 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7327 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7328 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7329 /* Surround mixer */
7330 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7331 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7332 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7334 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7335 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7336 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7338 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7339 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7340 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7341 /* Front Pin (0x0c) */
7342 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7343 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7344 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7345 /* LFE Pin (0x0e) */
7346 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7347 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7348 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7350 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7351 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7352 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7353 /* Front Mic pin: input vref at 80% */
7354 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7355 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7357 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7358 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7360 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7361 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7362 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7367 /* Macbook Pro rev3 */
7368 static struct hda_verb alc885_mbp3_init_verbs[] = {
7369 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7370 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7371 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7374 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7375 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7376 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7377 /* Front Pin: output 0 (0x0c) */
7378 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7379 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7380 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7381 /* HP Pin: output 0 (0x0d) */
7382 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7383 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7384 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7385 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7386 /* Mic (rear) pin: input vref at 80% */
7387 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7388 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7389 /* Front Mic pin: input vref at 80% */
7390 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7391 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7392 /* Line In pin: use output 1 when in LineOut mode */
7393 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7394 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7395 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7397 /* FIXME: use matrix-type input source selection */
7398 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7399 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7400 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7401 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7402 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7403 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7405 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7406 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7407 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7408 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7412 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7413 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7414 /* ADC1: mute amp left and right */
7415 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7416 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7417 /* ADC2: mute amp left and right */
7418 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7419 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7420 /* ADC3: mute amp left and right */
7421 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7422 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7427 /* iMac 24 mixer. */
7428 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7429 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7430 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7434 /* iMac 24 init verbs. */
7435 static struct hda_verb alc885_imac24_init_verbs[] = {
7436 /* Internal speakers: output 0 (0x0c) */
7437 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7438 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7439 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7440 /* Internal speakers: output 0 (0x0c) */
7441 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7442 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7443 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7444 /* Headphone: output 0 (0x0c) */
7445 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7446 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7447 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7448 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7449 /* Front Mic: input vref at 80% */
7450 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7451 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7455 /* Toggle speaker-output according to the hp-jack state */
7456 static void alc885_imac24_setup(struct hda_codec *codec)
7458 struct alc_spec *spec = codec->spec;
7460 spec->autocfg.hp_pins[0] = 0x14;
7461 spec->autocfg.speaker_pins[0] = 0x18;
7462 spec->autocfg.speaker_pins[1] = 0x1a;
7465 static void alc885_mbp3_setup(struct hda_codec *codec)
7467 struct alc_spec *spec = codec->spec;
7469 spec->autocfg.hp_pins[0] = 0x15;
7470 spec->autocfg.speaker_pins[0] = 0x14;
7474 static struct hda_verb alc882_targa_verbs[] = {
7475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7476 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7478 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7479 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7481 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7482 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7483 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7485 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7489 /* toggle speaker-output according to the hp-jack state */
7490 static void alc882_targa_automute(struct hda_codec *codec)
7492 struct alc_spec *spec = codec->spec;
7493 alc_automute_amp(codec);
7494 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7495 spec->jack_present ? 1 : 3);
7498 static void alc882_targa_setup(struct hda_codec *codec)
7500 struct alc_spec *spec = codec->spec;
7502 spec->autocfg.hp_pins[0] = 0x14;
7503 spec->autocfg.speaker_pins[0] = 0x1b;
7506 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7508 if ((res >> 26) == ALC880_HP_EVENT)
7509 alc882_targa_automute(codec);
7512 static struct hda_verb alc882_asus_a7j_verbs[] = {
7513 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7514 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7516 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7517 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7518 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7520 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7521 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7522 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7524 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7525 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7526 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7530 static struct hda_verb alc882_asus_a7m_verbs[] = {
7531 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7532 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7534 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7535 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7536 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7538 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7539 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7540 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7542 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7543 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7544 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7548 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7550 unsigned int gpiostate, gpiomask, gpiodir;
7552 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7553 AC_VERB_GET_GPIO_DATA, 0);
7556 gpiostate |= (1 << pin);
7558 gpiostate &= ~(1 << pin);
7560 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7561 AC_VERB_GET_GPIO_MASK, 0);
7562 gpiomask |= (1 << pin);
7564 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7565 AC_VERB_GET_GPIO_DIRECTION, 0);
7566 gpiodir |= (1 << pin);
7569 snd_hda_codec_write(codec, codec->afg, 0,
7570 AC_VERB_SET_GPIO_MASK, gpiomask);
7571 snd_hda_codec_write(codec, codec->afg, 0,
7572 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7576 snd_hda_codec_write(codec, codec->afg, 0,
7577 AC_VERB_SET_GPIO_DATA, gpiostate);
7580 /* set up GPIO at initialization */
7581 static void alc885_macpro_init_hook(struct hda_codec *codec)
7583 alc882_gpio_mute(codec, 0, 0);
7584 alc882_gpio_mute(codec, 1, 0);
7587 /* set up GPIO and update auto-muting at initialization */
7588 static void alc885_imac24_init_hook(struct hda_codec *codec)
7590 alc885_macpro_init_hook(codec);
7591 alc_automute_amp(codec);
7595 * generic initialization of ADC, input mixers and output mixers
7597 static struct hda_verb alc883_auto_init_verbs[] = {
7599 * Unmute ADC0-2 and set the default input to mic-in
7601 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7602 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7603 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7604 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7606 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7608 * Note: PASD motherboards uses the Line In 2 as the input for
7609 * front panel mic (mic 2)
7611 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7615 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7616 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7619 * Set up output mixers (0x0c - 0x0f)
7621 /* set vol=0 to output mixers */
7622 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7623 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7624 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7625 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7626 /* set up input amps for analog loopback */
7627 /* Amp Indices: DAC = 0, mixer = 1 */
7628 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7629 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7630 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7631 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7632 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7633 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7634 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7635 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7636 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7637 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7639 /* FIXME: use matrix-type input source selection */
7640 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7642 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7643 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7644 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7645 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7647 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7648 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7650 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7655 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7656 static struct hda_verb alc889A_mb31_ch2_init[] = {
7657 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7658 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7659 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7660 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7664 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7665 static struct hda_verb alc889A_mb31_ch4_init[] = {
7666 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7667 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7668 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7669 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7673 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7674 static struct hda_verb alc889A_mb31_ch5_init[] = {
7675 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7676 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7677 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7678 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7682 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7683 static struct hda_verb alc889A_mb31_ch6_init[] = {
7684 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7685 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7686 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7687 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7691 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7692 { 2, alc889A_mb31_ch2_init },
7693 { 4, alc889A_mb31_ch4_init },
7694 { 5, alc889A_mb31_ch5_init },
7695 { 6, alc889A_mb31_ch6_init },
7698 static struct hda_verb alc883_medion_eapd_verbs[] = {
7699 /* eanable EAPD on medion laptop */
7700 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7701 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7705 #define alc883_base_mixer alc882_base_mixer
7707 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7708 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7709 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7710 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7711 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7712 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7713 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7714 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7715 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7716 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7717 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7718 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7719 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7720 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7724 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7725 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7726 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7727 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7728 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7729 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7730 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7731 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7732 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7733 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7734 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7738 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7739 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7740 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7741 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7742 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7743 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7744 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7745 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7746 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7747 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7748 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7752 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7753 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7754 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7755 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7756 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7757 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7758 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7759 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7760 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7761 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7762 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7763 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7764 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7765 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7769 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7770 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7771 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7772 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7773 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7774 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7775 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7776 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7777 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7778 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7779 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7780 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7781 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7782 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7783 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7784 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7785 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7786 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7787 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7788 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7792 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7793 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7794 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7795 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7796 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7797 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7799 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7800 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7801 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7802 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7803 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7804 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7805 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7806 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7807 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7808 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7809 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7810 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7811 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7812 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7816 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7817 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7818 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7819 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7820 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7821 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7823 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7824 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7825 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7826 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7827 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7828 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7829 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7830 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7832 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7833 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7834 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7835 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7836 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7840 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7841 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7842 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7843 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7844 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7845 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7846 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7847 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7848 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7849 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7850 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7851 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7852 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7853 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7854 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7855 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7856 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7857 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7858 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7859 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7863 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7864 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7865 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7866 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7867 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7868 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7869 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7870 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7871 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7872 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7873 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7874 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7875 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7876 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7877 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7878 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7883 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7884 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7885 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7886 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7887 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7888 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7889 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7890 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7891 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7892 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7893 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7894 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7898 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7899 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7900 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7901 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7902 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7903 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7904 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7905 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7906 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7910 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7911 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7912 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7913 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7914 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7915 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7916 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7917 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7918 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7919 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7923 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7924 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7926 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7927 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7928 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7929 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7930 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7931 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7932 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7936 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7937 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7938 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7939 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7940 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7941 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7942 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7943 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7944 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7948 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
7949 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7950 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7951 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7952 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
7953 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7954 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7955 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7956 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7957 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7958 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7959 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7963 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7964 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7965 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7966 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7967 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7968 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7969 0x0d, 1, 0x0, HDA_OUTPUT),
7970 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7971 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7972 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7973 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7974 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7975 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7976 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7977 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7978 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7979 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7980 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7981 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7982 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7983 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7984 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7988 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
7990 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7991 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7992 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7993 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7994 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
7996 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
7997 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
7998 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
7999 /* Output switches */
8000 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8001 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8002 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8004 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8005 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8007 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8008 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8009 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8010 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8014 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8015 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8016 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8017 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8018 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8019 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8020 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8024 static struct hda_bind_ctls alc883_bind_cap_vol = {
8025 .ops = &snd_hda_bind_vol,
8027 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8028 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8033 static struct hda_bind_ctls alc883_bind_cap_switch = {
8034 .ops = &snd_hda_bind_sw,
8036 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8037 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8042 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8043 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8044 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8045 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8046 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8047 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8048 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8049 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8050 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8054 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8055 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8056 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8058 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8059 /* .name = "Capture Source", */
8060 .name = "Input Source",
8062 .info = alc_mux_enum_info,
8063 .get = alc_mux_enum_get,
8064 .put = alc_mux_enum_put,
8069 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8071 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8072 .name = "Channel Mode",
8073 .info = alc_ch_mode_info,
8074 .get = alc_ch_mode_get,
8075 .put = alc_ch_mode_put,
8080 /* toggle speaker-output according to the hp-jack state */
8081 static void alc883_mitac_setup(struct hda_codec *codec)
8083 struct alc_spec *spec = codec->spec;
8085 spec->autocfg.hp_pins[0] = 0x15;
8086 spec->autocfg.speaker_pins[0] = 0x14;
8087 spec->autocfg.speaker_pins[1] = 0x17;
8090 /* auto-toggle front mic */
8092 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8094 unsigned int present;
8097 present = snd_hda_codec_read(codec, 0x18, 0,
8098 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8099 bits = present ? HDA_AMP_MUTE : 0;
8100 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8104 static struct hda_verb alc883_mitac_verbs[] = {
8106 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8107 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8109 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8110 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8112 /* enable unsolicited event */
8113 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8114 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8119 static struct hda_verb alc883_clevo_m720_verbs[] = {
8121 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8122 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8124 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8125 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8127 /* enable unsolicited event */
8128 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8129 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8134 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8136 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8137 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8139 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8140 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8142 /* enable unsolicited event */
8143 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8148 static struct hda_verb alc883_targa_verbs[] = {
8149 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8150 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8152 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8153 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8155 /* Connect Line-Out side jack (SPDIF) to Side */
8156 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8157 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8158 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8159 /* Connect Mic jack to CLFE */
8160 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8161 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8162 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8163 /* Connect Line-in jack to Surround */
8164 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8165 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8166 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8167 /* Connect HP out jack to Front */
8168 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8169 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8170 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8172 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8177 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8178 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8179 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8180 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8184 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8185 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8186 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8187 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8188 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8192 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8193 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8194 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8195 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8196 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8197 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8201 static struct hda_verb alc883_haier_w66_verbs[] = {
8202 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8203 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8205 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8207 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8208 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8209 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8210 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8214 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8215 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8216 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8217 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8218 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8219 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8220 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8221 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8222 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8226 static struct hda_verb alc888_6st_dell_verbs[] = {
8227 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8231 static struct hda_verb alc883_vaiott_verbs[] = {
8233 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8234 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8236 /* enable unsolicited event */
8237 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8242 static void alc888_3st_hp_setup(struct hda_codec *codec)
8244 struct alc_spec *spec = codec->spec;
8246 spec->autocfg.hp_pins[0] = 0x1b;
8247 spec->autocfg.speaker_pins[0] = 0x14;
8248 spec->autocfg.speaker_pins[1] = 0x16;
8249 spec->autocfg.speaker_pins[2] = 0x18;
8252 static struct hda_verb alc888_3st_hp_verbs[] = {
8253 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8254 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8255 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8256 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8263 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8264 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8265 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8266 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8267 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8274 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8275 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8276 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8277 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8278 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8279 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8286 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8287 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8288 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8289 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8290 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8291 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8292 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8296 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8297 { 2, alc888_3st_hp_2ch_init },
8298 { 4, alc888_3st_hp_4ch_init },
8299 { 6, alc888_3st_hp_6ch_init },
8302 /* toggle front-jack and RCA according to the hp-jack state */
8303 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8305 unsigned int present;
8307 present = snd_hda_codec_read(codec, 0x1b, 0,
8308 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8309 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8310 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8311 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8312 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8315 /* toggle RCA according to the front-jack state */
8316 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8318 unsigned int present;
8320 present = snd_hda_codec_read(codec, 0x14, 0,
8321 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8322 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8323 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8326 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8329 if ((res >> 26) == ALC880_HP_EVENT)
8330 alc888_lenovo_ms7195_front_automute(codec);
8331 if ((res >> 26) == ALC880_FRONT_EVENT)
8332 alc888_lenovo_ms7195_rca_automute(codec);
8335 static struct hda_verb alc883_medion_md2_verbs[] = {
8336 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8339 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8341 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8345 /* toggle speaker-output according to the hp-jack state */
8346 static void alc883_medion_md2_setup(struct hda_codec *codec)
8348 struct alc_spec *spec = codec->spec;
8350 spec->autocfg.hp_pins[0] = 0x14;
8351 spec->autocfg.speaker_pins[0] = 0x15;
8354 /* toggle speaker-output according to the hp-jack state */
8355 #define alc883_targa_init_hook alc882_targa_init_hook
8356 #define alc883_targa_unsol_event alc882_targa_unsol_event
8358 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8360 unsigned int present;
8362 present = snd_hda_codec_read(codec, 0x18, 0,
8363 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8364 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8365 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8368 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8370 struct alc_spec *spec = codec->spec;
8372 spec->autocfg.hp_pins[0] = 0x15;
8373 spec->autocfg.speaker_pins[0] = 0x14;
8376 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8378 alc_automute_amp(codec);
8379 alc883_clevo_m720_mic_automute(codec);
8382 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8385 switch (res >> 26) {
8386 case ALC880_MIC_EVENT:
8387 alc883_clevo_m720_mic_automute(codec);
8390 alc_automute_amp_unsol_event(codec, res);
8395 /* toggle speaker-output according to the hp-jack state */
8396 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8398 struct alc_spec *spec = codec->spec;
8400 spec->autocfg.hp_pins[0] = 0x14;
8401 spec->autocfg.speaker_pins[0] = 0x15;
8404 static void alc883_haier_w66_setup(struct hda_codec *codec)
8406 struct alc_spec *spec = codec->spec;
8408 spec->autocfg.hp_pins[0] = 0x1b;
8409 spec->autocfg.speaker_pins[0] = 0x14;
8412 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8414 unsigned int present;
8417 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8418 & AC_PINSENSE_PRESENCE;
8419 bits = present ? HDA_AMP_MUTE : 0;
8420 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8421 HDA_AMP_MUTE, bits);
8424 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8426 unsigned int present;
8429 present = snd_hda_codec_read(codec, 0x1b, 0,
8430 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8431 bits = present ? HDA_AMP_MUTE : 0;
8432 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8433 HDA_AMP_MUTE, bits);
8434 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8435 HDA_AMP_MUTE, bits);
8438 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8441 if ((res >> 26) == ALC880_HP_EVENT)
8442 alc883_lenovo_101e_all_automute(codec);
8443 if ((res >> 26) == ALC880_FRONT_EVENT)
8444 alc883_lenovo_101e_ispeaker_automute(codec);
8447 /* toggle speaker-output according to the hp-jack state */
8448 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8450 struct alc_spec *spec = codec->spec;
8452 spec->autocfg.hp_pins[0] = 0x14;
8453 spec->autocfg.speaker_pins[0] = 0x15;
8454 spec->autocfg.speaker_pins[1] = 0x16;
8457 static struct hda_verb alc883_acer_eapd_verbs[] = {
8458 /* HP Pin: output 0 (0x0c) */
8459 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8460 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8461 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8462 /* Front Pin: output 0 (0x0c) */
8463 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8464 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8465 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8466 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8467 /* eanable EAPD on medion laptop */
8468 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8469 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8470 /* enable unsolicited event */
8471 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8475 static void alc888_6st_dell_setup(struct hda_codec *codec)
8477 struct alc_spec *spec = codec->spec;
8479 spec->autocfg.hp_pins[0] = 0x1b;
8480 spec->autocfg.speaker_pins[0] = 0x14;
8481 spec->autocfg.speaker_pins[1] = 0x15;
8482 spec->autocfg.speaker_pins[2] = 0x16;
8483 spec->autocfg.speaker_pins[3] = 0x17;
8486 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8488 struct alc_spec *spec = codec->spec;
8490 spec->autocfg.hp_pins[0] = 0x1b;
8491 spec->autocfg.speaker_pins[0] = 0x14;
8492 spec->autocfg.speaker_pins[1] = 0x15;
8493 spec->autocfg.speaker_pins[2] = 0x16;
8494 spec->autocfg.speaker_pins[3] = 0x17;
8495 spec->autocfg.speaker_pins[4] = 0x1a;
8498 static void alc883_vaiott_setup(struct hda_codec *codec)
8500 struct alc_spec *spec = codec->spec;
8502 spec->autocfg.hp_pins[0] = 0x15;
8503 spec->autocfg.speaker_pins[0] = 0x14;
8504 spec->autocfg.speaker_pins[1] = 0x17;
8507 static struct hda_verb alc888_asus_m90v_verbs[] = {
8508 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8509 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8510 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8511 /* enable unsolicited event */
8512 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8513 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8517 static void alc883_mode2_setup(struct hda_codec *codec)
8519 struct alc_spec *spec = codec->spec;
8521 spec->autocfg.hp_pins[0] = 0x1b;
8522 spec->autocfg.speaker_pins[0] = 0x14;
8523 spec->autocfg.speaker_pins[1] = 0x15;
8524 spec->autocfg.speaker_pins[2] = 0x16;
8525 spec->ext_mic.pin = 0x18;
8526 spec->int_mic.pin = 0x19;
8527 spec->ext_mic.mux_idx = 0;
8528 spec->int_mic.mux_idx = 1;
8532 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8533 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8534 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8535 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8536 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8537 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8538 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8539 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8540 /* enable unsolicited event */
8541 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8545 static void alc883_eee1601_inithook(struct hda_codec *codec)
8547 struct alc_spec *spec = codec->spec;
8549 spec->autocfg.hp_pins[0] = 0x14;
8550 spec->autocfg.speaker_pins[0] = 0x1b;
8551 alc_automute_pin(codec);
8554 static struct hda_verb alc889A_mb31_verbs[] = {
8555 /* Init rear pin (used as headphone output) */
8556 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8557 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8558 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8559 /* Init line pin (used as output in 4ch and 6ch mode) */
8560 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8561 /* Init line 2 pin (used as headphone out by default) */
8562 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8563 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8567 /* Mute speakers according to the headphone jack state */
8568 static void alc889A_mb31_automute(struct hda_codec *codec)
8570 unsigned int present;
8572 /* Mute only in 2ch or 4ch mode */
8573 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8575 present = snd_hda_codec_read(codec, 0x15, 0,
8576 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8577 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8578 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8579 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8580 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8584 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8586 if ((res >> 26) == ALC880_HP_EVENT)
8587 alc889A_mb31_automute(codec);
8591 #ifdef CONFIG_SND_HDA_POWER_SAVE
8592 #define alc882_loopbacks alc880_loopbacks
8595 /* pcm configuration: identical with ALC880 */
8596 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8597 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8598 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8599 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8601 static hda_nid_t alc883_slave_dig_outs[] = {
8602 ALC1200_DIGOUT_NID, 0,
8605 static hda_nid_t alc1200_slave_dig_outs[] = {
8606 ALC883_DIGOUT_NID, 0,
8610 * configuration and preset
8612 static const char *alc882_models[ALC882_MODEL_LAST] = {
8613 [ALC882_3ST_DIG] = "3stack-dig",
8614 [ALC882_6ST_DIG] = "6stack-dig",
8615 [ALC882_ARIMA] = "arima",
8616 [ALC882_W2JC] = "w2jc",
8617 [ALC882_TARGA] = "targa",
8618 [ALC882_ASUS_A7J] = "asus-a7j",
8619 [ALC882_ASUS_A7M] = "asus-a7m",
8620 [ALC885_MACPRO] = "macpro",
8621 [ALC885_MB5] = "mb5",
8622 [ALC885_MBP3] = "mbp3",
8623 [ALC885_IMAC24] = "imac24",
8624 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8625 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8626 [ALC883_3ST_6ch] = "3stack-6ch",
8627 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8628 [ALC883_TARGA_DIG] = "targa-dig",
8629 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8630 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8631 [ALC883_ACER] = "acer",
8632 [ALC883_ACER_ASPIRE] = "acer-aspire",
8633 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8634 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8635 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8636 [ALC883_MEDION] = "medion",
8637 [ALC883_MEDION_MD2] = "medion-md2",
8638 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8639 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8640 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8641 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8642 [ALC888_LENOVO_SKY] = "lenovo-sky",
8643 [ALC883_HAIER_W66] = "haier-w66",
8644 [ALC888_3ST_HP] = "3stack-hp",
8645 [ALC888_6ST_DELL] = "6stack-dell",
8646 [ALC883_MITAC] = "mitac",
8647 [ALC883_CLEVO_M720] = "clevo-m720",
8648 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8649 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8650 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8651 [ALC889A_INTEL] = "intel-alc889a",
8652 [ALC889_INTEL] = "intel-x58",
8653 [ALC1200_ASUS_P5Q] = "asus-p5q",
8654 [ALC889A_MB31] = "mb31",
8655 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8656 [ALC882_AUTO] = "auto",
8659 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8660 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8662 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8663 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8664 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8665 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8666 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8667 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8668 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8669 ALC888_ACER_ASPIRE_4930G),
8670 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8671 ALC888_ACER_ASPIRE_4930G),
8672 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8673 ALC888_ACER_ASPIRE_8930G),
8674 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8675 ALC888_ACER_ASPIRE_8930G),
8676 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8677 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8678 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8679 ALC888_ACER_ASPIRE_6530G),
8680 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8681 ALC888_ACER_ASPIRE_6530G),
8682 /* default Acer -- disabled as it causes more problems.
8683 * model=auto should work fine now
8685 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8687 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8689 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8690 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8691 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8692 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8693 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8694 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8696 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8697 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8698 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8699 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8700 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8701 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8702 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8703 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8704 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8705 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8706 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8708 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8709 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8710 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8711 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8712 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8713 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8714 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8715 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8716 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8718 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8719 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8720 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8721 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8722 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8723 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8724 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8725 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8726 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8727 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8728 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8729 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8730 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8731 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8732 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8733 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8734 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8735 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8736 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8737 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8738 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8739 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8740 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8741 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8742 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8743 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8744 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8745 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8746 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8748 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8749 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8750 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8751 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8752 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8753 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8754 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8755 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8756 ALC883_FUJITSU_PI2515),
8757 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8758 ALC888_FUJITSU_XA3530),
8759 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8760 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8761 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8762 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8763 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8764 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8765 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8766 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8767 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8769 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8770 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8771 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8772 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8773 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8774 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8775 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8780 /* codec SSID table for Intel Mac */
8781 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8782 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8783 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8784 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8785 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8786 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8787 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8788 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8789 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8790 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8791 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8792 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8793 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8794 * no perfect solution yet
8796 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8800 static struct alc_config_preset alc882_presets[] = {
8801 [ALC882_3ST_DIG] = {
8802 .mixers = { alc882_base_mixer },
8803 .init_verbs = { alc882_base_init_verbs,
8804 alc882_adc1_init_verbs },
8805 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8806 .dac_nids = alc882_dac_nids,
8807 .dig_out_nid = ALC882_DIGOUT_NID,
8808 .dig_in_nid = ALC882_DIGIN_NID,
8809 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8810 .channel_mode = alc882_ch_modes,
8812 .input_mux = &alc882_capture_source,
8814 [ALC882_6ST_DIG] = {
8815 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8816 .init_verbs = { alc882_base_init_verbs,
8817 alc882_adc1_init_verbs },
8818 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8819 .dac_nids = alc882_dac_nids,
8820 .dig_out_nid = ALC882_DIGOUT_NID,
8821 .dig_in_nid = ALC882_DIGIN_NID,
8822 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8823 .channel_mode = alc882_sixstack_modes,
8824 .input_mux = &alc882_capture_source,
8827 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8828 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8829 alc882_eapd_verbs },
8830 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8831 .dac_nids = alc882_dac_nids,
8832 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8833 .channel_mode = alc882_sixstack_modes,
8834 .input_mux = &alc882_capture_source,
8837 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8838 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8839 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8840 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8841 .dac_nids = alc882_dac_nids,
8842 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8843 .channel_mode = alc880_threestack_modes,
8845 .input_mux = &alc882_capture_source,
8846 .dig_out_nid = ALC882_DIGOUT_NID,
8849 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8850 .init_verbs = { alc885_mbp3_init_verbs,
8851 alc880_gpio1_init_verbs },
8852 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8853 .dac_nids = alc882_dac_nids,
8854 .channel_mode = alc885_mbp_6ch_modes,
8855 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
8856 .input_mux = &alc882_capture_source,
8857 .dig_out_nid = ALC882_DIGOUT_NID,
8858 .dig_in_nid = ALC882_DIGIN_NID,
8859 .unsol_event = alc_automute_amp_unsol_event,
8860 .setup = alc885_mbp3_setup,
8861 .init_hook = alc_automute_amp,
8864 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8865 .init_verbs = { alc885_mb5_init_verbs,
8866 alc880_gpio1_init_verbs },
8867 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8868 .dac_nids = alc882_dac_nids,
8869 .channel_mode = alc885_mb5_6ch_modes,
8870 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8871 .input_mux = &mb5_capture_source,
8872 .dig_out_nid = ALC882_DIGOUT_NID,
8873 .dig_in_nid = ALC882_DIGIN_NID,
8876 .mixers = { alc882_macpro_mixer },
8877 .init_verbs = { alc882_macpro_init_verbs },
8878 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8879 .dac_nids = alc882_dac_nids,
8880 .dig_out_nid = ALC882_DIGOUT_NID,
8881 .dig_in_nid = ALC882_DIGIN_NID,
8882 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8883 .channel_mode = alc882_ch_modes,
8884 .input_mux = &alc882_capture_source,
8885 .init_hook = alc885_macpro_init_hook,
8888 .mixers = { alc885_imac24_mixer },
8889 .init_verbs = { alc885_imac24_init_verbs },
8890 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8891 .dac_nids = alc882_dac_nids,
8892 .dig_out_nid = ALC882_DIGOUT_NID,
8893 .dig_in_nid = ALC882_DIGIN_NID,
8894 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8895 .channel_mode = alc882_ch_modes,
8896 .input_mux = &alc882_capture_source,
8897 .unsol_event = alc_automute_amp_unsol_event,
8898 .setup = alc885_imac24_setup,
8899 .init_hook = alc885_imac24_init_hook,
8902 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
8903 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8904 alc880_gpio3_init_verbs, alc882_targa_verbs},
8905 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8906 .dac_nids = alc882_dac_nids,
8907 .dig_out_nid = ALC882_DIGOUT_NID,
8908 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8909 .adc_nids = alc882_adc_nids,
8910 .capsrc_nids = alc882_capsrc_nids,
8911 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8912 .channel_mode = alc882_3ST_6ch_modes,
8914 .input_mux = &alc882_capture_source,
8915 .unsol_event = alc882_targa_unsol_event,
8916 .setup = alc882_targa_setup,
8917 .init_hook = alc882_targa_automute,
8919 [ALC882_ASUS_A7J] = {
8920 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
8921 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8922 alc882_asus_a7j_verbs},
8923 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8924 .dac_nids = alc882_dac_nids,
8925 .dig_out_nid = ALC882_DIGOUT_NID,
8926 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8927 .adc_nids = alc882_adc_nids,
8928 .capsrc_nids = alc882_capsrc_nids,
8929 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8930 .channel_mode = alc882_3ST_6ch_modes,
8932 .input_mux = &alc882_capture_source,
8934 [ALC882_ASUS_A7M] = {
8935 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
8936 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8937 alc882_eapd_verbs, alc880_gpio1_init_verbs,
8938 alc882_asus_a7m_verbs },
8939 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8940 .dac_nids = alc882_dac_nids,
8941 .dig_out_nid = ALC882_DIGOUT_NID,
8942 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8943 .channel_mode = alc880_threestack_modes,
8945 .input_mux = &alc882_capture_source,
8947 [ALC883_3ST_2ch_DIG] = {
8948 .mixers = { alc883_3ST_2ch_mixer },
8949 .init_verbs = { alc883_init_verbs },
8950 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8951 .dac_nids = alc883_dac_nids,
8952 .dig_out_nid = ALC883_DIGOUT_NID,
8953 .dig_in_nid = ALC883_DIGIN_NID,
8954 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8955 .channel_mode = alc883_3ST_2ch_modes,
8956 .input_mux = &alc883_capture_source,
8958 [ALC883_3ST_6ch_DIG] = {
8959 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8960 .init_verbs = { alc883_init_verbs },
8961 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8962 .dac_nids = alc883_dac_nids,
8963 .dig_out_nid = ALC883_DIGOUT_NID,
8964 .dig_in_nid = ALC883_DIGIN_NID,
8965 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8966 .channel_mode = alc883_3ST_6ch_modes,
8968 .input_mux = &alc883_capture_source,
8970 [ALC883_3ST_6ch] = {
8971 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8972 .init_verbs = { alc883_init_verbs },
8973 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8974 .dac_nids = alc883_dac_nids,
8975 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8976 .channel_mode = alc883_3ST_6ch_modes,
8978 .input_mux = &alc883_capture_source,
8980 [ALC883_3ST_6ch_INTEL] = {
8981 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8982 .init_verbs = { alc883_init_verbs },
8983 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8984 .dac_nids = alc883_dac_nids,
8985 .dig_out_nid = ALC883_DIGOUT_NID,
8986 .dig_in_nid = ALC883_DIGIN_NID,
8987 .slave_dig_outs = alc883_slave_dig_outs,
8988 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8989 .channel_mode = alc883_3ST_6ch_intel_modes,
8991 .input_mux = &alc883_3stack_6ch_intel,
8994 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
8995 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
8996 alc_hp15_unsol_verbs },
8997 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8998 .dac_nids = alc883_dac_nids,
8999 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9000 .adc_nids = alc889_adc_nids,
9001 .dig_out_nid = ALC883_DIGOUT_NID,
9002 .dig_in_nid = ALC883_DIGIN_NID,
9003 .slave_dig_outs = alc883_slave_dig_outs,
9004 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9005 .channel_mode = alc889_8ch_intel_modes,
9006 .capsrc_nids = alc889_capsrc_nids,
9007 .input_mux = &alc889_capture_source,
9008 .setup = alc889_automute_setup,
9009 .init_hook = alc_automute_amp,
9010 .unsol_event = alc_automute_amp_unsol_event,
9014 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9015 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9016 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9017 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9018 .dac_nids = alc883_dac_nids,
9019 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9020 .adc_nids = alc889_adc_nids,
9021 .dig_out_nid = ALC883_DIGOUT_NID,
9022 .dig_in_nid = ALC883_DIGIN_NID,
9023 .slave_dig_outs = alc883_slave_dig_outs,
9024 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9025 .channel_mode = alc889_8ch_intel_modes,
9026 .capsrc_nids = alc889_capsrc_nids,
9027 .input_mux = &alc889_capture_source,
9028 .setup = alc889_automute_setup,
9029 .init_hook = alc889_intel_init_hook,
9030 .unsol_event = alc_automute_amp_unsol_event,
9033 [ALC883_6ST_DIG] = {
9034 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9035 .init_verbs = { alc883_init_verbs },
9036 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9037 .dac_nids = alc883_dac_nids,
9038 .dig_out_nid = ALC883_DIGOUT_NID,
9039 .dig_in_nid = ALC883_DIGIN_NID,
9040 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9041 .channel_mode = alc883_sixstack_modes,
9042 .input_mux = &alc883_capture_source,
9044 [ALC883_TARGA_DIG] = {
9045 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9046 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9047 alc883_targa_verbs},
9048 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9049 .dac_nids = alc883_dac_nids,
9050 .dig_out_nid = ALC883_DIGOUT_NID,
9051 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9052 .channel_mode = alc883_3ST_6ch_modes,
9054 .input_mux = &alc883_capture_source,
9055 .unsol_event = alc883_targa_unsol_event,
9056 .setup = alc882_targa_setup,
9057 .init_hook = alc882_targa_automute,
9059 [ALC883_TARGA_2ch_DIG] = {
9060 .mixers = { alc883_targa_2ch_mixer},
9061 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9062 alc883_targa_verbs},
9063 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9064 .dac_nids = alc883_dac_nids,
9065 .adc_nids = alc883_adc_nids_alt,
9066 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9067 .dig_out_nid = ALC883_DIGOUT_NID,
9068 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9069 .channel_mode = alc883_3ST_2ch_modes,
9070 .input_mux = &alc883_capture_source,
9071 .unsol_event = alc883_targa_unsol_event,
9072 .setup = alc882_targa_setup,
9073 .init_hook = alc882_targa_automute,
9075 [ALC883_TARGA_8ch_DIG] = {
9076 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9077 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9078 alc883_targa_verbs },
9079 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9080 .dac_nids = alc883_dac_nids,
9081 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9082 .adc_nids = alc883_adc_nids_rev,
9083 .capsrc_nids = alc883_capsrc_nids_rev,
9084 .dig_out_nid = ALC883_DIGOUT_NID,
9085 .dig_in_nid = ALC883_DIGIN_NID,
9086 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9087 .channel_mode = alc883_4ST_8ch_modes,
9089 .input_mux = &alc883_capture_source,
9090 .unsol_event = alc883_targa_unsol_event,
9091 .setup = alc882_targa_setup,
9092 .init_hook = alc882_targa_automute,
9095 .mixers = { alc883_base_mixer },
9096 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9097 * and the headphone jack. Turn this on and rely on the
9098 * standard mute methods whenever the user wants to turn
9099 * these outputs off.
9101 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9102 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9103 .dac_nids = alc883_dac_nids,
9104 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9105 .channel_mode = alc883_3ST_2ch_modes,
9106 .input_mux = &alc883_capture_source,
9108 [ALC883_ACER_ASPIRE] = {
9109 .mixers = { alc883_acer_aspire_mixer },
9110 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9111 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9112 .dac_nids = alc883_dac_nids,
9113 .dig_out_nid = ALC883_DIGOUT_NID,
9114 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9115 .channel_mode = alc883_3ST_2ch_modes,
9116 .input_mux = &alc883_capture_source,
9117 .unsol_event = alc_automute_amp_unsol_event,
9118 .setup = alc883_acer_aspire_setup,
9119 .init_hook = alc_automute_amp,
9121 [ALC888_ACER_ASPIRE_4930G] = {
9122 .mixers = { alc888_base_mixer,
9123 alc883_chmode_mixer },
9124 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9125 alc888_acer_aspire_4930g_verbs },
9126 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9127 .dac_nids = alc883_dac_nids,
9128 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9129 .adc_nids = alc883_adc_nids_rev,
9130 .capsrc_nids = alc883_capsrc_nids_rev,
9131 .dig_out_nid = ALC883_DIGOUT_NID,
9132 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9133 .channel_mode = alc883_3ST_6ch_modes,
9136 ARRAY_SIZE(alc888_2_capture_sources),
9137 .input_mux = alc888_2_capture_sources,
9138 .unsol_event = alc_automute_amp_unsol_event,
9139 .setup = alc888_acer_aspire_4930g_setup,
9140 .init_hook = alc_automute_amp,
9142 [ALC888_ACER_ASPIRE_6530G] = {
9143 .mixers = { alc888_acer_aspire_6530_mixer },
9144 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9145 alc888_acer_aspire_6530g_verbs },
9146 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9147 .dac_nids = alc883_dac_nids,
9148 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9149 .adc_nids = alc883_adc_nids_rev,
9150 .capsrc_nids = alc883_capsrc_nids_rev,
9151 .dig_out_nid = ALC883_DIGOUT_NID,
9152 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9153 .channel_mode = alc883_3ST_2ch_modes,
9155 ARRAY_SIZE(alc888_2_capture_sources),
9156 .input_mux = alc888_acer_aspire_6530_sources,
9157 .unsol_event = alc_automute_amp_unsol_event,
9158 .setup = alc888_acer_aspire_6530g_setup,
9159 .init_hook = alc_automute_amp,
9161 [ALC888_ACER_ASPIRE_8930G] = {
9162 .mixers = { alc888_base_mixer,
9163 alc883_chmode_mixer },
9164 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9165 alc889_acer_aspire_8930g_verbs },
9166 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9167 .dac_nids = alc883_dac_nids,
9168 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9169 .adc_nids = alc889_adc_nids,
9170 .capsrc_nids = alc889_capsrc_nids,
9171 .dig_out_nid = ALC883_DIGOUT_NID,
9172 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9173 .channel_mode = alc883_3ST_6ch_modes,
9175 .const_channel_count = 6,
9177 ARRAY_SIZE(alc889_capture_sources),
9178 .input_mux = alc889_capture_sources,
9179 .unsol_event = alc_automute_amp_unsol_event,
9180 .setup = alc889_acer_aspire_8930g_setup,
9181 .init_hook = alc_automute_amp,
9184 .mixers = { alc883_fivestack_mixer,
9185 alc883_chmode_mixer },
9186 .init_verbs = { alc883_init_verbs,
9187 alc883_medion_eapd_verbs },
9188 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9189 .dac_nids = alc883_dac_nids,
9190 .adc_nids = alc883_adc_nids_alt,
9191 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9192 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9193 .channel_mode = alc883_sixstack_modes,
9194 .input_mux = &alc883_capture_source,
9196 [ALC883_MEDION_MD2] = {
9197 .mixers = { alc883_medion_md2_mixer},
9198 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9199 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9200 .dac_nids = alc883_dac_nids,
9201 .dig_out_nid = ALC883_DIGOUT_NID,
9202 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9203 .channel_mode = alc883_3ST_2ch_modes,
9204 .input_mux = &alc883_capture_source,
9205 .unsol_event = alc_automute_amp_unsol_event,
9206 .setup = alc883_medion_md2_setup,
9207 .init_hook = alc_automute_amp,
9209 [ALC883_LAPTOP_EAPD] = {
9210 .mixers = { alc883_base_mixer },
9211 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9212 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9213 .dac_nids = alc883_dac_nids,
9214 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9215 .channel_mode = alc883_3ST_2ch_modes,
9216 .input_mux = &alc883_capture_source,
9218 [ALC883_CLEVO_M720] = {
9219 .mixers = { alc883_clevo_m720_mixer },
9220 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9221 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9222 .dac_nids = alc883_dac_nids,
9223 .dig_out_nid = ALC883_DIGOUT_NID,
9224 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9225 .channel_mode = alc883_3ST_2ch_modes,
9226 .input_mux = &alc883_capture_source,
9227 .unsol_event = alc883_clevo_m720_unsol_event,
9228 .setup = alc883_clevo_m720_setup,
9229 .init_hook = alc883_clevo_m720_init_hook,
9231 [ALC883_LENOVO_101E_2ch] = {
9232 .mixers = { alc883_lenovo_101e_2ch_mixer},
9233 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9234 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9235 .dac_nids = alc883_dac_nids,
9236 .adc_nids = alc883_adc_nids_alt,
9237 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9238 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9239 .channel_mode = alc883_3ST_2ch_modes,
9240 .input_mux = &alc883_lenovo_101e_capture_source,
9241 .unsol_event = alc883_lenovo_101e_unsol_event,
9242 .init_hook = alc883_lenovo_101e_all_automute,
9244 [ALC883_LENOVO_NB0763] = {
9245 .mixers = { alc883_lenovo_nb0763_mixer },
9246 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9247 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9248 .dac_nids = alc883_dac_nids,
9249 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9250 .channel_mode = alc883_3ST_2ch_modes,
9252 .input_mux = &alc883_lenovo_nb0763_capture_source,
9253 .unsol_event = alc_automute_amp_unsol_event,
9254 .setup = alc883_medion_md2_setup,
9255 .init_hook = alc_automute_amp,
9257 [ALC888_LENOVO_MS7195_DIG] = {
9258 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9259 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9260 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9261 .dac_nids = alc883_dac_nids,
9262 .dig_out_nid = ALC883_DIGOUT_NID,
9263 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9264 .channel_mode = alc883_3ST_6ch_modes,
9266 .input_mux = &alc883_capture_source,
9267 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9268 .init_hook = alc888_lenovo_ms7195_front_automute,
9270 [ALC883_HAIER_W66] = {
9271 .mixers = { alc883_targa_2ch_mixer},
9272 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9273 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9274 .dac_nids = alc883_dac_nids,
9275 .dig_out_nid = ALC883_DIGOUT_NID,
9276 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9277 .channel_mode = alc883_3ST_2ch_modes,
9278 .input_mux = &alc883_capture_source,
9279 .unsol_event = alc_automute_amp_unsol_event,
9280 .setup = alc883_haier_w66_setup,
9281 .init_hook = alc_automute_amp,
9284 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9285 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9286 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9287 .dac_nids = alc883_dac_nids,
9288 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9289 .channel_mode = alc888_3st_hp_modes,
9291 .input_mux = &alc883_capture_source,
9292 .unsol_event = alc_automute_amp_unsol_event,
9293 .setup = alc888_3st_hp_setup,
9294 .init_hook = alc_automute_amp,
9296 [ALC888_6ST_DELL] = {
9297 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9298 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9299 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9300 .dac_nids = alc883_dac_nids,
9301 .dig_out_nid = ALC883_DIGOUT_NID,
9302 .dig_in_nid = ALC883_DIGIN_NID,
9303 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9304 .channel_mode = alc883_sixstack_modes,
9305 .input_mux = &alc883_capture_source,
9306 .unsol_event = alc_automute_amp_unsol_event,
9307 .setup = alc888_6st_dell_setup,
9308 .init_hook = alc_automute_amp,
9311 .mixers = { alc883_mitac_mixer },
9312 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9313 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9314 .dac_nids = alc883_dac_nids,
9315 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9316 .channel_mode = alc883_3ST_2ch_modes,
9317 .input_mux = &alc883_capture_source,
9318 .unsol_event = alc_automute_amp_unsol_event,
9319 .setup = alc883_mitac_setup,
9320 .init_hook = alc_automute_amp,
9322 [ALC883_FUJITSU_PI2515] = {
9323 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9324 .init_verbs = { alc883_init_verbs,
9325 alc883_2ch_fujitsu_pi2515_verbs},
9326 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9327 .dac_nids = alc883_dac_nids,
9328 .dig_out_nid = ALC883_DIGOUT_NID,
9329 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9330 .channel_mode = alc883_3ST_2ch_modes,
9331 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9332 .unsol_event = alc_automute_amp_unsol_event,
9333 .setup = alc883_2ch_fujitsu_pi2515_setup,
9334 .init_hook = alc_automute_amp,
9336 [ALC888_FUJITSU_XA3530] = {
9337 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9338 .init_verbs = { alc883_init_verbs,
9339 alc888_fujitsu_xa3530_verbs },
9340 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9341 .dac_nids = alc883_dac_nids,
9342 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9343 .adc_nids = alc883_adc_nids_rev,
9344 .capsrc_nids = alc883_capsrc_nids_rev,
9345 .dig_out_nid = ALC883_DIGOUT_NID,
9346 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9347 .channel_mode = alc888_4ST_8ch_intel_modes,
9349 ARRAY_SIZE(alc888_2_capture_sources),
9350 .input_mux = alc888_2_capture_sources,
9351 .unsol_event = alc_automute_amp_unsol_event,
9352 .setup = alc888_fujitsu_xa3530_setup,
9353 .init_hook = alc_automute_amp,
9355 [ALC888_LENOVO_SKY] = {
9356 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9357 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9358 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9359 .dac_nids = alc883_dac_nids,
9360 .dig_out_nid = ALC883_DIGOUT_NID,
9361 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9362 .channel_mode = alc883_sixstack_modes,
9364 .input_mux = &alc883_lenovo_sky_capture_source,
9365 .unsol_event = alc_automute_amp_unsol_event,
9366 .setup = alc888_lenovo_sky_setup,
9367 .init_hook = alc_automute_amp,
9369 [ALC888_ASUS_M90V] = {
9370 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9371 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9372 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9373 .dac_nids = alc883_dac_nids,
9374 .dig_out_nid = ALC883_DIGOUT_NID,
9375 .dig_in_nid = ALC883_DIGIN_NID,
9376 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9377 .channel_mode = alc883_3ST_6ch_modes,
9379 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9380 .unsol_event = alc_sku_unsol_event,
9381 .setup = alc883_mode2_setup,
9382 .init_hook = alc_inithook,
9384 [ALC888_ASUS_EEE1601] = {
9385 .mixers = { alc883_asus_eee1601_mixer },
9386 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9387 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9388 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9389 .dac_nids = alc883_dac_nids,
9390 .dig_out_nid = ALC883_DIGOUT_NID,
9391 .dig_in_nid = ALC883_DIGIN_NID,
9392 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9393 .channel_mode = alc883_3ST_2ch_modes,
9395 .input_mux = &alc883_asus_eee1601_capture_source,
9396 .unsol_event = alc_sku_unsol_event,
9397 .init_hook = alc883_eee1601_inithook,
9399 [ALC1200_ASUS_P5Q] = {
9400 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9401 .init_verbs = { alc883_init_verbs },
9402 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9403 .dac_nids = alc883_dac_nids,
9404 .dig_out_nid = ALC1200_DIGOUT_NID,
9405 .dig_in_nid = ALC883_DIGIN_NID,
9406 .slave_dig_outs = alc1200_slave_dig_outs,
9407 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9408 .channel_mode = alc883_sixstack_modes,
9409 .input_mux = &alc883_capture_source,
9412 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9413 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9414 alc880_gpio1_init_verbs },
9415 .adc_nids = alc883_adc_nids,
9416 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9417 .dac_nids = alc883_dac_nids,
9418 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9419 .channel_mode = alc889A_mb31_6ch_modes,
9420 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9421 .input_mux = &alc889A_mb31_capture_source,
9422 .dig_out_nid = ALC883_DIGOUT_NID,
9423 .unsol_event = alc889A_mb31_unsol_event,
9424 .init_hook = alc889A_mb31_automute,
9426 [ALC883_SONY_VAIO_TT] = {
9427 .mixers = { alc883_vaiott_mixer },
9428 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9429 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9430 .dac_nids = alc883_dac_nids,
9431 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9432 .channel_mode = alc883_3ST_2ch_modes,
9433 .input_mux = &alc883_capture_source,
9434 .unsol_event = alc_automute_amp_unsol_event,
9435 .setup = alc883_vaiott_setup,
9436 .init_hook = alc_automute_amp,
9445 PINFIX_ABIT_AW9D_MAX
9448 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9449 { 0x15, 0x01080104 }, /* side */
9450 { 0x16, 0x01011012 }, /* rear */
9451 { 0x17, 0x01016011 }, /* clfe */
9455 static const struct alc_pincfg *alc882_pin_fixes[] = {
9456 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
9459 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
9460 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9465 * BIOS auto configuration
9467 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9468 hda_nid_t nid, int pin_type,
9472 struct alc_spec *spec = codec->spec;
9475 alc_set_pin_output(codec, nid, pin_type);
9476 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9479 idx = spec->multiout.dac_nids[dac_idx] - 2;
9480 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9484 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9486 struct alc_spec *spec = codec->spec;
9489 for (i = 0; i <= HDA_SIDE; i++) {
9490 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9491 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9493 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9498 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9500 struct alc_spec *spec = codec->spec;
9503 pin = spec->autocfg.hp_pins[0];
9504 if (pin) /* connect to front */
9506 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9507 pin = spec->autocfg.speaker_pins[0];
9509 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9512 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9514 struct alc_spec *spec = codec->spec;
9517 for (i = 0; i < AUTO_PIN_LAST; i++) {
9518 hda_nid_t nid = spec->autocfg.input_pins[i];
9521 alc_set_input_pin(codec, nid, i);
9522 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9523 snd_hda_codec_write(codec, nid, 0,
9524 AC_VERB_SET_AMP_GAIN_MUTE,
9529 static void alc882_auto_init_input_src(struct hda_codec *codec)
9531 struct alc_spec *spec = codec->spec;
9534 for (c = 0; c < spec->num_adc_nids; c++) {
9535 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9536 hda_nid_t nid = spec->capsrc_nids[c];
9537 unsigned int mux_idx;
9538 const struct hda_input_mux *imux;
9539 int conns, mute, idx, item;
9541 conns = snd_hda_get_connections(codec, nid, conn_list,
9542 ARRAY_SIZE(conn_list));
9545 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9546 imux = &spec->input_mux[mux_idx];
9547 for (idx = 0; idx < conns; idx++) {
9548 /* if the current connection is the selected one,
9549 * unmute it as default - otherwise mute it
9551 mute = AMP_IN_MUTE(idx);
9552 for (item = 0; item < imux->num_items; item++) {
9553 if (imux->items[item].index == idx) {
9554 if (spec->cur_mux[c] == item)
9555 mute = AMP_IN_UNMUTE(idx);
9559 /* check if we have a selector or mixer
9560 * we could check for the widget type instead, but
9561 * just check for Amp-In presence (in case of mixer
9562 * without amp-in there is something wrong, this
9563 * function shouldn't be used or capsrc nid is wrong)
9565 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9566 snd_hda_codec_write(codec, nid, 0,
9567 AC_VERB_SET_AMP_GAIN_MUTE,
9569 else if (mute != AMP_IN_MUTE(idx))
9570 snd_hda_codec_write(codec, nid, 0,
9571 AC_VERB_SET_CONNECT_SEL,
9577 /* add mic boosts if needed */
9578 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9580 struct alc_spec *spec = codec->spec;
9584 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9585 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9586 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9588 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9592 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9593 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9594 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9596 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9603 /* almost identical with ALC880 parser... */
9604 static int alc882_parse_auto_config(struct hda_codec *codec)
9606 struct alc_spec *spec = codec->spec;
9607 struct auto_pin_cfg *autocfg = &spec->autocfg;
9610 int err = alc880_parse_auto_config(codec);
9615 return 0; /* no config found */
9617 err = alc_auto_add_mic_boost(codec);
9621 /* hack - override the init verbs */
9622 spec->init_verbs[0] = alc883_auto_init_verbs;
9623 /* if ADC 0x07 is available, initialize it, too */
9624 wcap = get_wcaps(codec, 0x07);
9625 wcap = get_wcaps_type(wcap);
9626 if (wcap == AC_WID_AUD_IN)
9627 add_verb(spec, alc882_adc1_init_verbs);
9629 /* digital-mic input pin is excluded in alc880_auto_create..()
9630 * because it's under 0x18
9632 if (autocfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9633 autocfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9634 struct hda_input_mux *imux = &spec->private_imux[0];
9635 for (i = 1; i < 3; i++)
9636 memcpy(&spec->private_imux[i],
9637 &spec->private_imux[0],
9638 sizeof(spec->private_imux[0]));
9639 imux->items[imux->num_items].label = "Int DMic";
9640 imux->items[imux->num_items].index = 0x0b;
9642 spec->num_mux_defs = 3;
9643 spec->input_mux = spec->private_imux;
9646 return 1; /* config found */
9649 /* additional initialization for auto-configuration model */
9650 static void alc882_auto_init(struct hda_codec *codec)
9652 struct alc_spec *spec = codec->spec;
9653 alc882_auto_init_multi_out(codec);
9654 alc882_auto_init_hp_out(codec);
9655 alc882_auto_init_analog_input(codec);
9656 alc882_auto_init_input_src(codec);
9657 if (spec->unsol_event)
9658 alc_inithook(codec);
9661 static int patch_alc882(struct hda_codec *codec)
9663 struct alc_spec *spec;
9664 int err, board_config;
9666 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9672 switch (codec->vendor_id) {
9677 /* ALC883 and variants */
9678 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9682 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9686 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9687 board_config = snd_hda_check_board_codec_sid_config(codec,
9688 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9690 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9691 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9693 board_config = ALC882_AUTO;
9696 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
9698 if (board_config == ALC882_AUTO) {
9699 /* automatic parse from the BIOS config */
9700 err = alc882_parse_auto_config(codec);
9706 "hda_codec: Cannot set up configuration "
9707 "from BIOS. Using base mode...\n");
9708 board_config = ALC882_3ST_DIG;
9712 err = snd_hda_attach_beep_device(codec, 0x1);
9718 if (board_config != ALC882_AUTO)
9719 setup_preset(codec, &alc882_presets[board_config]);
9721 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9722 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9723 /* FIXME: setup DAC5 */
9724 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9725 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9727 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9728 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9730 if (codec->vendor_id == 0x10ec0888)
9731 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9733 if (!spec->adc_nids && spec->input_mux) {
9735 spec->num_adc_nids = 0;
9736 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9738 hda_nid_t nid = alc882_adc_nids[i];
9739 unsigned int wcap = get_wcaps(codec, nid);
9741 wcap = get_wcaps_type(wcap);
9742 if (wcap != AC_WID_AUD_IN)
9744 spec->private_adc_nids[spec->num_adc_nids] = nid;
9745 err = snd_hda_get_connections(codec, nid, &cap, 1);
9748 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9749 spec->num_adc_nids++;
9751 spec->adc_nids = spec->private_adc_nids;
9752 spec->capsrc_nids = spec->private_capsrc_nids;
9755 set_capture_mixer(codec);
9756 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9758 spec->vmaster_nid = 0x0c;
9760 codec->patch_ops = alc_patch_ops;
9761 if (board_config == ALC882_AUTO)
9762 spec->init_hook = alc882_auto_init;
9763 #ifdef CONFIG_SND_HDA_POWER_SAVE
9764 if (!spec->loopback.amplist)
9765 spec->loopback.amplist = alc882_loopbacks;
9767 codec->proc_widget_hook = print_realtek_coef;
9777 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9778 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9780 #define alc262_dac_nids alc260_dac_nids
9781 #define alc262_adc_nids alc882_adc_nids
9782 #define alc262_adc_nids_alt alc882_adc_nids_alt
9783 #define alc262_capsrc_nids alc882_capsrc_nids
9784 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9786 #define alc262_modes alc260_modes
9787 #define alc262_capture_source alc882_capture_source
9789 static hda_nid_t alc262_dmic_adc_nids[1] = {
9794 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9796 static struct snd_kcontrol_new alc262_base_mixer[] = {
9797 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9798 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9799 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9800 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9801 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9802 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9805 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9806 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9807 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9808 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9809 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9810 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9811 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9812 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9816 /* update HP, line and mono-out pins according to the master switch */
9817 static void alc262_hp_master_update(struct hda_codec *codec)
9819 struct alc_spec *spec = codec->spec;
9820 int val = spec->master_sw;
9823 snd_hda_codec_write_cache(codec, 0x1b, 0,
9824 AC_VERB_SET_PIN_WIDGET_CONTROL,
9826 snd_hda_codec_write_cache(codec, 0x15, 0,
9827 AC_VERB_SET_PIN_WIDGET_CONTROL,
9829 /* mono (speaker) depending on the HP jack sense */
9830 val = val && !spec->jack_present;
9831 snd_hda_codec_write_cache(codec, 0x16, 0,
9832 AC_VERB_SET_PIN_WIDGET_CONTROL,
9836 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9838 struct alc_spec *spec = codec->spec;
9839 unsigned int presence;
9840 presence = snd_hda_codec_read(codec, 0x1b, 0,
9841 AC_VERB_GET_PIN_SENSE, 0);
9842 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9843 alc262_hp_master_update(codec);
9846 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9848 if ((res >> 26) != ALC880_HP_EVENT)
9850 alc262_hp_bpc_automute(codec);
9853 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9855 struct alc_spec *spec = codec->spec;
9856 unsigned int presence;
9857 presence = snd_hda_codec_read(codec, 0x15, 0,
9858 AC_VERB_GET_PIN_SENSE, 0);
9859 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9860 alc262_hp_master_update(codec);
9863 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9866 if ((res >> 26) != ALC880_HP_EVENT)
9868 alc262_hp_wildwest_automute(codec);
9871 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9873 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9874 struct snd_ctl_elem_value *ucontrol)
9876 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9877 struct alc_spec *spec = codec->spec;
9878 int val = !!*ucontrol->value.integer.value;
9880 if (val == spec->master_sw)
9882 spec->master_sw = val;
9883 alc262_hp_master_update(codec);
9887 #define ALC262_HP_MASTER_SWITCH \
9889 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9890 .name = "Master Playback Switch", \
9891 .info = snd_ctl_boolean_mono_info, \
9892 .get = alc262_hp_master_sw_get, \
9893 .put = alc262_hp_master_sw_put, \
9896 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9897 ALC262_HP_MASTER_SWITCH,
9898 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9899 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9900 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9901 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9903 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9905 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9906 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9907 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9908 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9909 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9910 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9911 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9912 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9913 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9914 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9915 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9916 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9920 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9921 ALC262_HP_MASTER_SWITCH,
9922 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9923 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9924 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9926 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9928 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9930 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9931 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9932 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9933 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9934 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9935 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9936 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9940 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9941 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9942 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9943 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9947 /* mute/unmute internal speaker according to the hp jack and mute state */
9948 static void alc262_hp_t5735_setup(struct hda_codec *codec)
9950 struct alc_spec *spec = codec->spec;
9952 spec->autocfg.hp_pins[0] = 0x15;
9953 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9956 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9957 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9958 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9959 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9960 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9961 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9962 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9963 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9967 static struct hda_verb alc262_hp_t5735_verbs[] = {
9968 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9969 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9971 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9975 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9976 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9977 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9978 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9979 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9980 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9981 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9985 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9986 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9987 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9988 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9989 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9990 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9991 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9992 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9993 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9994 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9995 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9999 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10006 /* bind hp and internal speaker mute (with plug check) as master switch */
10007 static void alc262_hippo_master_update(struct hda_codec *codec)
10009 struct alc_spec *spec = codec->spec;
10010 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10011 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10012 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10016 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10017 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10018 HDA_AMP_MUTE, mute);
10019 /* mute internal speaker per jack sense */
10020 if (spec->jack_present)
10021 mute = HDA_AMP_MUTE;
10023 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10024 HDA_AMP_MUTE, mute);
10025 if (speaker_nid && speaker_nid != line_nid)
10026 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10027 HDA_AMP_MUTE, mute);
10030 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10032 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10033 struct snd_ctl_elem_value *ucontrol)
10035 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10036 struct alc_spec *spec = codec->spec;
10037 int val = !!*ucontrol->value.integer.value;
10039 if (val == spec->master_sw)
10041 spec->master_sw = val;
10042 alc262_hippo_master_update(codec);
10046 #define ALC262_HIPPO_MASTER_SWITCH \
10048 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10049 .name = "Master Playback Switch", \
10050 .info = snd_ctl_boolean_mono_info, \
10051 .get = alc262_hippo_master_sw_get, \
10052 .put = alc262_hippo_master_sw_put, \
10055 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10056 ALC262_HIPPO_MASTER_SWITCH,
10057 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10058 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10059 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10060 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10061 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10063 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10064 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10065 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10066 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10067 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10068 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10072 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10073 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10074 ALC262_HIPPO_MASTER_SWITCH,
10075 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10076 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10077 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10078 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10079 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10080 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10081 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10082 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10083 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10084 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10088 /* mute/unmute internal speaker according to the hp jack and mute state */
10089 static void alc262_hippo_automute(struct hda_codec *codec)
10091 struct alc_spec *spec = codec->spec;
10092 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10093 unsigned int present;
10095 /* need to execute and sync at first */
10096 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10097 present = snd_hda_codec_read(codec, hp_nid, 0,
10098 AC_VERB_GET_PIN_SENSE, 0);
10099 spec->jack_present = (present & 0x80000000) != 0;
10100 alc262_hippo_master_update(codec);
10103 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10105 if ((res >> 26) != ALC880_HP_EVENT)
10107 alc262_hippo_automute(codec);
10110 static void alc262_hippo_setup(struct hda_codec *codec)
10112 struct alc_spec *spec = codec->spec;
10114 spec->autocfg.hp_pins[0] = 0x15;
10115 spec->autocfg.speaker_pins[0] = 0x14;
10118 static void alc262_hippo1_setup(struct hda_codec *codec)
10120 struct alc_spec *spec = codec->spec;
10122 spec->autocfg.hp_pins[0] = 0x1b;
10123 spec->autocfg.speaker_pins[0] = 0x14;
10127 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10128 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10129 ALC262_HIPPO_MASTER_SWITCH,
10130 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10131 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10132 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10133 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10137 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10138 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10139 ALC262_HIPPO_MASTER_SWITCH,
10140 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10141 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10142 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10143 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10144 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10148 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10149 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10150 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10151 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10152 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10153 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10154 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10155 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10156 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10157 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10158 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10159 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10160 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10164 static struct hda_verb alc262_tyan_verbs[] = {
10165 /* Headphone automute */
10166 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10167 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10168 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10170 /* P11 AUX_IN, white 4-pin connector */
10171 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10172 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10173 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10174 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10179 /* unsolicited event for HP jack sensing */
10180 static void alc262_tyan_setup(struct hda_codec *codec)
10182 struct alc_spec *spec = codec->spec;
10184 spec->autocfg.hp_pins[0] = 0x1b;
10185 spec->autocfg.speaker_pins[0] = 0x15;
10189 #define alc262_capture_mixer alc882_capture_mixer
10190 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10193 * generic initialization of ADC, input mixers and output mixers
10195 static struct hda_verb alc262_init_verbs[] = {
10197 * Unmute ADC0-2 and set the default input to mic-in
10199 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10200 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10201 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10202 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10203 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10204 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10206 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10208 * Note: PASD motherboards uses the Line In 2 as the input for
10209 * front panel mic (mic 2)
10211 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10212 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10213 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10214 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10215 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10216 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10219 * Set up output mixers (0x0c - 0x0e)
10221 /* set vol=0 to output mixers */
10222 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10223 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10224 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10225 /* set up input amps for analog loopback */
10226 /* Amp Indices: DAC = 0, mixer = 1 */
10227 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10228 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10229 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10230 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10231 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10232 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10234 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10235 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10236 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10237 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10238 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10239 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10241 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10242 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10243 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10244 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10245 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10247 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10248 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10250 /* FIXME: use matrix-type input source selection */
10251 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10252 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10253 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10254 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10255 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10256 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10258 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10259 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10260 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10261 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10271 static struct hda_verb alc262_eapd_verbs[] = {
10272 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10273 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10277 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10278 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10279 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10280 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10282 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10283 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10287 static struct hda_verb alc262_sony_unsol_verbs[] = {
10288 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10289 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10290 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10292 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10297 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10298 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10299 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10300 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10301 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10302 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10306 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10307 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10309 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10310 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10311 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10312 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10313 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10314 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10318 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10320 struct alc_spec *spec = codec->spec;
10322 spec->autocfg.hp_pins[0] = 0x15;
10323 spec->autocfg.speaker_pins[0] = 0x14;
10324 spec->ext_mic.pin = 0x18;
10325 spec->ext_mic.mux_idx = 0;
10326 spec->int_mic.pin = 0x12;
10327 spec->int_mic.mux_idx = 9;
10328 spec->auto_mic = 1;
10334 * 0x16 = internal speaker
10335 * 0x18 = external mic
10338 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10339 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10340 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10342 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10343 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10344 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10346 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10351 static struct hda_verb alc262_nec_verbs[] = {
10352 /* Unmute Speaker */
10353 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10356 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10357 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10359 /* External mic to headphone */
10360 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10361 /* External mic to speaker */
10362 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10368 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10369 * 0x1b = port replicator headphone out
10372 #define ALC_HP_EVENT 0x37
10374 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10375 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10376 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10377 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10378 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10382 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10383 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10384 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10388 static struct hda_input_mux alc262_fujitsu_capture_source = {
10392 { "Int Mic", 0x1 },
10397 static struct hda_input_mux alc262_HP_capture_source = {
10401 { "Front Mic", 0x1 },
10408 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10412 { "Front Mic", 0x2 },
10418 /* mute/unmute internal speaker according to the hp jacks and mute state */
10419 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10421 struct alc_spec *spec = codec->spec;
10424 if (force || !spec->sense_updated) {
10425 unsigned int present;
10426 /* need to execute and sync at first */
10427 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10428 /* check laptop HP jack */
10429 present = snd_hda_codec_read(codec, 0x14, 0,
10430 AC_VERB_GET_PIN_SENSE, 0);
10431 /* need to execute and sync at first */
10432 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10433 /* check docking HP jack */
10434 present |= snd_hda_codec_read(codec, 0x1b, 0,
10435 AC_VERB_GET_PIN_SENSE, 0);
10436 if (present & AC_PINSENSE_PRESENCE)
10437 spec->jack_present = 1;
10439 spec->jack_present = 0;
10440 spec->sense_updated = 1;
10442 /* unmute internal speaker only if both HPs are unplugged and
10443 * master switch is on
10445 if (spec->jack_present)
10446 mute = HDA_AMP_MUTE;
10448 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10449 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10450 HDA_AMP_MUTE, mute);
10453 /* unsolicited event for HP jack sensing */
10454 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10457 if ((res >> 26) != ALC_HP_EVENT)
10459 alc262_fujitsu_automute(codec, 1);
10462 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10464 alc262_fujitsu_automute(codec, 1);
10467 /* bind volumes of both NID 0x0c and 0x0d */
10468 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10469 .ops = &snd_hda_bind_vol,
10471 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10472 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10477 /* mute/unmute internal speaker according to the hp jack and mute state */
10478 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10480 struct alc_spec *spec = codec->spec;
10483 if (force || !spec->sense_updated) {
10484 unsigned int present_int_hp;
10485 /* need to execute and sync at first */
10486 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10487 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10488 AC_VERB_GET_PIN_SENSE, 0);
10489 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10490 spec->sense_updated = 1;
10492 if (spec->jack_present) {
10493 /* mute internal speaker */
10494 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10495 HDA_AMP_MUTE, HDA_AMP_MUTE);
10496 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10497 HDA_AMP_MUTE, HDA_AMP_MUTE);
10499 /* unmute internal speaker if necessary */
10500 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10501 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10502 HDA_AMP_MUTE, mute);
10503 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10504 HDA_AMP_MUTE, mute);
10508 /* unsolicited event for HP jack sensing */
10509 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10512 if ((res >> 26) != ALC_HP_EVENT)
10514 alc262_lenovo_3000_automute(codec, 1);
10517 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10518 int dir, int idx, long *valp)
10522 for (i = 0; i < 2; i++, valp++)
10523 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10525 *valp ? 0 : HDA_AMP_MUTE);
10529 /* bind hp and internal speaker mute (with plug check) */
10530 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10531 struct snd_ctl_elem_value *ucontrol)
10533 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10534 long *valp = ucontrol->value.integer.value;
10537 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10538 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10540 alc262_fujitsu_automute(codec, 0);
10544 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10545 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10547 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10548 .name = "Master Playback Switch",
10549 .info = snd_hda_mixer_amp_switch_info,
10550 .get = snd_hda_mixer_amp_switch_get,
10551 .put = alc262_fujitsu_master_sw_put,
10552 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10554 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10555 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10556 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10557 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10558 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10559 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10560 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10561 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10565 /* bind hp and internal speaker mute (with plug check) */
10566 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10567 struct snd_ctl_elem_value *ucontrol)
10569 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10570 long *valp = ucontrol->value.integer.value;
10573 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10575 alc262_lenovo_3000_automute(codec, 0);
10579 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10580 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10582 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10583 .name = "Master Playback Switch",
10584 .info = snd_hda_mixer_amp_switch_info,
10585 .get = snd_hda_mixer_amp_switch_get,
10586 .put = alc262_lenovo_3000_master_sw_put,
10587 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10589 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10590 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10591 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10592 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10593 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10594 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10595 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10596 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10600 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10601 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10602 ALC262_HIPPO_MASTER_SWITCH,
10603 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10604 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10605 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10606 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10607 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10608 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10612 /* additional init verbs for Benq laptops */
10613 static struct hda_verb alc262_EAPD_verbs[] = {
10614 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10615 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10619 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10620 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10621 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10623 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10624 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10628 /* Samsung Q1 Ultra Vista model setup */
10629 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10630 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10631 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10632 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10633 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10634 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10635 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10639 static struct hda_verb alc262_ultra_verbs[] = {
10641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10643 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10645 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10646 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10647 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10648 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10650 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10651 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10652 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10653 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10654 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10656 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10657 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10658 /* ADC, choose mic */
10659 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10660 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10661 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10662 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10663 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10664 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10665 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10666 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10667 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10668 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10672 /* mute/unmute internal speaker according to the hp jack and mute state */
10673 static void alc262_ultra_automute(struct hda_codec *codec)
10675 struct alc_spec *spec = codec->spec;
10679 /* auto-mute only when HP is used as HP */
10680 if (!spec->cur_mux[0]) {
10681 unsigned int present;
10682 /* need to execute and sync at first */
10683 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10684 present = snd_hda_codec_read(codec, 0x15, 0,
10685 AC_VERB_GET_PIN_SENSE, 0);
10686 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10687 if (spec->jack_present)
10688 mute = HDA_AMP_MUTE;
10690 /* mute/unmute internal speaker */
10691 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10692 HDA_AMP_MUTE, mute);
10693 /* mute/unmute HP */
10694 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10695 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10698 /* unsolicited event for HP jack sensing */
10699 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10702 if ((res >> 26) != ALC880_HP_EVENT)
10704 alc262_ultra_automute(codec);
10707 static struct hda_input_mux alc262_ultra_capture_source = {
10711 { "Headphone", 0x7 },
10715 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10716 struct snd_ctl_elem_value *ucontrol)
10718 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10719 struct alc_spec *spec = codec->spec;
10722 ret = alc_mux_enum_put(kcontrol, ucontrol);
10725 /* reprogram the HP pin as mic or HP according to the input source */
10726 snd_hda_codec_write_cache(codec, 0x15, 0,
10727 AC_VERB_SET_PIN_WIDGET_CONTROL,
10728 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10729 alc262_ultra_automute(codec); /* mute/unmute HP */
10733 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10734 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10735 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10737 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10738 .name = "Capture Source",
10739 .info = alc_mux_enum_info,
10740 .get = alc_mux_enum_get,
10741 .put = alc262_ultra_mux_enum_put,
10746 /* add playback controls from the parsed DAC table */
10747 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10748 const struct auto_pin_cfg *cfg)
10753 spec->multiout.num_dacs = 1; /* only use one dac */
10754 spec->multiout.dac_nids = spec->private_dac_nids;
10755 spec->multiout.dac_nids[0] = 2;
10757 nid = cfg->line_out_pins[0];
10759 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10760 "Front Playback Volume",
10761 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10764 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10765 "Front Playback Switch",
10766 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10771 nid = cfg->speaker_pins[0];
10774 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10775 "Speaker Playback Volume",
10776 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10780 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10781 "Speaker Playback Switch",
10782 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10787 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10788 "Speaker Playback Switch",
10789 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10795 nid = cfg->hp_pins[0];
10797 /* spec->multiout.hp_nid = 2; */
10799 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10800 "Headphone Playback Volume",
10801 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10805 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10806 "Headphone Playback Switch",
10807 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10812 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10813 "Headphone Playback Switch",
10814 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10823 static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec,
10824 const struct auto_pin_cfg *cfg)
10828 err = alc880_auto_create_analog_input_ctls(spec, cfg);
10831 /* digital-mic input pin is excluded in alc880_auto_create..()
10832 * because it's under 0x18
10834 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
10835 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
10836 struct hda_input_mux *imux = &spec->private_imux[0];
10837 imux->items[imux->num_items].label = "Int Mic";
10838 imux->items[imux->num_items].index = 0x09;
10846 * generic initialization of ADC, input mixers and output mixers
10848 static struct hda_verb alc262_volume_init_verbs[] = {
10850 * Unmute ADC0-2 and set the default input to mic-in
10852 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10853 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10854 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10855 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10856 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10857 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10859 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10861 * Note: PASD motherboards uses the Line In 2 as the input for
10862 * front panel mic (mic 2)
10864 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10865 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10866 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10867 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10868 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10869 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10872 * Set up output mixers (0x0c - 0x0f)
10874 /* set vol=0 to output mixers */
10875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10876 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10877 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10879 /* set up input amps for analog loopback */
10880 /* Amp Indices: DAC = 0, mixer = 1 */
10881 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10882 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10883 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10884 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10885 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10886 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10888 /* FIXME: use matrix-type input source selection */
10889 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10890 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10891 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10892 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10893 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10894 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10896 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10897 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10898 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10899 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10901 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10902 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10903 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10904 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10909 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10911 * Unmute ADC0-2 and set the default input to mic-in
10913 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10914 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10915 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10916 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10917 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10918 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10920 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10922 * Note: PASD motherboards uses the Line In 2 as the input for
10923 * front panel mic (mic 2)
10925 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10926 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10927 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10928 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10929 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10930 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10932 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10935 * Set up output mixers (0x0c - 0x0e)
10937 /* set vol=0 to output mixers */
10938 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10939 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10940 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10942 /* set up input amps for analog loopback */
10943 /* Amp Indices: DAC = 0, mixer = 1 */
10944 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10945 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10946 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10947 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10948 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10949 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10951 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10952 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10953 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10955 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10956 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10958 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10959 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10961 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10962 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10963 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10964 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10965 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10967 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10968 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10969 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10970 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10971 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10972 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10975 /* FIXME: use matrix-type input source selection */
10976 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
10977 /* Input mixer1: only unmute Mic */
10978 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10979 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10980 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10981 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10982 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10983 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10984 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10985 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10986 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10988 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10989 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10990 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10991 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10992 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10993 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10994 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10995 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10996 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10998 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10999 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11000 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11001 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11002 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11003 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11004 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11005 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11006 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11008 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11013 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11015 * Unmute ADC0-2 and set the default input to mic-in
11017 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11018 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11019 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11020 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11021 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11022 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11024 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11026 * Note: PASD motherboards uses the Line In 2 as the input for front
11027 * panel mic (mic 2)
11029 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11030 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11031 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11032 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11033 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11034 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11035 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11036 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11039 * Set up output mixers (0x0c - 0x0e)
11041 /* set vol=0 to output mixers */
11042 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11043 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11044 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11046 /* set up input amps for analog loopback */
11047 /* Amp Indices: DAC = 0, mixer = 1 */
11048 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11049 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11050 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11051 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11052 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11053 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11056 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11057 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11058 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11059 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11060 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11061 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11062 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11064 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11067 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11068 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11070 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11071 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11072 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11073 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11074 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11075 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11077 /* FIXME: use matrix-type input source selection */
11078 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11079 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11080 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11081 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11082 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11083 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11084 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11085 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11086 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11088 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11089 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11090 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11091 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11092 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11093 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11094 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11096 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11098 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11099 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11100 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11101 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11104 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11109 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11111 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11112 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11113 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11115 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11116 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11117 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11118 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11120 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11121 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11122 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11127 #ifdef CONFIG_SND_HDA_POWER_SAVE
11128 #define alc262_loopbacks alc880_loopbacks
11131 /* pcm configuration: identical with ALC880 */
11132 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11133 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11134 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11135 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11138 * BIOS auto configuration
11140 static int alc262_parse_auto_config(struct hda_codec *codec)
11142 struct alc_spec *spec = codec->spec;
11144 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11146 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11150 if (!spec->autocfg.line_outs) {
11151 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11152 spec->multiout.max_channels = 2;
11153 spec->no_analog = 1;
11156 return 0; /* can't find valid BIOS pin config */
11158 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11161 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
11165 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11168 if (spec->autocfg.dig_outs) {
11169 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11170 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11172 if (spec->autocfg.dig_in_pin)
11173 spec->dig_in_nid = ALC262_DIGIN_NID;
11175 if (spec->kctls.list)
11176 add_mixer(spec, spec->kctls.list);
11178 add_verb(spec, alc262_volume_init_verbs);
11179 spec->num_mux_defs = 1;
11180 spec->input_mux = &spec->private_imux[0];
11182 err = alc_auto_add_mic_boost(codec);
11186 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11191 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11192 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11193 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11194 #define alc262_auto_init_input_src alc882_auto_init_input_src
11197 /* init callback for auto-configuration model -- overriding the default init */
11198 static void alc262_auto_init(struct hda_codec *codec)
11200 struct alc_spec *spec = codec->spec;
11201 alc262_auto_init_multi_out(codec);
11202 alc262_auto_init_hp_out(codec);
11203 alc262_auto_init_analog_input(codec);
11204 alc262_auto_init_input_src(codec);
11205 if (spec->unsol_event)
11206 alc_inithook(codec);
11210 * configuration and preset
11212 static const char *alc262_models[ALC262_MODEL_LAST] = {
11213 [ALC262_BASIC] = "basic",
11214 [ALC262_HIPPO] = "hippo",
11215 [ALC262_HIPPO_1] = "hippo_1",
11216 [ALC262_FUJITSU] = "fujitsu",
11217 [ALC262_HP_BPC] = "hp-bpc",
11218 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11219 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11220 [ALC262_HP_RP5700] = "hp-rp5700",
11221 [ALC262_BENQ_ED8] = "benq",
11222 [ALC262_BENQ_T31] = "benq-t31",
11223 [ALC262_SONY_ASSAMD] = "sony-assamd",
11224 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11225 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11226 [ALC262_ULTRA] = "ultra",
11227 [ALC262_LENOVO_3000] = "lenovo-3000",
11228 [ALC262_NEC] = "nec",
11229 [ALC262_TYAN] = "tyan",
11230 [ALC262_AUTO] = "auto",
11233 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11234 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11235 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11236 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11238 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11240 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11242 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11243 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11244 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11245 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11246 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11247 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11248 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11249 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11250 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11251 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11252 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11253 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11254 ALC262_HP_TC_T5735),
11255 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11256 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11257 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11258 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11259 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11260 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11261 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11262 ALC262_SONY_ASSAMD),
11263 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11264 ALC262_TOSHIBA_RX1),
11265 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11266 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11267 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11268 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11269 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11271 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11272 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11273 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11274 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11275 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11279 static struct alc_config_preset alc262_presets[] = {
11281 .mixers = { alc262_base_mixer },
11282 .init_verbs = { alc262_init_verbs },
11283 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11284 .dac_nids = alc262_dac_nids,
11286 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11287 .channel_mode = alc262_modes,
11288 .input_mux = &alc262_capture_source,
11291 .mixers = { alc262_hippo_mixer },
11292 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11293 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11294 .dac_nids = alc262_dac_nids,
11296 .dig_out_nid = ALC262_DIGOUT_NID,
11297 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11298 .channel_mode = alc262_modes,
11299 .input_mux = &alc262_capture_source,
11300 .unsol_event = alc262_hippo_unsol_event,
11301 .setup = alc262_hippo_setup,
11302 .init_hook = alc262_hippo_automute,
11304 [ALC262_HIPPO_1] = {
11305 .mixers = { alc262_hippo1_mixer },
11306 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11307 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11308 .dac_nids = alc262_dac_nids,
11310 .dig_out_nid = ALC262_DIGOUT_NID,
11311 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11312 .channel_mode = alc262_modes,
11313 .input_mux = &alc262_capture_source,
11314 .unsol_event = alc262_hippo_unsol_event,
11315 .setup = alc262_hippo1_setup,
11316 .init_hook = alc262_hippo_automute,
11318 [ALC262_FUJITSU] = {
11319 .mixers = { alc262_fujitsu_mixer },
11320 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11321 alc262_fujitsu_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_fujitsu_capture_source,
11329 .unsol_event = alc262_fujitsu_unsol_event,
11330 .init_hook = alc262_fujitsu_init_hook,
11332 [ALC262_HP_BPC] = {
11333 .mixers = { alc262_HP_BPC_mixer },
11334 .init_verbs = { alc262_HP_BPC_init_verbs },
11335 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11336 .dac_nids = alc262_dac_nids,
11338 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11339 .channel_mode = alc262_modes,
11340 .input_mux = &alc262_HP_capture_source,
11341 .unsol_event = alc262_hp_bpc_unsol_event,
11342 .init_hook = alc262_hp_bpc_automute,
11344 [ALC262_HP_BPC_D7000_WF] = {
11345 .mixers = { alc262_HP_BPC_WildWest_mixer },
11346 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11347 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11348 .dac_nids = alc262_dac_nids,
11350 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11351 .channel_mode = alc262_modes,
11352 .input_mux = &alc262_HP_D7000_capture_source,
11353 .unsol_event = alc262_hp_wildwest_unsol_event,
11354 .init_hook = alc262_hp_wildwest_automute,
11356 [ALC262_HP_BPC_D7000_WL] = {
11357 .mixers = { alc262_HP_BPC_WildWest_mixer,
11358 alc262_HP_BPC_WildWest_option_mixer },
11359 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11360 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11361 .dac_nids = alc262_dac_nids,
11363 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11364 .channel_mode = alc262_modes,
11365 .input_mux = &alc262_HP_D7000_capture_source,
11366 .unsol_event = alc262_hp_wildwest_unsol_event,
11367 .init_hook = alc262_hp_wildwest_automute,
11369 [ALC262_HP_TC_T5735] = {
11370 .mixers = { alc262_hp_t5735_mixer },
11371 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11372 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11373 .dac_nids = alc262_dac_nids,
11375 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11376 .channel_mode = alc262_modes,
11377 .input_mux = &alc262_capture_source,
11378 .unsol_event = alc_automute_amp_unsol_event,
11379 .setup = alc262_hp_t5735_setup,
11380 .init_hook = alc_automute_amp,
11382 [ALC262_HP_RP5700] = {
11383 .mixers = { alc262_hp_rp5700_mixer },
11384 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11385 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11386 .dac_nids = alc262_dac_nids,
11387 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11388 .channel_mode = alc262_modes,
11389 .input_mux = &alc262_hp_rp5700_capture_source,
11391 [ALC262_BENQ_ED8] = {
11392 .mixers = { alc262_base_mixer },
11393 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11394 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11395 .dac_nids = alc262_dac_nids,
11397 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11398 .channel_mode = alc262_modes,
11399 .input_mux = &alc262_capture_source,
11401 [ALC262_SONY_ASSAMD] = {
11402 .mixers = { alc262_sony_mixer },
11403 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11404 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11405 .dac_nids = alc262_dac_nids,
11407 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11408 .channel_mode = alc262_modes,
11409 .input_mux = &alc262_capture_source,
11410 .unsol_event = alc262_hippo_unsol_event,
11411 .setup = alc262_hippo_setup,
11412 .init_hook = alc262_hippo_automute,
11414 [ALC262_BENQ_T31] = {
11415 .mixers = { alc262_benq_t31_mixer },
11416 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11417 alc_hp15_unsol_verbs },
11418 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11419 .dac_nids = alc262_dac_nids,
11421 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11422 .channel_mode = alc262_modes,
11423 .input_mux = &alc262_capture_source,
11424 .unsol_event = alc262_hippo_unsol_event,
11425 .setup = alc262_hippo_setup,
11426 .init_hook = alc262_hippo_automute,
11429 .mixers = { alc262_ultra_mixer },
11430 .cap_mixer = alc262_ultra_capture_mixer,
11431 .init_verbs = { alc262_ultra_verbs },
11432 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11433 .dac_nids = alc262_dac_nids,
11434 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11435 .channel_mode = alc262_modes,
11436 .input_mux = &alc262_ultra_capture_source,
11437 .adc_nids = alc262_adc_nids, /* ADC0 */
11438 .capsrc_nids = alc262_capsrc_nids,
11439 .num_adc_nids = 1, /* single ADC */
11440 .unsol_event = alc262_ultra_unsol_event,
11441 .init_hook = alc262_ultra_automute,
11443 [ALC262_LENOVO_3000] = {
11444 .mixers = { alc262_lenovo_3000_mixer },
11445 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11446 alc262_lenovo_3000_unsol_verbs },
11447 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11448 .dac_nids = alc262_dac_nids,
11450 .dig_out_nid = ALC262_DIGOUT_NID,
11451 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11452 .channel_mode = alc262_modes,
11453 .input_mux = &alc262_fujitsu_capture_source,
11454 .unsol_event = alc262_lenovo_3000_unsol_event,
11457 .mixers = { alc262_nec_mixer },
11458 .init_verbs = { alc262_nec_verbs },
11459 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11460 .dac_nids = alc262_dac_nids,
11462 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11463 .channel_mode = alc262_modes,
11464 .input_mux = &alc262_capture_source,
11466 [ALC262_TOSHIBA_S06] = {
11467 .mixers = { alc262_toshiba_s06_mixer },
11468 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11469 alc262_eapd_verbs },
11470 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11471 .capsrc_nids = alc262_dmic_capsrc_nids,
11472 .dac_nids = alc262_dac_nids,
11473 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11474 .num_adc_nids = 1, /* single ADC */
11475 .dig_out_nid = ALC262_DIGOUT_NID,
11476 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11477 .channel_mode = alc262_modes,
11478 .unsol_event = alc_sku_unsol_event,
11479 .setup = alc262_toshiba_s06_setup,
11480 .init_hook = alc_inithook,
11482 [ALC262_TOSHIBA_RX1] = {
11483 .mixers = { alc262_toshiba_rx1_mixer },
11484 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11485 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11486 .dac_nids = alc262_dac_nids,
11488 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11489 .channel_mode = alc262_modes,
11490 .input_mux = &alc262_capture_source,
11491 .unsol_event = alc262_hippo_unsol_event,
11492 .setup = alc262_hippo_setup,
11493 .init_hook = alc262_hippo_automute,
11496 .mixers = { alc262_tyan_mixer },
11497 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11498 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11499 .dac_nids = alc262_dac_nids,
11501 .dig_out_nid = ALC262_DIGOUT_NID,
11502 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11503 .channel_mode = alc262_modes,
11504 .input_mux = &alc262_capture_source,
11505 .unsol_event = alc_automute_amp_unsol_event,
11506 .setup = alc262_tyan_setup,
11507 .init_hook = alc_automute_amp,
11511 static int patch_alc262(struct hda_codec *codec)
11513 struct alc_spec *spec;
11517 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11521 codec->spec = spec;
11523 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11528 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11529 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11530 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11531 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11535 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11537 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11541 if (board_config < 0) {
11542 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11544 board_config = ALC262_AUTO;
11547 if (board_config == ALC262_AUTO) {
11548 /* automatic parse from the BIOS config */
11549 err = alc262_parse_auto_config(codec);
11555 "hda_codec: Cannot set up configuration "
11556 "from BIOS. Using base mode...\n");
11557 board_config = ALC262_BASIC;
11561 if (!spec->no_analog) {
11562 err = snd_hda_attach_beep_device(codec, 0x1);
11569 if (board_config != ALC262_AUTO)
11570 setup_preset(codec, &alc262_presets[board_config]);
11572 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11573 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11575 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11576 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11578 if (!spec->adc_nids && spec->input_mux) {
11580 /* check whether the digital-mic has to be supported */
11581 for (i = 0; i < spec->input_mux->num_items; i++) {
11582 if (spec->input_mux->items[i].index >= 9)
11585 if (i < spec->input_mux->num_items) {
11586 /* use only ADC0 */
11587 spec->adc_nids = alc262_dmic_adc_nids;
11588 spec->num_adc_nids = 1;
11589 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11591 /* all analog inputs */
11592 /* check whether NID 0x07 is valid */
11593 unsigned int wcap = get_wcaps(codec, 0x07);
11596 wcap = get_wcaps_type(wcap);
11597 if (wcap != AC_WID_AUD_IN) {
11598 spec->adc_nids = alc262_adc_nids_alt;
11599 spec->num_adc_nids =
11600 ARRAY_SIZE(alc262_adc_nids_alt);
11601 spec->capsrc_nids = alc262_capsrc_nids_alt;
11603 spec->adc_nids = alc262_adc_nids;
11604 spec->num_adc_nids =
11605 ARRAY_SIZE(alc262_adc_nids);
11606 spec->capsrc_nids = alc262_capsrc_nids;
11610 if (!spec->cap_mixer && !spec->no_analog)
11611 set_capture_mixer(codec);
11612 if (!spec->no_analog)
11613 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11615 spec->vmaster_nid = 0x0c;
11617 codec->patch_ops = alc_patch_ops;
11618 if (board_config == ALC262_AUTO)
11619 spec->init_hook = alc262_auto_init;
11620 #ifdef CONFIG_SND_HDA_POWER_SAVE
11621 if (!spec->loopback.amplist)
11622 spec->loopback.amplist = alc262_loopbacks;
11624 codec->proc_widget_hook = print_realtek_coef;
11630 * ALC268 channel source setting (2 channel)
11632 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11633 #define alc268_modes alc260_modes
11635 static hda_nid_t alc268_dac_nids[2] = {
11640 static hda_nid_t alc268_adc_nids[2] = {
11645 static hda_nid_t alc268_adc_nids_alt[1] = {
11650 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11652 static struct snd_kcontrol_new alc268_base_mixer[] = {
11653 /* output mixer control */
11654 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11655 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11656 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11657 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11658 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11659 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11660 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11664 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11665 /* output mixer control */
11666 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11667 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11668 ALC262_HIPPO_MASTER_SWITCH,
11669 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11670 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11671 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11675 /* bind Beep switches of both NID 0x0f and 0x10 */
11676 static struct hda_bind_ctls alc268_bind_beep_sw = {
11677 .ops = &snd_hda_bind_sw,
11679 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11680 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11685 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11686 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11687 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11691 static struct hda_verb alc268_eapd_verbs[] = {
11692 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11693 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11697 /* Toshiba specific */
11698 static struct hda_verb alc268_toshiba_verbs[] = {
11699 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11703 /* Acer specific */
11704 /* bind volumes of both NID 0x02 and 0x03 */
11705 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11706 .ops = &snd_hda_bind_vol,
11708 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11709 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11714 /* mute/unmute internal speaker according to the hp jack and mute state */
11715 static void alc268_acer_automute(struct hda_codec *codec, int force)
11717 struct alc_spec *spec = codec->spec;
11720 if (force || !spec->sense_updated) {
11721 unsigned int present;
11722 present = snd_hda_codec_read(codec, 0x14, 0,
11723 AC_VERB_GET_PIN_SENSE, 0);
11724 spec->jack_present = (present & 0x80000000) != 0;
11725 spec->sense_updated = 1;
11727 if (spec->jack_present)
11728 mute = HDA_AMP_MUTE; /* mute internal speaker */
11729 else /* unmute internal speaker if necessary */
11730 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11731 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11732 HDA_AMP_MUTE, mute);
11736 /* bind hp and internal speaker mute (with plug check) */
11737 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11738 struct snd_ctl_elem_value *ucontrol)
11740 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11741 long *valp = ucontrol->value.integer.value;
11744 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11746 alc268_acer_automute(codec, 0);
11750 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11751 /* output mixer control */
11752 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11754 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11755 .name = "Master Playback Switch",
11756 .info = snd_hda_mixer_amp_switch_info,
11757 .get = snd_hda_mixer_amp_switch_get,
11758 .put = alc268_acer_master_sw_put,
11759 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11761 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11765 static struct snd_kcontrol_new alc268_acer_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", 0x18, 0, HDA_INPUT),
11777 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11778 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11782 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11783 /* output mixer control */
11784 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11786 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11787 .name = "Master Playback Switch",
11788 .info = snd_hda_mixer_amp_switch_info,
11789 .get = snd_hda_mixer_amp_switch_get,
11790 .put = alc268_acer_master_sw_put,
11791 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11793 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11794 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11798 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11799 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11800 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11801 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11802 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11803 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11804 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11808 static struct hda_verb alc268_acer_verbs[] = {
11809 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11810 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11811 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11812 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11813 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11814 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11815 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11819 /* unsolicited event for HP jack sensing */
11820 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11821 #define alc268_toshiba_setup alc262_hippo_setup
11822 #define alc268_toshiba_automute alc262_hippo_automute
11824 static void alc268_acer_unsol_event(struct hda_codec *codec,
11827 if ((res >> 26) != ALC880_HP_EVENT)
11829 alc268_acer_automute(codec, 1);
11832 static void alc268_acer_init_hook(struct hda_codec *codec)
11834 alc268_acer_automute(codec, 1);
11837 /* toggle speaker-output according to the hp-jack state */
11838 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11840 unsigned int present;
11841 unsigned char bits;
11843 present = snd_hda_codec_read(codec, 0x15, 0,
11844 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11845 bits = present ? AMP_IN_MUTE(0) : 0;
11846 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11847 AMP_IN_MUTE(0), bits);
11848 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11849 AMP_IN_MUTE(0), bits);
11852 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11855 switch (res >> 26) {
11856 case ALC880_HP_EVENT:
11857 alc268_aspire_one_speaker_automute(codec);
11859 case ALC880_MIC_EVENT:
11860 alc_mic_automute(codec);
11865 static void alc268_acer_lc_setup(struct hda_codec *codec)
11867 struct alc_spec *spec = codec->spec;
11868 spec->ext_mic.pin = 0x18;
11869 spec->ext_mic.mux_idx = 0;
11870 spec->int_mic.pin = 0x12;
11871 spec->int_mic.mux_idx = 6;
11872 spec->auto_mic = 1;
11875 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11877 alc268_aspire_one_speaker_automute(codec);
11878 alc_mic_automute(codec);
11881 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11882 /* output mixer control */
11883 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11884 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11885 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11886 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11887 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11888 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11892 static struct hda_verb alc268_dell_verbs[] = {
11893 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11894 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11895 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11896 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11900 /* mute/unmute internal speaker according to the hp jack and mute state */
11901 static void alc268_dell_setup(struct hda_codec *codec)
11903 struct alc_spec *spec = codec->spec;
11905 spec->autocfg.hp_pins[0] = 0x15;
11906 spec->autocfg.speaker_pins[0] = 0x14;
11907 spec->ext_mic.pin = 0x18;
11908 spec->ext_mic.mux_idx = 0;
11909 spec->int_mic.pin = 0x19;
11910 spec->int_mic.mux_idx = 1;
11911 spec->auto_mic = 1;
11914 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11915 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11916 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11917 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11918 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11919 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11920 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11921 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11922 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11926 static struct hda_verb alc267_quanta_il1_verbs[] = {
11927 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11928 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11932 static void alc267_quanta_il1_setup(struct hda_codec *codec)
11934 struct alc_spec *spec = codec->spec;
11935 spec->autocfg.hp_pins[0] = 0x15;
11936 spec->autocfg.speaker_pins[0] = 0x14;
11937 spec->ext_mic.pin = 0x18;
11938 spec->ext_mic.mux_idx = 0;
11939 spec->int_mic.pin = 0x19;
11940 spec->int_mic.mux_idx = 1;
11941 spec->auto_mic = 1;
11945 * generic initialization of ADC, input mixers and output mixers
11947 static struct hda_verb alc268_base_init_verbs[] = {
11948 /* Unmute DAC0-1 and set vol = 0 */
11949 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11950 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11953 * Set up output mixers (0x0c - 0x0e)
11955 /* set vol=0 to output mixers */
11956 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11957 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11959 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11960 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11962 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11963 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11964 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11965 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11966 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11967 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11968 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11969 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11971 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11972 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11973 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11974 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11975 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11977 /* set PCBEEP vol = 0, mute connections */
11978 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11979 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11980 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11982 /* Unmute Selector 23h,24h and set the default input to mic-in */
11984 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11985 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11986 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11987 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11993 * generic initialization of ADC, input mixers and output mixers
11995 static struct hda_verb alc268_volume_init_verbs[] = {
11996 /* set output DAC */
11997 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11998 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12000 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12001 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12002 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12003 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12004 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12006 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12007 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12008 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12010 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12011 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12013 /* set PCBEEP vol = 0, mute connections */
12014 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12015 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12016 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12021 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12022 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12023 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12025 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12026 /* The multiple "Capture Source" controls confuse alsamixer
12027 * So call somewhat different..
12029 /* .name = "Capture Source", */
12030 .name = "Input Source",
12032 .info = alc_mux_enum_info,
12033 .get = alc_mux_enum_get,
12034 .put = alc_mux_enum_put,
12039 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12040 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12041 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12042 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12043 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12045 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12046 /* The multiple "Capture Source" controls confuse alsamixer
12047 * So call somewhat different..
12049 /* .name = "Capture Source", */
12050 .name = "Input Source",
12052 .info = alc_mux_enum_info,
12053 .get = alc_mux_enum_get,
12054 .put = alc_mux_enum_put,
12059 static struct hda_input_mux alc268_capture_source = {
12063 { "Front Mic", 0x1 },
12069 static struct hda_input_mux alc268_acer_capture_source = {
12073 { "Internal Mic", 0x1 },
12078 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12082 { "Internal Mic", 0x6 },
12087 #ifdef CONFIG_SND_DEBUG
12088 static struct snd_kcontrol_new alc268_test_mixer[] = {
12089 /* Volume widgets */
12090 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12091 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12092 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12093 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12094 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12095 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12096 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12097 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12098 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12099 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12100 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12101 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12102 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12103 /* The below appears problematic on some hardwares */
12104 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12105 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12106 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12107 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12108 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12110 /* Modes for retasking pin widgets */
12111 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12112 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12113 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12114 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12116 /* Controls for GPIO pins, assuming they are configured as outputs */
12117 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12118 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12119 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12120 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12122 /* Switches to allow the digital SPDIF output pin to be enabled.
12123 * The ALC268 does not have an SPDIF input.
12125 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12127 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12128 * this output to turn on an external amplifier.
12130 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12131 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12137 /* create input playback/capture controls for the given pin */
12138 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12139 const char *ctlname, int idx)
12145 sprintf(name, "%s Playback Volume", ctlname);
12157 if (spec->multiout.dac_nids[0] != dac &&
12158 spec->multiout.dac_nids[1] != dac) {
12159 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12160 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12164 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12167 sprintf(name, "%s Playback Switch", ctlname);
12169 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12170 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12172 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12173 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12179 /* add playback controls from the parsed DAC table */
12180 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12181 const struct auto_pin_cfg *cfg)
12186 spec->multiout.dac_nids = spec->private_dac_nids;
12188 nid = cfg->line_out_pins[0];
12191 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12195 err = alc268_new_analog_output(spec, nid, name, 0);
12200 nid = cfg->speaker_pins[0];
12202 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12203 "Speaker Playback Volume",
12204 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12208 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12212 nid = cfg->hp_pins[0];
12214 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12219 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12221 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12222 "Mono Playback Switch",
12223 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12230 /* create playback/capture controls for input pins */
12231 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
12232 const struct auto_pin_cfg *cfg)
12234 struct hda_input_mux *imux = &spec->private_imux[0];
12237 for (i = 0; i < AUTO_PIN_LAST; i++) {
12238 switch(cfg->input_pins[i]) {
12240 idx1 = 0; /* Mic 1 */
12243 idx1 = 1; /* Mic 2 */
12246 idx1 = 2; /* Line In */
12253 idx1 = 6; /* digital mics */
12258 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12259 imux->items[imux->num_items].index = idx1;
12265 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12267 struct alc_spec *spec = codec->spec;
12268 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12269 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12270 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12271 unsigned int dac_vol1, dac_vol2;
12274 snd_hda_codec_write(codec, speaker_nid, 0,
12275 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12276 snd_hda_codec_write(codec, 0x0f, 0,
12277 AC_VERB_SET_AMP_GAIN_MUTE,
12279 snd_hda_codec_write(codec, 0x10, 0,
12280 AC_VERB_SET_AMP_GAIN_MUTE,
12283 snd_hda_codec_write(codec, 0x0f, 0,
12284 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12285 snd_hda_codec_write(codec, 0x10, 0,
12286 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12289 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12290 if (line_nid == 0x14)
12291 dac_vol2 = AMP_OUT_ZERO;
12292 else if (line_nid == 0x15)
12293 dac_vol1 = AMP_OUT_ZERO;
12294 if (hp_nid == 0x14)
12295 dac_vol2 = AMP_OUT_ZERO;
12296 else if (hp_nid == 0x15)
12297 dac_vol1 = AMP_OUT_ZERO;
12298 if (line_nid != 0x16 || hp_nid != 0x16 ||
12299 spec->autocfg.line_out_pins[1] != 0x16 ||
12300 spec->autocfg.line_out_pins[2] != 0x16)
12301 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12303 snd_hda_codec_write(codec, 0x02, 0,
12304 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12305 snd_hda_codec_write(codec, 0x03, 0,
12306 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12309 /* pcm configuration: identical with ALC880 */
12310 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12311 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12312 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12313 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12316 * BIOS auto configuration
12318 static int alc268_parse_auto_config(struct hda_codec *codec)
12320 struct alc_spec *spec = codec->spec;
12322 static hda_nid_t alc268_ignore[] = { 0 };
12324 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12328 if (!spec->autocfg.line_outs) {
12329 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12330 spec->multiout.max_channels = 2;
12331 spec->no_analog = 1;
12334 return 0; /* can't find valid BIOS pin config */
12336 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12339 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
12343 spec->multiout.max_channels = 2;
12346 /* digital only support output */
12347 if (spec->autocfg.dig_outs) {
12348 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12349 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12351 if (spec->kctls.list)
12352 add_mixer(spec, spec->kctls.list);
12354 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12355 add_mixer(spec, alc268_beep_mixer);
12357 add_verb(spec, alc268_volume_init_verbs);
12358 spec->num_mux_defs = 1;
12359 spec->input_mux = &spec->private_imux[0];
12361 err = alc_auto_add_mic_boost(codec);
12365 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12370 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12371 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12372 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12374 /* init callback for auto-configuration model -- overriding the default init */
12375 static void alc268_auto_init(struct hda_codec *codec)
12377 struct alc_spec *spec = codec->spec;
12378 alc268_auto_init_multi_out(codec);
12379 alc268_auto_init_hp_out(codec);
12380 alc268_auto_init_mono_speaker_out(codec);
12381 alc268_auto_init_analog_input(codec);
12382 if (spec->unsol_event)
12383 alc_inithook(codec);
12387 * configuration and preset
12389 static const char *alc268_models[ALC268_MODEL_LAST] = {
12390 [ALC267_QUANTA_IL1] = "quanta-il1",
12391 [ALC268_3ST] = "3stack",
12392 [ALC268_TOSHIBA] = "toshiba",
12393 [ALC268_ACER] = "acer",
12394 [ALC268_ACER_DMIC] = "acer-dmic",
12395 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12396 [ALC268_DELL] = "dell",
12397 [ALC268_ZEPTO] = "zepto",
12398 #ifdef CONFIG_SND_DEBUG
12399 [ALC268_TEST] = "test",
12401 [ALC268_AUTO] = "auto",
12404 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12405 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12406 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12407 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12408 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12409 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12410 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12411 ALC268_ACER_ASPIRE_ONE),
12412 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12413 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12414 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12416 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12417 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12418 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12420 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12421 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12422 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12423 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12427 static struct alc_config_preset alc268_presets[] = {
12428 [ALC267_QUANTA_IL1] = {
12429 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12430 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12431 alc267_quanta_il1_verbs },
12432 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12433 .dac_nids = alc268_dac_nids,
12434 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12435 .adc_nids = alc268_adc_nids_alt,
12437 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12438 .channel_mode = alc268_modes,
12439 .input_mux = &alc268_capture_source,
12440 .unsol_event = alc_sku_unsol_event,
12441 .setup = alc267_quanta_il1_setup,
12442 .init_hook = alc_inithook,
12445 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12446 alc268_beep_mixer },
12447 .init_verbs = { alc268_base_init_verbs },
12448 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12449 .dac_nids = alc268_dac_nids,
12450 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12451 .adc_nids = alc268_adc_nids_alt,
12452 .capsrc_nids = alc268_capsrc_nids,
12454 .dig_out_nid = ALC268_DIGOUT_NID,
12455 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12456 .channel_mode = alc268_modes,
12457 .input_mux = &alc268_capture_source,
12459 [ALC268_TOSHIBA] = {
12460 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12461 alc268_beep_mixer },
12462 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12463 alc268_toshiba_verbs },
12464 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12465 .dac_nids = alc268_dac_nids,
12466 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12467 .adc_nids = alc268_adc_nids_alt,
12468 .capsrc_nids = alc268_capsrc_nids,
12470 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12471 .channel_mode = alc268_modes,
12472 .input_mux = &alc268_capture_source,
12473 .unsol_event = alc268_toshiba_unsol_event,
12474 .setup = alc268_toshiba_setup,
12475 .init_hook = alc268_toshiba_automute,
12478 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12479 alc268_beep_mixer },
12480 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12481 alc268_acer_verbs },
12482 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12483 .dac_nids = alc268_dac_nids,
12484 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12485 .adc_nids = alc268_adc_nids_alt,
12486 .capsrc_nids = alc268_capsrc_nids,
12488 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12489 .channel_mode = alc268_modes,
12490 .input_mux = &alc268_acer_capture_source,
12491 .unsol_event = alc268_acer_unsol_event,
12492 .init_hook = alc268_acer_init_hook,
12494 [ALC268_ACER_DMIC] = {
12495 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12496 alc268_beep_mixer },
12497 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12498 alc268_acer_verbs },
12499 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12500 .dac_nids = alc268_dac_nids,
12501 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12502 .adc_nids = alc268_adc_nids_alt,
12503 .capsrc_nids = alc268_capsrc_nids,
12505 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12506 .channel_mode = alc268_modes,
12507 .input_mux = &alc268_acer_dmic_capture_source,
12508 .unsol_event = alc268_acer_unsol_event,
12509 .init_hook = alc268_acer_init_hook,
12511 [ALC268_ACER_ASPIRE_ONE] = {
12512 .mixers = { alc268_acer_aspire_one_mixer,
12514 alc268_capture_alt_mixer },
12515 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12516 alc268_acer_aspire_one_verbs },
12517 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12518 .dac_nids = alc268_dac_nids,
12519 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12520 .adc_nids = alc268_adc_nids_alt,
12521 .capsrc_nids = alc268_capsrc_nids,
12523 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12524 .channel_mode = alc268_modes,
12525 .unsol_event = alc268_acer_lc_unsol_event,
12526 .setup = alc268_acer_lc_setup,
12527 .init_hook = alc268_acer_lc_init_hook,
12530 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12531 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12532 alc268_dell_verbs },
12533 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12534 .dac_nids = alc268_dac_nids,
12536 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12537 .channel_mode = alc268_modes,
12538 .unsol_event = alc_sku_unsol_event,
12539 .setup = alc268_dell_setup,
12540 .init_hook = alc_inithook,
12543 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12544 alc268_beep_mixer },
12545 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12546 alc268_toshiba_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,
12557 .setup = alc268_toshiba_setup,
12558 .init_hook = alc268_toshiba_automute,
12560 #ifdef CONFIG_SND_DEBUG
12562 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12563 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12564 alc268_volume_init_verbs },
12565 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12566 .dac_nids = alc268_dac_nids,
12567 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12568 .adc_nids = alc268_adc_nids_alt,
12569 .capsrc_nids = alc268_capsrc_nids,
12571 .dig_out_nid = ALC268_DIGOUT_NID,
12572 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12573 .channel_mode = alc268_modes,
12574 .input_mux = &alc268_capture_source,
12579 static int patch_alc268(struct hda_codec *codec)
12581 struct alc_spec *spec;
12583 int i, has_beep, err;
12585 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12589 codec->spec = spec;
12591 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12595 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12596 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12598 board_config = ALC268_AUTO;
12601 if (board_config == ALC268_AUTO) {
12602 /* automatic parse from the BIOS config */
12603 err = alc268_parse_auto_config(codec);
12609 "hda_codec: Cannot set up configuration "
12610 "from BIOS. Using base mode...\n");
12611 board_config = ALC268_3ST;
12615 if (board_config != ALC268_AUTO)
12616 setup_preset(codec, &alc268_presets[board_config]);
12618 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12619 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12620 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12622 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12625 for (i = 0; i < spec->num_mixers; i++) {
12626 if (spec->mixers[i] == alc268_beep_mixer) {
12633 err = snd_hda_attach_beep_device(codec, 0x1);
12638 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12639 /* override the amp caps for beep generator */
12640 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12641 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12642 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12643 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12644 (0 << AC_AMPCAP_MUTE_SHIFT));
12647 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12648 /* check whether NID 0x07 is valid */
12649 unsigned int wcap = get_wcaps(codec, 0x07);
12653 wcap = get_wcaps_type(wcap);
12654 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12655 spec->adc_nids = alc268_adc_nids_alt;
12656 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12657 add_mixer(spec, alc268_capture_alt_mixer);
12659 spec->adc_nids = alc268_adc_nids;
12660 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12661 add_mixer(spec, alc268_capture_mixer);
12663 spec->capsrc_nids = alc268_capsrc_nids;
12664 /* set default input source */
12665 for (i = 0; i < spec->num_adc_nids; i++)
12666 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12667 0, AC_VERB_SET_CONNECT_SEL,
12668 spec->input_mux->items[0].index);
12671 spec->vmaster_nid = 0x02;
12673 codec->patch_ops = alc_patch_ops;
12674 if (board_config == ALC268_AUTO)
12675 spec->init_hook = alc268_auto_init;
12677 codec->proc_widget_hook = print_realtek_coef;
12683 * ALC269 channel source setting (2 channel)
12685 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12687 #define alc269_dac_nids alc260_dac_nids
12689 static hda_nid_t alc269_adc_nids[1] = {
12694 static hda_nid_t alc269_capsrc_nids[1] = {
12698 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12702 #define alc269_modes alc260_modes
12703 #define alc269_capture_source alc880_lg_lw_capture_source
12705 static struct snd_kcontrol_new alc269_base_mixer[] = {
12706 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12707 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12708 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12709 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12710 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12711 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12712 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12713 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12714 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12715 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12716 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12717 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12721 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12722 /* output mixer control */
12723 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12725 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12726 .name = "Master Playback Switch",
12727 .info = snd_hda_mixer_amp_switch_info,
12728 .get = snd_hda_mixer_amp_switch_get,
12729 .put = alc268_acer_master_sw_put,
12730 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12733 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12734 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12735 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12736 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12737 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12741 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12742 /* output mixer control */
12743 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12745 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12746 .name = "Master Playback Switch",
12747 .info = snd_hda_mixer_amp_switch_info,
12748 .get = snd_hda_mixer_amp_switch_get,
12749 .put = alc268_acer_master_sw_put,
12750 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12752 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12753 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12754 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12755 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12756 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12757 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12758 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12759 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12760 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12764 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12765 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12766 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12767 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12768 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12772 /* capture mixer elements */
12773 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12774 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12775 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12776 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12781 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12783 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12784 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12785 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12786 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12787 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12788 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12789 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12793 static struct hda_verb alc269_lifebook_verbs[] = {
12794 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12795 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12796 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12797 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12798 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12799 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12800 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12801 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12802 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12803 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12807 /* toggle speaker-output according to the hp-jack state */
12808 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12810 unsigned int present;
12811 unsigned char bits;
12813 present = snd_hda_codec_read(codec, 0x15, 0,
12814 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12815 bits = present ? AMP_IN_MUTE(0) : 0;
12816 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12817 AMP_IN_MUTE(0), bits);
12818 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12819 AMP_IN_MUTE(0), bits);
12821 snd_hda_codec_write(codec, 0x20, 0,
12822 AC_VERB_SET_COEF_INDEX, 0x0c);
12823 snd_hda_codec_write(codec, 0x20, 0,
12824 AC_VERB_SET_PROC_COEF, 0x680);
12826 snd_hda_codec_write(codec, 0x20, 0,
12827 AC_VERB_SET_COEF_INDEX, 0x0c);
12828 snd_hda_codec_write(codec, 0x20, 0,
12829 AC_VERB_SET_PROC_COEF, 0x480);
12832 /* toggle speaker-output according to the hp-jacks state */
12833 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12835 unsigned int present;
12836 unsigned char bits;
12838 /* Check laptop headphone socket */
12839 present = snd_hda_codec_read(codec, 0x15, 0,
12840 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12842 /* Check port replicator headphone socket */
12843 present |= snd_hda_codec_read(codec, 0x1a, 0,
12844 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12846 bits = present ? AMP_IN_MUTE(0) : 0;
12847 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12848 AMP_IN_MUTE(0), bits);
12849 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12850 AMP_IN_MUTE(0), bits);
12852 snd_hda_codec_write(codec, 0x20, 0,
12853 AC_VERB_SET_COEF_INDEX, 0x0c);
12854 snd_hda_codec_write(codec, 0x20, 0,
12855 AC_VERB_SET_PROC_COEF, 0x680);
12857 snd_hda_codec_write(codec, 0x20, 0,
12858 AC_VERB_SET_COEF_INDEX, 0x0c);
12859 snd_hda_codec_write(codec, 0x20, 0,
12860 AC_VERB_SET_PROC_COEF, 0x480);
12863 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12865 unsigned int present_laptop;
12866 unsigned int present_dock;
12868 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12869 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12871 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12872 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12874 /* Laptop mic port overrides dock mic port, design decision */
12876 snd_hda_codec_write(codec, 0x23, 0,
12877 AC_VERB_SET_CONNECT_SEL, 0x3);
12878 if (present_laptop)
12879 snd_hda_codec_write(codec, 0x23, 0,
12880 AC_VERB_SET_CONNECT_SEL, 0x0);
12881 if (!present_dock && !present_laptop)
12882 snd_hda_codec_write(codec, 0x23, 0,
12883 AC_VERB_SET_CONNECT_SEL, 0x1);
12886 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12889 switch (res >> 26) {
12890 case ALC880_HP_EVENT:
12891 alc269_quanta_fl1_speaker_automute(codec);
12893 case ALC880_MIC_EVENT:
12894 alc_mic_automute(codec);
12899 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12902 if ((res >> 26) == ALC880_HP_EVENT)
12903 alc269_lifebook_speaker_automute(codec);
12904 if ((res >> 26) == ALC880_MIC_EVENT)
12905 alc269_lifebook_mic_autoswitch(codec);
12908 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
12910 struct alc_spec *spec = codec->spec;
12911 spec->ext_mic.pin = 0x18;
12912 spec->ext_mic.mux_idx = 0;
12913 spec->int_mic.pin = 0x19;
12914 spec->int_mic.mux_idx = 1;
12915 spec->auto_mic = 1;
12918 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12920 alc269_quanta_fl1_speaker_automute(codec);
12921 alc_mic_automute(codec);
12924 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12926 alc269_lifebook_speaker_automute(codec);
12927 alc269_lifebook_mic_autoswitch(codec);
12930 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12931 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12932 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12933 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12934 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12935 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12936 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12937 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12941 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12942 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12943 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12944 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12945 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12946 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12947 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12951 /* toggle speaker-output according to the hp-jack state */
12952 static void alc269_speaker_automute(struct hda_codec *codec)
12954 unsigned int present;
12955 unsigned char bits;
12957 present = snd_hda_codec_read(codec, 0x15, 0,
12958 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12959 bits = present ? AMP_IN_MUTE(0) : 0;
12960 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12961 AMP_IN_MUTE(0), bits);
12962 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12963 AMP_IN_MUTE(0), bits);
12966 /* unsolicited event for HP jack sensing */
12967 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
12970 switch (res >> 26) {
12971 case ALC880_HP_EVENT:
12972 alc269_speaker_automute(codec);
12974 case ALC880_MIC_EVENT:
12975 alc_mic_automute(codec);
12980 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
12982 struct alc_spec *spec = codec->spec;
12983 spec->ext_mic.pin = 0x18;
12984 spec->ext_mic.mux_idx = 0;
12985 spec->int_mic.pin = 0x12;
12986 spec->int_mic.mux_idx = 5;
12987 spec->auto_mic = 1;
12990 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
12992 struct alc_spec *spec = codec->spec;
12993 spec->ext_mic.pin = 0x18;
12994 spec->ext_mic.mux_idx = 0;
12995 spec->int_mic.pin = 0x19;
12996 spec->int_mic.mux_idx = 1;
12997 spec->auto_mic = 1;
13000 static void alc269_eeepc_inithook(struct hda_codec *codec)
13002 alc269_speaker_automute(codec);
13003 alc_mic_automute(codec);
13007 * generic initialization of ADC, input mixers and output mixers
13009 static struct hda_verb alc269_init_verbs[] = {
13011 * Unmute ADC0 and set the default input to mic-in
13013 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13015 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13016 * analog-loopback mixer widget
13017 * Note: PASD motherboards uses the Line In 2 as the input for
13018 * front panel mic (mic 2)
13020 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13021 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13024 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13025 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13028 * Set up output mixers (0x0c - 0x0e)
13030 /* set vol=0 to output mixers */
13031 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13032 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13034 /* set up input amps for analog loopback */
13035 /* Amp Indices: DAC = 0, mixer = 1 */
13036 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13037 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13038 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13039 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13040 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13041 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13043 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13044 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13045 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13046 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13047 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13048 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13049 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13051 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13052 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13053 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13054 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13055 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13056 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13057 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13059 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13060 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13062 /* FIXME: use matrix-type input source selection */
13063 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13064 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13065 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13066 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13067 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13068 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13071 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13072 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13076 /* add playback controls from the parsed DAC table */
13077 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
13078 const struct auto_pin_cfg *cfg)
13083 spec->multiout.num_dacs = 1; /* only use one dac */
13084 spec->multiout.dac_nids = spec->private_dac_nids;
13085 spec->multiout.dac_nids[0] = 2;
13087 nid = cfg->line_out_pins[0];
13089 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13090 "Front Playback Volume",
13091 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
13094 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13095 "Front Playback Switch",
13096 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13101 nid = cfg->speaker_pins[0];
13103 if (!cfg->line_out_pins[0]) {
13104 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13105 "Speaker Playback Volume",
13106 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13112 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13113 "Speaker Playback Switch",
13114 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13119 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13120 "Speaker Playback Switch",
13121 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13127 nid = cfg->hp_pins[0];
13129 /* spec->multiout.hp_nid = 2; */
13130 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
13131 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13132 "Headphone Playback Volume",
13133 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13139 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13140 "Headphone Playback Switch",
13141 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13146 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13147 "Headphone Playback Switch",
13148 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13157 #define alc269_auto_create_analog_input_ctls \
13158 alc262_auto_create_analog_input_ctls
13160 #ifdef CONFIG_SND_HDA_POWER_SAVE
13161 #define alc269_loopbacks alc880_loopbacks
13164 /* pcm configuration: identical with ALC880 */
13165 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13166 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13167 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13168 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13170 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13174 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13175 /* NID is set in alc_build_pcms */
13177 .open = alc880_playback_pcm_open,
13178 .prepare = alc880_playback_pcm_prepare,
13179 .cleanup = alc880_playback_pcm_cleanup
13183 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13187 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13188 /* NID is set in alc_build_pcms */
13192 * BIOS auto configuration
13194 static int alc269_parse_auto_config(struct hda_codec *codec)
13196 struct alc_spec *spec = codec->spec;
13198 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13200 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13205 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13208 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
13212 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13214 if (spec->autocfg.dig_outs)
13215 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13217 if (spec->kctls.list)
13218 add_mixer(spec, spec->kctls.list);
13220 add_verb(spec, alc269_init_verbs);
13221 spec->num_mux_defs = 1;
13222 spec->input_mux = &spec->private_imux[0];
13223 /* set default input source */
13224 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13225 0, AC_VERB_SET_CONNECT_SEL,
13226 spec->input_mux->items[0].index);
13228 err = alc_auto_add_mic_boost(codec);
13232 if (!spec->cap_mixer && !spec->no_analog)
13233 set_capture_mixer(codec);
13235 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13240 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13241 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13242 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13245 /* init callback for auto-configuration model -- overriding the default init */
13246 static void alc269_auto_init(struct hda_codec *codec)
13248 struct alc_spec *spec = codec->spec;
13249 alc269_auto_init_multi_out(codec);
13250 alc269_auto_init_hp_out(codec);
13251 alc269_auto_init_analog_input(codec);
13252 if (spec->unsol_event)
13253 alc_inithook(codec);
13257 * configuration and preset
13259 static const char *alc269_models[ALC269_MODEL_LAST] = {
13260 [ALC269_BASIC] = "basic",
13261 [ALC269_QUANTA_FL1] = "quanta",
13262 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13263 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13264 [ALC269_FUJITSU] = "fujitsu",
13265 [ALC269_LIFEBOOK] = "lifebook"
13268 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13269 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13270 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13271 ALC269_ASUS_EEEPC_P703),
13272 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13273 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13274 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13275 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13276 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13277 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13278 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13279 ALC269_ASUS_EEEPC_P901),
13280 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13281 ALC269_ASUS_EEEPC_P901),
13282 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13283 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13284 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13288 static struct alc_config_preset alc269_presets[] = {
13290 .mixers = { alc269_base_mixer },
13291 .init_verbs = { alc269_init_verbs },
13292 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13293 .dac_nids = alc269_dac_nids,
13295 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13296 .channel_mode = alc269_modes,
13297 .input_mux = &alc269_capture_source,
13299 [ALC269_QUANTA_FL1] = {
13300 .mixers = { alc269_quanta_fl1_mixer },
13301 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13302 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13303 .dac_nids = alc269_dac_nids,
13305 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13306 .channel_mode = alc269_modes,
13307 .input_mux = &alc269_capture_source,
13308 .unsol_event = alc269_quanta_fl1_unsol_event,
13309 .setup = alc269_quanta_fl1_setup,
13310 .init_hook = alc269_quanta_fl1_init_hook,
13312 [ALC269_ASUS_EEEPC_P703] = {
13313 .mixers = { alc269_eeepc_mixer },
13314 .cap_mixer = alc269_epc_capture_mixer,
13315 .init_verbs = { alc269_init_verbs,
13316 alc269_eeepc_amic_init_verbs },
13317 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13318 .dac_nids = alc269_dac_nids,
13320 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13321 .channel_mode = alc269_modes,
13322 .unsol_event = alc269_eeepc_unsol_event,
13323 .setup = alc269_eeepc_amic_setup,
13324 .init_hook = alc269_eeepc_inithook,
13326 [ALC269_ASUS_EEEPC_P901] = {
13327 .mixers = { alc269_eeepc_mixer },
13328 .cap_mixer = alc269_epc_capture_mixer,
13329 .init_verbs = { alc269_init_verbs,
13330 alc269_eeepc_dmic_init_verbs },
13331 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13332 .dac_nids = alc269_dac_nids,
13334 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13335 .channel_mode = alc269_modes,
13336 .unsol_event = alc269_eeepc_unsol_event,
13337 .setup = alc269_eeepc_dmic_setup,
13338 .init_hook = alc269_eeepc_inithook,
13340 [ALC269_FUJITSU] = {
13341 .mixers = { alc269_fujitsu_mixer },
13342 .cap_mixer = alc269_epc_capture_mixer,
13343 .init_verbs = { alc269_init_verbs,
13344 alc269_eeepc_dmic_init_verbs },
13345 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13346 .dac_nids = alc269_dac_nids,
13348 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13349 .channel_mode = alc269_modes,
13350 .unsol_event = alc269_eeepc_unsol_event,
13351 .setup = alc269_eeepc_dmic_setup,
13352 .init_hook = alc269_eeepc_inithook,
13354 [ALC269_LIFEBOOK] = {
13355 .mixers = { alc269_lifebook_mixer },
13356 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13357 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13358 .dac_nids = alc269_dac_nids,
13360 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13361 .channel_mode = alc269_modes,
13362 .input_mux = &alc269_capture_source,
13363 .unsol_event = alc269_lifebook_unsol_event,
13364 .init_hook = alc269_lifebook_init_hook,
13368 static int patch_alc269(struct hda_codec *codec)
13370 struct alc_spec *spec;
13374 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13378 codec->spec = spec;
13380 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13382 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13386 if (board_config < 0) {
13387 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13389 board_config = ALC269_AUTO;
13392 if (board_config == ALC269_AUTO) {
13393 /* automatic parse from the BIOS config */
13394 err = alc269_parse_auto_config(codec);
13400 "hda_codec: Cannot set up configuration "
13401 "from BIOS. Using base mode...\n");
13402 board_config = ALC269_BASIC;
13406 err = snd_hda_attach_beep_device(codec, 0x1);
13412 if (board_config != ALC269_AUTO)
13413 setup_preset(codec, &alc269_presets[board_config]);
13415 if (codec->subsystem_id == 0x17aa3bf8) {
13416 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13417 * fix the sample rate of analog I/O to 44.1kHz
13419 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13420 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13422 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13423 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13425 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13426 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13428 spec->adc_nids = alc269_adc_nids;
13429 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13430 spec->capsrc_nids = alc269_capsrc_nids;
13431 if (!spec->cap_mixer)
13432 set_capture_mixer(codec);
13433 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13435 spec->vmaster_nid = 0x02;
13437 codec->patch_ops = alc_patch_ops;
13438 if (board_config == ALC269_AUTO)
13439 spec->init_hook = alc269_auto_init;
13440 #ifdef CONFIG_SND_HDA_POWER_SAVE
13441 if (!spec->loopback.amplist)
13442 spec->loopback.amplist = alc269_loopbacks;
13444 codec->proc_widget_hook = print_realtek_coef;
13450 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13454 * set the path ways for 2 channel output
13455 * need to set the codec line out and mic 1 pin widgets to inputs
13457 static struct hda_verb alc861_threestack_ch2_init[] = {
13458 /* set pin widget 1Ah (line in) for input */
13459 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13460 /* set pin widget 18h (mic1/2) for input, for mic also enable
13463 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13465 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13467 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13468 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13474 * need to set the codec line out and mic 1 pin widgets to outputs
13476 static struct hda_verb alc861_threestack_ch6_init[] = {
13477 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13478 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13479 /* set pin widget 18h (mic1) for output (CLFE)*/
13480 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13482 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13483 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13485 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13487 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13488 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13493 static struct hda_channel_mode alc861_threestack_modes[2] = {
13494 { 2, alc861_threestack_ch2_init },
13495 { 6, alc861_threestack_ch6_init },
13497 /* Set mic1 as input and unmute the mixer */
13498 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13499 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13500 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13503 /* Set mic1 as output and mute mixer */
13504 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13505 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13506 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13510 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13511 { 2, alc861_uniwill_m31_ch2_init },
13512 { 4, alc861_uniwill_m31_ch4_init },
13515 /* Set mic1 and line-in as input and unmute the mixer */
13516 static struct hda_verb alc861_asus_ch2_init[] = {
13517 /* set pin widget 1Ah (line in) for input */
13518 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13519 /* set pin widget 18h (mic1/2) for input, for mic also enable
13522 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13524 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13526 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13527 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13531 /* Set mic1 nad line-in as output and mute mixer */
13532 static struct hda_verb alc861_asus_ch6_init[] = {
13533 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13534 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13535 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13536 /* set pin widget 18h (mic1) for output (CLFE)*/
13537 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13538 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13539 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13540 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13542 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13544 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13545 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13550 static struct hda_channel_mode alc861_asus_modes[2] = {
13551 { 2, alc861_asus_ch2_init },
13552 { 6, alc861_asus_ch6_init },
13557 static struct snd_kcontrol_new alc861_base_mixer[] = {
13558 /* output mixer control */
13559 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13560 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13561 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13562 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13563 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13565 /*Input mixer control */
13566 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13567 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13568 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13569 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13570 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13571 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13572 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13573 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13574 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13575 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13580 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13581 /* output mixer control */
13582 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13583 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13584 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13585 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13586 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13588 /* Input mixer control */
13589 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13590 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13591 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13592 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13593 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13594 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13595 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13596 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13597 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13598 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13601 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13602 .name = "Channel Mode",
13603 .info = alc_ch_mode_info,
13604 .get = alc_ch_mode_get,
13605 .put = alc_ch_mode_put,
13606 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13611 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13612 /* output mixer control */
13613 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13614 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13615 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13620 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13621 /* output mixer control */
13622 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13623 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13624 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13625 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13626 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13628 /* Input mixer control */
13629 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13630 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13631 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13632 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13633 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13634 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13635 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13636 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13637 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13638 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13641 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13642 .name = "Channel Mode",
13643 .info = alc_ch_mode_info,
13644 .get = alc_ch_mode_get,
13645 .put = alc_ch_mode_put,
13646 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13651 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13652 /* output mixer control */
13653 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13654 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13655 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13656 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13657 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13659 /* Input mixer control */
13660 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13661 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13662 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13663 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13664 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13665 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13666 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13667 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13668 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13669 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13672 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13673 .name = "Channel Mode",
13674 .info = alc_ch_mode_info,
13675 .get = alc_ch_mode_get,
13676 .put = alc_ch_mode_put,
13677 .private_value = ARRAY_SIZE(alc861_asus_modes),
13682 /* additional mixer */
13683 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13684 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13685 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13690 * generic initialization of ADC, input mixers and output mixers
13692 static struct hda_verb alc861_base_init_verbs[] = {
13694 * Unmute ADC0 and set the default input to mic-in
13696 /* port-A for surround (rear panel) */
13697 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13698 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13699 /* port-B for mic-in (rear panel) with vref */
13700 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13701 /* port-C for line-in (rear panel) */
13702 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13703 /* port-D for Front */
13704 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13705 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13706 /* port-E for HP out (front panel) */
13707 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13708 /* route front PCM to HP */
13709 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13710 /* port-F for mic-in (front panel) with vref */
13711 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13712 /* port-G for CLFE (rear panel) */
13713 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13714 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13715 /* port-H for side (rear panel) */
13716 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13717 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13719 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13720 /* route front mic to ADC1*/
13721 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13722 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13724 /* Unmute DAC0~3 & spdif out*/
13725 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13726 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13727 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13728 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13729 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13731 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13732 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13733 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13734 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13735 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13737 /* Unmute Stereo Mixer 15 */
13738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13739 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13740 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13743 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13744 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13745 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13746 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13747 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13748 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13749 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13751 /* hp used DAC 3 (Front) */
13752 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13753 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13758 static struct hda_verb alc861_threestack_init_verbs[] = {
13760 * Unmute ADC0 and set the default input to mic-in
13762 /* port-A for surround (rear panel) */
13763 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13764 /* port-B for mic-in (rear panel) with vref */
13765 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13766 /* port-C for line-in (rear panel) */
13767 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13768 /* port-D for Front */
13769 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13770 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13771 /* port-E for HP out (front panel) */
13772 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13773 /* route front PCM to HP */
13774 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13775 /* port-F for mic-in (front panel) with vref */
13776 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13777 /* port-G for CLFE (rear panel) */
13778 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13779 /* port-H for side (rear panel) */
13780 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13782 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13783 /* route front mic to ADC1*/
13784 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13785 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13786 /* Unmute DAC0~3 & spdif out*/
13787 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13788 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13789 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13790 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13791 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13793 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13794 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13795 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13796 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13797 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13799 /* Unmute Stereo Mixer 15 */
13800 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13802 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13803 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13805 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13806 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13807 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13808 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13809 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13810 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13811 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13812 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13813 /* hp used DAC 3 (Front) */
13814 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13815 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13819 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13821 * Unmute ADC0 and set the default input to mic-in
13823 /* port-A for surround (rear panel) */
13824 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13825 /* port-B for mic-in (rear panel) with vref */
13826 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13827 /* port-C for line-in (rear panel) */
13828 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13829 /* port-D for Front */
13830 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13831 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13832 /* port-E for HP out (front panel) */
13833 /* this has to be set to VREF80 */
13834 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13835 /* route front PCM to HP */
13836 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13837 /* port-F for mic-in (front panel) with vref */
13838 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13839 /* port-G for CLFE (rear panel) */
13840 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13841 /* port-H for side (rear panel) */
13842 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13844 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13845 /* route front mic to ADC1*/
13846 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13847 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13848 /* Unmute DAC0~3 & spdif out*/
13849 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13850 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13851 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13852 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13853 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13855 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13856 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13857 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13858 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13859 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13861 /* Unmute Stereo Mixer 15 */
13862 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13863 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13864 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13865 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13867 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13868 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13869 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13870 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13871 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13872 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13873 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13874 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13875 /* hp used DAC 3 (Front) */
13876 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13877 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13881 static struct hda_verb alc861_asus_init_verbs[] = {
13883 * Unmute ADC0 and set the default input to mic-in
13885 /* port-A for surround (rear panel)
13886 * according to codec#0 this is the HP jack
13888 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13889 /* route front PCM to HP */
13890 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13891 /* port-B for mic-in (rear panel) with vref */
13892 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13893 /* port-C for line-in (rear panel) */
13894 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13895 /* port-D for Front */
13896 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13897 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13898 /* port-E for HP out (front panel) */
13899 /* this has to be set to VREF80 */
13900 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13901 /* route front PCM to HP */
13902 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13903 /* port-F for mic-in (front panel) with vref */
13904 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13905 /* port-G for CLFE (rear panel) */
13906 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13907 /* port-H for side (rear panel) */
13908 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13910 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13911 /* route front mic to ADC1*/
13912 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13913 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13914 /* Unmute DAC0~3 & spdif out*/
13915 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13916 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13917 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13918 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13920 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13921 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13922 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13923 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13924 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13926 /* Unmute Stereo Mixer 15 */
13927 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13928 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13929 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13932 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13933 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13934 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13935 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13936 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13937 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13938 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13939 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13940 /* hp used DAC 3 (Front) */
13941 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13942 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13946 /* additional init verbs for ASUS laptops */
13947 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13948 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13949 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13954 * generic initialization of ADC, input mixers and output mixers
13956 static struct hda_verb alc861_auto_init_verbs[] = {
13958 * Unmute ADC0 and set the default input to mic-in
13960 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13961 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13963 /* Unmute DAC0~3 & spdif out*/
13964 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13965 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13966 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13967 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13968 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13970 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13971 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13972 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13973 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13974 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13976 /* Unmute Stereo Mixer 15 */
13977 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13978 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13979 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13980 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13982 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13983 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13984 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13985 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13986 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13987 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13988 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13989 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13991 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13992 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13993 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13994 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13995 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13996 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13997 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13998 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14000 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14005 static struct hda_verb alc861_toshiba_init_verbs[] = {
14006 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14011 /* toggle speaker-output according to the hp-jack state */
14012 static void alc861_toshiba_automute(struct hda_codec *codec)
14014 unsigned int present;
14016 present = snd_hda_codec_read(codec, 0x0f, 0,
14017 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14018 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14019 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14020 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14021 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14024 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14027 if ((res >> 26) == ALC880_HP_EVENT)
14028 alc861_toshiba_automute(codec);
14031 /* pcm configuration: identical with ALC880 */
14032 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14033 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14034 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14035 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14038 #define ALC861_DIGOUT_NID 0x07
14040 static struct hda_channel_mode alc861_8ch_modes[1] = {
14044 static hda_nid_t alc861_dac_nids[4] = {
14045 /* front, surround, clfe, side */
14046 0x03, 0x06, 0x05, 0x04
14049 static hda_nid_t alc660_dac_nids[3] = {
14050 /* front, clfe, surround */
14054 static hda_nid_t alc861_adc_nids[1] = {
14059 static struct hda_input_mux alc861_capture_source = {
14063 { "Front Mic", 0x3 },
14070 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14072 struct alc_spec *spec = codec->spec;
14073 hda_nid_t mix, srcs[5];
14076 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14078 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14081 for (i = 0; i < num; i++) {
14083 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14084 if (type != AC_WID_AUD_OUT)
14086 for (j = 0; j < spec->multiout.num_dacs; j++)
14087 if (spec->multiout.dac_nids[j] == srcs[i])
14089 if (j >= spec->multiout.num_dacs)
14095 /* fill in the dac_nids table from the parsed pin configuration */
14096 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14097 const struct auto_pin_cfg *cfg)
14099 struct alc_spec *spec = codec->spec;
14101 hda_nid_t nid, dac;
14103 spec->multiout.dac_nids = spec->private_dac_nids;
14104 for (i = 0; i < cfg->line_outs; i++) {
14105 nid = cfg->line_out_pins[i];
14106 dac = alc861_look_for_dac(codec, nid);
14109 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14114 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14115 hda_nid_t nid, unsigned int chs)
14118 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
14119 return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name,
14120 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14123 /* add playback controls from the parsed DAC table */
14124 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14125 const struct auto_pin_cfg *cfg)
14127 struct alc_spec *spec = codec->spec;
14128 static const char *chname[4] = {
14129 "Front", "Surround", NULL /*CLFE*/, "Side"
14134 if (cfg->line_outs == 1) {
14135 const char *pfx = NULL;
14138 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14141 nid = spec->multiout.dac_nids[0];
14142 return alc861_create_out_sw(codec, pfx, nid, 3);
14146 for (i = 0; i < cfg->line_outs; i++) {
14147 nid = spec->multiout.dac_nids[i];
14152 err = alc861_create_out_sw(codec, "Center", nid, 1);
14155 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14159 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14167 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14169 struct alc_spec *spec = codec->spec;
14176 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14177 nid = alc861_look_for_dac(codec, pin);
14179 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14182 spec->multiout.hp_nid = nid;
14188 /* create playback/capture controls for input pins */
14189 static int alc861_auto_create_analog_input_ctls(struct hda_codec *codec,
14190 const struct auto_pin_cfg *cfg)
14192 struct alc_spec *spec = codec->spec;
14193 struct hda_input_mux *imux = &spec->private_imux[0];
14194 int i, err, idx, idx1;
14196 for (i = 0; i < AUTO_PIN_LAST; i++) {
14197 switch (cfg->input_pins[i]) {
14200 idx = 2; /* Line In */
14204 idx = 2; /* Line In */
14208 idx = 1; /* Mic In */
14212 idx = 1; /* Mic In */
14222 err = new_analog_input(spec, cfg->input_pins[i],
14223 auto_pin_cfg_labels[i], idx, 0x15);
14227 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
14228 imux->items[imux->num_items].index = idx1;
14234 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14236 int pin_type, hda_nid_t dac)
14238 hda_nid_t mix, srcs[5];
14241 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14243 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14245 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14247 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14250 for (i = 0; i < num; i++) {
14252 if (srcs[i] == dac || srcs[i] == 0x15)
14253 mute = AMP_IN_UNMUTE(i);
14255 mute = AMP_IN_MUTE(i);
14256 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14261 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14263 struct alc_spec *spec = codec->spec;
14266 for (i = 0; i < spec->autocfg.line_outs; i++) {
14267 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14268 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14270 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14271 spec->multiout.dac_nids[i]);
14275 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14277 struct alc_spec *spec = codec->spec;
14280 pin = spec->autocfg.hp_pins[0];
14282 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14283 spec->multiout.hp_nid);
14284 pin = spec->autocfg.speaker_pins[0];
14286 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT,
14287 spec->multiout.dac_nids[0]);
14290 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14292 struct alc_spec *spec = codec->spec;
14295 for (i = 0; i < AUTO_PIN_LAST; i++) {
14296 hda_nid_t nid = spec->autocfg.input_pins[i];
14297 if (nid >= 0x0c && nid <= 0x11)
14298 alc_set_input_pin(codec, nid, i);
14302 /* parse the BIOS configuration and set up the alc_spec */
14303 /* return 1 if successful, 0 if the proper config is not found,
14304 * or a negative error code
14306 static int alc861_parse_auto_config(struct hda_codec *codec)
14308 struct alc_spec *spec = codec->spec;
14310 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14312 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14316 if (!spec->autocfg.line_outs)
14317 return 0; /* can't find valid BIOS pin config */
14319 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14322 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14325 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14328 err = alc861_auto_create_analog_input_ctls(codec, &spec->autocfg);
14332 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14334 if (spec->autocfg.dig_outs)
14335 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14337 if (spec->kctls.list)
14338 add_mixer(spec, spec->kctls.list);
14340 add_verb(spec, alc861_auto_init_verbs);
14342 spec->num_mux_defs = 1;
14343 spec->input_mux = &spec->private_imux[0];
14345 spec->adc_nids = alc861_adc_nids;
14346 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14347 set_capture_mixer(codec);
14349 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14354 /* additional initialization for auto-configuration model */
14355 static void alc861_auto_init(struct hda_codec *codec)
14357 struct alc_spec *spec = codec->spec;
14358 alc861_auto_init_multi_out(codec);
14359 alc861_auto_init_hp_out(codec);
14360 alc861_auto_init_analog_input(codec);
14361 if (spec->unsol_event)
14362 alc_inithook(codec);
14365 #ifdef CONFIG_SND_HDA_POWER_SAVE
14366 static struct hda_amp_list alc861_loopbacks[] = {
14367 { 0x15, HDA_INPUT, 0 },
14368 { 0x15, HDA_INPUT, 1 },
14369 { 0x15, HDA_INPUT, 2 },
14370 { 0x15, HDA_INPUT, 3 },
14377 * configuration and preset
14379 static const char *alc861_models[ALC861_MODEL_LAST] = {
14380 [ALC861_3ST] = "3stack",
14381 [ALC660_3ST] = "3stack-660",
14382 [ALC861_3ST_DIG] = "3stack-dig",
14383 [ALC861_6ST_DIG] = "6stack-dig",
14384 [ALC861_UNIWILL_M31] = "uniwill-m31",
14385 [ALC861_TOSHIBA] = "toshiba",
14386 [ALC861_ASUS] = "asus",
14387 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14388 [ALC861_AUTO] = "auto",
14391 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14392 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14393 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14394 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14395 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14396 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14397 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14398 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14399 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14400 * Any other models that need this preset?
14402 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14403 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14404 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14405 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14406 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14407 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14408 /* FIXME: the below seems conflict */
14409 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14410 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14411 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14415 static struct alc_config_preset alc861_presets[] = {
14417 .mixers = { alc861_3ST_mixer },
14418 .init_verbs = { alc861_threestack_init_verbs },
14419 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14420 .dac_nids = alc861_dac_nids,
14421 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14422 .channel_mode = alc861_threestack_modes,
14424 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14425 .adc_nids = alc861_adc_nids,
14426 .input_mux = &alc861_capture_source,
14428 [ALC861_3ST_DIG] = {
14429 .mixers = { alc861_base_mixer },
14430 .init_verbs = { alc861_threestack_init_verbs },
14431 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14432 .dac_nids = alc861_dac_nids,
14433 .dig_out_nid = ALC861_DIGOUT_NID,
14434 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14435 .channel_mode = alc861_threestack_modes,
14437 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14438 .adc_nids = alc861_adc_nids,
14439 .input_mux = &alc861_capture_source,
14441 [ALC861_6ST_DIG] = {
14442 .mixers = { alc861_base_mixer },
14443 .init_verbs = { alc861_base_init_verbs },
14444 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14445 .dac_nids = alc861_dac_nids,
14446 .dig_out_nid = ALC861_DIGOUT_NID,
14447 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14448 .channel_mode = alc861_8ch_modes,
14449 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14450 .adc_nids = alc861_adc_nids,
14451 .input_mux = &alc861_capture_source,
14454 .mixers = { alc861_3ST_mixer },
14455 .init_verbs = { alc861_threestack_init_verbs },
14456 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14457 .dac_nids = alc660_dac_nids,
14458 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14459 .channel_mode = alc861_threestack_modes,
14461 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14462 .adc_nids = alc861_adc_nids,
14463 .input_mux = &alc861_capture_source,
14465 [ALC861_UNIWILL_M31] = {
14466 .mixers = { alc861_uniwill_m31_mixer },
14467 .init_verbs = { alc861_uniwill_m31_init_verbs },
14468 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14469 .dac_nids = alc861_dac_nids,
14470 .dig_out_nid = ALC861_DIGOUT_NID,
14471 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14472 .channel_mode = alc861_uniwill_m31_modes,
14474 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14475 .adc_nids = alc861_adc_nids,
14476 .input_mux = &alc861_capture_source,
14478 [ALC861_TOSHIBA] = {
14479 .mixers = { alc861_toshiba_mixer },
14480 .init_verbs = { alc861_base_init_verbs,
14481 alc861_toshiba_init_verbs },
14482 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14483 .dac_nids = alc861_dac_nids,
14484 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14485 .channel_mode = alc883_3ST_2ch_modes,
14486 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14487 .adc_nids = alc861_adc_nids,
14488 .input_mux = &alc861_capture_source,
14489 .unsol_event = alc861_toshiba_unsol_event,
14490 .init_hook = alc861_toshiba_automute,
14493 .mixers = { alc861_asus_mixer },
14494 .init_verbs = { alc861_asus_init_verbs },
14495 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14496 .dac_nids = alc861_dac_nids,
14497 .dig_out_nid = ALC861_DIGOUT_NID,
14498 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14499 .channel_mode = alc861_asus_modes,
14502 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14503 .adc_nids = alc861_adc_nids,
14504 .input_mux = &alc861_capture_source,
14506 [ALC861_ASUS_LAPTOP] = {
14507 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14508 .init_verbs = { alc861_asus_init_verbs,
14509 alc861_asus_laptop_init_verbs },
14510 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14511 .dac_nids = alc861_dac_nids,
14512 .dig_out_nid = ALC861_DIGOUT_NID,
14513 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14514 .channel_mode = alc883_3ST_2ch_modes,
14516 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14517 .adc_nids = alc861_adc_nids,
14518 .input_mux = &alc861_capture_source,
14523 static int patch_alc861(struct hda_codec *codec)
14525 struct alc_spec *spec;
14529 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14533 codec->spec = spec;
14535 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14539 if (board_config < 0) {
14540 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14542 board_config = ALC861_AUTO;
14545 if (board_config == ALC861_AUTO) {
14546 /* automatic parse from the BIOS config */
14547 err = alc861_parse_auto_config(codec);
14553 "hda_codec: Cannot set up configuration "
14554 "from BIOS. Using base mode...\n");
14555 board_config = ALC861_3ST_DIG;
14559 err = snd_hda_attach_beep_device(codec, 0x23);
14565 if (board_config != ALC861_AUTO)
14566 setup_preset(codec, &alc861_presets[board_config]);
14568 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14569 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14571 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14572 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14574 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14576 spec->vmaster_nid = 0x03;
14578 codec->patch_ops = alc_patch_ops;
14579 if (board_config == ALC861_AUTO)
14580 spec->init_hook = alc861_auto_init;
14581 #ifdef CONFIG_SND_HDA_POWER_SAVE
14582 if (!spec->loopback.amplist)
14583 spec->loopback.amplist = alc861_loopbacks;
14585 codec->proc_widget_hook = print_realtek_coef;
14591 * ALC861-VD support
14595 * In addition, an independent DAC
14597 #define ALC861VD_DIGOUT_NID 0x06
14599 static hda_nid_t alc861vd_dac_nids[4] = {
14600 /* front, surr, clfe, side surr */
14601 0x02, 0x03, 0x04, 0x05
14604 /* dac_nids for ALC660vd are in a different order - according to
14605 * Realtek's driver.
14606 * This should probably result in a different mixer for 6stack models
14607 * of ALC660vd codecs, but for now there is only 3stack mixer
14608 * - and it is the same as in 861vd.
14609 * adc_nids in ALC660vd are (is) the same as in 861vd
14611 static hda_nid_t alc660vd_dac_nids[3] = {
14612 /* front, rear, clfe, rear_surr */
14616 static hda_nid_t alc861vd_adc_nids[1] = {
14621 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14624 /* FIXME: should be a matrix-type input source selection */
14625 static struct hda_input_mux alc861vd_capture_source = {
14629 { "Front Mic", 0x1 },
14635 static struct hda_input_mux alc861vd_dallas_capture_source = {
14638 { "Ext Mic", 0x0 },
14639 { "Int Mic", 0x1 },
14643 static struct hda_input_mux alc861vd_hp_capture_source = {
14646 { "Front Mic", 0x0 },
14647 { "ATAPI Mic", 0x1 },
14654 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14661 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14662 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14663 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14664 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14665 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14672 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14673 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14674 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14675 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14676 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14680 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14681 { 6, alc861vd_6stack_ch6_init },
14682 { 8, alc861vd_6stack_ch8_init },
14685 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14687 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14688 .name = "Channel Mode",
14689 .info = alc_ch_mode_info,
14690 .get = alc_ch_mode_get,
14691 .put = alc_ch_mode_put,
14696 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14697 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14699 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14700 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14701 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14703 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14704 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14706 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14708 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14710 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14711 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14713 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14714 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14716 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14718 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14719 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14722 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14723 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14724 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14726 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14727 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14729 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14730 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14735 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14736 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14737 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14739 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14741 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14742 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14743 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14745 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14746 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14747 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14749 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14750 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14752 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14753 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14758 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14759 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14760 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14761 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14763 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14765 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14766 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14767 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14769 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14770 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14771 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14773 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14774 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14779 /* Pin assignment: Speaker=0x14, HP = 0x15,
14780 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14782 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14783 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14784 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14785 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14786 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14787 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14788 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14789 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14790 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14791 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14792 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14796 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14797 * Front Mic=0x18, ATAPI Mic = 0x19,
14799 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14800 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14801 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14802 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14803 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14804 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14805 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14806 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14807 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14813 * generic initialization of ADC, input mixers and output mixers
14815 static struct hda_verb alc861vd_volume_init_verbs[] = {
14817 * Unmute ADC0 and set the default input to mic-in
14819 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14820 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14822 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14823 * the analog-loopback mixer widget
14825 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14826 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14827 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14828 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14829 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14830 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14832 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14833 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14834 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14835 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14836 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14839 * Set up output mixers (0x02 - 0x05)
14841 /* set vol=0 to output mixers */
14842 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14843 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14844 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14845 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14847 /* set up input amps for analog loopback */
14848 /* Amp Indices: DAC = 0, mixer = 1 */
14849 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14850 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14851 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14852 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14853 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14854 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14855 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14856 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14862 * 3-stack pin configuration:
14863 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14865 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14867 * Set pin mode and muting
14869 /* set front pin widgets 0x14 for output */
14870 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14871 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14872 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14874 /* Mic (rear) pin: input vref at 80% */
14875 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14876 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14877 /* Front Mic pin: input vref at 80% */
14878 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14879 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14880 /* Line In pin: input */
14881 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14882 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14883 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14884 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14885 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14886 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14887 /* CD pin widget for input */
14888 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14894 * 6-stack pin configuration:
14896 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14898 * Set pin mode and muting
14900 /* set front pin widgets 0x14 for output */
14901 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14902 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14903 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14905 /* Rear Pin: output 1 (0x0d) */
14906 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14907 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14908 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14909 /* CLFE Pin: output 2 (0x0e) */
14910 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14911 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14912 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14913 /* Side Pin: output 3 (0x0f) */
14914 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14915 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14916 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14918 /* Mic (rear) pin: input vref at 80% */
14919 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14920 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14921 /* Front Mic pin: input vref at 80% */
14922 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14923 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14924 /* Line In pin: input */
14925 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14926 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14927 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14928 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14929 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14930 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14931 /* CD pin widget for input */
14932 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14937 static struct hda_verb alc861vd_eapd_verbs[] = {
14938 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14942 static struct hda_verb alc660vd_eapd_verbs[] = {
14943 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14944 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14948 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14949 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14950 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14951 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14952 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14953 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14957 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14959 unsigned int present;
14960 unsigned char bits;
14962 present = snd_hda_codec_read(codec, 0x18, 0,
14963 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14964 bits = present ? HDA_AMP_MUTE : 0;
14965 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14966 HDA_AMP_MUTE, bits);
14969 static void alc861vd_lenovo_setup(struct hda_codec *codec)
14971 struct alc_spec *spec = codec->spec;
14972 spec->autocfg.hp_pins[0] = 0x1b;
14973 spec->autocfg.speaker_pins[0] = 0x14;
14976 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14978 alc_automute_amp(codec);
14979 alc861vd_lenovo_mic_automute(codec);
14982 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14985 switch (res >> 26) {
14986 case ALC880_MIC_EVENT:
14987 alc861vd_lenovo_mic_automute(codec);
14990 alc_automute_amp_unsol_event(codec, res);
14995 static struct hda_verb alc861vd_dallas_verbs[] = {
14996 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14997 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14998 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14999 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15001 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15002 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15003 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15004 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15005 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15006 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15007 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15008 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15010 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15011 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15012 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15013 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15014 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15015 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15016 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15017 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15019 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15020 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15021 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15022 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15023 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15024 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15025 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15026 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15028 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15029 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15030 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15031 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15033 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15034 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15035 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15040 /* toggle speaker-output according to the hp-jack state */
15041 static void alc861vd_dallas_setup(struct hda_codec *codec)
15043 struct alc_spec *spec = codec->spec;
15045 spec->autocfg.hp_pins[0] = 0x15;
15046 spec->autocfg.speaker_pins[0] = 0x14;
15049 #ifdef CONFIG_SND_HDA_POWER_SAVE
15050 #define alc861vd_loopbacks alc880_loopbacks
15053 /* pcm configuration: identical with ALC880 */
15054 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15055 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15056 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15057 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15060 * configuration and preset
15062 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15063 [ALC660VD_3ST] = "3stack-660",
15064 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15065 [ALC660VD_ASUS_V1S] = "asus-v1s",
15066 [ALC861VD_3ST] = "3stack",
15067 [ALC861VD_3ST_DIG] = "3stack-digout",
15068 [ALC861VD_6ST_DIG] = "6stack-digout",
15069 [ALC861VD_LENOVO] = "lenovo",
15070 [ALC861VD_DALLAS] = "dallas",
15071 [ALC861VD_HP] = "hp",
15072 [ALC861VD_AUTO] = "auto",
15075 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15076 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15077 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15078 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15079 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
15080 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15081 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15082 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15083 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15084 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15085 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15086 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15087 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15088 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15089 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15090 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15094 static struct alc_config_preset alc861vd_presets[] = {
15096 .mixers = { alc861vd_3st_mixer },
15097 .init_verbs = { alc861vd_volume_init_verbs,
15098 alc861vd_3stack_init_verbs },
15099 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15100 .dac_nids = alc660vd_dac_nids,
15101 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15102 .channel_mode = alc861vd_3stack_2ch_modes,
15103 .input_mux = &alc861vd_capture_source,
15105 [ALC660VD_3ST_DIG] = {
15106 .mixers = { alc861vd_3st_mixer },
15107 .init_verbs = { alc861vd_volume_init_verbs,
15108 alc861vd_3stack_init_verbs },
15109 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15110 .dac_nids = alc660vd_dac_nids,
15111 .dig_out_nid = ALC861VD_DIGOUT_NID,
15112 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15113 .channel_mode = alc861vd_3stack_2ch_modes,
15114 .input_mux = &alc861vd_capture_source,
15117 .mixers = { alc861vd_3st_mixer },
15118 .init_verbs = { alc861vd_volume_init_verbs,
15119 alc861vd_3stack_init_verbs },
15120 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15121 .dac_nids = alc861vd_dac_nids,
15122 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15123 .channel_mode = alc861vd_3stack_2ch_modes,
15124 .input_mux = &alc861vd_capture_source,
15126 [ALC861VD_3ST_DIG] = {
15127 .mixers = { alc861vd_3st_mixer },
15128 .init_verbs = { alc861vd_volume_init_verbs,
15129 alc861vd_3stack_init_verbs },
15130 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15131 .dac_nids = alc861vd_dac_nids,
15132 .dig_out_nid = ALC861VD_DIGOUT_NID,
15133 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15134 .channel_mode = alc861vd_3stack_2ch_modes,
15135 .input_mux = &alc861vd_capture_source,
15137 [ALC861VD_6ST_DIG] = {
15138 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15139 .init_verbs = { alc861vd_volume_init_verbs,
15140 alc861vd_6stack_init_verbs },
15141 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15142 .dac_nids = alc861vd_dac_nids,
15143 .dig_out_nid = ALC861VD_DIGOUT_NID,
15144 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15145 .channel_mode = alc861vd_6stack_modes,
15146 .input_mux = &alc861vd_capture_source,
15148 [ALC861VD_LENOVO] = {
15149 .mixers = { alc861vd_lenovo_mixer },
15150 .init_verbs = { alc861vd_volume_init_verbs,
15151 alc861vd_3stack_init_verbs,
15152 alc861vd_eapd_verbs,
15153 alc861vd_lenovo_unsol_verbs },
15154 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15155 .dac_nids = alc660vd_dac_nids,
15156 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15157 .channel_mode = alc861vd_3stack_2ch_modes,
15158 .input_mux = &alc861vd_capture_source,
15159 .unsol_event = alc861vd_lenovo_unsol_event,
15160 .setup = alc861vd_lenovo_setup,
15161 .init_hook = alc861vd_lenovo_init_hook,
15163 [ALC861VD_DALLAS] = {
15164 .mixers = { alc861vd_dallas_mixer },
15165 .init_verbs = { alc861vd_dallas_verbs },
15166 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15167 .dac_nids = alc861vd_dac_nids,
15168 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15169 .channel_mode = alc861vd_3stack_2ch_modes,
15170 .input_mux = &alc861vd_dallas_capture_source,
15171 .unsol_event = alc_automute_amp_unsol_event,
15172 .setup = alc861vd_dallas_setup,
15173 .init_hook = alc_automute_amp,
15176 .mixers = { alc861vd_hp_mixer },
15177 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15178 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15179 .dac_nids = alc861vd_dac_nids,
15180 .dig_out_nid = ALC861VD_DIGOUT_NID,
15181 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15182 .channel_mode = alc861vd_3stack_2ch_modes,
15183 .input_mux = &alc861vd_hp_capture_source,
15184 .unsol_event = alc_automute_amp_unsol_event,
15185 .setup = alc861vd_dallas_setup,
15186 .init_hook = alc_automute_amp,
15188 [ALC660VD_ASUS_V1S] = {
15189 .mixers = { alc861vd_lenovo_mixer },
15190 .init_verbs = { alc861vd_volume_init_verbs,
15191 alc861vd_3stack_init_verbs,
15192 alc861vd_eapd_verbs,
15193 alc861vd_lenovo_unsol_verbs },
15194 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15195 .dac_nids = alc660vd_dac_nids,
15196 .dig_out_nid = ALC861VD_DIGOUT_NID,
15197 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15198 .channel_mode = alc861vd_3stack_2ch_modes,
15199 .input_mux = &alc861vd_capture_source,
15200 .unsol_event = alc861vd_lenovo_unsol_event,
15201 .setup = alc861vd_lenovo_setup,
15202 .init_hook = alc861vd_lenovo_init_hook,
15207 * BIOS auto configuration
15209 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15210 hda_nid_t nid, int pin_type, int dac_idx)
15212 alc_set_pin_output(codec, nid, pin_type);
15215 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15217 struct alc_spec *spec = codec->spec;
15220 for (i = 0; i <= HDA_SIDE; i++) {
15221 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15222 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15224 alc861vd_auto_set_output_and_unmute(codec, nid,
15230 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15232 struct alc_spec *spec = codec->spec;
15235 pin = spec->autocfg.hp_pins[0];
15236 if (pin) /* connect to front and use dac 0 */
15237 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15238 pin = spec->autocfg.speaker_pins[0];
15240 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15243 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
15244 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15246 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15248 struct alc_spec *spec = codec->spec;
15251 for (i = 0; i < AUTO_PIN_LAST; i++) {
15252 hda_nid_t nid = spec->autocfg.input_pins[i];
15253 if (alc861vd_is_input_pin(nid)) {
15254 alc_set_input_pin(codec, nid, i);
15255 if (nid != ALC861VD_PIN_CD_NID &&
15256 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15257 snd_hda_codec_write(codec, nid, 0,
15258 AC_VERB_SET_AMP_GAIN_MUTE,
15264 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15266 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15267 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15269 /* add playback controls from the parsed DAC table */
15270 /* Based on ALC880 version. But ALC861VD has separate,
15271 * different NIDs for mute/unmute switch and volume control */
15272 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15273 const struct auto_pin_cfg *cfg)
15276 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15277 hda_nid_t nid_v, nid_s;
15280 for (i = 0; i < cfg->line_outs; i++) {
15281 if (!spec->multiout.dac_nids[i])
15283 nid_v = alc861vd_idx_to_mixer_vol(
15285 spec->multiout.dac_nids[i]));
15286 nid_s = alc861vd_idx_to_mixer_switch(
15288 spec->multiout.dac_nids[i]));
15292 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15293 "Center Playback Volume",
15294 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15298 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15299 "LFE Playback Volume",
15300 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15304 err = add_control(spec, ALC_CTL_BIND_MUTE,
15305 "Center Playback Switch",
15306 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15310 err = add_control(spec, ALC_CTL_BIND_MUTE,
15311 "LFE Playback Switch",
15312 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15317 sprintf(name, "%s Playback Volume", chname[i]);
15318 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15319 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15323 sprintf(name, "%s Playback Switch", chname[i]);
15324 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15325 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15334 /* add playback controls for speaker and HP outputs */
15335 /* Based on ALC880 version. But ALC861VD has separate,
15336 * different NIDs for mute/unmute switch and volume control */
15337 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15338 hda_nid_t pin, const char *pfx)
15340 hda_nid_t nid_v, nid_s;
15347 if (alc880_is_fixed_pin(pin)) {
15348 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15349 /* specify the DAC as the extra output */
15350 if (!spec->multiout.hp_nid)
15351 spec->multiout.hp_nid = nid_v;
15353 spec->multiout.extra_out_nid[0] = nid_v;
15354 /* control HP volume/switch on the output mixer amp */
15355 nid_v = alc861vd_idx_to_mixer_vol(
15356 alc880_fixed_pin_idx(pin));
15357 nid_s = alc861vd_idx_to_mixer_switch(
15358 alc880_fixed_pin_idx(pin));
15360 sprintf(name, "%s Playback Volume", pfx);
15361 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15362 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15365 sprintf(name, "%s Playback Switch", pfx);
15366 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15367 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15370 } else if (alc880_is_multi_pin(pin)) {
15371 /* set manual connection */
15372 /* we have only a switch on HP-out PIN */
15373 sprintf(name, "%s Playback Switch", pfx);
15374 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15375 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15382 /* parse the BIOS configuration and set up the alc_spec
15383 * return 1 if successful, 0 if the proper config is not found,
15384 * or a negative error code
15385 * Based on ALC880 version - had to change it to override
15386 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15387 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15389 struct alc_spec *spec = codec->spec;
15391 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15393 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15397 if (!spec->autocfg.line_outs)
15398 return 0; /* can't find valid BIOS pin config */
15400 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15403 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15406 err = alc861vd_auto_create_extra_out(spec,
15407 spec->autocfg.speaker_pins[0],
15411 err = alc861vd_auto_create_extra_out(spec,
15412 spec->autocfg.hp_pins[0],
15416 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15420 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15422 if (spec->autocfg.dig_outs)
15423 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15425 if (spec->kctls.list)
15426 add_mixer(spec, spec->kctls.list);
15428 add_verb(spec, alc861vd_volume_init_verbs);
15430 spec->num_mux_defs = 1;
15431 spec->input_mux = &spec->private_imux[0];
15433 err = alc_auto_add_mic_boost(codec);
15437 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15442 /* additional initialization for auto-configuration model */
15443 static void alc861vd_auto_init(struct hda_codec *codec)
15445 struct alc_spec *spec = codec->spec;
15446 alc861vd_auto_init_multi_out(codec);
15447 alc861vd_auto_init_hp_out(codec);
15448 alc861vd_auto_init_analog_input(codec);
15449 alc861vd_auto_init_input_src(codec);
15450 if (spec->unsol_event)
15451 alc_inithook(codec);
15454 static int patch_alc861vd(struct hda_codec *codec)
15456 struct alc_spec *spec;
15457 int err, board_config;
15459 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15463 codec->spec = spec;
15465 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15469 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15470 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15472 board_config = ALC861VD_AUTO;
15475 if (board_config == ALC861VD_AUTO) {
15476 /* automatic parse from the BIOS config */
15477 err = alc861vd_parse_auto_config(codec);
15483 "hda_codec: Cannot set up configuration "
15484 "from BIOS. Using base mode...\n");
15485 board_config = ALC861VD_3ST;
15489 err = snd_hda_attach_beep_device(codec, 0x23);
15495 if (board_config != ALC861VD_AUTO)
15496 setup_preset(codec, &alc861vd_presets[board_config]);
15498 if (codec->vendor_id == 0x10ec0660) {
15499 /* always turn on EAPD */
15500 add_verb(spec, alc660vd_eapd_verbs);
15503 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15504 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15506 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15507 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15509 if (!spec->adc_nids) {
15510 spec->adc_nids = alc861vd_adc_nids;
15511 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15513 if (!spec->capsrc_nids)
15514 spec->capsrc_nids = alc861vd_capsrc_nids;
15516 set_capture_mixer(codec);
15517 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15519 spec->vmaster_nid = 0x02;
15521 codec->patch_ops = alc_patch_ops;
15523 if (board_config == ALC861VD_AUTO)
15524 spec->init_hook = alc861vd_auto_init;
15525 #ifdef CONFIG_SND_HDA_POWER_SAVE
15526 if (!spec->loopback.amplist)
15527 spec->loopback.amplist = alc861vd_loopbacks;
15529 codec->proc_widget_hook = print_realtek_coef;
15537 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15538 * configuration. Each pin widget can choose any input DACs and a mixer.
15539 * Each ADC is connected from a mixer of all inputs. This makes possible
15540 * 6-channel independent captures.
15542 * In addition, an independent DAC for the multi-playback (not used in this
15545 #define ALC662_DIGOUT_NID 0x06
15546 #define ALC662_DIGIN_NID 0x0a
15548 static hda_nid_t alc662_dac_nids[4] = {
15549 /* front, rear, clfe, rear_surr */
15553 static hda_nid_t alc272_dac_nids[2] = {
15557 static hda_nid_t alc662_adc_nids[2] = {
15562 static hda_nid_t alc272_adc_nids[1] = {
15567 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15568 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15572 /* FIXME: should be a matrix-type input source selection */
15573 static struct hda_input_mux alc662_capture_source = {
15577 { "Front Mic", 0x1 },
15583 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15591 static struct hda_input_mux alc663_capture_source = {
15595 { "Front Mic", 0x1 },
15600 #if 0 /* set to 1 for testing other input sources below */
15601 static struct hda_input_mux alc272_nc10_capture_source = {
15604 { "Autoselect Mic", 0x0 },
15605 { "Internal Mic", 0x1 },
15606 { "In-0x02", 0x2 },
15607 { "In-0x03", 0x3 },
15608 { "In-0x04", 0x4 },
15609 { "In-0x05", 0x5 },
15610 { "In-0x06", 0x6 },
15611 { "In-0x07", 0x7 },
15612 { "In-0x08", 0x8 },
15613 { "In-0x09", 0x9 },
15614 { "In-0x0a", 0x0a },
15615 { "In-0x0b", 0x0b },
15616 { "In-0x0c", 0x0c },
15617 { "In-0x0d", 0x0d },
15618 { "In-0x0e", 0x0e },
15619 { "In-0x0f", 0x0f },
15627 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15634 static struct hda_verb alc662_3ST_ch2_init[] = {
15635 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15636 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15637 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15638 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15645 static struct hda_verb alc662_3ST_ch6_init[] = {
15646 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15647 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15648 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15649 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15650 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15651 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15655 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15656 { 2, alc662_3ST_ch2_init },
15657 { 6, alc662_3ST_ch6_init },
15663 static struct hda_verb alc662_sixstack_ch6_init[] = {
15664 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15665 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15666 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15673 static struct hda_verb alc662_sixstack_ch8_init[] = {
15674 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15675 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15676 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15680 static struct hda_channel_mode alc662_5stack_modes[2] = {
15681 { 2, alc662_sixstack_ch6_init },
15682 { 6, alc662_sixstack_ch8_init },
15685 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15686 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15689 static struct snd_kcontrol_new alc662_base_mixer[] = {
15690 /* output mixer control */
15691 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15692 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15693 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15694 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15695 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15696 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15697 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15698 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15699 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15701 /*Input mixer control */
15702 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15703 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15704 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15705 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15706 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15707 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15708 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15709 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15713 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15714 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15715 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15716 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15717 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15718 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15719 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15720 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15721 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15722 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15723 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15724 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15728 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15729 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15730 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15731 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15732 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15733 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15734 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15735 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15736 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15737 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15738 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15739 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15740 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15741 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15742 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15743 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15744 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15745 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15749 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15750 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15751 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15752 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15753 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15754 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15755 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15756 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15757 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15758 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15762 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15763 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15764 ALC262_HIPPO_MASTER_SWITCH,
15766 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15767 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15768 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15770 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15771 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15772 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15776 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15777 ALC262_HIPPO_MASTER_SWITCH,
15778 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15779 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15780 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15781 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15782 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15783 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15784 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15785 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15786 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15790 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15791 .ops = &snd_hda_bind_vol,
15793 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15794 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15799 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15800 .ops = &snd_hda_bind_sw,
15802 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15803 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15808 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15809 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15810 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15811 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15812 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15816 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15817 .ops = &snd_hda_bind_sw,
15819 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15820 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15821 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15826 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15827 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15828 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15829 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15830 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15831 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15832 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15837 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15838 .ops = &snd_hda_bind_sw,
15840 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15841 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15842 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15847 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15848 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15849 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15850 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15851 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15852 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15853 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15857 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15858 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15859 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15860 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15861 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15862 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15863 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15864 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15868 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15869 .ops = &snd_hda_bind_vol,
15871 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15872 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15877 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15878 .ops = &snd_hda_bind_sw,
15880 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15881 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15886 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15887 HDA_BIND_VOL("Master Playback Volume",
15888 &alc663_asus_two_bind_master_vol),
15889 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15890 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15891 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15897 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15898 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15899 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15900 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15901 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15907 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15908 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15909 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15910 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15911 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15912 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15914 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15915 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15916 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15917 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15921 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15922 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15923 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15924 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15926 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15927 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15928 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15929 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15930 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15931 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15935 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15937 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15938 .name = "Channel Mode",
15939 .info = alc_ch_mode_info,
15940 .get = alc_ch_mode_get,
15941 .put = alc_ch_mode_put,
15946 static struct hda_verb alc662_init_verbs[] = {
15947 /* ADC: mute amp left and right */
15948 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15949 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15950 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15952 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15953 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15954 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15955 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15956 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15958 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15959 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15960 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15961 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15962 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15963 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15965 /* Front Pin: output 0 (0x0c) */
15966 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15967 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15969 /* Rear Pin: output 1 (0x0d) */
15970 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15971 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15973 /* CLFE Pin: output 2 (0x0e) */
15974 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15975 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15977 /* Mic (rear) pin: input vref at 80% */
15978 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15979 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15980 /* Front Mic pin: input vref at 80% */
15981 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15982 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15983 /* Line In pin: input */
15984 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15985 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15986 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15987 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15988 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15989 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15990 /* CD pin widget for input */
15991 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15993 /* FIXME: use matrix-type input source selection */
15994 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15996 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15997 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15999 /* always trun on EAPD */
16000 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16001 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16006 static struct hda_verb alc662_sue_init_verbs[] = {
16007 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16008 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16012 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16013 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16014 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16018 /* Set Unsolicited Event*/
16019 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16020 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16021 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16026 * generic initialization of ADC, input mixers and output mixers
16028 static struct hda_verb alc662_auto_init_verbs[] = {
16030 * Unmute ADC and set the default input to mic-in
16032 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16033 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16035 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16037 * Note: PASD motherboards uses the Line In 2 as the input for front
16038 * panel mic (mic 2)
16040 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16041 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16042 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16044 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16045 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16048 * Set up output mixers (0x0c - 0x0f)
16050 /* set vol=0 to output mixers */
16051 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16052 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16053 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16055 /* set up input amps for analog loopback */
16056 /* Amp Indices: DAC = 0, mixer = 1 */
16057 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16059 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16060 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16061 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16062 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16065 /* FIXME: use matrix-type input source selection */
16066 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16069 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16073 /* additional verbs for ALC663 */
16074 static struct hda_verb alc663_auto_init_verbs[] = {
16075 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16076 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16080 static struct hda_verb alc663_m51va_init_verbs[] = {
16081 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16082 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16083 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16084 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16085 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16088 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16089 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16093 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16094 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16095 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16096 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16098 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16099 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16100 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16104 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16105 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16106 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16107 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16108 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16110 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16111 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16112 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16116 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16117 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16118 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16119 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16120 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16121 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16122 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16123 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16127 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16128 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16129 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16130 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16131 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16132 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16133 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16134 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16135 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16136 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16137 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16138 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16139 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16143 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16144 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16145 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16146 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16147 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16148 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16149 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16150 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16151 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16152 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16153 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16154 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16155 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16159 static struct hda_verb alc663_g71v_init_verbs[] = {
16160 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16161 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16162 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16164 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16165 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16166 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16168 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16169 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16170 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16174 static struct hda_verb alc663_g50v_init_verbs[] = {
16175 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16176 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16177 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16179 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16180 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16184 static struct hda_verb alc662_ecs_init_verbs[] = {
16185 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16186 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16187 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16188 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16192 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16193 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16194 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16195 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16196 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16197 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16198 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16199 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16200 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16201 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16202 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16203 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16207 static struct hda_verb alc272_dell_init_verbs[] = {
16208 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16209 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16210 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16211 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16212 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16213 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16214 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16215 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16216 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16217 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16218 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16222 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16223 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16224 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16228 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16229 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16230 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16234 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16236 unsigned int present;
16237 unsigned char bits;
16239 present = snd_hda_codec_read(codec, 0x14, 0,
16240 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16241 bits = present ? HDA_AMP_MUTE : 0;
16242 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16243 HDA_AMP_MUTE, bits);
16246 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16248 unsigned int present;
16249 unsigned char bits;
16251 present = snd_hda_codec_read(codec, 0x1b, 0,
16252 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16253 bits = present ? HDA_AMP_MUTE : 0;
16254 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16255 HDA_AMP_MUTE, bits);
16256 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16257 HDA_AMP_MUTE, bits);
16260 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16263 if ((res >> 26) == ALC880_HP_EVENT)
16264 alc662_lenovo_101e_all_automute(codec);
16265 if ((res >> 26) == ALC880_FRONT_EVENT)
16266 alc662_lenovo_101e_ispeaker_automute(codec);
16269 /* unsolicited event for HP jack sensing */
16270 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16273 if ((res >> 26) == ALC880_MIC_EVENT)
16274 alc_mic_automute(codec);
16276 alc262_hippo_unsol_event(codec, res);
16279 static void alc662_eeepc_setup(struct hda_codec *codec)
16281 struct alc_spec *spec = codec->spec;
16283 alc262_hippo1_setup(codec);
16284 spec->ext_mic.pin = 0x18;
16285 spec->ext_mic.mux_idx = 0;
16286 spec->int_mic.pin = 0x19;
16287 spec->int_mic.mux_idx = 1;
16288 spec->auto_mic = 1;
16291 static void alc662_eeepc_inithook(struct hda_codec *codec)
16293 alc262_hippo_automute(codec);
16294 alc_mic_automute(codec);
16297 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16299 struct alc_spec *spec = codec->spec;
16301 spec->autocfg.hp_pins[0] = 0x14;
16302 spec->autocfg.speaker_pins[0] = 0x1b;
16305 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16307 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16309 unsigned int present;
16310 unsigned char bits;
16312 present = snd_hda_codec_read(codec, 0x21, 0,
16313 AC_VERB_GET_PIN_SENSE, 0)
16314 & AC_PINSENSE_PRESENCE;
16315 bits = present ? HDA_AMP_MUTE : 0;
16316 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16317 AMP_IN_MUTE(0), bits);
16318 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16319 AMP_IN_MUTE(0), bits);
16322 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16324 unsigned int present;
16325 unsigned char bits;
16327 present = snd_hda_codec_read(codec, 0x21, 0,
16328 AC_VERB_GET_PIN_SENSE, 0)
16329 & AC_PINSENSE_PRESENCE;
16330 bits = present ? HDA_AMP_MUTE : 0;
16331 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16332 AMP_IN_MUTE(0), bits);
16333 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16334 AMP_IN_MUTE(0), bits);
16335 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16336 AMP_IN_MUTE(0), bits);
16337 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16338 AMP_IN_MUTE(0), bits);
16341 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16343 unsigned int present;
16344 unsigned char bits;
16346 present = snd_hda_codec_read(codec, 0x15, 0,
16347 AC_VERB_GET_PIN_SENSE, 0)
16348 & AC_PINSENSE_PRESENCE;
16349 bits = present ? HDA_AMP_MUTE : 0;
16350 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16351 AMP_IN_MUTE(0), bits);
16352 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16353 AMP_IN_MUTE(0), bits);
16354 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16355 AMP_IN_MUTE(0), bits);
16356 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16357 AMP_IN_MUTE(0), bits);
16360 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16362 unsigned int present;
16363 unsigned char bits;
16365 present = snd_hda_codec_read(codec, 0x1b, 0,
16366 AC_VERB_GET_PIN_SENSE, 0)
16367 & AC_PINSENSE_PRESENCE;
16368 bits = present ? 0 : PIN_OUT;
16369 snd_hda_codec_write(codec, 0x14, 0,
16370 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16373 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16375 unsigned int present1, present2;
16377 present1 = snd_hda_codec_read(codec, 0x21, 0,
16378 AC_VERB_GET_PIN_SENSE, 0)
16379 & AC_PINSENSE_PRESENCE;
16380 present2 = snd_hda_codec_read(codec, 0x15, 0,
16381 AC_VERB_GET_PIN_SENSE, 0)
16382 & AC_PINSENSE_PRESENCE;
16384 if (present1 || present2) {
16385 snd_hda_codec_write_cache(codec, 0x14, 0,
16386 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16388 snd_hda_codec_write_cache(codec, 0x14, 0,
16389 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16393 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16395 unsigned int present1, present2;
16397 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16398 AC_VERB_GET_PIN_SENSE, 0)
16399 & AC_PINSENSE_PRESENCE;
16400 present2 = snd_hda_codec_read(codec, 0x15, 0,
16401 AC_VERB_GET_PIN_SENSE, 0)
16402 & AC_PINSENSE_PRESENCE;
16404 if (present1 || present2) {
16405 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16406 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16407 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16408 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16410 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16411 AMP_IN_MUTE(0), 0);
16412 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16413 AMP_IN_MUTE(0), 0);
16417 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16420 switch (res >> 26) {
16421 case ALC880_HP_EVENT:
16422 alc663_m51va_speaker_automute(codec);
16424 case ALC880_MIC_EVENT:
16425 alc_mic_automute(codec);
16430 static void alc663_m51va_setup(struct hda_codec *codec)
16432 struct alc_spec *spec = codec->spec;
16433 spec->ext_mic.pin = 0x18;
16434 spec->ext_mic.mux_idx = 0;
16435 spec->int_mic.pin = 0x12;
16436 spec->int_mic.mux_idx = 1;
16437 spec->auto_mic = 1;
16440 static void alc663_m51va_inithook(struct hda_codec *codec)
16442 alc663_m51va_speaker_automute(codec);
16443 alc_mic_automute(codec);
16446 /* ***************** Mode1 ******************************/
16447 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16448 #define alc663_mode1_setup alc663_m51va_setup
16449 #define alc663_mode1_inithook alc663_m51va_inithook
16451 /* ***************** Mode2 ******************************/
16452 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16455 switch (res >> 26) {
16456 case ALC880_HP_EVENT:
16457 alc662_f5z_speaker_automute(codec);
16459 case ALC880_MIC_EVENT:
16460 alc_mic_automute(codec);
16465 #define alc662_mode2_setup alc663_m51va_setup
16467 static void alc662_mode2_inithook(struct hda_codec *codec)
16469 alc662_f5z_speaker_automute(codec);
16470 alc_mic_automute(codec);
16472 /* ***************** Mode3 ******************************/
16473 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16476 switch (res >> 26) {
16477 case ALC880_HP_EVENT:
16478 alc663_two_hp_m1_speaker_automute(codec);
16480 case ALC880_MIC_EVENT:
16481 alc_mic_automute(codec);
16486 #define alc663_mode3_setup alc663_m51va_setup
16488 static void alc663_mode3_inithook(struct hda_codec *codec)
16490 alc663_two_hp_m1_speaker_automute(codec);
16491 alc_mic_automute(codec);
16493 /* ***************** Mode4 ******************************/
16494 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16497 switch (res >> 26) {
16498 case ALC880_HP_EVENT:
16499 alc663_21jd_two_speaker_automute(codec);
16501 case ALC880_MIC_EVENT:
16502 alc_mic_automute(codec);
16507 #define alc663_mode4_setup alc663_m51va_setup
16509 static void alc663_mode4_inithook(struct hda_codec *codec)
16511 alc663_21jd_two_speaker_automute(codec);
16512 alc_mic_automute(codec);
16514 /* ***************** Mode5 ******************************/
16515 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16518 switch (res >> 26) {
16519 case ALC880_HP_EVENT:
16520 alc663_15jd_two_speaker_automute(codec);
16522 case ALC880_MIC_EVENT:
16523 alc_mic_automute(codec);
16528 #define alc663_mode5_setup alc663_m51va_setup
16530 static void alc663_mode5_inithook(struct hda_codec *codec)
16532 alc663_15jd_two_speaker_automute(codec);
16533 alc_mic_automute(codec);
16535 /* ***************** Mode6 ******************************/
16536 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16539 switch (res >> 26) {
16540 case ALC880_HP_EVENT:
16541 alc663_two_hp_m2_speaker_automute(codec);
16543 case ALC880_MIC_EVENT:
16544 alc_mic_automute(codec);
16549 #define alc663_mode6_setup alc663_m51va_setup
16551 static void alc663_mode6_inithook(struct hda_codec *codec)
16553 alc663_two_hp_m2_speaker_automute(codec);
16554 alc_mic_automute(codec);
16557 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16559 unsigned int present;
16560 unsigned char bits;
16562 present = snd_hda_codec_read(codec, 0x21, 0,
16563 AC_VERB_GET_PIN_SENSE, 0)
16564 & AC_PINSENSE_PRESENCE;
16565 bits = present ? HDA_AMP_MUTE : 0;
16566 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16567 HDA_AMP_MUTE, bits);
16568 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16569 HDA_AMP_MUTE, bits);
16572 static void alc663_g71v_front_automute(struct hda_codec *codec)
16574 unsigned int present;
16575 unsigned char bits;
16577 present = snd_hda_codec_read(codec, 0x15, 0,
16578 AC_VERB_GET_PIN_SENSE, 0)
16579 & AC_PINSENSE_PRESENCE;
16580 bits = present ? HDA_AMP_MUTE : 0;
16581 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16582 HDA_AMP_MUTE, bits);
16585 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16588 switch (res >> 26) {
16589 case ALC880_HP_EVENT:
16590 alc663_g71v_hp_automute(codec);
16592 case ALC880_FRONT_EVENT:
16593 alc663_g71v_front_automute(codec);
16595 case ALC880_MIC_EVENT:
16596 alc_mic_automute(codec);
16601 #define alc663_g71v_setup alc663_m51va_setup
16603 static void alc663_g71v_inithook(struct hda_codec *codec)
16605 alc663_g71v_front_automute(codec);
16606 alc663_g71v_hp_automute(codec);
16607 alc_mic_automute(codec);
16610 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16613 switch (res >> 26) {
16614 case ALC880_HP_EVENT:
16615 alc663_m51va_speaker_automute(codec);
16617 case ALC880_MIC_EVENT:
16618 alc_mic_automute(codec);
16623 #define alc663_g50v_setup alc663_m51va_setup
16625 static void alc663_g50v_inithook(struct hda_codec *codec)
16627 alc663_m51va_speaker_automute(codec);
16628 alc_mic_automute(codec);
16631 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16632 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16633 ALC262_HIPPO_MASTER_SWITCH,
16635 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16636 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16637 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16639 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16640 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16641 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16645 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16646 /* Master Playback automatically created from Speaker and Headphone */
16647 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16648 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16649 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16650 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16652 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16653 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16654 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16656 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16657 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16658 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16662 #ifdef CONFIG_SND_HDA_POWER_SAVE
16663 #define alc662_loopbacks alc880_loopbacks
16667 /* pcm configuration: identical with ALC880 */
16668 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16669 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16670 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16671 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16674 * configuration and preset
16676 static const char *alc662_models[ALC662_MODEL_LAST] = {
16677 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16678 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16679 [ALC662_3ST_6ch] = "3stack-6ch",
16680 [ALC662_5ST_DIG] = "6stack-dig",
16681 [ALC662_LENOVO_101E] = "lenovo-101e",
16682 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16683 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16684 [ALC662_ECS] = "ecs",
16685 [ALC663_ASUS_M51VA] = "m51va",
16686 [ALC663_ASUS_G71V] = "g71v",
16687 [ALC663_ASUS_H13] = "h13",
16688 [ALC663_ASUS_G50V] = "g50v",
16689 [ALC663_ASUS_MODE1] = "asus-mode1",
16690 [ALC662_ASUS_MODE2] = "asus-mode2",
16691 [ALC663_ASUS_MODE3] = "asus-mode3",
16692 [ALC663_ASUS_MODE4] = "asus-mode4",
16693 [ALC663_ASUS_MODE5] = "asus-mode5",
16694 [ALC663_ASUS_MODE6] = "asus-mode6",
16695 [ALC272_DELL] = "dell",
16696 [ALC272_DELL_ZM1] = "dell-zm1",
16697 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16698 [ALC662_AUTO] = "auto",
16701 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16702 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16703 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16704 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16705 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16706 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16707 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16708 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16709 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16710 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16711 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16712 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16713 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16714 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16715 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16716 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16717 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16718 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16719 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16720 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16721 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16722 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16723 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16724 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16725 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16726 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16727 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16728 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16729 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16730 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16731 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16732 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16733 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16734 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16735 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16736 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16737 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16738 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16739 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16740 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16741 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16742 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16743 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16744 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16745 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16746 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16747 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16748 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16749 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16750 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16751 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16752 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16753 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16754 ALC662_3ST_6ch_DIG),
16755 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16756 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16757 ALC662_3ST_6ch_DIG),
16758 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16759 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16760 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16761 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16762 ALC662_3ST_6ch_DIG),
16763 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16768 static struct alc_config_preset alc662_presets[] = {
16769 [ALC662_3ST_2ch_DIG] = {
16770 .mixers = { alc662_3ST_2ch_mixer },
16771 .init_verbs = { alc662_init_verbs },
16772 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16773 .dac_nids = alc662_dac_nids,
16774 .dig_out_nid = ALC662_DIGOUT_NID,
16775 .dig_in_nid = ALC662_DIGIN_NID,
16776 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16777 .channel_mode = alc662_3ST_2ch_modes,
16778 .input_mux = &alc662_capture_source,
16780 [ALC662_3ST_6ch_DIG] = {
16781 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16782 .init_verbs = { alc662_init_verbs },
16783 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16784 .dac_nids = alc662_dac_nids,
16785 .dig_out_nid = ALC662_DIGOUT_NID,
16786 .dig_in_nid = ALC662_DIGIN_NID,
16787 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16788 .channel_mode = alc662_3ST_6ch_modes,
16790 .input_mux = &alc662_capture_source,
16792 [ALC662_3ST_6ch] = {
16793 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16794 .init_verbs = { alc662_init_verbs },
16795 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16796 .dac_nids = alc662_dac_nids,
16797 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16798 .channel_mode = alc662_3ST_6ch_modes,
16800 .input_mux = &alc662_capture_source,
16802 [ALC662_5ST_DIG] = {
16803 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16804 .init_verbs = { alc662_init_verbs },
16805 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16806 .dac_nids = alc662_dac_nids,
16807 .dig_out_nid = ALC662_DIGOUT_NID,
16808 .dig_in_nid = ALC662_DIGIN_NID,
16809 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16810 .channel_mode = alc662_5stack_modes,
16811 .input_mux = &alc662_capture_source,
16813 [ALC662_LENOVO_101E] = {
16814 .mixers = { alc662_lenovo_101e_mixer },
16815 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16816 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16817 .dac_nids = alc662_dac_nids,
16818 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16819 .channel_mode = alc662_3ST_2ch_modes,
16820 .input_mux = &alc662_lenovo_101e_capture_source,
16821 .unsol_event = alc662_lenovo_101e_unsol_event,
16822 .init_hook = alc662_lenovo_101e_all_automute,
16824 [ALC662_ASUS_EEEPC_P701] = {
16825 .mixers = { alc662_eeepc_p701_mixer },
16826 .init_verbs = { alc662_init_verbs,
16827 alc662_eeepc_sue_init_verbs },
16828 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16829 .dac_nids = alc662_dac_nids,
16830 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16831 .channel_mode = alc662_3ST_2ch_modes,
16832 .unsol_event = alc662_eeepc_unsol_event,
16833 .setup = alc662_eeepc_setup,
16834 .init_hook = alc662_eeepc_inithook,
16836 [ALC662_ASUS_EEEPC_EP20] = {
16837 .mixers = { alc662_eeepc_ep20_mixer,
16838 alc662_chmode_mixer },
16839 .init_verbs = { alc662_init_verbs,
16840 alc662_eeepc_ep20_sue_init_verbs },
16841 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16842 .dac_nids = alc662_dac_nids,
16843 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16844 .channel_mode = alc662_3ST_6ch_modes,
16845 .input_mux = &alc662_lenovo_101e_capture_source,
16846 .unsol_event = alc662_eeepc_unsol_event,
16847 .setup = alc662_eeepc_ep20_setup,
16848 .init_hook = alc662_eeepc_ep20_inithook,
16851 .mixers = { alc662_ecs_mixer },
16852 .init_verbs = { alc662_init_verbs,
16853 alc662_ecs_init_verbs },
16854 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16855 .dac_nids = alc662_dac_nids,
16856 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16857 .channel_mode = alc662_3ST_2ch_modes,
16858 .unsol_event = alc662_eeepc_unsol_event,
16859 .setup = alc662_eeepc_setup,
16860 .init_hook = alc662_eeepc_inithook,
16862 [ALC663_ASUS_M51VA] = {
16863 .mixers = { alc663_m51va_mixer },
16864 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16865 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16866 .dac_nids = alc662_dac_nids,
16867 .dig_out_nid = ALC662_DIGOUT_NID,
16868 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16869 .channel_mode = alc662_3ST_2ch_modes,
16870 .unsol_event = alc663_m51va_unsol_event,
16871 .setup = alc663_m51va_setup,
16872 .init_hook = alc663_m51va_inithook,
16874 [ALC663_ASUS_G71V] = {
16875 .mixers = { alc663_g71v_mixer },
16876 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16877 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16878 .dac_nids = alc662_dac_nids,
16879 .dig_out_nid = ALC662_DIGOUT_NID,
16880 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16881 .channel_mode = alc662_3ST_2ch_modes,
16882 .unsol_event = alc663_g71v_unsol_event,
16883 .setup = alc663_g71v_setup,
16884 .init_hook = alc663_g71v_inithook,
16886 [ALC663_ASUS_H13] = {
16887 .mixers = { alc663_m51va_mixer },
16888 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16889 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16890 .dac_nids = alc662_dac_nids,
16891 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16892 .channel_mode = alc662_3ST_2ch_modes,
16893 .unsol_event = alc663_m51va_unsol_event,
16894 .init_hook = alc663_m51va_inithook,
16896 [ALC663_ASUS_G50V] = {
16897 .mixers = { alc663_g50v_mixer },
16898 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16899 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16900 .dac_nids = alc662_dac_nids,
16901 .dig_out_nid = ALC662_DIGOUT_NID,
16902 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16903 .channel_mode = alc662_3ST_6ch_modes,
16904 .input_mux = &alc663_capture_source,
16905 .unsol_event = alc663_g50v_unsol_event,
16906 .setup = alc663_g50v_setup,
16907 .init_hook = alc663_g50v_inithook,
16909 [ALC663_ASUS_MODE1] = {
16910 .mixers = { alc663_m51va_mixer },
16911 .cap_mixer = alc662_auto_capture_mixer,
16912 .init_verbs = { alc662_init_verbs,
16913 alc663_21jd_amic_init_verbs },
16914 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16916 .dac_nids = alc662_dac_nids,
16917 .dig_out_nid = ALC662_DIGOUT_NID,
16918 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16919 .channel_mode = alc662_3ST_2ch_modes,
16920 .unsol_event = alc663_mode1_unsol_event,
16921 .setup = alc663_mode1_setup,
16922 .init_hook = alc663_mode1_inithook,
16924 [ALC662_ASUS_MODE2] = {
16925 .mixers = { alc662_1bjd_mixer },
16926 .cap_mixer = alc662_auto_capture_mixer,
16927 .init_verbs = { alc662_init_verbs,
16928 alc662_1bjd_amic_init_verbs },
16929 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16930 .dac_nids = alc662_dac_nids,
16931 .dig_out_nid = ALC662_DIGOUT_NID,
16932 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16933 .channel_mode = alc662_3ST_2ch_modes,
16934 .unsol_event = alc662_mode2_unsol_event,
16935 .setup = alc662_mode2_setup,
16936 .init_hook = alc662_mode2_inithook,
16938 [ALC663_ASUS_MODE3] = {
16939 .mixers = { alc663_two_hp_m1_mixer },
16940 .cap_mixer = alc662_auto_capture_mixer,
16941 .init_verbs = { alc662_init_verbs,
16942 alc663_two_hp_amic_m1_init_verbs },
16943 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16945 .dac_nids = alc662_dac_nids,
16946 .dig_out_nid = ALC662_DIGOUT_NID,
16947 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16948 .channel_mode = alc662_3ST_2ch_modes,
16949 .unsol_event = alc663_mode3_unsol_event,
16950 .setup = alc663_mode3_setup,
16951 .init_hook = alc663_mode3_inithook,
16953 [ALC663_ASUS_MODE4] = {
16954 .mixers = { alc663_asus_21jd_clfe_mixer },
16955 .cap_mixer = alc662_auto_capture_mixer,
16956 .init_verbs = { alc662_init_verbs,
16957 alc663_21jd_amic_init_verbs},
16958 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16960 .dac_nids = alc662_dac_nids,
16961 .dig_out_nid = ALC662_DIGOUT_NID,
16962 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16963 .channel_mode = alc662_3ST_2ch_modes,
16964 .unsol_event = alc663_mode4_unsol_event,
16965 .setup = alc663_mode4_setup,
16966 .init_hook = alc663_mode4_inithook,
16968 [ALC663_ASUS_MODE5] = {
16969 .mixers = { alc663_asus_15jd_clfe_mixer },
16970 .cap_mixer = alc662_auto_capture_mixer,
16971 .init_verbs = { alc662_init_verbs,
16972 alc663_15jd_amic_init_verbs },
16973 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16975 .dac_nids = alc662_dac_nids,
16976 .dig_out_nid = ALC662_DIGOUT_NID,
16977 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16978 .channel_mode = alc662_3ST_2ch_modes,
16979 .unsol_event = alc663_mode5_unsol_event,
16980 .setup = alc663_mode5_setup,
16981 .init_hook = alc663_mode5_inithook,
16983 [ALC663_ASUS_MODE6] = {
16984 .mixers = { alc663_two_hp_m2_mixer },
16985 .cap_mixer = alc662_auto_capture_mixer,
16986 .init_verbs = { alc662_init_verbs,
16987 alc663_two_hp_amic_m2_init_verbs },
16988 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16990 .dac_nids = alc662_dac_nids,
16991 .dig_out_nid = ALC662_DIGOUT_NID,
16992 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16993 .channel_mode = alc662_3ST_2ch_modes,
16994 .unsol_event = alc663_mode6_unsol_event,
16995 .setup = alc663_mode6_setup,
16996 .init_hook = alc663_mode6_inithook,
16999 .mixers = { alc663_m51va_mixer },
17000 .cap_mixer = alc272_auto_capture_mixer,
17001 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17002 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17003 .dac_nids = alc662_dac_nids,
17004 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17005 .adc_nids = alc272_adc_nids,
17006 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17007 .capsrc_nids = alc272_capsrc_nids,
17008 .channel_mode = alc662_3ST_2ch_modes,
17009 .unsol_event = alc663_m51va_unsol_event,
17010 .setup = alc663_m51va_setup,
17011 .init_hook = alc663_m51va_inithook,
17013 [ALC272_DELL_ZM1] = {
17014 .mixers = { alc663_m51va_mixer },
17015 .cap_mixer = alc662_auto_capture_mixer,
17016 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17017 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17018 .dac_nids = alc662_dac_nids,
17019 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17020 .adc_nids = alc662_adc_nids,
17022 .capsrc_nids = alc662_capsrc_nids,
17023 .channel_mode = alc662_3ST_2ch_modes,
17024 .unsol_event = alc663_m51va_unsol_event,
17025 .setup = alc663_m51va_setup,
17026 .init_hook = alc663_m51va_inithook,
17028 [ALC272_SAMSUNG_NC10] = {
17029 .mixers = { alc272_nc10_mixer },
17030 .init_verbs = { alc662_init_verbs,
17031 alc663_21jd_amic_init_verbs },
17032 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17033 .dac_nids = alc272_dac_nids,
17034 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17035 .channel_mode = alc662_3ST_2ch_modes,
17036 /*.input_mux = &alc272_nc10_capture_source,*/
17037 .unsol_event = alc663_mode4_unsol_event,
17038 .setup = alc663_mode4_setup,
17039 .init_hook = alc663_mode4_inithook,
17045 * BIOS auto configuration
17048 /* add playback controls from the parsed DAC table */
17049 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
17050 const struct auto_pin_cfg *cfg)
17053 static const char *chname[4] = {
17054 "Front", "Surround", NULL /*CLFE*/, "Side"
17059 for (i = 0; i < cfg->line_outs; i++) {
17060 if (!spec->multiout.dac_nids[i])
17062 nid = alc880_idx_to_dac(i);
17065 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17066 "Center Playback Volume",
17067 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
17071 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17072 "LFE Playback Volume",
17073 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
17077 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17078 "Center Playback Switch",
17079 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17083 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17084 "LFE Playback Switch",
17085 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17090 sprintf(name, "%s Playback Volume", chname[i]);
17091 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17092 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
17096 sprintf(name, "%s Playback Switch", chname[i]);
17097 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17098 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
17107 /* add playback controls for speaker and HP outputs */
17108 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17119 /* ALC663 has a mono output pin on 0x17 */
17120 sprintf(name, "%s Playback Switch", pfx);
17121 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17122 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17126 if (alc880_is_fixed_pin(pin)) {
17127 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17128 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17129 /* specify the DAC as the extra output */
17130 if (!spec->multiout.hp_nid)
17131 spec->multiout.hp_nid = nid;
17133 spec->multiout.extra_out_nid[0] = nid;
17134 /* control HP volume/switch on the output mixer amp */
17135 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17136 sprintf(name, "%s Playback Volume", pfx);
17137 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17138 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17141 sprintf(name, "%s Playback Switch", pfx);
17142 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17143 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17146 } else if (alc880_is_multi_pin(pin)) {
17147 /* set manual connection */
17148 /* we have only a switch on HP-out PIN */
17149 sprintf(name, "%s Playback Switch", pfx);
17150 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17151 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17158 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
17160 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
17161 return (pincap & AC_PINCAP_IN) != 0;
17164 /* create playback/capture controls for input pins */
17165 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
17166 const struct auto_pin_cfg *cfg)
17168 struct alc_spec *spec = codec->spec;
17169 struct hda_input_mux *imux = &spec->private_imux[0];
17172 for (i = 0; i < AUTO_PIN_LAST; i++) {
17173 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
17174 idx = get_connection_index(codec, 0x0b,
17175 cfg->input_pins[i]);
17177 err = new_analog_input(spec, cfg->input_pins[i],
17178 auto_pin_cfg_labels[i],
17183 idx = get_connection_index(codec, 0x22,
17184 cfg->input_pins[i]);
17186 imux->items[imux->num_items].label =
17187 auto_pin_cfg_labels[i];
17188 imux->items[imux->num_items].index = idx;
17196 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17197 hda_nid_t nid, int pin_type,
17200 alc_set_pin_output(codec, nid, pin_type);
17201 /* need the manual connection? */
17202 if (alc880_is_multi_pin(nid)) {
17203 struct alc_spec *spec = codec->spec;
17204 int idx = alc880_multi_pin_idx(nid);
17205 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17206 AC_VERB_SET_CONNECT_SEL,
17207 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17211 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17213 struct alc_spec *spec = codec->spec;
17216 for (i = 0; i <= HDA_SIDE; i++) {
17217 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17218 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17220 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17225 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17227 struct alc_spec *spec = codec->spec;
17230 pin = spec->autocfg.hp_pins[0];
17231 if (pin) /* connect to front */
17233 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17234 pin = spec->autocfg.speaker_pins[0];
17236 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17239 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17241 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17243 struct alc_spec *spec = codec->spec;
17246 for (i = 0; i < AUTO_PIN_LAST; i++) {
17247 hda_nid_t nid = spec->autocfg.input_pins[i];
17248 if (alc662_is_input_pin(codec, nid)) {
17249 alc_set_input_pin(codec, nid, i);
17250 if (nid != ALC662_PIN_CD_NID &&
17251 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17252 snd_hda_codec_write(codec, nid, 0,
17253 AC_VERB_SET_AMP_GAIN_MUTE,
17259 #define alc662_auto_init_input_src alc882_auto_init_input_src
17261 static int alc662_parse_auto_config(struct hda_codec *codec)
17263 struct alc_spec *spec = codec->spec;
17265 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17267 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17271 if (!spec->autocfg.line_outs)
17272 return 0; /* can't find valid BIOS pin config */
17274 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17277 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17280 err = alc662_auto_create_extra_out(spec,
17281 spec->autocfg.speaker_pins[0],
17285 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17289 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
17293 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17295 if (spec->autocfg.dig_outs)
17296 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17298 if (spec->kctls.list)
17299 add_mixer(spec, spec->kctls.list);
17301 spec->num_mux_defs = 1;
17302 spec->input_mux = &spec->private_imux[0];
17304 add_verb(spec, alc662_auto_init_verbs);
17305 if (codec->vendor_id == 0x10ec0663)
17306 add_verb(spec, alc663_auto_init_verbs);
17308 err = alc_auto_add_mic_boost(codec);
17312 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17317 /* additional initialization for auto-configuration model */
17318 static void alc662_auto_init(struct hda_codec *codec)
17320 struct alc_spec *spec = codec->spec;
17321 alc662_auto_init_multi_out(codec);
17322 alc662_auto_init_hp_out(codec);
17323 alc662_auto_init_analog_input(codec);
17324 alc662_auto_init_input_src(codec);
17325 if (spec->unsol_event)
17326 alc_inithook(codec);
17329 static int patch_alc662(struct hda_codec *codec)
17331 struct alc_spec *spec;
17332 int err, board_config;
17334 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17338 codec->spec = spec;
17340 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17342 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17345 if (board_config < 0) {
17346 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17348 board_config = ALC662_AUTO;
17351 if (board_config == ALC662_AUTO) {
17352 /* automatic parse from the BIOS config */
17353 err = alc662_parse_auto_config(codec);
17359 "hda_codec: Cannot set up configuration "
17360 "from BIOS. Using base mode...\n");
17361 board_config = ALC662_3ST_2ch_DIG;
17365 err = snd_hda_attach_beep_device(codec, 0x1);
17371 if (board_config != ALC662_AUTO)
17372 setup_preset(codec, &alc662_presets[board_config]);
17374 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17375 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17377 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17378 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17380 if (!spec->adc_nids) {
17381 spec->adc_nids = alc662_adc_nids;
17382 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17384 if (!spec->capsrc_nids)
17385 spec->capsrc_nids = alc662_capsrc_nids;
17387 if (!spec->cap_mixer)
17388 set_capture_mixer(codec);
17389 if (codec->vendor_id == 0x10ec0662)
17390 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17392 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17394 spec->vmaster_nid = 0x02;
17396 codec->patch_ops = alc_patch_ops;
17397 if (board_config == ALC662_AUTO)
17398 spec->init_hook = alc662_auto_init;
17399 #ifdef CONFIG_SND_HDA_POWER_SAVE
17400 if (!spec->loopback.amplist)
17401 spec->loopback.amplist = alc662_loopbacks;
17403 codec->proc_widget_hook = print_realtek_coef;
17411 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17412 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17413 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17414 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17415 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17416 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17417 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17418 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17419 .patch = patch_alc861 },
17420 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17421 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17422 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17423 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17424 .patch = patch_alc882 },
17425 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17426 .patch = patch_alc662 },
17427 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17428 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17429 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17430 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17431 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17432 .patch = patch_alc882 },
17433 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17434 .patch = patch_alc882 },
17435 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17436 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17437 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17438 .patch = patch_alc882 },
17439 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17440 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17441 {} /* terminator */
17444 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17446 MODULE_LICENSE("GPL");
17447 MODULE_DESCRIPTION("Realtek HD-audio codec");
17449 static struct hda_codec_preset_list realtek_list = {
17450 .preset = snd_hda_preset_realtek,
17451 .owner = THIS_MODULE,
17454 static int __init patch_realtek_init(void)
17456 return snd_hda_add_codec_preset(&realtek_list);
17459 static void __exit patch_realtek_exit(void)
17461 snd_hda_delete_codec_preset(&realtek_list);
17464 module_init(patch_realtek_init)
17465 module_exit(patch_realtek_exit)