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_init(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;
1550 alc_automute_amp(codec);
1553 static void alc889_intel_init_hook(struct hda_codec *codec)
1555 alc889_coef_init(codec);
1556 alc889_automute_init(codec);
1559 static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec)
1561 struct alc_spec *spec = codec->spec;
1563 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1564 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1565 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1566 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1567 alc_automute_amp(codec);
1571 * ALC888 Acer Aspire 4930G model
1574 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1575 /* Front Mic: set to PIN_IN (empty by default) */
1576 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1577 /* Unselect Front Mic by default in input mixer 3 */
1578 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1579 /* Enable unsolicited event for HP jack */
1580 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1581 /* Connect Internal HP to front */
1582 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1583 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1584 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1585 /* Connect HP out to front */
1586 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1587 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1588 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1593 * ALC888 Acer Aspire 6530G model
1596 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1597 /* Bias voltage on for external mic port */
1598 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1599 /* Front Mic: set to PIN_IN (empty by default) */
1600 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1601 /* Unselect Front Mic by default in input mixer 3 */
1602 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1603 /* Enable unsolicited event for HP jack */
1604 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1605 /* Enable speaker output */
1606 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1607 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1608 /* Enable headphone output */
1609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1610 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1611 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1616 * ALC889 Acer Aspire 8930G model
1619 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1620 /* Front Mic: set to PIN_IN (empty by default) */
1621 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1622 /* Unselect Front Mic by default in input mixer 3 */
1623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1624 /* Enable unsolicited event for HP jack */
1625 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1626 /* Connect Internal Front to Front */
1627 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1628 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1629 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1630 /* Connect Internal Rear to Rear */
1631 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1632 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1633 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1634 /* Connect Internal CLFE to CLFE */
1635 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1636 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1637 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1638 /* Connect HP out to Front */
1639 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1640 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1641 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1642 /* Enable all DACs */
1643 /* DAC DISABLE/MUTE 1? */
1644 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1645 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1646 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1647 /* DAC DISABLE/MUTE 2? */
1648 /* some bit here disables the other DACs. Init=0x4900 */
1649 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1650 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1651 /* Enable amplifiers */
1652 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1653 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1655 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1656 * which makes the stereo useless. However, either the mic or the ALC889
1657 * makes the signal become a difference/sum signal instead of standard
1658 * stereo, which is annoying. So instead we flip this bit which makes the
1659 * codec replicate the sum signal to both channels, turning it into a
1662 /* DMIC_CONTROL? Init value = 0x0001 */
1663 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1664 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1668 static struct hda_input_mux alc888_2_capture_sources[2] = {
1669 /* Front mic only available on one ADC */
1676 { "Front Mic", 0xb },
1689 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1690 /* Interal mic only available on one ADC */
1697 { "Input Mix", 0xa },
1707 { "Input Mix", 0xa },
1712 static struct hda_input_mux alc889_capture_sources[3] = {
1713 /* Digital mic only available on first "ADC" */
1720 { "Front Mic", 0xb },
1721 { "Input Mix", 0xa },
1730 { "Input Mix", 0xa },
1739 { "Input Mix", 0xa },
1744 static struct snd_kcontrol_new alc888_base_mixer[] = {
1745 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1746 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1747 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1748 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1749 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1751 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1752 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1753 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1754 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1755 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1756 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1757 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1758 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1759 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1760 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1761 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1762 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1766 static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec)
1768 struct alc_spec *spec = codec->spec;
1770 spec->autocfg.hp_pins[0] = 0x15;
1771 spec->autocfg.speaker_pins[0] = 0x14;
1772 alc_automute_amp(codec);
1775 static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec)
1777 struct alc_spec *spec = codec->spec;
1779 spec->autocfg.hp_pins[0] = 0x15;
1780 spec->autocfg.speaker_pins[0] = 0x14;
1781 spec->autocfg.speaker_pins[1] = 0x16;
1782 spec->autocfg.speaker_pins[2] = 0x17;
1783 alc_automute_amp(codec);
1786 static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec)
1788 struct alc_spec *spec = codec->spec;
1790 spec->autocfg.hp_pins[0] = 0x15;
1791 spec->autocfg.speaker_pins[0] = 0x14;
1792 spec->autocfg.speaker_pins[1] = 0x16;
1793 spec->autocfg.speaker_pins[2] = 0x1b;
1794 alc_automute_amp(codec);
1798 * ALC880 3-stack model
1800 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1801 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1802 * F-Mic = 0x1b, HP = 0x19
1805 static hda_nid_t alc880_dac_nids[4] = {
1806 /* front, rear, clfe, rear_surr */
1807 0x02, 0x05, 0x04, 0x03
1810 static hda_nid_t alc880_adc_nids[3] = {
1815 /* The datasheet says the node 0x07 is connected from inputs,
1816 * but it shows zero connection in the real implementation on some devices.
1817 * Note: this is a 915GAV bug, fixed on 915GLV
1819 static hda_nid_t alc880_adc_nids_alt[2] = {
1824 #define ALC880_DIGOUT_NID 0x06
1825 #define ALC880_DIGIN_NID 0x0a
1827 static struct hda_input_mux alc880_capture_source = {
1831 { "Front Mic", 0x3 },
1837 /* channel source setting (2/6 channel selection for 3-stack) */
1839 static struct hda_verb alc880_threestack_ch2_init[] = {
1840 /* set line-in to input, mute it */
1841 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1842 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1843 /* set mic-in to input vref 80%, mute it */
1844 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1845 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1850 static struct hda_verb alc880_threestack_ch6_init[] = {
1851 /* set line-in to output, unmute it */
1852 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1853 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1854 /* set mic-in to output, unmute it */
1855 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1856 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1860 static struct hda_channel_mode alc880_threestack_modes[2] = {
1861 { 2, alc880_threestack_ch2_init },
1862 { 6, alc880_threestack_ch6_init },
1865 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1866 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1867 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1868 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1869 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1870 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1871 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1872 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1873 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1874 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1875 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1876 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1877 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1880 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1881 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1882 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1884 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1885 .name = "Channel Mode",
1886 .info = alc_ch_mode_info,
1887 .get = alc_ch_mode_get,
1888 .put = alc_ch_mode_put,
1893 /* capture mixer elements */
1894 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1895 struct snd_ctl_elem_info *uinfo)
1897 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1898 struct alc_spec *spec = codec->spec;
1901 mutex_lock(&codec->control_mutex);
1902 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1904 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1905 mutex_unlock(&codec->control_mutex);
1909 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1910 unsigned int size, unsigned int __user *tlv)
1912 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1913 struct alc_spec *spec = codec->spec;
1916 mutex_lock(&codec->control_mutex);
1917 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1919 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1920 mutex_unlock(&codec->control_mutex);
1924 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1925 struct snd_ctl_elem_value *ucontrol);
1927 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1928 struct snd_ctl_elem_value *ucontrol,
1931 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1932 struct alc_spec *spec = codec->spec;
1933 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1936 mutex_lock(&codec->control_mutex);
1937 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1939 err = func(kcontrol, ucontrol);
1940 mutex_unlock(&codec->control_mutex);
1944 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1945 struct snd_ctl_elem_value *ucontrol)
1947 return alc_cap_getput_caller(kcontrol, ucontrol,
1948 snd_hda_mixer_amp_volume_get);
1951 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1952 struct snd_ctl_elem_value *ucontrol)
1954 return alc_cap_getput_caller(kcontrol, ucontrol,
1955 snd_hda_mixer_amp_volume_put);
1958 /* capture mixer elements */
1959 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1961 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1962 struct snd_ctl_elem_value *ucontrol)
1964 return alc_cap_getput_caller(kcontrol, ucontrol,
1965 snd_hda_mixer_amp_switch_get);
1968 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1969 struct snd_ctl_elem_value *ucontrol)
1971 return alc_cap_getput_caller(kcontrol, ucontrol,
1972 snd_hda_mixer_amp_switch_put);
1975 #define _DEFINE_CAPMIX(num) \
1977 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1978 .name = "Capture Switch", \
1979 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1981 .info = alc_cap_sw_info, \
1982 .get = alc_cap_sw_get, \
1983 .put = alc_cap_sw_put, \
1986 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1987 .name = "Capture Volume", \
1988 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1989 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1990 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1992 .info = alc_cap_vol_info, \
1993 .get = alc_cap_vol_get, \
1994 .put = alc_cap_vol_put, \
1995 .tlv = { .c = alc_cap_vol_tlv }, \
1998 #define _DEFINE_CAPSRC(num) \
2000 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2001 /* .name = "Capture Source", */ \
2002 .name = "Input Source", \
2004 .info = alc_mux_enum_info, \
2005 .get = alc_mux_enum_get, \
2006 .put = alc_mux_enum_put, \
2009 #define DEFINE_CAPMIX(num) \
2010 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2011 _DEFINE_CAPMIX(num), \
2012 _DEFINE_CAPSRC(num), \
2016 #define DEFINE_CAPMIX_NOSRC(num) \
2017 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2018 _DEFINE_CAPMIX(num), \
2022 /* up to three ADCs */
2026 DEFINE_CAPMIX_NOSRC(1);
2027 DEFINE_CAPMIX_NOSRC(2);
2028 DEFINE_CAPMIX_NOSRC(3);
2031 * ALC880 5-stack model
2033 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2035 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2036 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2039 /* additional mixers to alc880_three_stack_mixer */
2040 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2041 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2042 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2046 /* channel source setting (6/8 channel selection for 5-stack) */
2048 static struct hda_verb alc880_fivestack_ch6_init[] = {
2049 /* set line-in to input, mute it */
2050 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2051 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2056 static struct hda_verb alc880_fivestack_ch8_init[] = {
2057 /* set line-in to output, unmute it */
2058 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2059 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2063 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2064 { 6, alc880_fivestack_ch6_init },
2065 { 8, alc880_fivestack_ch8_init },
2070 * ALC880 6-stack model
2072 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2073 * Side = 0x05 (0x0f)
2074 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2075 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2078 static hda_nid_t alc880_6st_dac_nids[4] = {
2079 /* front, rear, clfe, rear_surr */
2080 0x02, 0x03, 0x04, 0x05
2083 static struct hda_input_mux alc880_6stack_capture_source = {
2087 { "Front Mic", 0x1 },
2093 /* fixed 8-channels */
2094 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2098 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2099 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2100 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2101 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2102 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2103 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2104 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2105 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2106 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2107 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2108 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2109 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2110 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2111 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2112 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2113 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2114 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2115 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2116 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2118 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2119 .name = "Channel Mode",
2120 .info = alc_ch_mode_info,
2121 .get = alc_ch_mode_get,
2122 .put = alc_ch_mode_put,
2131 * W810 has rear IO for:
2134 * Center/LFE (DAC 04)
2137 * The system also has a pair of internal speakers, and a headphone jack.
2138 * These are both connected to Line2 on the codec, hence to DAC 02.
2140 * There is a variable resistor to control the speaker or headphone
2141 * volume. This is a hardware-only device without a software API.
2143 * Plugging headphones in will disable the internal speakers. This is
2144 * implemented in hardware, not via the driver using jack sense. In
2145 * a similar fashion, plugging into the rear socket marked "front" will
2146 * disable both the speakers and headphones.
2148 * For input, there's a microphone jack, and an "audio in" jack.
2149 * These may not do anything useful with this driver yet, because I
2150 * haven't setup any initialization verbs for these yet...
2153 static hda_nid_t alc880_w810_dac_nids[3] = {
2154 /* front, rear/surround, clfe */
2158 /* fixed 6 channels */
2159 static struct hda_channel_mode alc880_w810_modes[1] = {
2163 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2164 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2165 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2166 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2167 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2168 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2169 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2170 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2171 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2172 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2173 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2181 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2182 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2186 static hda_nid_t alc880_z71v_dac_nids[1] = {
2189 #define ALC880_Z71V_HP_DAC 0x03
2191 /* fixed 2 channels */
2192 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2196 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2197 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2198 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2199 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2200 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2201 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2202 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2203 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2210 * ALC880 F1734 model
2212 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2213 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2216 static hda_nid_t alc880_f1734_dac_nids[1] = {
2219 #define ALC880_F1734_HP_DAC 0x02
2221 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2222 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2223 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2224 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2225 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2226 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2227 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2229 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2233 static struct hda_input_mux alc880_f1734_capture_source = {
2245 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2246 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2247 * Mic = 0x18, Line = 0x1a
2250 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2251 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2253 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2254 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2255 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2256 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2257 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2258 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2259 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2260 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2261 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2262 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2263 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2264 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2265 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2266 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2267 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2269 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2270 .name = "Channel Mode",
2271 .info = alc_ch_mode_info,
2272 .get = alc_ch_mode_get,
2273 .put = alc_ch_mode_put,
2279 * ALC880 ASUS W1V model
2281 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2282 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2283 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2286 /* additional mixers to alc880_asus_mixer */
2287 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2288 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2289 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2294 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2295 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2296 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2297 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2298 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2299 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2300 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2301 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2302 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2303 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2308 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2309 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2310 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2311 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2312 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2313 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2314 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2315 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2316 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2317 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2318 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2319 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2320 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2321 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2322 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2323 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2324 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2326 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2327 .name = "Channel Mode",
2328 .info = alc_ch_mode_info,
2329 .get = alc_ch_mode_get,
2330 .put = alc_ch_mode_put,
2335 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2336 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2337 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2338 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2339 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2340 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2341 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2342 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2343 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2344 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2345 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2349 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2350 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2351 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2352 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2353 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2354 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2355 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2360 * virtual master controls
2364 * slave controls for virtual master
2366 static const char *alc_slave_vols[] = {
2367 "Front Playback Volume",
2368 "Surround Playback Volume",
2369 "Center Playback Volume",
2370 "LFE Playback Volume",
2371 "Side Playback Volume",
2372 "Headphone Playback Volume",
2373 "Speaker Playback Volume",
2374 "Mono Playback Volume",
2375 "Line-Out Playback Volume",
2376 "PCM Playback Volume",
2380 static const char *alc_slave_sws[] = {
2381 "Front Playback Switch",
2382 "Surround Playback Switch",
2383 "Center Playback Switch",
2384 "LFE Playback Switch",
2385 "Side Playback Switch",
2386 "Headphone Playback Switch",
2387 "Speaker Playback Switch",
2388 "Mono Playback Switch",
2389 "IEC958 Playback Switch",
2394 * build control elements
2397 static void alc_free_kctls(struct hda_codec *codec);
2399 /* additional beep mixers; the actual parameters are overwritten at build */
2400 static struct snd_kcontrol_new alc_beep_mixer[] = {
2401 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2402 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2406 static int alc_build_controls(struct hda_codec *codec)
2408 struct alc_spec *spec = codec->spec;
2412 for (i = 0; i < spec->num_mixers; i++) {
2413 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2417 if (spec->cap_mixer) {
2418 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2422 if (spec->multiout.dig_out_nid) {
2423 err = snd_hda_create_spdif_out_ctls(codec,
2424 spec->multiout.dig_out_nid);
2427 if (!spec->no_analog) {
2428 err = snd_hda_create_spdif_share_sw(codec,
2432 spec->multiout.share_spdif = 1;
2435 if (spec->dig_in_nid) {
2436 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2441 /* create beep controls if needed */
2442 if (spec->beep_amp) {
2443 struct snd_kcontrol_new *knew;
2444 for (knew = alc_beep_mixer; knew->name; knew++) {
2445 struct snd_kcontrol *kctl;
2446 kctl = snd_ctl_new1(knew, codec);
2449 kctl->private_value = spec->beep_amp;
2450 err = snd_hda_ctl_add(codec, kctl);
2456 /* if we have no master control, let's create it */
2457 if (!spec->no_analog &&
2458 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2459 unsigned int vmaster_tlv[4];
2460 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2461 HDA_OUTPUT, vmaster_tlv);
2462 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2463 vmaster_tlv, alc_slave_vols);
2467 if (!spec->no_analog &&
2468 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2469 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2470 NULL, alc_slave_sws);
2475 alc_free_kctls(codec); /* no longer needed */
2481 * initialize the codec volumes, etc
2485 * generic initialization of ADC, input mixers and output mixers
2487 static struct hda_verb alc880_volume_init_verbs[] = {
2489 * Unmute ADC0-2 and set the default input to mic-in
2491 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2492 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2493 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2494 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2495 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2496 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2498 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2500 * Note: PASD motherboards uses the Line In 2 as the input for front
2503 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2509 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2510 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2513 * Set up output mixers (0x0c - 0x0f)
2515 /* set vol=0 to output mixers */
2516 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2517 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2518 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2519 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2520 /* set up input amps for analog loopback */
2521 /* Amp Indices: DAC = 0, mixer = 1 */
2522 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2523 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2524 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2525 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2526 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2527 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2528 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2529 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2535 * 3-stack pin configuration:
2536 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2538 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2540 * preset connection lists of input pins
2541 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2543 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2544 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2545 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2548 * Set pin mode and muting
2550 /* set front pin widgets 0x14 for output */
2551 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2552 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2553 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2554 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2555 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2556 /* Mic2 (as headphone out) for HP output */
2557 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2558 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2559 /* Line In pin widget for input */
2560 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2561 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2562 /* Line2 (as front mic) pin widget for input and vref at 80% */
2563 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2564 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2565 /* CD pin widget for input */
2566 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2572 * 5-stack pin configuration:
2573 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2574 * line-in/side = 0x1a, f-mic = 0x1b
2576 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2578 * preset connection lists of input pins
2579 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2581 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2582 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2585 * Set pin mode and muting
2587 /* set pin widgets 0x14-0x17 for output */
2588 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2589 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2590 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2591 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2592 /* unmute pins for output (no gain on this amp) */
2593 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2594 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2595 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2596 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2598 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2599 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2600 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2601 /* Mic2 (as headphone out) for HP output */
2602 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2603 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2604 /* Line In pin widget for input */
2605 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2606 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2607 /* Line2 (as front mic) pin widget for input and vref at 80% */
2608 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2609 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2610 /* CD pin widget for input */
2611 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2617 * W810 pin configuration:
2618 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2620 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2621 /* hphone/speaker input selector: front DAC */
2622 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2624 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2625 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2626 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2627 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2628 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2629 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2631 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2632 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2638 * Z71V pin configuration:
2639 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2641 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2642 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2643 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2644 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2645 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2647 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2648 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2649 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2650 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2656 * 6-stack pin configuration:
2657 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2658 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2660 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2661 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2663 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2664 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2665 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2666 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2667 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2668 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2669 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2670 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2672 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2673 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2674 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2675 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2676 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2677 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2678 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2679 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2680 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2686 * Uniwill pin configuration:
2687 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2690 static struct hda_verb alc880_uniwill_init_verbs[] = {
2691 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2693 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2694 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2695 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2696 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2697 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2698 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2699 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2700 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2701 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2702 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2703 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2704 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2705 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2706 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2708 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2709 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2710 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2711 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2712 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2713 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2714 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2715 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2716 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2718 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2719 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2726 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2728 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2729 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2731 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2732 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2733 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2734 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2735 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2736 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2737 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2739 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2740 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2741 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2742 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2744 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2745 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2746 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2747 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2748 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2749 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2751 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2752 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2757 static struct hda_verb alc880_beep_init_verbs[] = {
2758 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2762 /* auto-toggle front mic */
2763 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2765 unsigned int present;
2768 present = snd_hda_codec_read(codec, 0x18, 0,
2769 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2770 bits = present ? HDA_AMP_MUTE : 0;
2771 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2774 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2776 struct alc_spec *spec = codec->spec;
2778 spec->autocfg.hp_pins[0] = 0x14;
2779 spec->autocfg.speaker_pins[0] = 0x15;
2780 spec->autocfg.speaker_pins[0] = 0x16;
2781 alc_automute_amp(codec);
2782 alc880_uniwill_mic_automute(codec);
2785 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2788 /* Looks like the unsol event is incompatible with the standard
2789 * definition. 4bit tag is placed at 28 bit!
2791 switch (res >> 28) {
2792 case ALC880_MIC_EVENT:
2793 alc880_uniwill_mic_automute(codec);
2796 alc_automute_amp_unsol_event(codec, res);
2801 static void alc880_uniwill_p53_init_hook(struct hda_codec *codec)
2803 struct alc_spec *spec = codec->spec;
2805 spec->autocfg.hp_pins[0] = 0x14;
2806 spec->autocfg.speaker_pins[0] = 0x15;
2807 alc_automute_amp(codec);
2810 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2812 unsigned int present;
2814 present = snd_hda_codec_read(codec, 0x21, 0,
2815 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2816 present &= HDA_AMP_VOLMASK;
2817 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2818 HDA_AMP_VOLMASK, present);
2819 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2820 HDA_AMP_VOLMASK, present);
2823 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2826 /* Looks like the unsol event is incompatible with the standard
2827 * definition. 4bit tag is placed at 28 bit!
2829 if ((res >> 28) == ALC880_DCVOL_EVENT)
2830 alc880_uniwill_p53_dcvol_automute(codec);
2832 alc_automute_amp_unsol_event(codec, res);
2836 * F1734 pin configuration:
2837 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2839 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2840 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2841 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2842 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2843 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2844 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2846 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2847 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2848 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2849 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2851 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2852 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2853 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2854 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2855 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2856 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2857 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2858 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2859 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2861 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2862 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2868 * ASUS pin configuration:
2869 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2871 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2872 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2873 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2874 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2875 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2877 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2878 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2879 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2880 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2881 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2882 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2883 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2884 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2886 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2887 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2888 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2889 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2890 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2891 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2892 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2893 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2894 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2899 /* Enable GPIO mask and set output */
2900 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2901 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2902 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2904 /* Clevo m520g init */
2905 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2906 /* headphone output */
2907 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2909 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2910 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2912 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2913 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2915 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2916 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2917 /* Mic1 (rear panel) */
2918 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2919 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2920 /* Mic2 (front panel) */
2921 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2922 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2924 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2925 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2926 /* change to EAPD mode */
2927 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2928 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2933 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2934 /* change to EAPD mode */
2935 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2936 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2938 /* Headphone output */
2939 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2941 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2942 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2944 /* Line In pin widget for input */
2945 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2946 /* CD pin widget for input */
2947 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2948 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2949 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2951 /* change to EAPD mode */
2952 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2953 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2959 * LG m1 express dual
2962 * Rear Line-In/Out (blue): 0x14
2963 * Build-in Mic-In: 0x15
2965 * HP-Out (green): 0x1b
2966 * Mic-In/Out (red): 0x19
2970 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2971 static hda_nid_t alc880_lg_dac_nids[3] = {
2975 /* seems analog CD is not working */
2976 static struct hda_input_mux alc880_lg_capture_source = {
2981 { "Internal Mic", 0x6 },
2985 /* 2,4,6 channel modes */
2986 static struct hda_verb alc880_lg_ch2_init[] = {
2987 /* set line-in and mic-in to input */
2988 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2989 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2993 static struct hda_verb alc880_lg_ch4_init[] = {
2994 /* set line-in to out and mic-in to input */
2995 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2996 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3000 static struct hda_verb alc880_lg_ch6_init[] = {
3001 /* set line-in and mic-in to output */
3002 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3003 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3007 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3008 { 2, alc880_lg_ch2_init },
3009 { 4, alc880_lg_ch4_init },
3010 { 6, alc880_lg_ch6_init },
3013 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3014 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3015 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3016 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3017 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3018 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3019 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3020 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3021 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3022 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3023 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3024 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3025 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3026 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3027 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3029 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3030 .name = "Channel Mode",
3031 .info = alc_ch_mode_info,
3032 .get = alc_ch_mode_get,
3033 .put = alc_ch_mode_put,
3038 static struct hda_verb alc880_lg_init_verbs[] = {
3039 /* set capture source to mic-in */
3040 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3041 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3042 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3043 /* mute all amp mixer inputs */
3044 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3045 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3046 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3047 /* line-in to input */
3048 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3049 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3051 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3052 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3054 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3055 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3056 /* mic-in to input */
3057 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3058 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3059 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3061 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3062 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3063 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3065 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3069 /* toggle speaker-output according to the hp-jack state */
3070 static void alc880_lg_init_hook(struct hda_codec *codec)
3072 struct alc_spec *spec = codec->spec;
3074 spec->autocfg.hp_pins[0] = 0x1b;
3075 spec->autocfg.speaker_pins[0] = 0x17;
3076 alc_automute_amp(codec);
3085 * Built-in Mic-In: 0x19
3091 static struct hda_input_mux alc880_lg_lw_capture_source = {
3095 { "Internal Mic", 0x1 },
3100 #define alc880_lg_lw_modes alc880_threestack_modes
3102 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3103 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3104 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3105 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3106 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3107 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3108 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3109 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3110 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3111 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3112 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3113 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3114 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3115 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3116 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3118 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3119 .name = "Channel Mode",
3120 .info = alc_ch_mode_info,
3121 .get = alc_ch_mode_get,
3122 .put = alc_ch_mode_put,
3127 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3128 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3129 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3130 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3132 /* set capture source to mic-in */
3133 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3134 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3135 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3138 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3139 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3141 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3142 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3143 /* mic-in to input */
3144 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3145 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3147 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3148 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3150 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3154 /* toggle speaker-output according to the hp-jack state */
3155 static void alc880_lg_lw_init_hook(struct hda_codec *codec)
3157 struct alc_spec *spec = codec->spec;
3159 spec->autocfg.hp_pins[0] = 0x1b;
3160 spec->autocfg.speaker_pins[0] = 0x14;
3161 alc_automute_amp(codec);
3164 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3165 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3166 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3168 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3169 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3170 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3174 static struct hda_input_mux alc880_medion_rim_capture_source = {
3178 { "Internal Mic", 0x1 },
3182 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3183 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3185 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3186 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3188 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3189 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3190 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3191 /* Mic2 (as headphone out) for HP output */
3192 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3193 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3194 /* Internal Speaker */
3195 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3196 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3198 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3199 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3201 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3205 /* toggle speaker-output according to the hp-jack state */
3206 static void alc880_medion_rim_automute(struct hda_codec *codec)
3208 struct alc_spec *spec = codec->spec;
3209 alc_automute_amp(codec);
3211 if (spec->jack_present)
3212 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3214 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3217 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3220 /* Looks like the unsol event is incompatible with the standard
3221 * definition. 4bit tag is placed at 28 bit!
3223 if ((res >> 28) == ALC880_HP_EVENT)
3224 alc880_medion_rim_automute(codec);
3227 static void alc880_medion_rim_init_hook(struct hda_codec *codec)
3229 struct alc_spec *spec = codec->spec;
3231 spec->autocfg.hp_pins[0] = 0x14;
3232 spec->autocfg.speaker_pins[0] = 0x1b;
3233 alc880_medion_rim_automute(codec);
3236 #ifdef CONFIG_SND_HDA_POWER_SAVE
3237 static struct hda_amp_list alc880_loopbacks[] = {
3238 { 0x0b, HDA_INPUT, 0 },
3239 { 0x0b, HDA_INPUT, 1 },
3240 { 0x0b, HDA_INPUT, 2 },
3241 { 0x0b, HDA_INPUT, 3 },
3242 { 0x0b, HDA_INPUT, 4 },
3246 static struct hda_amp_list alc880_lg_loopbacks[] = {
3247 { 0x0b, HDA_INPUT, 1 },
3248 { 0x0b, HDA_INPUT, 6 },
3249 { 0x0b, HDA_INPUT, 7 },
3258 static int alc_init(struct hda_codec *codec)
3260 struct alc_spec *spec = codec->spec;
3264 alc_auto_init_amp(codec, spec->init_amp);
3266 for (i = 0; i < spec->num_init_verbs; i++)
3267 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3269 if (spec->init_hook)
3270 spec->init_hook(codec);
3275 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3277 struct alc_spec *spec = codec->spec;
3279 if (spec->unsol_event)
3280 spec->unsol_event(codec, res);
3283 #ifdef CONFIG_SND_HDA_POWER_SAVE
3284 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3286 struct alc_spec *spec = codec->spec;
3287 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3292 * Analog playback callbacks
3294 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3295 struct hda_codec *codec,
3296 struct snd_pcm_substream *substream)
3298 struct alc_spec *spec = codec->spec;
3299 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3303 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3304 struct hda_codec *codec,
3305 unsigned int stream_tag,
3306 unsigned int format,
3307 struct snd_pcm_substream *substream)
3309 struct alc_spec *spec = codec->spec;
3310 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3311 stream_tag, format, substream);
3314 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3315 struct hda_codec *codec,
3316 struct snd_pcm_substream *substream)
3318 struct alc_spec *spec = codec->spec;
3319 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3325 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3326 struct hda_codec *codec,
3327 struct snd_pcm_substream *substream)
3329 struct alc_spec *spec = codec->spec;
3330 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3333 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3334 struct hda_codec *codec,
3335 unsigned int stream_tag,
3336 unsigned int format,
3337 struct snd_pcm_substream *substream)
3339 struct alc_spec *spec = codec->spec;
3340 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3341 stream_tag, format, substream);
3344 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3345 struct hda_codec *codec,
3346 struct snd_pcm_substream *substream)
3348 struct alc_spec *spec = codec->spec;
3349 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3352 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3353 struct hda_codec *codec,
3354 struct snd_pcm_substream *substream)
3356 struct alc_spec *spec = codec->spec;
3357 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3363 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3364 struct hda_codec *codec,
3365 unsigned int stream_tag,
3366 unsigned int format,
3367 struct snd_pcm_substream *substream)
3369 struct alc_spec *spec = codec->spec;
3371 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3372 stream_tag, 0, format);
3376 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3377 struct hda_codec *codec,
3378 struct snd_pcm_substream *substream)
3380 struct alc_spec *spec = codec->spec;
3382 snd_hda_codec_cleanup_stream(codec,
3383 spec->adc_nids[substream->number + 1]);
3390 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3394 /* NID is set in alc_build_pcms */
3396 .open = alc880_playback_pcm_open,
3397 .prepare = alc880_playback_pcm_prepare,
3398 .cleanup = alc880_playback_pcm_cleanup
3402 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3406 /* NID is set in alc_build_pcms */
3409 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3413 /* NID is set in alc_build_pcms */
3416 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3417 .substreams = 2, /* can be overridden */
3420 /* NID is set in alc_build_pcms */
3422 .prepare = alc880_alt_capture_pcm_prepare,
3423 .cleanup = alc880_alt_capture_pcm_cleanup
3427 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3431 /* NID is set in alc_build_pcms */
3433 .open = alc880_dig_playback_pcm_open,
3434 .close = alc880_dig_playback_pcm_close,
3435 .prepare = alc880_dig_playback_pcm_prepare,
3436 .cleanup = alc880_dig_playback_pcm_cleanup
3440 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3444 /* NID is set in alc_build_pcms */
3447 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3448 static struct hda_pcm_stream alc_pcm_null_stream = {
3454 static int alc_build_pcms(struct hda_codec *codec)
3456 struct alc_spec *spec = codec->spec;
3457 struct hda_pcm *info = spec->pcm_rec;
3460 codec->num_pcms = 1;
3461 codec->pcm_info = info;
3463 if (spec->no_analog)
3466 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3467 "%s Analog", codec->chip_name);
3468 info->name = spec->stream_name_analog;
3470 if (spec->stream_analog_playback) {
3471 if (snd_BUG_ON(!spec->multiout.dac_nids))
3473 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3474 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3476 if (spec->stream_analog_capture) {
3477 if (snd_BUG_ON(!spec->adc_nids))
3479 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3480 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3483 if (spec->channel_mode) {
3484 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3485 for (i = 0; i < spec->num_channel_mode; i++) {
3486 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3487 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3493 /* SPDIF for stream index #1 */
3494 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3495 snprintf(spec->stream_name_digital,
3496 sizeof(spec->stream_name_digital),
3497 "%s Digital", codec->chip_name);
3498 codec->num_pcms = 2;
3499 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3500 info = spec->pcm_rec + 1;
3501 info->name = spec->stream_name_digital;
3502 if (spec->dig_out_type)
3503 info->pcm_type = spec->dig_out_type;
3505 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3506 if (spec->multiout.dig_out_nid &&
3507 spec->stream_digital_playback) {
3508 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3509 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3511 if (spec->dig_in_nid &&
3512 spec->stream_digital_capture) {
3513 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3514 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3516 /* FIXME: do we need this for all Realtek codec models? */
3517 codec->spdif_status_reset = 1;
3520 if (spec->no_analog)
3523 /* If the use of more than one ADC is requested for the current
3524 * model, configure a second analog capture-only PCM.
3526 /* Additional Analaog capture for index #2 */
3527 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3528 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3529 codec->num_pcms = 3;
3530 info = spec->pcm_rec + 2;
3531 info->name = spec->stream_name_analog;
3532 if (spec->alt_dac_nid) {
3533 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3534 *spec->stream_analog_alt_playback;
3535 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3538 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3539 alc_pcm_null_stream;
3540 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3542 if (spec->num_adc_nids > 1) {
3543 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3544 *spec->stream_analog_alt_capture;
3545 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3547 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3548 spec->num_adc_nids - 1;
3550 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3551 alc_pcm_null_stream;
3552 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3559 static void alc_free_kctls(struct hda_codec *codec)
3561 struct alc_spec *spec = codec->spec;
3563 if (spec->kctls.list) {
3564 struct snd_kcontrol_new *kctl = spec->kctls.list;
3566 for (i = 0; i < spec->kctls.used; i++)
3567 kfree(kctl[i].name);
3569 snd_array_free(&spec->kctls);
3572 static void alc_free(struct hda_codec *codec)
3574 struct alc_spec *spec = codec->spec;
3579 alc_free_kctls(codec);
3581 snd_hda_detach_beep_device(codec);
3584 #ifdef SND_HDA_NEEDS_RESUME
3585 static int alc_resume(struct hda_codec *codec)
3587 codec->patch_ops.init(codec);
3588 snd_hda_codec_resume_amp(codec);
3589 snd_hda_codec_resume_cache(codec);
3596 static struct hda_codec_ops alc_patch_ops = {
3597 .build_controls = alc_build_controls,
3598 .build_pcms = alc_build_pcms,
3601 .unsol_event = alc_unsol_event,
3602 #ifdef SND_HDA_NEEDS_RESUME
3603 .resume = alc_resume,
3605 #ifdef CONFIG_SND_HDA_POWER_SAVE
3606 .check_power_status = alc_check_power_status,
3612 * Test configuration for debugging
3614 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3617 #ifdef CONFIG_SND_DEBUG
3618 static hda_nid_t alc880_test_dac_nids[4] = {
3619 0x02, 0x03, 0x04, 0x05
3622 static struct hda_input_mux alc880_test_capture_source = {
3631 { "Surround", 0x6 },
3635 static struct hda_channel_mode alc880_test_modes[4] = {
3642 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3643 struct snd_ctl_elem_info *uinfo)
3645 static char *texts[] = {
3646 "N/A", "Line Out", "HP Out",
3647 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3649 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3651 uinfo->value.enumerated.items = 8;
3652 if (uinfo->value.enumerated.item >= 8)
3653 uinfo->value.enumerated.item = 7;
3654 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3658 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3659 struct snd_ctl_elem_value *ucontrol)
3661 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3662 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3663 unsigned int pin_ctl, item = 0;
3665 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3666 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3667 if (pin_ctl & AC_PINCTL_OUT_EN) {
3668 if (pin_ctl & AC_PINCTL_HP_EN)
3672 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3673 switch (pin_ctl & AC_PINCTL_VREFEN) {
3674 case AC_PINCTL_VREF_HIZ: item = 3; break;
3675 case AC_PINCTL_VREF_50: item = 4; break;
3676 case AC_PINCTL_VREF_GRD: item = 5; break;
3677 case AC_PINCTL_VREF_80: item = 6; break;
3678 case AC_PINCTL_VREF_100: item = 7; break;
3681 ucontrol->value.enumerated.item[0] = item;
3685 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3686 struct snd_ctl_elem_value *ucontrol)
3688 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3689 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3690 static unsigned int ctls[] = {
3691 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3692 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3693 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3694 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3695 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3696 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3698 unsigned int old_ctl, new_ctl;
3700 old_ctl = snd_hda_codec_read(codec, nid, 0,
3701 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3702 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3703 if (old_ctl != new_ctl) {
3705 snd_hda_codec_write_cache(codec, nid, 0,
3706 AC_VERB_SET_PIN_WIDGET_CONTROL,
3708 val = ucontrol->value.enumerated.item[0] >= 3 ?
3710 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3717 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3718 struct snd_ctl_elem_info *uinfo)
3720 static char *texts[] = {
3721 "Front", "Surround", "CLFE", "Side"
3723 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3725 uinfo->value.enumerated.items = 4;
3726 if (uinfo->value.enumerated.item >= 4)
3727 uinfo->value.enumerated.item = 3;
3728 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3732 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3733 struct snd_ctl_elem_value *ucontrol)
3735 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3736 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3739 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3740 ucontrol->value.enumerated.item[0] = sel & 3;
3744 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3745 struct snd_ctl_elem_value *ucontrol)
3747 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3748 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3751 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3752 if (ucontrol->value.enumerated.item[0] != sel) {
3753 sel = ucontrol->value.enumerated.item[0] & 3;
3754 snd_hda_codec_write_cache(codec, nid, 0,
3755 AC_VERB_SET_CONNECT_SEL, sel);
3761 #define PIN_CTL_TEST(xname,nid) { \
3762 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3764 .info = alc_test_pin_ctl_info, \
3765 .get = alc_test_pin_ctl_get, \
3766 .put = alc_test_pin_ctl_put, \
3767 .private_value = nid \
3770 #define PIN_SRC_TEST(xname,nid) { \
3771 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3773 .info = alc_test_pin_src_info, \
3774 .get = alc_test_pin_src_get, \
3775 .put = alc_test_pin_src_put, \
3776 .private_value = nid \
3779 static struct snd_kcontrol_new alc880_test_mixer[] = {
3780 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3781 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3782 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3783 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3784 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3785 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3786 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3787 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3788 PIN_CTL_TEST("Front Pin Mode", 0x14),
3789 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3790 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3791 PIN_CTL_TEST("Side Pin Mode", 0x17),
3792 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3793 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3794 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3795 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3796 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3797 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3798 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3799 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3800 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3801 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3802 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3803 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3804 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3805 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3806 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3807 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3808 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3809 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3811 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3812 .name = "Channel Mode",
3813 .info = alc_ch_mode_info,
3814 .get = alc_ch_mode_get,
3815 .put = alc_ch_mode_put,
3820 static struct hda_verb alc880_test_init_verbs[] = {
3821 /* Unmute inputs of 0x0c - 0x0f */
3822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3823 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3824 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3825 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3826 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3827 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3828 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3829 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3830 /* Vol output for 0x0c-0x0f */
3831 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3832 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3833 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3834 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3835 /* Set output pins 0x14-0x17 */
3836 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3837 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3838 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3839 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3840 /* Unmute output pins 0x14-0x17 */
3841 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3842 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3843 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3844 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3845 /* Set input pins 0x18-0x1c */
3846 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3847 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3848 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3849 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3850 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3851 /* Mute input pins 0x18-0x1b */
3852 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3853 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3854 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3855 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3858 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3859 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3860 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3861 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3862 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3863 /* Analog input/passthru */
3864 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3865 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3866 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3867 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3868 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3876 static const char *alc880_models[ALC880_MODEL_LAST] = {
3877 [ALC880_3ST] = "3stack",
3878 [ALC880_TCL_S700] = "tcl",
3879 [ALC880_3ST_DIG] = "3stack-digout",
3880 [ALC880_CLEVO] = "clevo",
3881 [ALC880_5ST] = "5stack",
3882 [ALC880_5ST_DIG] = "5stack-digout",
3883 [ALC880_W810] = "w810",
3884 [ALC880_Z71V] = "z71v",
3885 [ALC880_6ST] = "6stack",
3886 [ALC880_6ST_DIG] = "6stack-digout",
3887 [ALC880_ASUS] = "asus",
3888 [ALC880_ASUS_W1V] = "asus-w1v",
3889 [ALC880_ASUS_DIG] = "asus-dig",
3890 [ALC880_ASUS_DIG2] = "asus-dig2",
3891 [ALC880_UNIWILL_DIG] = "uniwill",
3892 [ALC880_UNIWILL_P53] = "uniwill-p53",
3893 [ALC880_FUJITSU] = "fujitsu",
3894 [ALC880_F1734] = "F1734",
3896 [ALC880_LG_LW] = "lg-lw",
3897 [ALC880_MEDION_RIM] = "medion",
3898 #ifdef CONFIG_SND_DEBUG
3899 [ALC880_TEST] = "test",
3901 [ALC880_AUTO] = "auto",
3904 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3905 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3906 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3907 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3908 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3909 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3910 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3911 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3912 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3913 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3914 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3915 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3916 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3917 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3918 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3919 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3920 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3921 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3922 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3923 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3924 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3925 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3926 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3927 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3928 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3929 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3930 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3931 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3932 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3933 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3934 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3935 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3936 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3937 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3938 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3939 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3940 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3941 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3942 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3943 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3944 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3945 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3946 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3947 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3948 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3949 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3950 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3951 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3952 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3953 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3954 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3955 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3956 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3957 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3958 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3959 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3960 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3961 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3962 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3963 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3964 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3965 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3966 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3967 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3968 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3969 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3970 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3971 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3972 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3974 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3975 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3976 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3981 * ALC880 codec presets
3983 static struct alc_config_preset alc880_presets[] = {
3985 .mixers = { alc880_three_stack_mixer },
3986 .init_verbs = { alc880_volume_init_verbs,
3987 alc880_pin_3stack_init_verbs },
3988 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3989 .dac_nids = alc880_dac_nids,
3990 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3991 .channel_mode = alc880_threestack_modes,
3993 .input_mux = &alc880_capture_source,
3995 [ALC880_3ST_DIG] = {
3996 .mixers = { alc880_three_stack_mixer },
3997 .init_verbs = { alc880_volume_init_verbs,
3998 alc880_pin_3stack_init_verbs },
3999 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4000 .dac_nids = alc880_dac_nids,
4001 .dig_out_nid = ALC880_DIGOUT_NID,
4002 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4003 .channel_mode = alc880_threestack_modes,
4005 .input_mux = &alc880_capture_source,
4007 [ALC880_TCL_S700] = {
4008 .mixers = { alc880_tcl_s700_mixer },
4009 .init_verbs = { alc880_volume_init_verbs,
4010 alc880_pin_tcl_S700_init_verbs,
4011 alc880_gpio2_init_verbs },
4012 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4013 .dac_nids = alc880_dac_nids,
4014 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4015 .num_adc_nids = 1, /* single ADC */
4017 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4018 .channel_mode = alc880_2_jack_modes,
4019 .input_mux = &alc880_capture_source,
4022 .mixers = { alc880_three_stack_mixer,
4023 alc880_five_stack_mixer},
4024 .init_verbs = { alc880_volume_init_verbs,
4025 alc880_pin_5stack_init_verbs },
4026 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4027 .dac_nids = alc880_dac_nids,
4028 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4029 .channel_mode = alc880_fivestack_modes,
4030 .input_mux = &alc880_capture_source,
4032 [ALC880_5ST_DIG] = {
4033 .mixers = { alc880_three_stack_mixer,
4034 alc880_five_stack_mixer },
4035 .init_verbs = { alc880_volume_init_verbs,
4036 alc880_pin_5stack_init_verbs },
4037 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4038 .dac_nids = alc880_dac_nids,
4039 .dig_out_nid = ALC880_DIGOUT_NID,
4040 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4041 .channel_mode = alc880_fivestack_modes,
4042 .input_mux = &alc880_capture_source,
4045 .mixers = { alc880_six_stack_mixer },
4046 .init_verbs = { alc880_volume_init_verbs,
4047 alc880_pin_6stack_init_verbs },
4048 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4049 .dac_nids = alc880_6st_dac_nids,
4050 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4051 .channel_mode = alc880_sixstack_modes,
4052 .input_mux = &alc880_6stack_capture_source,
4054 [ALC880_6ST_DIG] = {
4055 .mixers = { alc880_six_stack_mixer },
4056 .init_verbs = { alc880_volume_init_verbs,
4057 alc880_pin_6stack_init_verbs },
4058 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4059 .dac_nids = alc880_6st_dac_nids,
4060 .dig_out_nid = ALC880_DIGOUT_NID,
4061 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4062 .channel_mode = alc880_sixstack_modes,
4063 .input_mux = &alc880_6stack_capture_source,
4066 .mixers = { alc880_w810_base_mixer },
4067 .init_verbs = { alc880_volume_init_verbs,
4068 alc880_pin_w810_init_verbs,
4069 alc880_gpio2_init_verbs },
4070 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4071 .dac_nids = alc880_w810_dac_nids,
4072 .dig_out_nid = ALC880_DIGOUT_NID,
4073 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4074 .channel_mode = alc880_w810_modes,
4075 .input_mux = &alc880_capture_source,
4078 .mixers = { alc880_z71v_mixer },
4079 .init_verbs = { alc880_volume_init_verbs,
4080 alc880_pin_z71v_init_verbs },
4081 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4082 .dac_nids = alc880_z71v_dac_nids,
4083 .dig_out_nid = ALC880_DIGOUT_NID,
4085 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4086 .channel_mode = alc880_2_jack_modes,
4087 .input_mux = &alc880_capture_source,
4090 .mixers = { alc880_f1734_mixer },
4091 .init_verbs = { alc880_volume_init_verbs,
4092 alc880_pin_f1734_init_verbs },
4093 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4094 .dac_nids = alc880_f1734_dac_nids,
4096 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4097 .channel_mode = alc880_2_jack_modes,
4098 .input_mux = &alc880_f1734_capture_source,
4099 .unsol_event = alc880_uniwill_p53_unsol_event,
4100 .init_hook = alc880_uniwill_p53_init_hook,
4103 .mixers = { alc880_asus_mixer },
4104 .init_verbs = { alc880_volume_init_verbs,
4105 alc880_pin_asus_init_verbs,
4106 alc880_gpio1_init_verbs },
4107 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4108 .dac_nids = alc880_asus_dac_nids,
4109 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4110 .channel_mode = alc880_asus_modes,
4112 .input_mux = &alc880_capture_source,
4114 [ALC880_ASUS_DIG] = {
4115 .mixers = { alc880_asus_mixer },
4116 .init_verbs = { alc880_volume_init_verbs,
4117 alc880_pin_asus_init_verbs,
4118 alc880_gpio1_init_verbs },
4119 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4120 .dac_nids = alc880_asus_dac_nids,
4121 .dig_out_nid = ALC880_DIGOUT_NID,
4122 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4123 .channel_mode = alc880_asus_modes,
4125 .input_mux = &alc880_capture_source,
4127 [ALC880_ASUS_DIG2] = {
4128 .mixers = { alc880_asus_mixer },
4129 .init_verbs = { alc880_volume_init_verbs,
4130 alc880_pin_asus_init_verbs,
4131 alc880_gpio2_init_verbs }, /* use GPIO2 */
4132 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4133 .dac_nids = alc880_asus_dac_nids,
4134 .dig_out_nid = ALC880_DIGOUT_NID,
4135 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4136 .channel_mode = alc880_asus_modes,
4138 .input_mux = &alc880_capture_source,
4140 [ALC880_ASUS_W1V] = {
4141 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4142 .init_verbs = { alc880_volume_init_verbs,
4143 alc880_pin_asus_init_verbs,
4144 alc880_gpio1_init_verbs },
4145 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4146 .dac_nids = alc880_asus_dac_nids,
4147 .dig_out_nid = ALC880_DIGOUT_NID,
4148 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4149 .channel_mode = alc880_asus_modes,
4151 .input_mux = &alc880_capture_source,
4153 [ALC880_UNIWILL_DIG] = {
4154 .mixers = { alc880_asus_mixer },
4155 .init_verbs = { alc880_volume_init_verbs,
4156 alc880_pin_asus_init_verbs },
4157 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4158 .dac_nids = alc880_asus_dac_nids,
4159 .dig_out_nid = ALC880_DIGOUT_NID,
4160 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4161 .channel_mode = alc880_asus_modes,
4163 .input_mux = &alc880_capture_source,
4165 [ALC880_UNIWILL] = {
4166 .mixers = { alc880_uniwill_mixer },
4167 .init_verbs = { alc880_volume_init_verbs,
4168 alc880_uniwill_init_verbs },
4169 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4170 .dac_nids = alc880_asus_dac_nids,
4171 .dig_out_nid = ALC880_DIGOUT_NID,
4172 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4173 .channel_mode = alc880_threestack_modes,
4175 .input_mux = &alc880_capture_source,
4176 .unsol_event = alc880_uniwill_unsol_event,
4177 .init_hook = alc880_uniwill_init_hook,
4179 [ALC880_UNIWILL_P53] = {
4180 .mixers = { alc880_uniwill_p53_mixer },
4181 .init_verbs = { alc880_volume_init_verbs,
4182 alc880_uniwill_p53_init_verbs },
4183 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4184 .dac_nids = alc880_asus_dac_nids,
4185 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4186 .channel_mode = alc880_threestack_modes,
4187 .input_mux = &alc880_capture_source,
4188 .unsol_event = alc880_uniwill_p53_unsol_event,
4189 .init_hook = alc880_uniwill_p53_init_hook,
4191 [ALC880_FUJITSU] = {
4192 .mixers = { alc880_fujitsu_mixer },
4193 .init_verbs = { alc880_volume_init_verbs,
4194 alc880_uniwill_p53_init_verbs,
4195 alc880_beep_init_verbs },
4196 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4197 .dac_nids = alc880_dac_nids,
4198 .dig_out_nid = ALC880_DIGOUT_NID,
4199 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4200 .channel_mode = alc880_2_jack_modes,
4201 .input_mux = &alc880_capture_source,
4202 .unsol_event = alc880_uniwill_p53_unsol_event,
4203 .init_hook = alc880_uniwill_p53_init_hook,
4206 .mixers = { alc880_three_stack_mixer },
4207 .init_verbs = { alc880_volume_init_verbs,
4208 alc880_pin_clevo_init_verbs },
4209 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4210 .dac_nids = alc880_dac_nids,
4212 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4213 .channel_mode = alc880_threestack_modes,
4215 .input_mux = &alc880_capture_source,
4218 .mixers = { alc880_lg_mixer },
4219 .init_verbs = { alc880_volume_init_verbs,
4220 alc880_lg_init_verbs },
4221 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4222 .dac_nids = alc880_lg_dac_nids,
4223 .dig_out_nid = ALC880_DIGOUT_NID,
4224 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4225 .channel_mode = alc880_lg_ch_modes,
4227 .input_mux = &alc880_lg_capture_source,
4228 .unsol_event = alc_automute_amp_unsol_event,
4229 .init_hook = alc880_lg_init_hook,
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 .init_hook = alc880_lg_lw_init_hook,
4247 [ALC880_MEDION_RIM] = {
4248 .mixers = { alc880_medion_rim_mixer },
4249 .init_verbs = { alc880_volume_init_verbs,
4250 alc880_medion_rim_init_verbs,
4251 alc_gpio2_init_verbs },
4252 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4253 .dac_nids = alc880_dac_nids,
4254 .dig_out_nid = ALC880_DIGOUT_NID,
4255 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4256 .channel_mode = alc880_2_jack_modes,
4257 .input_mux = &alc880_medion_rim_capture_source,
4258 .unsol_event = alc880_medion_rim_unsol_event,
4259 .init_hook = alc880_medion_rim_init_hook,
4261 #ifdef CONFIG_SND_DEBUG
4263 .mixers = { alc880_test_mixer },
4264 .init_verbs = { alc880_test_init_verbs },
4265 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4266 .dac_nids = alc880_test_dac_nids,
4267 .dig_out_nid = ALC880_DIGOUT_NID,
4268 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4269 .channel_mode = alc880_test_modes,
4270 .input_mux = &alc880_test_capture_source,
4276 * Automatic parse of I/O pins from the BIOS configuration
4281 ALC_CTL_WIDGET_MUTE,
4284 static struct snd_kcontrol_new alc880_control_templates[] = {
4285 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4286 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4287 HDA_BIND_MUTE(NULL, 0, 0, 0),
4290 /* add dynamic controls */
4291 static int add_control(struct alc_spec *spec, int type, const char *name,
4294 struct snd_kcontrol_new *knew;
4296 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4297 knew = snd_array_new(&spec->kctls);
4300 *knew = alc880_control_templates[type];
4301 knew->name = kstrdup(name, GFP_KERNEL);
4304 knew->private_value = val;
4308 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4309 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4310 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4311 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4312 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4313 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4314 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4315 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4316 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4317 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4318 #define ALC880_PIN_CD_NID 0x1c
4320 /* fill in the dac_nids table from the parsed pin configuration */
4321 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4322 const struct auto_pin_cfg *cfg)
4328 memset(assigned, 0, sizeof(assigned));
4329 spec->multiout.dac_nids = spec->private_dac_nids;
4331 /* check the pins hardwired to audio widget */
4332 for (i = 0; i < cfg->line_outs; i++) {
4333 nid = cfg->line_out_pins[i];
4334 if (alc880_is_fixed_pin(nid)) {
4335 int idx = alc880_fixed_pin_idx(nid);
4336 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4340 /* left pins can be connect to any audio widget */
4341 for (i = 0; i < cfg->line_outs; i++) {
4342 nid = cfg->line_out_pins[i];
4343 if (alc880_is_fixed_pin(nid))
4345 /* search for an empty channel */
4346 for (j = 0; j < cfg->line_outs; j++) {
4348 spec->multiout.dac_nids[i] =
4349 alc880_idx_to_dac(j);
4355 spec->multiout.num_dacs = cfg->line_outs;
4359 /* add playback controls from the parsed DAC table */
4360 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4361 const struct auto_pin_cfg *cfg)
4364 static const char *chname[4] = {
4365 "Front", "Surround", NULL /*CLFE*/, "Side"
4370 for (i = 0; i < cfg->line_outs; i++) {
4371 if (!spec->multiout.dac_nids[i])
4373 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4376 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4377 "Center Playback Volume",
4378 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4382 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4383 "LFE Playback Volume",
4384 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4388 err = add_control(spec, ALC_CTL_BIND_MUTE,
4389 "Center Playback Switch",
4390 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4394 err = add_control(spec, ALC_CTL_BIND_MUTE,
4395 "LFE Playback Switch",
4396 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4401 sprintf(name, "%s Playback Volume", chname[i]);
4402 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4403 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4407 sprintf(name, "%s Playback Switch", chname[i]);
4408 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4409 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4418 /* add playback controls for speaker and HP outputs */
4419 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4429 if (alc880_is_fixed_pin(pin)) {
4430 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4431 /* specify the DAC as the extra output */
4432 if (!spec->multiout.hp_nid)
4433 spec->multiout.hp_nid = nid;
4435 spec->multiout.extra_out_nid[0] = nid;
4436 /* control HP volume/switch on the output mixer amp */
4437 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4438 sprintf(name, "%s Playback Volume", pfx);
4439 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4440 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4443 sprintf(name, "%s Playback Switch", pfx);
4444 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4445 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4448 } else if (alc880_is_multi_pin(pin)) {
4449 /* set manual connection */
4450 /* we have only a switch on HP-out PIN */
4451 sprintf(name, "%s Playback Switch", pfx);
4452 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4453 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4460 /* create input playback/capture controls for the given pin */
4461 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4462 const char *ctlname,
4463 int idx, hda_nid_t mix_nid)
4468 sprintf(name, "%s Playback Volume", ctlname);
4469 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4470 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4473 sprintf(name, "%s Playback Switch", ctlname);
4474 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4475 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4481 /* create playback/capture controls for input pins */
4482 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4483 const struct auto_pin_cfg *cfg)
4485 struct hda_input_mux *imux = &spec->private_imux[0];
4488 for (i = 0; i < AUTO_PIN_LAST; i++) {
4489 if (alc880_is_input_pin(cfg->input_pins[i])) {
4490 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4491 err = new_analog_input(spec, cfg->input_pins[i],
4492 auto_pin_cfg_labels[i],
4496 imux->items[imux->num_items].label =
4497 auto_pin_cfg_labels[i];
4498 imux->items[imux->num_items].index =
4499 alc880_input_pin_idx(cfg->input_pins[i]);
4506 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4507 unsigned int pin_type)
4509 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4512 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4516 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4517 hda_nid_t nid, int pin_type,
4520 alc_set_pin_output(codec, nid, pin_type);
4521 /* need the manual connection? */
4522 if (alc880_is_multi_pin(nid)) {
4523 struct alc_spec *spec = codec->spec;
4524 int idx = alc880_multi_pin_idx(nid);
4525 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4526 AC_VERB_SET_CONNECT_SEL,
4527 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4531 static int get_pin_type(int line_out_type)
4533 if (line_out_type == AUTO_PIN_HP_OUT)
4539 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4541 struct alc_spec *spec = codec->spec;
4544 for (i = 0; i < spec->autocfg.line_outs; i++) {
4545 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4546 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4547 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4551 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4553 struct alc_spec *spec = codec->spec;
4556 pin = spec->autocfg.speaker_pins[0];
4557 if (pin) /* connect to front */
4558 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4559 pin = spec->autocfg.hp_pins[0];
4560 if (pin) /* connect to front */
4561 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4564 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4566 struct alc_spec *spec = codec->spec;
4569 for (i = 0; i < AUTO_PIN_LAST; i++) {
4570 hda_nid_t nid = spec->autocfg.input_pins[i];
4571 if (alc880_is_input_pin(nid)) {
4572 alc_set_input_pin(codec, nid, i);
4573 if (nid != ALC880_PIN_CD_NID &&
4574 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4575 snd_hda_codec_write(codec, nid, 0,
4576 AC_VERB_SET_AMP_GAIN_MUTE,
4582 /* parse the BIOS configuration and set up the alc_spec */
4583 /* return 1 if successful, 0 if the proper config is not found,
4584 * or a negative error code
4586 static int alc880_parse_auto_config(struct hda_codec *codec)
4588 struct alc_spec *spec = codec->spec;
4590 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4592 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4596 if (!spec->autocfg.line_outs)
4597 return 0; /* can't find valid BIOS pin config */
4599 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4602 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4605 err = alc880_auto_create_extra_out(spec,
4606 spec->autocfg.speaker_pins[0],
4610 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4614 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4618 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4620 /* check multiple SPDIF-out (for recent codecs) */
4621 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4623 err = snd_hda_get_connections(codec,
4624 spec->autocfg.dig_out_pins[i],
4629 spec->multiout.dig_out_nid = dig_nid;
4631 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4632 spec->slave_dig_outs[i - 1] = dig_nid;
4633 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4637 if (spec->autocfg.dig_in_pin)
4638 spec->dig_in_nid = ALC880_DIGIN_NID;
4640 if (spec->kctls.list)
4641 add_mixer(spec, spec->kctls.list);
4643 add_verb(spec, alc880_volume_init_verbs);
4645 spec->num_mux_defs = 1;
4646 spec->input_mux = &spec->private_imux[0];
4648 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4653 /* additional initialization for auto-configuration model */
4654 static void alc880_auto_init(struct hda_codec *codec)
4656 struct alc_spec *spec = codec->spec;
4657 alc880_auto_init_multi_out(codec);
4658 alc880_auto_init_extra_out(codec);
4659 alc880_auto_init_analog_input(codec);
4660 if (spec->unsol_event)
4661 alc_inithook(codec);
4664 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4665 * one of two digital mic pins, e.g. on ALC272
4667 static void fixup_automic_adc(struct hda_codec *codec)
4669 struct alc_spec *spec = codec->spec;
4672 for (i = 0; i < spec->num_adc_nids; i++) {
4673 hda_nid_t cap = spec->capsrc_nids ?
4674 spec->capsrc_nids[i] : spec->adc_nids[i];
4677 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4680 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4683 spec->int_mic.mux_idx = iidx;
4684 spec->ext_mic.mux_idx = eidx;
4685 if (spec->capsrc_nids)
4686 spec->capsrc_nids += i;
4687 spec->adc_nids += i;
4688 spec->num_adc_nids = 1;
4691 snd_printd(KERN_INFO "hda_codec: %s: "
4692 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4693 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4694 spec->auto_mic = 0; /* disable auto-mic to be sure */
4697 static void set_capture_mixer(struct hda_codec *codec)
4699 struct alc_spec *spec = codec->spec;
4700 static struct snd_kcontrol_new *caps[2][3] = {
4701 { alc_capture_mixer_nosrc1,
4702 alc_capture_mixer_nosrc2,
4703 alc_capture_mixer_nosrc3 },
4704 { alc_capture_mixer1,
4706 alc_capture_mixer3 },
4708 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4710 if (spec->auto_mic) {
4712 fixup_automic_adc(codec);
4713 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4717 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4721 #define set_beep_amp(spec, nid, idx, dir) \
4722 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4725 * OK, here we have finally the patch for ALC880
4728 static int patch_alc880(struct hda_codec *codec)
4730 struct alc_spec *spec;
4734 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4740 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4743 if (board_config < 0) {
4744 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4746 board_config = ALC880_AUTO;
4749 if (board_config == ALC880_AUTO) {
4750 /* automatic parse from the BIOS config */
4751 err = alc880_parse_auto_config(codec);
4757 "hda_codec: Cannot set up configuration "
4758 "from BIOS. Using 3-stack mode...\n");
4759 board_config = ALC880_3ST;
4763 err = snd_hda_attach_beep_device(codec, 0x1);
4769 if (board_config != ALC880_AUTO)
4770 setup_preset(codec, &alc880_presets[board_config]);
4772 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4773 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4774 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4776 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4777 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4779 if (!spec->adc_nids && spec->input_mux) {
4780 /* check whether NID 0x07 is valid */
4781 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4783 wcap = get_wcaps_type(wcap);
4784 if (wcap != AC_WID_AUD_IN) {
4785 spec->adc_nids = alc880_adc_nids_alt;
4786 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4788 spec->adc_nids = alc880_adc_nids;
4789 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4792 set_capture_mixer(codec);
4793 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4795 spec->vmaster_nid = 0x0c;
4797 codec->patch_ops = alc_patch_ops;
4798 if (board_config == ALC880_AUTO)
4799 spec->init_hook = alc880_auto_init;
4800 #ifdef CONFIG_SND_HDA_POWER_SAVE
4801 if (!spec->loopback.amplist)
4802 spec->loopback.amplist = alc880_loopbacks;
4804 codec->proc_widget_hook = print_realtek_coef;
4814 static hda_nid_t alc260_dac_nids[1] = {
4819 static hda_nid_t alc260_adc_nids[1] = {
4824 static hda_nid_t alc260_adc_nids_alt[1] = {
4829 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4830 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4832 static hda_nid_t alc260_dual_adc_nids[2] = {
4837 #define ALC260_DIGOUT_NID 0x03
4838 #define ALC260_DIGIN_NID 0x06
4840 static struct hda_input_mux alc260_capture_source = {
4844 { "Front Mic", 0x1 },
4850 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4851 * headphone jack and the internal CD lines since these are the only pins at
4852 * which audio can appear. For flexibility, also allow the option of
4853 * recording the mixer output on the second ADC (ADC0 doesn't have a
4854 * connection to the mixer output).
4856 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4860 { "Mic/Line", 0x0 },
4862 { "Headphone", 0x2 },
4868 { "Mic/Line", 0x0 },
4870 { "Headphone", 0x2 },
4877 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4878 * the Fujitsu S702x, but jacks are marked differently.
4880 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4887 { "Headphone", 0x5 },
4896 { "Headphone", 0x6 },
4902 /* Maxdata Favorit 100XS */
4903 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4907 { "Line/Mic", 0x0 },
4914 { "Line/Mic", 0x0 },
4922 * This is just place-holder, so there's something for alc_build_pcms to look
4923 * at when it calculates the maximum number of channels. ALC260 has no mixer
4924 * element which allows changing the channel mode, so the verb list is
4927 static struct hda_channel_mode alc260_modes[1] = {
4932 /* Mixer combinations
4934 * basic: base_output + input + pc_beep + capture
4935 * HP: base_output + input + capture_alt
4936 * HP_3013: hp_3013 + input + capture
4937 * fujitsu: fujitsu + capture
4938 * acer: acer + capture
4941 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4942 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4943 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4944 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4945 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4946 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4947 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4951 static struct snd_kcontrol_new alc260_input_mixer[] = {
4952 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4953 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4954 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4955 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4956 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4957 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4958 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4959 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4963 /* update HP, line and mono out pins according to the master switch */
4964 static void alc260_hp_master_update(struct hda_codec *codec,
4965 hda_nid_t hp, hda_nid_t line,
4968 struct alc_spec *spec = codec->spec;
4969 unsigned int val = spec->master_sw ? PIN_HP : 0;
4970 /* change HP and line-out pins */
4971 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4973 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4975 /* mono (speaker) depending on the HP jack sense */
4976 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4977 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4981 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4982 struct snd_ctl_elem_value *ucontrol)
4984 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4985 struct alc_spec *spec = codec->spec;
4986 *ucontrol->value.integer.value = spec->master_sw;
4990 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4991 struct snd_ctl_elem_value *ucontrol)
4993 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4994 struct alc_spec *spec = codec->spec;
4995 int val = !!*ucontrol->value.integer.value;
4996 hda_nid_t hp, line, mono;
4998 if (val == spec->master_sw)
5000 spec->master_sw = val;
5001 hp = (kcontrol->private_value >> 16) & 0xff;
5002 line = (kcontrol->private_value >> 8) & 0xff;
5003 mono = kcontrol->private_value & 0xff;
5004 alc260_hp_master_update(codec, hp, line, mono);
5008 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5010 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5011 .name = "Master Playback Switch",
5012 .info = snd_ctl_boolean_mono_info,
5013 .get = alc260_hp_master_sw_get,
5014 .put = alc260_hp_master_sw_put,
5015 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5017 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5018 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5019 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5020 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5021 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5023 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5027 static struct hda_verb alc260_hp_unsol_verbs[] = {
5028 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5032 static void alc260_hp_automute(struct hda_codec *codec)
5034 struct alc_spec *spec = codec->spec;
5035 unsigned int present;
5037 present = snd_hda_codec_read(codec, 0x10, 0,
5038 AC_VERB_GET_PIN_SENSE, 0);
5039 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5040 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5043 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5045 if ((res >> 26) == ALC880_HP_EVENT)
5046 alc260_hp_automute(codec);
5049 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5051 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5052 .name = "Master Playback Switch",
5053 .info = snd_ctl_boolean_mono_info,
5054 .get = alc260_hp_master_sw_get,
5055 .put = alc260_hp_master_sw_put,
5056 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5058 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5059 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5060 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5061 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5062 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5063 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5064 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5065 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5069 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5070 .ops = &snd_hda_bind_vol,
5072 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5073 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5074 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5079 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5080 .ops = &snd_hda_bind_sw,
5082 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5083 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5088 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5089 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5090 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5091 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5092 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5096 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5097 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5101 static void alc260_hp_3013_automute(struct hda_codec *codec)
5103 struct alc_spec *spec = codec->spec;
5104 unsigned int present;
5106 present = snd_hda_codec_read(codec, 0x15, 0,
5107 AC_VERB_GET_PIN_SENSE, 0);
5108 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5109 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5112 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5115 if ((res >> 26) == ALC880_HP_EVENT)
5116 alc260_hp_3013_automute(codec);
5119 static void alc260_hp_3012_automute(struct hda_codec *codec)
5121 unsigned int present, bits;
5123 present = snd_hda_codec_read(codec, 0x10, 0,
5124 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
5126 bits = present ? 0 : PIN_OUT;
5127 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5129 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5131 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5135 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5138 if ((res >> 26) == ALC880_HP_EVENT)
5139 alc260_hp_3012_automute(codec);
5142 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5143 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5145 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5146 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5147 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5148 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5149 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5150 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5151 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5152 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5153 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5154 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5155 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5159 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5160 * versions of the ALC260 don't act on requests to enable mic bias from NID
5161 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5162 * datasheet doesn't mention this restriction. At this stage it's not clear
5163 * whether this behaviour is intentional or is a hardware bug in chip
5164 * revisions available in early 2006. Therefore for now allow the
5165 * "Headphone Jack Mode" control to span all choices, but if it turns out
5166 * that the lack of mic bias for this NID is intentional we could change the
5167 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5169 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5170 * don't appear to make the mic bias available from the "line" jack, even
5171 * though the NID used for this jack (0x14) can supply it. The theory is
5172 * that perhaps Acer have included blocking capacitors between the ALC260
5173 * and the output jack. If this turns out to be the case for all such
5174 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5175 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5177 * The C20x Tablet series have a mono internal speaker which is controlled
5178 * via the chip's Mono sum widget and pin complex, so include the necessary
5179 * controls for such models. On models without a "mono speaker" the control
5180 * won't do anything.
5182 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5183 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5184 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5185 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5186 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5188 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5190 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5191 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5192 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5193 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5194 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5195 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5196 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5197 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5201 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5203 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5204 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5205 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5206 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5207 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5208 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5209 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5213 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5214 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5216 static struct snd_kcontrol_new alc260_will_mixer[] = {
5217 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5218 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5220 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5221 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5222 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5223 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5224 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5225 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5226 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5230 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5231 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5233 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5234 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5235 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5236 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5237 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5238 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5239 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5240 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5241 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5242 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5243 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5248 * initialization verbs
5250 static struct hda_verb alc260_init_verbs[] = {
5251 /* Line In pin widget for input */
5252 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5253 /* CD pin widget for input */
5254 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5255 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5256 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5257 /* Mic2 (front panel) pin widget for input and vref at 80% */
5258 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5259 /* LINE-2 is used for line-out in rear */
5260 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5261 /* select line-out */
5262 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5264 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5266 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5268 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5269 /* mute capture amp left and right */
5270 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5271 /* set connection select to line in (default select for this ADC) */
5272 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5273 /* mute capture amp left and right */
5274 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5275 /* set connection select to line in (default select for this ADC) */
5276 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5277 /* set vol=0 Line-Out mixer amp left and right */
5278 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5279 /* unmute pin widget amp left and right (no gain on this amp) */
5280 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5281 /* set vol=0 HP mixer amp left and right */
5282 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5283 /* unmute pin widget amp left and right (no gain on this amp) */
5284 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5285 /* set vol=0 Mono mixer amp left and right */
5286 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5287 /* unmute pin widget amp left and right (no gain on this amp) */
5288 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5289 /* unmute LINE-2 out pin */
5290 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5291 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5294 /* mute analog inputs */
5295 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5296 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5297 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5298 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5299 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5300 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5301 /* mute Front out path */
5302 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5303 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5304 /* mute Headphone out path */
5305 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5306 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5307 /* mute Mono out path */
5308 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5309 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5313 #if 0 /* should be identical with alc260_init_verbs? */
5314 static struct hda_verb alc260_hp_init_verbs[] = {
5315 /* Headphone and output */
5316 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5318 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5319 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5320 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5321 /* Mic2 (front panel) pin widget for input and vref at 80% */
5322 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5323 /* Line In pin widget for input */
5324 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5325 /* Line-2 pin widget for output */
5326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5327 /* CD pin widget for input */
5328 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5329 /* unmute amp left and right */
5330 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5331 /* set connection select to line in (default select for this ADC) */
5332 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5333 /* unmute Line-Out mixer amp left and right (volume = 0) */
5334 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5335 /* mute pin widget amp left and right (no gain on this amp) */
5336 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5337 /* unmute HP mixer amp left and right (volume = 0) */
5338 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5339 /* mute pin widget amp left and right (no gain on this amp) */
5340 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5341 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5344 /* mute analog inputs */
5345 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5346 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5347 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5348 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5349 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5350 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5351 /* Unmute Front out path */
5352 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5353 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5354 /* Unmute Headphone out path */
5355 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5356 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5357 /* Unmute Mono out path */
5358 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5359 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5364 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5365 /* Line out and output */
5366 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5368 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5369 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5370 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5371 /* Mic2 (front panel) pin widget for input and vref at 80% */
5372 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5373 /* Line In pin widget for input */
5374 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5375 /* Headphone pin widget for output */
5376 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5377 /* CD pin widget for input */
5378 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5379 /* unmute amp left and right */
5380 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5381 /* set connection select to line in (default select for this ADC) */
5382 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5383 /* unmute Line-Out mixer amp left and right (volume = 0) */
5384 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5385 /* mute pin widget amp left and right (no gain on this amp) */
5386 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5387 /* unmute HP mixer amp left and right (volume = 0) */
5388 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5389 /* mute pin widget amp left and right (no gain on this amp) */
5390 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5391 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5394 /* mute analog inputs */
5395 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5396 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5397 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5398 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5399 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5400 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5401 /* Unmute Front out path */
5402 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5403 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5404 /* Unmute Headphone out path */
5405 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5406 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5407 /* Unmute Mono out path */
5408 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5409 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5413 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5414 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5415 * audio = 0x16, internal speaker = 0x10.
5417 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5418 /* Disable all GPIOs */
5419 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5420 /* Internal speaker is connected to headphone pin */
5421 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5422 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5423 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5424 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5425 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5426 /* Ensure all other unused pins are disabled and muted. */
5427 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5428 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5429 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5430 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5431 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5432 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5433 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5434 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5436 /* Disable digital (SPDIF) pins */
5437 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5438 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5440 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5441 * when acting as an output.
5443 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5445 /* Start with output sum widgets muted and their output gains at min */
5446 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5447 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5448 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5449 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5450 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5451 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5452 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5453 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5454 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5456 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5457 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5458 /* Unmute Line1 pin widget output buffer since it starts as an output.
5459 * If the pin mode is changed by the user the pin mode control will
5460 * take care of enabling the pin's input/output buffers as needed.
5461 * Therefore there's no need to enable the input buffer at this
5464 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5465 /* Unmute input buffer of pin widget used for Line-in (no equiv
5468 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5470 /* Mute capture amp left and right */
5471 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5472 /* Set ADC connection select to match default mixer setting - line
5475 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5477 /* Do the same for the second ADC: mute capture input amp and
5478 * set ADC connection to line in (on mic1 pin)
5480 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5481 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5483 /* Mute all inputs to mixer widget (even unconnected ones) */
5484 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5485 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5486 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5489 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5490 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5491 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5496 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5497 * similar laptops (adapted from Fujitsu init verbs).
5499 static struct hda_verb alc260_acer_init_verbs[] = {
5500 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5501 * the headphone jack. Turn this on and rely on the standard mute
5502 * methods whenever the user wants to turn these outputs off.
5504 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5505 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5506 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5507 /* Internal speaker/Headphone jack is connected to Line-out pin */
5508 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5509 /* Internal microphone/Mic jack is connected to Mic1 pin */
5510 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5511 /* Line In jack is connected to Line1 pin */
5512 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5513 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5514 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5515 /* Ensure all other unused pins are disabled and muted. */
5516 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5517 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5518 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5519 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5520 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5521 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5522 /* Disable digital (SPDIF) pins */
5523 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5524 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5526 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5527 * bus when acting as outputs.
5529 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5530 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5532 /* Start with output sum widgets muted and their output gains at min */
5533 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5534 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5535 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5536 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5537 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5538 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5539 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5540 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5541 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5543 /* Unmute Line-out pin widget amp left and right
5544 * (no equiv mixer ctrl)
5546 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5547 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5548 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5549 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5550 * inputs. If the pin mode is changed by the user the pin mode control
5551 * will take care of enabling the pin's input/output buffers as needed.
5552 * Therefore there's no need to enable the input buffer at this
5555 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5556 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5558 /* Mute capture amp left and right */
5559 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5560 /* Set ADC connection select to match default mixer setting - mic
5563 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5565 /* Do similar with the second ADC: mute capture input amp and
5566 * set ADC connection to mic to match ALSA's default state.
5568 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5569 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5571 /* Mute all inputs to mixer widget (even unconnected ones) */
5572 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5573 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5574 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5575 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5576 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5577 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5578 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5579 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5584 /* Initialisation sequence for Maxdata Favorit 100XS
5585 * (adapted from Acer init verbs).
5587 static struct hda_verb alc260_favorit100_init_verbs[] = {
5588 /* GPIO 0 enables the output jack.
5589 * Turn this on and rely on the standard mute
5590 * methods whenever the user wants to turn these outputs off.
5592 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5593 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5594 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5595 /* Line/Mic input jack is connected to Mic1 pin */
5596 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5597 /* Ensure all other unused pins are disabled and muted. */
5598 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5599 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5600 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5601 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5602 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5603 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5604 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5605 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5606 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5607 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5608 /* Disable digital (SPDIF) pins */
5609 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5610 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5612 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5613 * bus when acting as outputs.
5615 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5616 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5618 /* Start with output sum widgets muted and their output gains at min */
5619 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5620 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5621 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5622 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5623 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5624 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5625 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5626 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5627 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5629 /* Unmute Line-out pin widget amp left and right
5630 * (no equiv mixer ctrl)
5632 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5633 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5634 * inputs. If the pin mode is changed by the user the pin mode control
5635 * will take care of enabling the pin's input/output buffers as needed.
5636 * Therefore there's no need to enable the input buffer at this
5639 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5641 /* Mute capture amp left and right */
5642 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5643 /* Set ADC connection select to match default mixer setting - mic
5646 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5648 /* Do similar with the second ADC: mute capture input amp and
5649 * set ADC connection to mic to match ALSA's default state.
5651 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5652 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5654 /* Mute all inputs to mixer widget (even unconnected ones) */
5655 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5656 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5657 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5658 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5659 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5660 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5661 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5662 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5667 static struct hda_verb alc260_will_verbs[] = {
5668 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5669 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5670 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5671 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5672 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5673 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5677 static struct hda_verb alc260_replacer_672v_verbs[] = {
5678 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5679 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5680 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5682 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5683 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5684 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5686 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5690 /* toggle speaker-output according to the hp-jack state */
5691 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5693 unsigned int present;
5695 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5696 present = snd_hda_codec_read(codec, 0x0f, 0,
5697 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5699 snd_hda_codec_write_cache(codec, 0x01, 0,
5700 AC_VERB_SET_GPIO_DATA, 1);
5701 snd_hda_codec_write_cache(codec, 0x0f, 0,
5702 AC_VERB_SET_PIN_WIDGET_CONTROL,
5705 snd_hda_codec_write_cache(codec, 0x01, 0,
5706 AC_VERB_SET_GPIO_DATA, 0);
5707 snd_hda_codec_write_cache(codec, 0x0f, 0,
5708 AC_VERB_SET_PIN_WIDGET_CONTROL,
5713 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5716 if ((res >> 26) == ALC880_HP_EVENT)
5717 alc260_replacer_672v_automute(codec);
5720 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5721 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5722 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5723 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5724 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5725 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5726 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5727 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5728 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5729 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5730 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5734 /* Test configuration for debugging, modelled after the ALC880 test
5737 #ifdef CONFIG_SND_DEBUG
5738 static hda_nid_t alc260_test_dac_nids[1] = {
5741 static hda_nid_t alc260_test_adc_nids[2] = {
5744 /* For testing the ALC260, each input MUX needs its own definition since
5745 * the signal assignments are different. This assumes that the first ADC
5748 static struct hda_input_mux alc260_test_capture_sources[2] = {
5752 { "MIC1 pin", 0x0 },
5753 { "MIC2 pin", 0x1 },
5754 { "LINE1 pin", 0x2 },
5755 { "LINE2 pin", 0x3 },
5757 { "LINE-OUT pin", 0x5 },
5758 { "HP-OUT pin", 0x6 },
5764 { "MIC1 pin", 0x0 },
5765 { "MIC2 pin", 0x1 },
5766 { "LINE1 pin", 0x2 },
5767 { "LINE2 pin", 0x3 },
5770 { "LINE-OUT pin", 0x6 },
5771 { "HP-OUT pin", 0x7 },
5775 static struct snd_kcontrol_new alc260_test_mixer[] = {
5776 /* Output driver widgets */
5777 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5778 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5779 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5780 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5781 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5782 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5784 /* Modes for retasking pin widgets
5785 * Note: the ALC260 doesn't seem to act on requests to enable mic
5786 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5787 * mention this restriction. At this stage it's not clear whether
5788 * this behaviour is intentional or is a hardware bug in chip
5789 * revisions available at least up until early 2006. Therefore for
5790 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5791 * choices, but if it turns out that the lack of mic bias for these
5792 * NIDs is intentional we could change their modes from
5793 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5795 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5796 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5797 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5798 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5799 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5800 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5802 /* Loopback mixer controls */
5803 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5804 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5805 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5806 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5807 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5808 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5809 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5810 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5811 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5812 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5813 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5814 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5815 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5816 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5818 /* Controls for GPIO pins, assuming they are configured as outputs */
5819 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5820 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5821 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5822 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5824 /* Switches to allow the digital IO pins to be enabled. The datasheet
5825 * is ambigious as to which NID is which; testing on laptops which
5826 * make this output available should provide clarification.
5828 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5829 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5831 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5832 * this output to turn on an external amplifier.
5834 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5835 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5839 static struct hda_verb alc260_test_init_verbs[] = {
5840 /* Enable all GPIOs as outputs with an initial value of 0 */
5841 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5842 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5843 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5845 /* Enable retasking pins as output, initially without power amp */
5846 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5847 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5848 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5849 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5850 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5851 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5853 /* Disable digital (SPDIF) pins initially, but users can enable
5854 * them via a mixer switch. In the case of SPDIF-out, this initverb
5855 * payload also sets the generation to 0, output to be in "consumer"
5856 * PCM format, copyright asserted, no pre-emphasis and no validity
5859 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5860 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5862 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5863 * OUT1 sum bus when acting as an output.
5865 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5866 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5867 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5868 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5870 /* Start with output sum widgets muted and their output gains at min */
5871 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5872 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5873 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5874 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5875 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5876 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5877 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5878 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5879 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5881 /* Unmute retasking pin widget output buffers since the default
5882 * state appears to be output. As the pin mode is changed by the
5883 * user the pin mode control will take care of enabling the pin's
5884 * input/output buffers as needed.
5886 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5887 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5888 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5889 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5890 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5891 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5892 /* Also unmute the mono-out pin widget */
5893 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5895 /* Mute capture amp left and right */
5896 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5897 /* Set ADC connection select to match default mixer setting (mic1
5900 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5902 /* Do the same for the second ADC: mute capture input amp and
5903 * set ADC connection to mic1 pin
5905 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5906 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5908 /* Mute all inputs to mixer widget (even unconnected ones) */
5909 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5910 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5911 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5912 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5913 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5914 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5915 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5922 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5923 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5925 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5926 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5929 * for BIOS auto-configuration
5932 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5933 const char *pfx, int *vol_bits)
5936 unsigned long vol_val, sw_val;
5940 if (nid >= 0x0f && nid < 0x11) {
5941 nid_vol = nid - 0x7;
5942 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5943 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5944 } else if (nid == 0x11) {
5945 nid_vol = nid - 0x7;
5946 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5947 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5948 } else if (nid >= 0x12 && nid <= 0x15) {
5950 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5951 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5955 if (!(*vol_bits & (1 << nid_vol))) {
5956 /* first control for the volume widget */
5957 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5958 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5961 *vol_bits |= (1 << nid_vol);
5963 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5964 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5970 /* add playback controls from the parsed DAC table */
5971 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5972 const struct auto_pin_cfg *cfg)
5978 spec->multiout.num_dacs = 1;
5979 spec->multiout.dac_nids = spec->private_dac_nids;
5980 spec->multiout.dac_nids[0] = 0x02;
5982 nid = cfg->line_out_pins[0];
5984 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5989 nid = cfg->speaker_pins[0];
5991 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5996 nid = cfg->hp_pins[0];
5998 err = alc260_add_playback_controls(spec, nid, "Headphone",
6006 /* create playback/capture controls for input pins */
6007 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
6008 const struct auto_pin_cfg *cfg)
6010 struct hda_input_mux *imux = &spec->private_imux[0];
6013 for (i = 0; i < AUTO_PIN_LAST; i++) {
6014 if (cfg->input_pins[i] >= 0x12) {
6015 idx = cfg->input_pins[i] - 0x12;
6016 err = new_analog_input(spec, cfg->input_pins[i],
6017 auto_pin_cfg_labels[i], idx,
6021 imux->items[imux->num_items].label =
6022 auto_pin_cfg_labels[i];
6023 imux->items[imux->num_items].index = idx;
6026 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
6027 idx = cfg->input_pins[i] - 0x09;
6028 err = new_analog_input(spec, cfg->input_pins[i],
6029 auto_pin_cfg_labels[i], idx,
6033 imux->items[imux->num_items].label =
6034 auto_pin_cfg_labels[i];
6035 imux->items[imux->num_items].index = idx;
6042 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6043 hda_nid_t nid, int pin_type,
6046 alc_set_pin_output(codec, nid, pin_type);
6047 /* need the manual connection? */
6049 int idx = nid - 0x12;
6050 snd_hda_codec_write(codec, idx + 0x0b, 0,
6051 AC_VERB_SET_CONNECT_SEL, sel_idx);
6055 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6057 struct alc_spec *spec = codec->spec;
6060 nid = spec->autocfg.line_out_pins[0];
6062 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6063 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6066 nid = spec->autocfg.speaker_pins[0];
6068 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6070 nid = spec->autocfg.hp_pins[0];
6072 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6075 #define ALC260_PIN_CD_NID 0x16
6076 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6078 struct alc_spec *spec = codec->spec;
6081 for (i = 0; i < AUTO_PIN_LAST; i++) {
6082 hda_nid_t nid = spec->autocfg.input_pins[i];
6084 alc_set_input_pin(codec, nid, i);
6085 if (nid != ALC260_PIN_CD_NID &&
6086 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6087 snd_hda_codec_write(codec, nid, 0,
6088 AC_VERB_SET_AMP_GAIN_MUTE,
6095 * generic initialization of ADC, input mixers and output mixers
6097 static struct hda_verb alc260_volume_init_verbs[] = {
6099 * Unmute ADC0-1 and set the default input to mic-in
6101 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6102 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6103 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6104 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6106 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6108 * Note: PASD motherboards uses the Line In 2 as the input for
6109 * front panel mic (mic 2)
6111 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6112 /* mute analog inputs */
6113 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6114 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6115 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6120 * Set up output mixers (0x08 - 0x0a)
6122 /* set vol=0 to output mixers */
6123 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6124 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6125 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6126 /* set up input amps for analog loopback */
6127 /* Amp Indices: DAC = 0, mixer = 1 */
6128 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6129 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6130 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6131 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6132 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6133 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6138 static int alc260_parse_auto_config(struct hda_codec *codec)
6140 struct alc_spec *spec = codec->spec;
6142 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6144 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6148 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6151 if (!spec->kctls.list)
6152 return 0; /* can't find valid BIOS pin config */
6153 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
6157 spec->multiout.max_channels = 2;
6159 if (spec->autocfg.dig_outs)
6160 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6161 if (spec->kctls.list)
6162 add_mixer(spec, spec->kctls.list);
6164 add_verb(spec, alc260_volume_init_verbs);
6166 spec->num_mux_defs = 1;
6167 spec->input_mux = &spec->private_imux[0];
6169 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6174 /* additional initialization for auto-configuration model */
6175 static void alc260_auto_init(struct hda_codec *codec)
6177 struct alc_spec *spec = codec->spec;
6178 alc260_auto_init_multi_out(codec);
6179 alc260_auto_init_analog_input(codec);
6180 if (spec->unsol_event)
6181 alc_inithook(codec);
6184 #ifdef CONFIG_SND_HDA_POWER_SAVE
6185 static struct hda_amp_list alc260_loopbacks[] = {
6186 { 0x07, HDA_INPUT, 0 },
6187 { 0x07, HDA_INPUT, 1 },
6188 { 0x07, HDA_INPUT, 2 },
6189 { 0x07, HDA_INPUT, 3 },
6190 { 0x07, HDA_INPUT, 4 },
6196 * ALC260 configurations
6198 static const char *alc260_models[ALC260_MODEL_LAST] = {
6199 [ALC260_BASIC] = "basic",
6201 [ALC260_HP_3013] = "hp-3013",
6202 [ALC260_HP_DC7600] = "hp-dc7600",
6203 [ALC260_FUJITSU_S702X] = "fujitsu",
6204 [ALC260_ACER] = "acer",
6205 [ALC260_WILL] = "will",
6206 [ALC260_REPLACER_672V] = "replacer",
6207 [ALC260_FAVORIT100] = "favorit100",
6208 #ifdef CONFIG_SND_DEBUG
6209 [ALC260_TEST] = "test",
6211 [ALC260_AUTO] = "auto",
6214 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6215 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6216 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6217 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6218 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6219 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6220 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6221 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6222 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6223 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6224 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6225 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6226 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6227 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6228 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6229 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6230 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6231 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6232 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6233 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6237 static struct alc_config_preset alc260_presets[] = {
6239 .mixers = { alc260_base_output_mixer,
6240 alc260_input_mixer },
6241 .init_verbs = { alc260_init_verbs },
6242 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6243 .dac_nids = alc260_dac_nids,
6244 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6245 .adc_nids = alc260_adc_nids,
6246 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6247 .channel_mode = alc260_modes,
6248 .input_mux = &alc260_capture_source,
6251 .mixers = { alc260_hp_output_mixer,
6252 alc260_input_mixer },
6253 .init_verbs = { alc260_init_verbs,
6254 alc260_hp_unsol_verbs },
6255 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6256 .dac_nids = alc260_dac_nids,
6257 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6258 .adc_nids = alc260_adc_nids_alt,
6259 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6260 .channel_mode = alc260_modes,
6261 .input_mux = &alc260_capture_source,
6262 .unsol_event = alc260_hp_unsol_event,
6263 .init_hook = alc260_hp_automute,
6265 [ALC260_HP_DC7600] = {
6266 .mixers = { alc260_hp_dc7600_mixer,
6267 alc260_input_mixer },
6268 .init_verbs = { alc260_init_verbs,
6269 alc260_hp_dc7600_verbs },
6270 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6271 .dac_nids = alc260_dac_nids,
6272 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6273 .adc_nids = alc260_adc_nids_alt,
6274 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6275 .channel_mode = alc260_modes,
6276 .input_mux = &alc260_capture_source,
6277 .unsol_event = alc260_hp_3012_unsol_event,
6278 .init_hook = alc260_hp_3012_automute,
6280 [ALC260_HP_3013] = {
6281 .mixers = { alc260_hp_3013_mixer,
6282 alc260_input_mixer },
6283 .init_verbs = { alc260_hp_3013_init_verbs,
6284 alc260_hp_3013_unsol_verbs },
6285 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6286 .dac_nids = alc260_dac_nids,
6287 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6288 .adc_nids = alc260_adc_nids_alt,
6289 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6290 .channel_mode = alc260_modes,
6291 .input_mux = &alc260_capture_source,
6292 .unsol_event = alc260_hp_3013_unsol_event,
6293 .init_hook = alc260_hp_3013_automute,
6295 [ALC260_FUJITSU_S702X] = {
6296 .mixers = { alc260_fujitsu_mixer },
6297 .init_verbs = { alc260_fujitsu_init_verbs },
6298 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6299 .dac_nids = alc260_dac_nids,
6300 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6301 .adc_nids = alc260_dual_adc_nids,
6302 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6303 .channel_mode = alc260_modes,
6304 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6305 .input_mux = alc260_fujitsu_capture_sources,
6308 .mixers = { alc260_acer_mixer },
6309 .init_verbs = { alc260_acer_init_verbs },
6310 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6311 .dac_nids = alc260_dac_nids,
6312 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6313 .adc_nids = alc260_dual_adc_nids,
6314 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6315 .channel_mode = alc260_modes,
6316 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6317 .input_mux = alc260_acer_capture_sources,
6319 [ALC260_FAVORIT100] = {
6320 .mixers = { alc260_favorit100_mixer },
6321 .init_verbs = { alc260_favorit100_init_verbs },
6322 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6323 .dac_nids = alc260_dac_nids,
6324 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6325 .adc_nids = alc260_dual_adc_nids,
6326 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6327 .channel_mode = alc260_modes,
6328 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6329 .input_mux = alc260_favorit100_capture_sources,
6332 .mixers = { alc260_will_mixer },
6333 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6334 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6335 .dac_nids = alc260_dac_nids,
6336 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6337 .adc_nids = alc260_adc_nids,
6338 .dig_out_nid = ALC260_DIGOUT_NID,
6339 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6340 .channel_mode = alc260_modes,
6341 .input_mux = &alc260_capture_source,
6343 [ALC260_REPLACER_672V] = {
6344 .mixers = { alc260_replacer_672v_mixer },
6345 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6346 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6347 .dac_nids = alc260_dac_nids,
6348 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6349 .adc_nids = alc260_adc_nids,
6350 .dig_out_nid = ALC260_DIGOUT_NID,
6351 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6352 .channel_mode = alc260_modes,
6353 .input_mux = &alc260_capture_source,
6354 .unsol_event = alc260_replacer_672v_unsol_event,
6355 .init_hook = alc260_replacer_672v_automute,
6357 #ifdef CONFIG_SND_DEBUG
6359 .mixers = { alc260_test_mixer },
6360 .init_verbs = { alc260_test_init_verbs },
6361 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6362 .dac_nids = alc260_test_dac_nids,
6363 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6364 .adc_nids = alc260_test_adc_nids,
6365 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6366 .channel_mode = alc260_modes,
6367 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6368 .input_mux = alc260_test_capture_sources,
6373 static int patch_alc260(struct hda_codec *codec)
6375 struct alc_spec *spec;
6376 int err, board_config;
6378 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6384 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6387 if (board_config < 0) {
6388 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6390 board_config = ALC260_AUTO;
6393 if (board_config == ALC260_AUTO) {
6394 /* automatic parse from the BIOS config */
6395 err = alc260_parse_auto_config(codec);
6401 "hda_codec: Cannot set up configuration "
6402 "from BIOS. Using base mode...\n");
6403 board_config = ALC260_BASIC;
6407 err = snd_hda_attach_beep_device(codec, 0x1);
6413 if (board_config != ALC260_AUTO)
6414 setup_preset(codec, &alc260_presets[board_config]);
6416 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6417 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6419 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6420 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6422 if (!spec->adc_nids && spec->input_mux) {
6423 /* check whether NID 0x04 is valid */
6424 unsigned int wcap = get_wcaps(codec, 0x04);
6425 wcap = get_wcaps_type(wcap);
6427 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6428 spec->adc_nids = alc260_adc_nids_alt;
6429 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6431 spec->adc_nids = alc260_adc_nids;
6432 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6435 set_capture_mixer(codec);
6436 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6438 spec->vmaster_nid = 0x08;
6440 codec->patch_ops = alc_patch_ops;
6441 if (board_config == ALC260_AUTO)
6442 spec->init_hook = alc260_auto_init;
6443 #ifdef CONFIG_SND_HDA_POWER_SAVE
6444 if (!spec->loopback.amplist)
6445 spec->loopback.amplist = alc260_loopbacks;
6447 codec->proc_widget_hook = print_realtek_coef;
6454 * ALC882/883/885/888/889 support
6456 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6457 * configuration. Each pin widget can choose any input DACs and a mixer.
6458 * Each ADC is connected from a mixer of all inputs. This makes possible
6459 * 6-channel independent captures.
6461 * In addition, an independent DAC for the multi-playback (not used in this
6464 #define ALC882_DIGOUT_NID 0x06
6465 #define ALC882_DIGIN_NID 0x0a
6466 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6467 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6468 #define ALC1200_DIGOUT_NID 0x10
6471 static struct hda_channel_mode alc882_ch_modes[1] = {
6476 static hda_nid_t alc882_dac_nids[4] = {
6477 /* front, rear, clfe, rear_surr */
6478 0x02, 0x03, 0x04, 0x05
6480 #define alc883_dac_nids alc882_dac_nids
6483 #define alc882_adc_nids alc880_adc_nids
6484 #define alc882_adc_nids_alt alc880_adc_nids_alt
6485 #define alc883_adc_nids alc882_adc_nids_alt
6486 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6487 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6488 #define alc889_adc_nids alc880_adc_nids
6490 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6491 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6492 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6493 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6494 #define alc889_capsrc_nids alc882_capsrc_nids
6497 /* FIXME: should be a matrix-type input source selection */
6499 static struct hda_input_mux alc882_capture_source = {
6503 { "Front Mic", 0x1 },
6509 #define alc883_capture_source alc882_capture_source
6511 static struct hda_input_mux alc889_capture_source = {
6514 { "Front Mic", 0x0 },
6520 static struct hda_input_mux mb5_capture_source = {
6529 static struct hda_input_mux alc883_3stack_6ch_intel = {
6533 { "Front Mic", 0x0 },
6539 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6547 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6557 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6565 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6569 { "Front Mic", 0x1 },
6574 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6582 static struct hda_input_mux alc889A_mb31_capture_source = {
6586 /* Front Mic (0x01) unused */
6588 /* Line 2 (0x03) unused */
6589 /* CD (0x04) unsused? */
6596 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6603 static struct hda_verb alc882_3ST_ch2_init[] = {
6604 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6605 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6606 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6607 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6614 static struct hda_verb alc882_3ST_ch4_init[] = {
6615 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6616 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6617 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6618 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6619 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6626 static struct hda_verb alc882_3ST_ch6_init[] = {
6627 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6628 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6629 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6630 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6631 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6632 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6636 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6637 { 2, alc882_3ST_ch2_init },
6638 { 4, alc882_3ST_ch4_init },
6639 { 6, alc882_3ST_ch6_init },
6642 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6647 static struct hda_verb alc882_sixstack_ch6_init[] = {
6648 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6649 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6650 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6651 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6658 static struct hda_verb alc882_sixstack_ch8_init[] = {
6659 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6660 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6661 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6662 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6666 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6667 { 6, alc882_sixstack_ch6_init },
6668 { 8, alc882_sixstack_ch8_init },
6672 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6678 static struct hda_verb alc885_mbp_ch2_init[] = {
6679 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6680 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6681 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6688 static struct hda_verb alc885_mbp_ch6_init[] = {
6689 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6690 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6691 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6692 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6693 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6697 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6698 { 2, alc885_mbp_ch2_init },
6699 { 6, alc885_mbp_ch6_init },
6704 * Speakers/Woofer/HP = Front
6707 static struct hda_verb alc885_mb5_ch2_init[] = {
6708 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6709 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6715 * Speakers/HP = Front
6719 static struct hda_verb alc885_mb5_ch6_init[] = {
6720 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6721 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6722 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6726 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6727 { 2, alc885_mb5_ch2_init },
6728 { 6, alc885_mb5_ch6_init },
6735 static struct hda_verb alc883_4ST_ch2_init[] = {
6736 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6737 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6738 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6739 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6740 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6741 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6748 static struct hda_verb alc883_4ST_ch4_init[] = {
6749 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6750 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6751 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6752 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6753 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6754 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6755 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6762 static struct hda_verb alc883_4ST_ch6_init[] = {
6763 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6764 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6765 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6766 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6767 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6768 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6769 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6770 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6777 static struct hda_verb alc883_4ST_ch8_init[] = {
6778 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6779 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6780 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6781 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6782 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6783 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6784 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6785 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6786 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6790 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6791 { 2, alc883_4ST_ch2_init },
6792 { 4, alc883_4ST_ch4_init },
6793 { 6, alc883_4ST_ch6_init },
6794 { 8, alc883_4ST_ch8_init },
6801 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6802 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6803 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6804 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6805 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6812 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6813 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6814 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6815 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6816 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6817 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6824 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6825 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6826 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6827 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6828 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6829 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6830 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6834 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6835 { 2, alc883_3ST_ch2_intel_init },
6836 { 4, alc883_3ST_ch4_intel_init },
6837 { 6, alc883_3ST_ch6_intel_init },
6843 static struct hda_verb alc889_ch2_intel_init[] = {
6844 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6845 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6846 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6847 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6848 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6849 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6856 static struct hda_verb alc889_ch6_intel_init[] = {
6857 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6858 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6859 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6860 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6861 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6862 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6869 static struct hda_verb alc889_ch8_intel_init[] = {
6870 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6871 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6872 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6873 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6874 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6875 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6876 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6880 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6881 { 2, alc889_ch2_intel_init },
6882 { 6, alc889_ch6_intel_init },
6883 { 8, alc889_ch8_intel_init },
6889 static struct hda_verb alc883_sixstack_ch6_init[] = {
6890 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6891 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6892 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6893 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6900 static struct hda_verb alc883_sixstack_ch8_init[] = {
6901 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6902 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6903 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6904 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6908 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6909 { 6, alc883_sixstack_ch6_init },
6910 { 8, alc883_sixstack_ch8_init },
6914 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6915 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6917 static struct snd_kcontrol_new alc882_base_mixer[] = {
6918 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6919 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6920 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6921 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6922 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6923 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6924 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6925 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6926 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6927 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6928 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6929 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6930 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6931 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6932 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6933 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6934 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6935 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6936 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6937 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6938 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6942 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6943 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6944 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6945 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6946 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6947 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6948 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6949 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6950 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6951 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6952 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6956 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6957 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6958 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6959 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6960 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6961 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6962 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6963 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6964 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6965 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6966 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6967 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6968 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6969 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6970 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6974 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6975 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6976 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6977 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6978 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6979 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6980 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6981 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6982 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6983 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6987 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6988 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6989 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6990 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6991 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6992 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6993 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6994 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6995 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6996 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6997 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6998 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6999 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7000 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7004 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7005 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7007 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7008 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7009 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7010 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7011 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7012 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7013 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7014 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7015 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7016 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7017 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7018 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7019 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7020 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7024 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7025 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7026 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7027 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7028 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7029 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7030 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7031 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7032 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7033 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7034 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7038 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7040 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7041 .name = "Channel Mode",
7042 .info = alc_ch_mode_info,
7043 .get = alc_ch_mode_get,
7044 .put = alc_ch_mode_put,
7049 static struct hda_verb alc882_base_init_verbs[] = {
7050 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7051 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7052 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7053 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7055 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7056 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7057 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7059 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7060 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7061 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7063 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7064 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7065 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7067 /* mute analog input loopbacks */
7068 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7069 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7070 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7071 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7072 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7074 /* Front Pin: output 0 (0x0c) */
7075 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7076 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7077 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7078 /* Rear Pin: output 1 (0x0d) */
7079 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7080 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7081 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7082 /* CLFE Pin: output 2 (0x0e) */
7083 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7084 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7085 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7086 /* Side Pin: output 3 (0x0f) */
7087 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7088 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7089 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7090 /* Mic (rear) pin: input vref at 80% */
7091 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7092 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7093 /* Front Mic pin: input vref at 80% */
7094 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7095 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7096 /* Line In pin: input */
7097 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7098 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7099 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7100 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7101 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7102 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7103 /* CD pin widget for input */
7104 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7106 /* FIXME: use matrix-type input source selection */
7107 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7109 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7110 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7111 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7112 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7114 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7115 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7116 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7118 /* ADC2: mute amp left and right */
7119 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7120 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7121 /* ADC3: mute amp left and right */
7122 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7123 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7128 static struct hda_verb alc882_adc1_init_verbs[] = {
7129 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7130 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7131 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7132 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7133 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7134 /* ADC1: mute amp left and right */
7135 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7136 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7140 static struct hda_verb alc882_eapd_verbs[] = {
7141 /* change to EAPD mode */
7142 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7143 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7147 static struct hda_verb alc889_eapd_verbs[] = {
7148 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7149 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7153 static struct hda_verb alc_hp15_unsol_verbs[] = {
7154 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7155 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7159 static struct hda_verb alc885_init_verbs[] = {
7160 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7161 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7165 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7166 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7167 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7169 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7170 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7171 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7173 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7174 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7175 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7177 /* mute analog input loopbacks */
7178 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7179 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7180 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7182 /* Front HP Pin: output 0 (0x0c) */
7183 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7184 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7185 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7186 /* Front Pin: output 0 (0x0c) */
7187 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7188 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7189 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7190 /* Rear Pin: output 1 (0x0d) */
7191 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7192 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7193 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7194 /* CLFE Pin: output 2 (0x0e) */
7195 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7196 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7197 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7198 /* Side Pin: output 3 (0x0f) */
7199 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7200 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7201 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7202 /* Mic (rear) pin: input vref at 80% */
7203 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7204 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7205 /* Front Mic pin: input vref at 80% */
7206 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7207 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7208 /* Line In pin: input */
7209 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7210 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7212 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7214 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7215 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7216 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7218 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7219 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7220 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7222 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7223 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7224 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7225 /* ADC2: mute amp left and right */
7226 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7227 /* ADC3: mute amp left and right */
7228 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7233 static struct hda_verb alc885_init_input_verbs[] = {
7234 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7235 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7236 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7241 /* Unmute Selector 24h and set the default input to front mic */
7242 static struct hda_verb alc889_init_input_verbs[] = {
7243 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7244 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7249 #define alc883_init_verbs alc882_base_init_verbs
7252 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7253 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7254 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7255 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7256 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7257 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7258 /* FIXME: this looks suspicious...
7259 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7260 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7265 static struct hda_verb alc882_macpro_init_verbs[] = {
7266 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7267 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7268 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7269 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7270 /* Front Pin: output 0 (0x0c) */
7271 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7272 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7273 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7274 /* Front Mic pin: input vref at 80% */
7275 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7276 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7277 /* Speaker: output */
7278 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7279 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7280 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7281 /* Headphone output (output 0 - 0x0c) */
7282 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7283 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7284 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7286 /* FIXME: use matrix-type input source selection */
7287 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7288 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7289 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7290 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7291 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7292 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7294 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7295 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7296 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7297 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7299 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7300 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7301 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7303 /* ADC1: mute amp left and right */
7304 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7305 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7306 /* ADC2: mute amp left and right */
7307 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7308 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7309 /* ADC3: mute amp left and right */
7310 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7311 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7317 static struct hda_verb alc885_mb5_init_verbs[] = {
7319 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7320 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7321 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7322 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7324 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7325 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7326 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7327 /* Surround mixer */
7328 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7329 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7330 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7332 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7333 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7334 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7336 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7337 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7338 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7339 /* Front Pin (0x0c) */
7340 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7341 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7342 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7343 /* LFE Pin (0x0e) */
7344 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7345 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7346 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7348 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7349 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7350 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7351 /* Front Mic pin: input vref at 80% */
7352 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7353 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7355 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7356 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7358 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7359 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7360 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7361 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7365 /* Macbook Pro rev3 */
7366 static struct hda_verb alc885_mbp3_init_verbs[] = {
7367 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7368 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7369 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7370 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7372 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7373 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7374 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7375 /* Front Pin: output 0 (0x0c) */
7376 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7377 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7378 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7379 /* HP Pin: output 0 (0x0d) */
7380 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7381 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7382 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7383 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7384 /* Mic (rear) pin: input vref at 80% */
7385 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7386 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7387 /* Front Mic pin: input vref at 80% */
7388 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7389 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7390 /* Line In pin: use output 1 when in LineOut mode */
7391 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7392 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7393 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7395 /* FIXME: use matrix-type input source selection */
7396 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7397 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7398 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7400 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7401 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7403 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7404 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7405 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7406 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7408 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7409 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7412 /* ADC1: mute amp left and right */
7413 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7414 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7415 /* ADC2: mute amp left and right */
7416 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7417 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7418 /* ADC3: mute amp left and right */
7419 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7420 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7425 /* iMac 24 mixer. */
7426 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7427 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7428 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7432 /* iMac 24 init verbs. */
7433 static struct hda_verb alc885_imac24_init_verbs[] = {
7434 /* Internal speakers: output 0 (0x0c) */
7435 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7436 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7437 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7438 /* Internal speakers: output 0 (0x0c) */
7439 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7440 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7441 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7442 /* Headphone: output 0 (0x0c) */
7443 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7444 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7445 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7446 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7447 /* Front Mic: input vref at 80% */
7448 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7449 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7453 /* Toggle speaker-output according to the hp-jack state */
7454 static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
7456 struct alc_spec *spec = codec->spec;
7458 spec->autocfg.hp_pins[0] = 0x14;
7459 spec->autocfg.speaker_pins[0] = 0x18;
7460 spec->autocfg.speaker_pins[1] = 0x1a;
7461 alc_automute_amp(codec);
7464 static void alc885_mbp3_init_hook(struct hda_codec *codec)
7466 struct alc_spec *spec = codec->spec;
7468 spec->autocfg.hp_pins[0] = 0x15;
7469 spec->autocfg.speaker_pins[0] = 0x14;
7470 alc_automute_amp(codec);
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_init_hook(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;
7504 alc882_targa_automute(codec);
7507 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7509 if ((res >> 26) == ALC880_HP_EVENT)
7510 alc882_targa_automute(codec);
7513 static struct hda_verb alc882_asus_a7j_verbs[] = {
7514 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7515 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7517 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7518 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7519 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7521 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7522 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7523 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7525 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7526 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7527 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7531 static struct hda_verb alc882_asus_a7m_verbs[] = {
7532 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7533 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7535 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7536 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7537 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7539 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7540 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7541 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7543 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7544 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7545 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7549 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7551 unsigned int gpiostate, gpiomask, gpiodir;
7553 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7554 AC_VERB_GET_GPIO_DATA, 0);
7557 gpiostate |= (1 << pin);
7559 gpiostate &= ~(1 << pin);
7561 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7562 AC_VERB_GET_GPIO_MASK, 0);
7563 gpiomask |= (1 << pin);
7565 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7566 AC_VERB_GET_GPIO_DIRECTION, 0);
7567 gpiodir |= (1 << pin);
7570 snd_hda_codec_write(codec, codec->afg, 0,
7571 AC_VERB_SET_GPIO_MASK, gpiomask);
7572 snd_hda_codec_write(codec, codec->afg, 0,
7573 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7577 snd_hda_codec_write(codec, codec->afg, 0,
7578 AC_VERB_SET_GPIO_DATA, gpiostate);
7581 /* set up GPIO at initialization */
7582 static void alc885_macpro_init_hook(struct hda_codec *codec)
7584 alc882_gpio_mute(codec, 0, 0);
7585 alc882_gpio_mute(codec, 1, 0);
7588 /* set up GPIO and update auto-muting at initialization */
7589 static void alc885_imac24_init_hook(struct hda_codec *codec)
7591 alc885_macpro_init_hook(codec);
7592 alc885_imac24_automute_init_hook(codec);
7596 * generic initialization of ADC, input mixers and output mixers
7598 static struct hda_verb alc883_auto_init_verbs[] = {
7600 * Unmute ADC0-2 and set the default input to mic-in
7602 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7603 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7604 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7605 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7607 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7609 * Note: PASD motherboards uses the Line In 2 as the input for
7610 * front panel mic (mic 2)
7612 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7615 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7616 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7617 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7620 * Set up output mixers (0x0c - 0x0f)
7622 /* set vol=0 to output mixers */
7623 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7624 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7625 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7626 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7627 /* set up input amps for analog loopback */
7628 /* Amp Indices: DAC = 0, mixer = 1 */
7629 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7630 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7631 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7632 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7633 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7634 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7635 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7636 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7637 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7638 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7640 /* FIXME: use matrix-type input source selection */
7641 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7643 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7644 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7645 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7646 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7648 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7650 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7651 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7656 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7657 static struct hda_verb alc889A_mb31_ch2_init[] = {
7658 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7659 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7660 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7661 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7665 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7666 static struct hda_verb alc889A_mb31_ch4_init[] = {
7667 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7668 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7669 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7670 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7674 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7675 static struct hda_verb alc889A_mb31_ch5_init[] = {
7676 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7677 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7678 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7679 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7683 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7684 static struct hda_verb alc889A_mb31_ch6_init[] = {
7685 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7686 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7687 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7688 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7692 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7693 { 2, alc889A_mb31_ch2_init },
7694 { 4, alc889A_mb31_ch4_init },
7695 { 5, alc889A_mb31_ch5_init },
7696 { 6, alc889A_mb31_ch6_init },
7699 static struct hda_verb alc883_medion_eapd_verbs[] = {
7700 /* eanable EAPD on medion laptop */
7701 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7702 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7706 #define alc883_base_mixer alc882_base_mixer
7708 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7709 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7710 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7711 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7712 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7713 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7714 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7715 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7716 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7717 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7718 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7719 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7720 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7721 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7725 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7726 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7727 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7728 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7729 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7730 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7731 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7732 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7733 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7734 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7735 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7739 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7740 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7741 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7742 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7743 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7744 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7745 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7746 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7747 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7748 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7749 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7753 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7754 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7755 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7756 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7757 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7758 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7759 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7760 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7761 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7762 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7763 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7764 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7765 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7766 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7770 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7771 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7772 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7773 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7774 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7775 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7776 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7777 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7778 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7779 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7780 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7781 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7782 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7783 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7784 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7785 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7786 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7787 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7788 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7789 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7793 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7794 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7795 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7796 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7797 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7798 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7800 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7801 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7802 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7803 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7804 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7805 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7806 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7807 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7808 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7809 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7810 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7811 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7812 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7813 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7817 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7818 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7819 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7820 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7821 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7822 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7824 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7825 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7826 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7827 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7828 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7829 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7830 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7831 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7832 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7833 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7835 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7836 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7837 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7841 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7842 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7843 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7844 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7845 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7846 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7847 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7848 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7849 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7850 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7851 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7852 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7853 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7854 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7855 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7856 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7857 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7858 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7859 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7860 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7864 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7865 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7866 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7867 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7868 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7869 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7870 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7871 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7872 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7873 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7874 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7875 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7876 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7877 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7879 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7880 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7884 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7885 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7886 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7887 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7888 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7889 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7890 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7891 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7892 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7893 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7894 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7895 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7899 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7900 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7901 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7902 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7903 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7904 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7905 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7906 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7907 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7911 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7912 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7913 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7914 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7915 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7916 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7917 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7918 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7919 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7920 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7924 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7925 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7926 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7927 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7928 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7929 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7930 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7931 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7932 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7933 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7937 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7938 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7939 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7940 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7941 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7942 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7943 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7944 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7945 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7949 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
7950 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7951 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7952 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7953 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
7954 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7955 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7956 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7957 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7958 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7959 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7960 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7964 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7965 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7966 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7967 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7968 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7969 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7970 0x0d, 1, 0x0, HDA_OUTPUT),
7971 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7972 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7973 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7974 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7975 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7976 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7977 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7978 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7979 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7980 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7981 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7982 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7983 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7984 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7985 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7989 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
7991 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7992 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7993 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7994 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7995 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
7997 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
7998 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
7999 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8000 /* Output switches */
8001 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8002 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8003 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8005 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8006 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8008 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8009 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8010 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8011 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8015 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8016 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8017 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8018 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8019 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8020 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8025 static struct hda_bind_ctls alc883_bind_cap_vol = {
8026 .ops = &snd_hda_bind_vol,
8028 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8029 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8034 static struct hda_bind_ctls alc883_bind_cap_switch = {
8035 .ops = &snd_hda_bind_sw,
8037 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8038 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8043 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8044 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8045 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8046 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8047 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8048 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8049 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8050 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8051 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8055 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8056 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8057 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8059 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8060 /* .name = "Capture Source", */
8061 .name = "Input Source",
8063 .info = alc_mux_enum_info,
8064 .get = alc_mux_enum_get,
8065 .put = alc_mux_enum_put,
8070 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8072 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8073 .name = "Channel Mode",
8074 .info = alc_ch_mode_info,
8075 .get = alc_ch_mode_get,
8076 .put = alc_ch_mode_put,
8081 /* toggle speaker-output according to the hp-jack state */
8082 static void alc883_mitac_init_hook(struct hda_codec *codec)
8084 struct alc_spec *spec = codec->spec;
8086 spec->autocfg.hp_pins[0] = 0x15;
8087 spec->autocfg.speaker_pins[0] = 0x14;
8088 spec->autocfg.speaker_pins[1] = 0x17;
8089 alc_automute_amp(codec);
8092 /* auto-toggle front mic */
8094 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8096 unsigned int present;
8099 present = snd_hda_codec_read(codec, 0x18, 0,
8100 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8101 bits = present ? HDA_AMP_MUTE : 0;
8102 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8106 static struct hda_verb alc883_mitac_verbs[] = {
8108 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8109 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8111 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8112 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8114 /* enable unsolicited event */
8115 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8116 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8121 static struct hda_verb alc883_clevo_m720_verbs[] = {
8123 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8124 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8126 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8127 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8129 /* enable unsolicited event */
8130 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8131 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8136 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8138 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8139 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8141 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8142 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8144 /* enable unsolicited event */
8145 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8150 static struct hda_verb alc883_targa_verbs[] = {
8151 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8152 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8154 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8155 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8157 /* Connect Line-Out side jack (SPDIF) to Side */
8158 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8159 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8160 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8161 /* Connect Mic jack to CLFE */
8162 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8163 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8164 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8165 /* Connect Line-in jack to Surround */
8166 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8167 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8168 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8169 /* Connect HP out jack to Front */
8170 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8171 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8172 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8174 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8179 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8180 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8181 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8182 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8186 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8187 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8188 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8189 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8190 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8194 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8195 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8196 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8197 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8198 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8199 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8203 static struct hda_verb alc883_haier_w66_verbs[] = {
8204 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8205 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8207 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8209 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8210 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8211 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8212 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8216 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8217 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8218 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8219 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8220 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8221 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8222 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8223 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8224 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8228 static struct hda_verb alc888_6st_dell_verbs[] = {
8229 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8233 static struct hda_verb alc883_vaiott_verbs[] = {
8235 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8236 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8238 /* enable unsolicited event */
8239 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8244 static void alc888_3st_hp_init_hook(struct hda_codec *codec)
8246 struct alc_spec *spec = codec->spec;
8248 spec->autocfg.hp_pins[0] = 0x1b;
8249 spec->autocfg.speaker_pins[0] = 0x14;
8250 spec->autocfg.speaker_pins[1] = 0x16;
8251 spec->autocfg.speaker_pins[2] = 0x18;
8252 alc_automute_amp(codec);
8255 static struct hda_verb alc888_3st_hp_verbs[] = {
8256 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8257 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8258 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8259 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8266 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8267 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8268 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8269 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8270 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8277 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8278 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8279 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8280 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8281 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8282 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8289 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8290 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8291 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8292 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8293 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8294 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8295 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8299 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8300 { 2, alc888_3st_hp_2ch_init },
8301 { 4, alc888_3st_hp_4ch_init },
8302 { 6, alc888_3st_hp_6ch_init },
8305 /* toggle front-jack and RCA according to the hp-jack state */
8306 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8308 unsigned int present;
8310 present = snd_hda_codec_read(codec, 0x1b, 0,
8311 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8312 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8313 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8314 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8315 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8318 /* toggle RCA according to the front-jack state */
8319 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8321 unsigned int present;
8323 present = snd_hda_codec_read(codec, 0x14, 0,
8324 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8325 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8326 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8329 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8332 if ((res >> 26) == ALC880_HP_EVENT)
8333 alc888_lenovo_ms7195_front_automute(codec);
8334 if ((res >> 26) == ALC880_FRONT_EVENT)
8335 alc888_lenovo_ms7195_rca_automute(codec);
8338 static struct hda_verb alc883_medion_md2_verbs[] = {
8339 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8340 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8342 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8344 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8348 /* toggle speaker-output according to the hp-jack state */
8349 static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8351 struct alc_spec *spec = codec->spec;
8353 spec->autocfg.hp_pins[0] = 0x14;
8354 spec->autocfg.speaker_pins[0] = 0x15;
8355 alc_automute_amp(codec);
8358 /* toggle speaker-output according to the hp-jack state */
8359 #define alc883_targa_init_hook alc882_targa_init_hook
8360 #define alc883_targa_unsol_event alc882_targa_unsol_event
8362 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8364 unsigned int present;
8366 present = snd_hda_codec_read(codec, 0x18, 0,
8367 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8368 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8369 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8372 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8374 struct alc_spec *spec = codec->spec;
8376 spec->autocfg.hp_pins[0] = 0x15;
8377 spec->autocfg.speaker_pins[0] = 0x14;
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_init_hook(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;
8402 alc_automute_amp(codec);
8405 static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8407 struct alc_spec *spec = codec->spec;
8409 spec->autocfg.hp_pins[0] = 0x1b;
8410 spec->autocfg.speaker_pins[0] = 0x14;
8411 alc_automute_amp(codec);
8414 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8416 unsigned int present;
8419 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8420 & AC_PINSENSE_PRESENCE;
8421 bits = present ? HDA_AMP_MUTE : 0;
8422 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8423 HDA_AMP_MUTE, bits);
8426 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8428 unsigned int present;
8431 present = snd_hda_codec_read(codec, 0x1b, 0,
8432 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8433 bits = present ? HDA_AMP_MUTE : 0;
8434 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8435 HDA_AMP_MUTE, bits);
8436 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8437 HDA_AMP_MUTE, bits);
8440 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8443 if ((res >> 26) == ALC880_HP_EVENT)
8444 alc883_lenovo_101e_all_automute(codec);
8445 if ((res >> 26) == ALC880_FRONT_EVENT)
8446 alc883_lenovo_101e_ispeaker_automute(codec);
8449 /* toggle speaker-output according to the hp-jack state */
8450 static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8452 struct alc_spec *spec = codec->spec;
8454 spec->autocfg.hp_pins[0] = 0x14;
8455 spec->autocfg.speaker_pins[0] = 0x15;
8456 spec->autocfg.speaker_pins[1] = 0x16;
8457 alc_automute_amp(codec);
8460 static struct hda_verb alc883_acer_eapd_verbs[] = {
8461 /* HP Pin: output 0 (0x0c) */
8462 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8463 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8464 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8465 /* Front Pin: output 0 (0x0c) */
8466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8467 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8468 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8469 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8470 /* eanable EAPD on medion laptop */
8471 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8472 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8473 /* enable unsolicited event */
8474 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8478 static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8480 struct alc_spec *spec = codec->spec;
8482 spec->autocfg.hp_pins[0] = 0x1b;
8483 spec->autocfg.speaker_pins[0] = 0x14;
8484 spec->autocfg.speaker_pins[1] = 0x15;
8485 spec->autocfg.speaker_pins[2] = 0x16;
8486 spec->autocfg.speaker_pins[3] = 0x17;
8487 alc_automute_amp(codec);
8490 static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8492 struct alc_spec *spec = codec->spec;
8494 spec->autocfg.hp_pins[0] = 0x1b;
8495 spec->autocfg.speaker_pins[0] = 0x14;
8496 spec->autocfg.speaker_pins[1] = 0x15;
8497 spec->autocfg.speaker_pins[2] = 0x16;
8498 spec->autocfg.speaker_pins[3] = 0x17;
8499 spec->autocfg.speaker_pins[4] = 0x1a;
8500 alc_automute_amp(codec);
8503 static void alc883_vaiott_init_hook(struct hda_codec *codec)
8505 struct alc_spec *spec = codec->spec;
8507 spec->autocfg.hp_pins[0] = 0x15;
8508 spec->autocfg.speaker_pins[0] = 0x14;
8509 spec->autocfg.speaker_pins[1] = 0x17;
8510 alc_automute_amp(codec);
8513 static struct hda_verb alc888_asus_m90v_verbs[] = {
8514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8515 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8516 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8517 /* enable unsolicited event */
8518 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8519 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8523 static void alc883_nb_mic_automute(struct hda_codec *codec)
8525 unsigned int present;
8527 present = snd_hda_codec_read(codec, 0x18, 0,
8528 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8529 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8530 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8531 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8532 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8535 static void alc883_M90V_init_hook(struct hda_codec *codec)
8537 struct alc_spec *spec = codec->spec;
8539 spec->autocfg.hp_pins[0] = 0x1b;
8540 spec->autocfg.speaker_pins[0] = 0x14;
8541 spec->autocfg.speaker_pins[1] = 0x15;
8542 spec->autocfg.speaker_pins[2] = 0x16;
8543 alc_automute_pin(codec);
8546 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8549 switch (res >> 26) {
8550 case ALC880_MIC_EVENT:
8551 alc883_nb_mic_automute(codec);
8554 alc_sku_unsol_event(codec, res);
8559 static void alc883_mode2_inithook(struct hda_codec *codec)
8561 alc883_M90V_init_hook(codec);
8562 alc883_nb_mic_automute(codec);
8565 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8566 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8567 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8568 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8569 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8570 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8571 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8572 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8573 /* enable unsolicited event */
8574 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8578 static void alc883_eee1601_inithook(struct hda_codec *codec)
8580 struct alc_spec *spec = codec->spec;
8582 spec->autocfg.hp_pins[0] = 0x14;
8583 spec->autocfg.speaker_pins[0] = 0x1b;
8584 alc_automute_pin(codec);
8587 static struct hda_verb alc889A_mb31_verbs[] = {
8588 /* Init rear pin (used as headphone output) */
8589 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8590 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8591 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8592 /* Init line pin (used as output in 4ch and 6ch mode) */
8593 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8594 /* Init line 2 pin (used as headphone out by default) */
8595 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8596 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8600 /* Mute speakers according to the headphone jack state */
8601 static void alc889A_mb31_automute(struct hda_codec *codec)
8603 unsigned int present;
8605 /* Mute only in 2ch or 4ch mode */
8606 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8608 present = snd_hda_codec_read(codec, 0x15, 0,
8609 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8610 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8611 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8612 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8613 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8617 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8619 if ((res >> 26) == ALC880_HP_EVENT)
8620 alc889A_mb31_automute(codec);
8624 #ifdef CONFIG_SND_HDA_POWER_SAVE
8625 #define alc882_loopbacks alc880_loopbacks
8628 /* pcm configuration: identical with ALC880 */
8629 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8630 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8631 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8632 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8634 static hda_nid_t alc883_slave_dig_outs[] = {
8635 ALC1200_DIGOUT_NID, 0,
8638 static hda_nid_t alc1200_slave_dig_outs[] = {
8639 ALC883_DIGOUT_NID, 0,
8643 * configuration and preset
8645 static const char *alc882_models[ALC882_MODEL_LAST] = {
8646 [ALC882_3ST_DIG] = "3stack-dig",
8647 [ALC882_6ST_DIG] = "6stack-dig",
8648 [ALC882_ARIMA] = "arima",
8649 [ALC882_W2JC] = "w2jc",
8650 [ALC882_TARGA] = "targa",
8651 [ALC882_ASUS_A7J] = "asus-a7j",
8652 [ALC882_ASUS_A7M] = "asus-a7m",
8653 [ALC885_MACPRO] = "macpro",
8654 [ALC885_MB5] = "mb5",
8655 [ALC885_MBP3] = "mbp3",
8656 [ALC885_IMAC24] = "imac24",
8657 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8658 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8659 [ALC883_3ST_6ch] = "3stack-6ch",
8660 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8661 [ALC883_TARGA_DIG] = "targa-dig",
8662 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8663 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8664 [ALC883_ACER] = "acer",
8665 [ALC883_ACER_ASPIRE] = "acer-aspire",
8666 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8667 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8668 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8669 [ALC883_MEDION] = "medion",
8670 [ALC883_MEDION_MD2] = "medion-md2",
8671 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8672 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8673 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8674 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8675 [ALC888_LENOVO_SKY] = "lenovo-sky",
8676 [ALC883_HAIER_W66] = "haier-w66",
8677 [ALC888_3ST_HP] = "3stack-hp",
8678 [ALC888_6ST_DELL] = "6stack-dell",
8679 [ALC883_MITAC] = "mitac",
8680 [ALC883_CLEVO_M720] = "clevo-m720",
8681 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8682 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8683 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8684 [ALC889A_INTEL] = "intel-alc889a",
8685 [ALC889_INTEL] = "intel-x58",
8686 [ALC1200_ASUS_P5Q] = "asus-p5q",
8687 [ALC889A_MB31] = "mb31",
8688 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8689 [ALC882_AUTO] = "auto",
8692 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8693 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8695 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8696 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8697 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8698 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8699 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8700 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8701 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8702 ALC888_ACER_ASPIRE_4930G),
8703 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8704 ALC888_ACER_ASPIRE_4930G),
8705 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8706 ALC888_ACER_ASPIRE_8930G),
8707 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8708 ALC888_ACER_ASPIRE_8930G),
8709 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8710 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8711 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8712 ALC888_ACER_ASPIRE_6530G),
8713 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8714 ALC888_ACER_ASPIRE_6530G),
8715 /* default Acer -- disabled as it causes more problems.
8716 * model=auto should work fine now
8718 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8720 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8722 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8723 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8724 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8725 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8726 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8727 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8729 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8730 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8731 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8732 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8733 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8734 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8735 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8736 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8737 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8738 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8739 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8741 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8742 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8743 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8744 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8745 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8746 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8747 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8748 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8749 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8751 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8752 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8753 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8754 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8755 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8756 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8757 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8758 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8759 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8760 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8761 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8762 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8763 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8764 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8765 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8766 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8767 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8768 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8769 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8770 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8771 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8772 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8773 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8774 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8775 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8776 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8777 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8778 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8779 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8781 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8782 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8783 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8784 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8785 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8786 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8787 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8788 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8789 ALC883_FUJITSU_PI2515),
8790 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8791 ALC888_FUJITSU_XA3530),
8792 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8793 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8794 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8795 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8796 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8797 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8798 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8799 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8800 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8802 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8803 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8804 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8805 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8806 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8807 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8808 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8813 /* codec SSID table for Intel Mac */
8814 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8815 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8816 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8817 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8818 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8819 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8820 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8821 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8822 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8823 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8824 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8825 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8826 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8827 * no perfect solution yet
8829 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8833 static struct alc_config_preset alc882_presets[] = {
8834 [ALC882_3ST_DIG] = {
8835 .mixers = { alc882_base_mixer },
8836 .init_verbs = { alc882_base_init_verbs,
8837 alc882_adc1_init_verbs },
8838 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8839 .dac_nids = alc882_dac_nids,
8840 .dig_out_nid = ALC882_DIGOUT_NID,
8841 .dig_in_nid = ALC882_DIGIN_NID,
8842 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8843 .channel_mode = alc882_ch_modes,
8845 .input_mux = &alc882_capture_source,
8847 [ALC882_6ST_DIG] = {
8848 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8849 .init_verbs = { alc882_base_init_verbs,
8850 alc882_adc1_init_verbs },
8851 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8852 .dac_nids = alc882_dac_nids,
8853 .dig_out_nid = ALC882_DIGOUT_NID,
8854 .dig_in_nid = ALC882_DIGIN_NID,
8855 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8856 .channel_mode = alc882_sixstack_modes,
8857 .input_mux = &alc882_capture_source,
8860 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8861 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8862 alc882_eapd_verbs },
8863 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8864 .dac_nids = alc882_dac_nids,
8865 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8866 .channel_mode = alc882_sixstack_modes,
8867 .input_mux = &alc882_capture_source,
8870 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8871 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8872 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8873 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8874 .dac_nids = alc882_dac_nids,
8875 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8876 .channel_mode = alc880_threestack_modes,
8878 .input_mux = &alc882_capture_source,
8879 .dig_out_nid = ALC882_DIGOUT_NID,
8882 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8883 .init_verbs = { alc885_mbp3_init_verbs,
8884 alc880_gpio1_init_verbs },
8885 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8886 .dac_nids = alc882_dac_nids,
8887 .channel_mode = alc885_mbp_6ch_modes,
8888 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
8889 .input_mux = &alc882_capture_source,
8890 .dig_out_nid = ALC882_DIGOUT_NID,
8891 .dig_in_nid = ALC882_DIGIN_NID,
8892 .unsol_event = alc_automute_amp_unsol_event,
8893 .init_hook = alc885_mbp3_init_hook,
8896 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8897 .init_verbs = { alc885_mb5_init_verbs,
8898 alc880_gpio1_init_verbs },
8899 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8900 .dac_nids = alc882_dac_nids,
8901 .channel_mode = alc885_mb5_6ch_modes,
8902 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8903 .input_mux = &mb5_capture_source,
8904 .dig_out_nid = ALC882_DIGOUT_NID,
8905 .dig_in_nid = ALC882_DIGIN_NID,
8908 .mixers = { alc882_macpro_mixer },
8909 .init_verbs = { alc882_macpro_init_verbs },
8910 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8911 .dac_nids = alc882_dac_nids,
8912 .dig_out_nid = ALC882_DIGOUT_NID,
8913 .dig_in_nid = ALC882_DIGIN_NID,
8914 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8915 .channel_mode = alc882_ch_modes,
8916 .input_mux = &alc882_capture_source,
8917 .init_hook = alc885_macpro_init_hook,
8920 .mixers = { alc885_imac24_mixer },
8921 .init_verbs = { alc885_imac24_init_verbs },
8922 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8923 .dac_nids = alc882_dac_nids,
8924 .dig_out_nid = ALC882_DIGOUT_NID,
8925 .dig_in_nid = ALC882_DIGIN_NID,
8926 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8927 .channel_mode = alc882_ch_modes,
8928 .input_mux = &alc882_capture_source,
8929 .unsol_event = alc_automute_amp_unsol_event,
8930 .init_hook = alc885_imac24_init_hook,
8933 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
8934 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8935 alc880_gpio3_init_verbs, alc882_targa_verbs},
8936 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8937 .dac_nids = alc882_dac_nids,
8938 .dig_out_nid = ALC882_DIGOUT_NID,
8939 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8940 .adc_nids = alc882_adc_nids,
8941 .capsrc_nids = alc882_capsrc_nids,
8942 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8943 .channel_mode = alc882_3ST_6ch_modes,
8945 .input_mux = &alc882_capture_source,
8946 .unsol_event = alc882_targa_unsol_event,
8947 .init_hook = alc882_targa_init_hook,
8949 [ALC882_ASUS_A7J] = {
8950 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
8951 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8952 alc882_asus_a7j_verbs},
8953 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8954 .dac_nids = alc882_dac_nids,
8955 .dig_out_nid = ALC882_DIGOUT_NID,
8956 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8957 .adc_nids = alc882_adc_nids,
8958 .capsrc_nids = alc882_capsrc_nids,
8959 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8960 .channel_mode = alc882_3ST_6ch_modes,
8962 .input_mux = &alc882_capture_source,
8964 [ALC882_ASUS_A7M] = {
8965 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
8966 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8967 alc882_eapd_verbs, alc880_gpio1_init_verbs,
8968 alc882_asus_a7m_verbs },
8969 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8970 .dac_nids = alc882_dac_nids,
8971 .dig_out_nid = ALC882_DIGOUT_NID,
8972 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8973 .channel_mode = alc880_threestack_modes,
8975 .input_mux = &alc882_capture_source,
8977 [ALC883_3ST_2ch_DIG] = {
8978 .mixers = { alc883_3ST_2ch_mixer },
8979 .init_verbs = { alc883_init_verbs },
8980 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8981 .dac_nids = alc883_dac_nids,
8982 .dig_out_nid = ALC883_DIGOUT_NID,
8983 .dig_in_nid = ALC883_DIGIN_NID,
8984 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8985 .channel_mode = alc883_3ST_2ch_modes,
8986 .input_mux = &alc883_capture_source,
8988 [ALC883_3ST_6ch_DIG] = {
8989 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8990 .init_verbs = { alc883_init_verbs },
8991 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8992 .dac_nids = alc883_dac_nids,
8993 .dig_out_nid = ALC883_DIGOUT_NID,
8994 .dig_in_nid = ALC883_DIGIN_NID,
8995 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8996 .channel_mode = alc883_3ST_6ch_modes,
8998 .input_mux = &alc883_capture_source,
9000 [ALC883_3ST_6ch] = {
9001 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9002 .init_verbs = { alc883_init_verbs },
9003 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9004 .dac_nids = alc883_dac_nids,
9005 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9006 .channel_mode = alc883_3ST_6ch_modes,
9008 .input_mux = &alc883_capture_source,
9010 [ALC883_3ST_6ch_INTEL] = {
9011 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9012 .init_verbs = { alc883_init_verbs },
9013 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9014 .dac_nids = alc883_dac_nids,
9015 .dig_out_nid = ALC883_DIGOUT_NID,
9016 .dig_in_nid = ALC883_DIGIN_NID,
9017 .slave_dig_outs = alc883_slave_dig_outs,
9018 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9019 .channel_mode = alc883_3ST_6ch_intel_modes,
9021 .input_mux = &alc883_3stack_6ch_intel,
9024 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9025 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9026 alc_hp15_unsol_verbs },
9027 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9028 .dac_nids = alc883_dac_nids,
9029 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9030 .adc_nids = alc889_adc_nids,
9031 .dig_out_nid = ALC883_DIGOUT_NID,
9032 .dig_in_nid = ALC883_DIGIN_NID,
9033 .slave_dig_outs = alc883_slave_dig_outs,
9034 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9035 .channel_mode = alc889_8ch_intel_modes,
9036 .capsrc_nids = alc889_capsrc_nids,
9037 .input_mux = &alc889_capture_source,
9038 .init_hook = alc889_automute_init,
9039 .unsol_event = alc_automute_amp_unsol_event,
9043 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9044 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9045 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9046 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9047 .dac_nids = alc883_dac_nids,
9048 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9049 .adc_nids = alc889_adc_nids,
9050 .dig_out_nid = ALC883_DIGOUT_NID,
9051 .dig_in_nid = ALC883_DIGIN_NID,
9052 .slave_dig_outs = alc883_slave_dig_outs,
9053 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9054 .channel_mode = alc889_8ch_intel_modes,
9055 .capsrc_nids = alc889_capsrc_nids,
9056 .input_mux = &alc889_capture_source,
9057 .init_hook = alc889_intel_init_hook,
9058 .unsol_event = alc_automute_amp_unsol_event,
9061 [ALC883_6ST_DIG] = {
9062 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9063 .init_verbs = { alc883_init_verbs },
9064 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9065 .dac_nids = alc883_dac_nids,
9066 .dig_out_nid = ALC883_DIGOUT_NID,
9067 .dig_in_nid = ALC883_DIGIN_NID,
9068 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9069 .channel_mode = alc883_sixstack_modes,
9070 .input_mux = &alc883_capture_source,
9072 [ALC883_TARGA_DIG] = {
9073 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9074 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9075 alc883_targa_verbs},
9076 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9077 .dac_nids = alc883_dac_nids,
9078 .dig_out_nid = ALC883_DIGOUT_NID,
9079 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9080 .channel_mode = alc883_3ST_6ch_modes,
9082 .input_mux = &alc883_capture_source,
9083 .unsol_event = alc883_targa_unsol_event,
9084 .init_hook = alc883_targa_init_hook,
9086 [ALC883_TARGA_2ch_DIG] = {
9087 .mixers = { alc883_targa_2ch_mixer},
9088 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9089 alc883_targa_verbs},
9090 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9091 .dac_nids = alc883_dac_nids,
9092 .adc_nids = alc883_adc_nids_alt,
9093 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9094 .dig_out_nid = ALC883_DIGOUT_NID,
9095 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9096 .channel_mode = alc883_3ST_2ch_modes,
9097 .input_mux = &alc883_capture_source,
9098 .unsol_event = alc883_targa_unsol_event,
9099 .init_hook = alc883_targa_init_hook,
9101 [ALC883_TARGA_8ch_DIG] = {
9102 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9103 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9104 alc883_targa_verbs },
9105 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9106 .dac_nids = alc883_dac_nids,
9107 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9108 .adc_nids = alc883_adc_nids_rev,
9109 .capsrc_nids = alc883_capsrc_nids_rev,
9110 .dig_out_nid = ALC883_DIGOUT_NID,
9111 .dig_in_nid = ALC883_DIGIN_NID,
9112 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9113 .channel_mode = alc883_4ST_8ch_modes,
9115 .input_mux = &alc883_capture_source,
9116 .unsol_event = alc883_targa_unsol_event,
9117 .init_hook = alc883_targa_init_hook,
9120 .mixers = { alc883_base_mixer },
9121 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9122 * and the headphone jack. Turn this on and rely on the
9123 * standard mute methods whenever the user wants to turn
9124 * these outputs off.
9126 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9127 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9128 .dac_nids = alc883_dac_nids,
9129 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9130 .channel_mode = alc883_3ST_2ch_modes,
9131 .input_mux = &alc883_capture_source,
9133 [ALC883_ACER_ASPIRE] = {
9134 .mixers = { alc883_acer_aspire_mixer },
9135 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9136 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9137 .dac_nids = alc883_dac_nids,
9138 .dig_out_nid = ALC883_DIGOUT_NID,
9139 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9140 .channel_mode = alc883_3ST_2ch_modes,
9141 .input_mux = &alc883_capture_source,
9142 .unsol_event = alc_automute_amp_unsol_event,
9143 .init_hook = alc883_acer_aspire_init_hook,
9145 [ALC888_ACER_ASPIRE_4930G] = {
9146 .mixers = { alc888_base_mixer,
9147 alc883_chmode_mixer },
9148 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9149 alc888_acer_aspire_4930g_verbs },
9150 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9151 .dac_nids = alc883_dac_nids,
9152 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9153 .adc_nids = alc883_adc_nids_rev,
9154 .capsrc_nids = alc883_capsrc_nids_rev,
9155 .dig_out_nid = ALC883_DIGOUT_NID,
9156 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9157 .channel_mode = alc883_3ST_6ch_modes,
9160 ARRAY_SIZE(alc888_2_capture_sources),
9161 .input_mux = alc888_2_capture_sources,
9162 .unsol_event = alc_automute_amp_unsol_event,
9163 .init_hook = alc888_acer_aspire_4930g_init_hook,
9165 [ALC888_ACER_ASPIRE_6530G] = {
9166 .mixers = { alc888_acer_aspire_6530_mixer },
9167 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9168 alc888_acer_aspire_6530g_verbs },
9169 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9170 .dac_nids = alc883_dac_nids,
9171 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9172 .adc_nids = alc883_adc_nids_rev,
9173 .capsrc_nids = alc883_capsrc_nids_rev,
9174 .dig_out_nid = ALC883_DIGOUT_NID,
9175 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9176 .channel_mode = alc883_3ST_2ch_modes,
9178 ARRAY_SIZE(alc888_2_capture_sources),
9179 .input_mux = alc888_acer_aspire_6530_sources,
9180 .unsol_event = alc_automute_amp_unsol_event,
9181 .init_hook = alc888_acer_aspire_6530g_init_hook,
9183 [ALC888_ACER_ASPIRE_8930G] = {
9184 .mixers = { alc888_base_mixer,
9185 alc883_chmode_mixer },
9186 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9187 alc889_acer_aspire_8930g_verbs },
9188 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9189 .dac_nids = alc883_dac_nids,
9190 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9191 .adc_nids = alc889_adc_nids,
9192 .capsrc_nids = alc889_capsrc_nids,
9193 .dig_out_nid = ALC883_DIGOUT_NID,
9194 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9195 .channel_mode = alc883_3ST_6ch_modes,
9197 .const_channel_count = 6,
9199 ARRAY_SIZE(alc889_capture_sources),
9200 .input_mux = alc889_capture_sources,
9201 .unsol_event = alc_automute_amp_unsol_event,
9202 .init_hook = alc889_acer_aspire_8930g_init_hook,
9205 .mixers = { alc883_fivestack_mixer,
9206 alc883_chmode_mixer },
9207 .init_verbs = { alc883_init_verbs,
9208 alc883_medion_eapd_verbs },
9209 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9210 .dac_nids = alc883_dac_nids,
9211 .adc_nids = alc883_adc_nids_alt,
9212 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9213 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9214 .channel_mode = alc883_sixstack_modes,
9215 .input_mux = &alc883_capture_source,
9217 [ALC883_MEDION_MD2] = {
9218 .mixers = { alc883_medion_md2_mixer},
9219 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9220 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9221 .dac_nids = alc883_dac_nids,
9222 .dig_out_nid = ALC883_DIGOUT_NID,
9223 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9224 .channel_mode = alc883_3ST_2ch_modes,
9225 .input_mux = &alc883_capture_source,
9226 .unsol_event = alc_automute_amp_unsol_event,
9227 .init_hook = alc883_medion_md2_init_hook,
9229 [ALC883_LAPTOP_EAPD] = {
9230 .mixers = { alc883_base_mixer },
9231 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9232 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9233 .dac_nids = alc883_dac_nids,
9234 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9235 .channel_mode = alc883_3ST_2ch_modes,
9236 .input_mux = &alc883_capture_source,
9238 [ALC883_CLEVO_M720] = {
9239 .mixers = { alc883_clevo_m720_mixer },
9240 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9241 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9242 .dac_nids = alc883_dac_nids,
9243 .dig_out_nid = ALC883_DIGOUT_NID,
9244 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9245 .channel_mode = alc883_3ST_2ch_modes,
9246 .input_mux = &alc883_capture_source,
9247 .unsol_event = alc883_clevo_m720_unsol_event,
9248 .init_hook = alc883_clevo_m720_init_hook,
9250 [ALC883_LENOVO_101E_2ch] = {
9251 .mixers = { alc883_lenovo_101e_2ch_mixer},
9252 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9253 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9254 .dac_nids = alc883_dac_nids,
9255 .adc_nids = alc883_adc_nids_alt,
9256 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9257 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9258 .channel_mode = alc883_3ST_2ch_modes,
9259 .input_mux = &alc883_lenovo_101e_capture_source,
9260 .unsol_event = alc883_lenovo_101e_unsol_event,
9261 .init_hook = alc883_lenovo_101e_all_automute,
9263 [ALC883_LENOVO_NB0763] = {
9264 .mixers = { alc883_lenovo_nb0763_mixer },
9265 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9266 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9267 .dac_nids = alc883_dac_nids,
9268 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9269 .channel_mode = alc883_3ST_2ch_modes,
9271 .input_mux = &alc883_lenovo_nb0763_capture_source,
9272 .unsol_event = alc_automute_amp_unsol_event,
9273 .init_hook = alc883_medion_md2_init_hook,
9275 [ALC888_LENOVO_MS7195_DIG] = {
9276 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9277 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9278 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9279 .dac_nids = alc883_dac_nids,
9280 .dig_out_nid = ALC883_DIGOUT_NID,
9281 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9282 .channel_mode = alc883_3ST_6ch_modes,
9284 .input_mux = &alc883_capture_source,
9285 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9286 .init_hook = alc888_lenovo_ms7195_front_automute,
9288 [ALC883_HAIER_W66] = {
9289 .mixers = { alc883_targa_2ch_mixer},
9290 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9291 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9292 .dac_nids = alc883_dac_nids,
9293 .dig_out_nid = ALC883_DIGOUT_NID,
9294 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9295 .channel_mode = alc883_3ST_2ch_modes,
9296 .input_mux = &alc883_capture_source,
9297 .unsol_event = alc_automute_amp_unsol_event,
9298 .init_hook = alc883_haier_w66_init_hook,
9301 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9302 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9303 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9304 .dac_nids = alc883_dac_nids,
9305 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9306 .channel_mode = alc888_3st_hp_modes,
9308 .input_mux = &alc883_capture_source,
9309 .unsol_event = alc_automute_amp_unsol_event,
9310 .init_hook = alc888_3st_hp_init_hook,
9312 [ALC888_6ST_DELL] = {
9313 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9314 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9315 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9316 .dac_nids = alc883_dac_nids,
9317 .dig_out_nid = ALC883_DIGOUT_NID,
9318 .dig_in_nid = ALC883_DIGIN_NID,
9319 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9320 .channel_mode = alc883_sixstack_modes,
9321 .input_mux = &alc883_capture_source,
9322 .unsol_event = alc_automute_amp_unsol_event,
9323 .init_hook = alc888_6st_dell_init_hook,
9326 .mixers = { alc883_mitac_mixer },
9327 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9328 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9329 .dac_nids = alc883_dac_nids,
9330 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9331 .channel_mode = alc883_3ST_2ch_modes,
9332 .input_mux = &alc883_capture_source,
9333 .unsol_event = alc_automute_amp_unsol_event,
9334 .init_hook = alc883_mitac_init_hook,
9336 [ALC883_FUJITSU_PI2515] = {
9337 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9338 .init_verbs = { alc883_init_verbs,
9339 alc883_2ch_fujitsu_pi2515_verbs},
9340 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9341 .dac_nids = alc883_dac_nids,
9342 .dig_out_nid = ALC883_DIGOUT_NID,
9343 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9344 .channel_mode = alc883_3ST_2ch_modes,
9345 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9346 .unsol_event = alc_automute_amp_unsol_event,
9347 .init_hook = alc883_2ch_fujitsu_pi2515_init_hook,
9349 [ALC888_FUJITSU_XA3530] = {
9350 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9351 .init_verbs = { alc883_init_verbs,
9352 alc888_fujitsu_xa3530_verbs },
9353 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9354 .dac_nids = alc883_dac_nids,
9355 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9356 .adc_nids = alc883_adc_nids_rev,
9357 .capsrc_nids = alc883_capsrc_nids_rev,
9358 .dig_out_nid = ALC883_DIGOUT_NID,
9359 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9360 .channel_mode = alc888_4ST_8ch_intel_modes,
9362 ARRAY_SIZE(alc888_2_capture_sources),
9363 .input_mux = alc888_2_capture_sources,
9364 .unsol_event = alc_automute_amp_unsol_event,
9365 .init_hook = alc888_fujitsu_xa3530_init_hook,
9367 [ALC888_LENOVO_SKY] = {
9368 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9369 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9370 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9371 .dac_nids = alc883_dac_nids,
9372 .dig_out_nid = ALC883_DIGOUT_NID,
9373 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9374 .channel_mode = alc883_sixstack_modes,
9376 .input_mux = &alc883_lenovo_sky_capture_source,
9377 .unsol_event = alc_automute_amp_unsol_event,
9378 .init_hook = alc888_lenovo_sky_init_hook,
9380 [ALC888_ASUS_M90V] = {
9381 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9382 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9383 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9384 .dac_nids = alc883_dac_nids,
9385 .dig_out_nid = ALC883_DIGOUT_NID,
9386 .dig_in_nid = ALC883_DIGIN_NID,
9387 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9388 .channel_mode = alc883_3ST_6ch_modes,
9390 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9391 .unsol_event = alc883_mode2_unsol_event,
9392 .init_hook = alc883_mode2_inithook,
9394 [ALC888_ASUS_EEE1601] = {
9395 .mixers = { alc883_asus_eee1601_mixer },
9396 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9397 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9398 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9399 .dac_nids = alc883_dac_nids,
9400 .dig_out_nid = ALC883_DIGOUT_NID,
9401 .dig_in_nid = ALC883_DIGIN_NID,
9402 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9403 .channel_mode = alc883_3ST_2ch_modes,
9405 .input_mux = &alc883_asus_eee1601_capture_source,
9406 .unsol_event = alc_sku_unsol_event,
9407 .init_hook = alc883_eee1601_inithook,
9409 [ALC1200_ASUS_P5Q] = {
9410 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9411 .init_verbs = { alc883_init_verbs },
9412 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9413 .dac_nids = alc883_dac_nids,
9414 .dig_out_nid = ALC1200_DIGOUT_NID,
9415 .dig_in_nid = ALC883_DIGIN_NID,
9416 .slave_dig_outs = alc1200_slave_dig_outs,
9417 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9418 .channel_mode = alc883_sixstack_modes,
9419 .input_mux = &alc883_capture_source,
9422 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9423 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9424 alc880_gpio1_init_verbs },
9425 .adc_nids = alc883_adc_nids,
9426 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9427 .dac_nids = alc883_dac_nids,
9428 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9429 .channel_mode = alc889A_mb31_6ch_modes,
9430 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9431 .input_mux = &alc889A_mb31_capture_source,
9432 .dig_out_nid = ALC883_DIGOUT_NID,
9433 .unsol_event = alc889A_mb31_unsol_event,
9434 .init_hook = alc889A_mb31_automute,
9436 [ALC883_SONY_VAIO_TT] = {
9437 .mixers = { alc883_vaiott_mixer },
9438 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9439 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9440 .dac_nids = alc883_dac_nids,
9441 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9442 .channel_mode = alc883_3ST_2ch_modes,
9443 .input_mux = &alc883_capture_source,
9444 .unsol_event = alc_automute_amp_unsol_event,
9445 .init_hook = alc883_vaiott_init_hook,
9454 PINFIX_ABIT_AW9D_MAX
9457 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9458 { 0x15, 0x01080104 }, /* side */
9459 { 0x16, 0x01011012 }, /* rear */
9460 { 0x17, 0x01016011 }, /* clfe */
9464 static const struct alc_pincfg *alc882_pin_fixes[] = {
9465 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
9468 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
9469 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9474 * BIOS auto configuration
9476 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9477 hda_nid_t nid, int pin_type,
9481 struct alc_spec *spec = codec->spec;
9484 alc_set_pin_output(codec, nid, pin_type);
9485 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9488 idx = spec->multiout.dac_nids[dac_idx] - 2;
9489 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9493 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9495 struct alc_spec *spec = codec->spec;
9498 for (i = 0; i <= HDA_SIDE; i++) {
9499 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9500 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9502 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9507 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9509 struct alc_spec *spec = codec->spec;
9512 pin = spec->autocfg.hp_pins[0];
9513 if (pin) /* connect to front */
9515 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9516 pin = spec->autocfg.speaker_pins[0];
9518 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9521 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9523 struct alc_spec *spec = codec->spec;
9526 for (i = 0; i < AUTO_PIN_LAST; i++) {
9527 hda_nid_t nid = spec->autocfg.input_pins[i];
9530 alc_set_input_pin(codec, nid, i);
9531 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9532 snd_hda_codec_write(codec, nid, 0,
9533 AC_VERB_SET_AMP_GAIN_MUTE,
9538 static void alc882_auto_init_input_src(struct hda_codec *codec)
9540 struct alc_spec *spec = codec->spec;
9543 for (c = 0; c < spec->num_adc_nids; c++) {
9544 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9545 hda_nid_t nid = spec->capsrc_nids[c];
9546 unsigned int mux_idx;
9547 const struct hda_input_mux *imux;
9548 int conns, mute, idx, item;
9550 conns = snd_hda_get_connections(codec, nid, conn_list,
9551 ARRAY_SIZE(conn_list));
9554 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9555 imux = &spec->input_mux[mux_idx];
9556 for (idx = 0; idx < conns; idx++) {
9557 /* if the current connection is the selected one,
9558 * unmute it as default - otherwise mute it
9560 mute = AMP_IN_MUTE(idx);
9561 for (item = 0; item < imux->num_items; item++) {
9562 if (imux->items[item].index == idx) {
9563 if (spec->cur_mux[c] == item)
9564 mute = AMP_IN_UNMUTE(idx);
9568 /* check if we have a selector or mixer
9569 * we could check for the widget type instead, but
9570 * just check for Amp-In presence (in case of mixer
9571 * without amp-in there is something wrong, this
9572 * function shouldn't be used or capsrc nid is wrong)
9574 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9575 snd_hda_codec_write(codec, nid, 0,
9576 AC_VERB_SET_AMP_GAIN_MUTE,
9578 else if (mute != AMP_IN_MUTE(idx))
9579 snd_hda_codec_write(codec, nid, 0,
9580 AC_VERB_SET_CONNECT_SEL,
9586 /* add mic boosts if needed */
9587 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9589 struct alc_spec *spec = codec->spec;
9593 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9594 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9595 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9597 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9601 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9602 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9603 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9605 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9612 /* almost identical with ALC880 parser... */
9613 static int alc882_parse_auto_config(struct hda_codec *codec)
9615 struct alc_spec *spec = codec->spec;
9616 struct auto_pin_cfg *autocfg = &spec->autocfg;
9619 int err = alc880_parse_auto_config(codec);
9624 return 0; /* no config found */
9626 err = alc_auto_add_mic_boost(codec);
9630 /* hack - override the init verbs */
9631 spec->init_verbs[0] = alc883_auto_init_verbs;
9632 /* if ADC 0x07 is available, initialize it, too */
9633 wcap = get_wcaps(codec, 0x07);
9634 wcap = get_wcaps_type(wcap);
9635 if (wcap == AC_WID_AUD_IN)
9636 add_verb(spec, alc882_adc1_init_verbs);
9638 /* digital-mic input pin is excluded in alc880_auto_create..()
9639 * because it's under 0x18
9641 if (autocfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9642 autocfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9643 struct hda_input_mux *imux = &spec->private_imux[0];
9644 for (i = 1; i < 3; i++)
9645 memcpy(&spec->private_imux[i],
9646 &spec->private_imux[0],
9647 sizeof(spec->private_imux[0]));
9648 imux->items[imux->num_items].label = "Int DMic";
9649 imux->items[imux->num_items].index = 0x0b;
9651 spec->num_mux_defs = 3;
9652 spec->input_mux = spec->private_imux;
9655 return 1; /* config found */
9658 /* additional initialization for auto-configuration model */
9659 static void alc882_auto_init(struct hda_codec *codec)
9661 struct alc_spec *spec = codec->spec;
9662 alc882_auto_init_multi_out(codec);
9663 alc882_auto_init_hp_out(codec);
9664 alc882_auto_init_analog_input(codec);
9665 alc882_auto_init_input_src(codec);
9666 if (spec->unsol_event)
9667 alc_inithook(codec);
9670 static int patch_alc882(struct hda_codec *codec)
9672 struct alc_spec *spec;
9673 int err, board_config;
9675 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9681 switch (codec->vendor_id) {
9686 /* ALC883 and variants */
9687 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9691 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9695 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9696 board_config = snd_hda_check_board_codec_sid_config(codec,
9697 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9699 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9700 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9702 board_config = ALC882_AUTO;
9705 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
9707 if (board_config == ALC882_AUTO) {
9708 /* automatic parse from the BIOS config */
9709 err = alc882_parse_auto_config(codec);
9715 "hda_codec: Cannot set up configuration "
9716 "from BIOS. Using base mode...\n");
9717 board_config = ALC882_3ST_DIG;
9721 err = snd_hda_attach_beep_device(codec, 0x1);
9727 if (board_config != ALC882_AUTO)
9728 setup_preset(codec, &alc882_presets[board_config]);
9730 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9731 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9732 /* FIXME: setup DAC5 */
9733 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9734 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9736 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9737 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9739 if (codec->vendor_id == 0x10ec0888)
9740 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9742 if (!spec->adc_nids && spec->input_mux) {
9744 spec->num_adc_nids = 0;
9745 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9747 hda_nid_t nid = alc882_adc_nids[i];
9748 unsigned int wcap = get_wcaps(codec, nid);
9750 wcap = get_wcaps_type(wcap);
9751 if (wcap != AC_WID_AUD_IN)
9753 spec->private_adc_nids[spec->num_adc_nids] = nid;
9754 err = snd_hda_get_connections(codec, nid, &cap, 1);
9757 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9758 spec->num_adc_nids++;
9760 spec->adc_nids = spec->private_adc_nids;
9761 spec->capsrc_nids = spec->private_capsrc_nids;
9764 set_capture_mixer(codec);
9765 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9767 spec->vmaster_nid = 0x0c;
9769 codec->patch_ops = alc_patch_ops;
9770 if (board_config == ALC882_AUTO)
9771 spec->init_hook = alc882_auto_init;
9772 #ifdef CONFIG_SND_HDA_POWER_SAVE
9773 if (!spec->loopback.amplist)
9774 spec->loopback.amplist = alc882_loopbacks;
9776 codec->proc_widget_hook = print_realtek_coef;
9786 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9787 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9789 #define alc262_dac_nids alc260_dac_nids
9790 #define alc262_adc_nids alc882_adc_nids
9791 #define alc262_adc_nids_alt alc882_adc_nids_alt
9792 #define alc262_capsrc_nids alc882_capsrc_nids
9793 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9795 #define alc262_modes alc260_modes
9796 #define alc262_capture_source alc882_capture_source
9798 static hda_nid_t alc262_dmic_adc_nids[1] = {
9803 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9805 static struct snd_kcontrol_new alc262_base_mixer[] = {
9806 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9807 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9808 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9809 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9810 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9811 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9812 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9813 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9814 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9815 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9816 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9817 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9818 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9819 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9820 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9821 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9825 /* update HP, line and mono-out pins according to the master switch */
9826 static void alc262_hp_master_update(struct hda_codec *codec)
9828 struct alc_spec *spec = codec->spec;
9829 int val = spec->master_sw;
9832 snd_hda_codec_write_cache(codec, 0x1b, 0,
9833 AC_VERB_SET_PIN_WIDGET_CONTROL,
9835 snd_hda_codec_write_cache(codec, 0x15, 0,
9836 AC_VERB_SET_PIN_WIDGET_CONTROL,
9838 /* mono (speaker) depending on the HP jack sense */
9839 val = val && !spec->jack_present;
9840 snd_hda_codec_write_cache(codec, 0x16, 0,
9841 AC_VERB_SET_PIN_WIDGET_CONTROL,
9845 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9847 struct alc_spec *spec = codec->spec;
9848 unsigned int presence;
9849 presence = snd_hda_codec_read(codec, 0x1b, 0,
9850 AC_VERB_GET_PIN_SENSE, 0);
9851 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9852 alc262_hp_master_update(codec);
9855 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9857 if ((res >> 26) != ALC880_HP_EVENT)
9859 alc262_hp_bpc_automute(codec);
9862 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9864 struct alc_spec *spec = codec->spec;
9865 unsigned int presence;
9866 presence = snd_hda_codec_read(codec, 0x15, 0,
9867 AC_VERB_GET_PIN_SENSE, 0);
9868 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9869 alc262_hp_master_update(codec);
9872 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9875 if ((res >> 26) != ALC880_HP_EVENT)
9877 alc262_hp_wildwest_automute(codec);
9880 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9882 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9883 struct snd_ctl_elem_value *ucontrol)
9885 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9886 struct alc_spec *spec = codec->spec;
9887 int val = !!*ucontrol->value.integer.value;
9889 if (val == spec->master_sw)
9891 spec->master_sw = val;
9892 alc262_hp_master_update(codec);
9896 #define ALC262_HP_MASTER_SWITCH \
9898 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9899 .name = "Master Playback Switch", \
9900 .info = snd_ctl_boolean_mono_info, \
9901 .get = alc262_hp_master_sw_get, \
9902 .put = alc262_hp_master_sw_put, \
9905 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9906 ALC262_HP_MASTER_SWITCH,
9907 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9908 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9909 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9910 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9912 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9914 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9915 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9916 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9917 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9918 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9919 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9920 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9921 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9922 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9923 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9924 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9925 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9929 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9930 ALC262_HP_MASTER_SWITCH,
9931 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9932 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9933 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9934 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9935 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9937 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9939 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9940 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9941 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9942 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9943 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9944 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9945 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9949 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9950 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9951 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9952 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9956 /* mute/unmute internal speaker according to the hp jack and mute state */
9957 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9959 struct alc_spec *spec = codec->spec;
9961 spec->autocfg.hp_pins[0] = 0x15;
9962 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9963 alc_automute_amp(codec);
9966 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9967 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9968 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9969 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9970 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9971 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9972 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9973 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9977 static struct hda_verb alc262_hp_t5735_verbs[] = {
9978 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9979 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9981 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9985 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9986 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9987 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9988 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9989 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9990 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9991 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9995 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9996 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9997 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9998 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9999 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10000 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10001 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10002 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10003 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10004 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10005 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10009 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10016 /* bind hp and internal speaker mute (with plug check) as master switch */
10017 static void alc262_hippo_master_update(struct hda_codec *codec)
10019 struct alc_spec *spec = codec->spec;
10020 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10021 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10022 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10026 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10027 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10028 HDA_AMP_MUTE, mute);
10029 /* mute internal speaker per jack sense */
10030 if (spec->jack_present)
10031 mute = HDA_AMP_MUTE;
10033 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10034 HDA_AMP_MUTE, mute);
10035 if (speaker_nid && speaker_nid != line_nid)
10036 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10037 HDA_AMP_MUTE, mute);
10040 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10042 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10043 struct snd_ctl_elem_value *ucontrol)
10045 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10046 struct alc_spec *spec = codec->spec;
10047 int val = !!*ucontrol->value.integer.value;
10049 if (val == spec->master_sw)
10051 spec->master_sw = val;
10052 alc262_hippo_master_update(codec);
10056 #define ALC262_HIPPO_MASTER_SWITCH \
10058 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10059 .name = "Master Playback Switch", \
10060 .info = snd_ctl_boolean_mono_info, \
10061 .get = alc262_hippo_master_sw_get, \
10062 .put = alc262_hippo_master_sw_put, \
10065 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10066 ALC262_HIPPO_MASTER_SWITCH,
10067 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10068 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10069 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10070 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10071 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10072 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10073 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10074 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10075 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10076 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10077 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10078 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10082 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10083 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10084 ALC262_HIPPO_MASTER_SWITCH,
10085 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10086 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10087 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10088 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10089 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10090 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10091 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10092 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10093 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10094 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10098 /* mute/unmute internal speaker according to the hp jack and mute state */
10099 static void alc262_hippo_automute(struct hda_codec *codec)
10101 struct alc_spec *spec = codec->spec;
10102 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10103 unsigned int present;
10105 /* need to execute and sync at first */
10106 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10107 present = snd_hda_codec_read(codec, hp_nid, 0,
10108 AC_VERB_GET_PIN_SENSE, 0);
10109 spec->jack_present = (present & 0x80000000) != 0;
10110 alc262_hippo_master_update(codec);
10113 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10115 if ((res >> 26) != ALC880_HP_EVENT)
10117 alc262_hippo_automute(codec);
10120 static void alc262_hippo_init_hook(struct hda_codec *codec)
10122 struct alc_spec *spec = codec->spec;
10124 spec->autocfg.hp_pins[0] = 0x15;
10125 spec->autocfg.speaker_pins[0] = 0x14;
10126 alc262_hippo_automute(codec);
10129 static void alc262_hippo1_init_hook(struct hda_codec *codec)
10131 struct alc_spec *spec = codec->spec;
10133 spec->autocfg.hp_pins[0] = 0x1b;
10134 spec->autocfg.speaker_pins[0] = 0x14;
10135 alc262_hippo_automute(codec);
10139 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10140 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10141 ALC262_HIPPO_MASTER_SWITCH,
10142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10143 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10144 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10145 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10149 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10150 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10151 ALC262_HIPPO_MASTER_SWITCH,
10152 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10153 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10154 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10155 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10156 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10160 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10161 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10162 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10163 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10164 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10165 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10166 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10168 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10169 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10170 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10171 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10172 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10176 static struct hda_verb alc262_tyan_verbs[] = {
10177 /* Headphone automute */
10178 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10179 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10180 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10182 /* P11 AUX_IN, white 4-pin connector */
10183 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10184 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10185 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10186 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10191 /* unsolicited event for HP jack sensing */
10192 static void alc262_tyan_init_hook(struct hda_codec *codec)
10194 struct alc_spec *spec = codec->spec;
10196 spec->autocfg.hp_pins[0] = 0x1b;
10197 spec->autocfg.speaker_pins[0] = 0x15;
10198 alc_automute_amp(codec);
10202 #define alc262_capture_mixer alc882_capture_mixer
10203 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10206 * generic initialization of ADC, input mixers and output mixers
10208 static struct hda_verb alc262_init_verbs[] = {
10210 * Unmute ADC0-2 and set the default input to mic-in
10212 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10213 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10214 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10215 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10216 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10217 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10219 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10221 * Note: PASD motherboards uses the Line In 2 as the input for
10222 * front panel mic (mic 2)
10224 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10225 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10226 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10227 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10228 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10229 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10232 * Set up output mixers (0x0c - 0x0e)
10234 /* set vol=0 to output mixers */
10235 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10236 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10237 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10238 /* set up input amps for analog loopback */
10239 /* Amp Indices: DAC = 0, mixer = 1 */
10240 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10241 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10242 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10243 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10244 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10245 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10247 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10248 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10249 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10250 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10251 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10252 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10254 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10255 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10256 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10257 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10258 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10260 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10261 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10263 /* FIXME: use matrix-type input source selection */
10264 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10265 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10266 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10267 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10268 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10269 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10271 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10272 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10273 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10274 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10276 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10277 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10278 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10279 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10284 static struct hda_verb alc262_eapd_verbs[] = {
10285 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10286 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10290 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10291 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10292 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10293 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10295 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10296 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10300 static struct hda_verb alc262_sony_unsol_verbs[] = {
10301 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10302 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10303 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10305 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10306 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10310 static struct hda_input_mux alc262_dmic_capture_source = {
10313 { "Int DMic", 0x9 },
10318 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10319 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10320 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10321 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10322 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10323 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10327 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10328 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10329 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10330 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10331 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10332 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10333 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10334 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10335 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10339 static void alc262_dmic_automute(struct hda_codec *codec)
10341 unsigned int present;
10343 present = snd_hda_codec_read(codec, 0x18, 0,
10344 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10345 snd_hda_codec_write(codec, 0x22, 0,
10346 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
10350 /* unsolicited event for HP jack sensing */
10351 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
10354 if ((res >> 26) == ALC880_MIC_EVENT)
10355 alc262_dmic_automute(codec);
10357 alc_sku_unsol_event(codec, res);
10360 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
10362 struct alc_spec *spec = codec->spec;
10364 spec->autocfg.hp_pins[0] = 0x15;
10365 spec->autocfg.speaker_pins[0] = 0x14;
10366 alc_automute_pin(codec);
10367 alc262_dmic_automute(codec);
10373 * 0x16 = internal speaker
10374 * 0x18 = external mic
10377 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10378 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10379 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10382 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10383 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10385 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10386 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10390 static struct hda_verb alc262_nec_verbs[] = {
10391 /* Unmute Speaker */
10392 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10395 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10396 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10398 /* External mic to headphone */
10399 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10400 /* External mic to speaker */
10401 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10407 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10408 * 0x1b = port replicator headphone out
10411 #define ALC_HP_EVENT 0x37
10413 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10414 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10415 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10416 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10417 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10421 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10422 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10423 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10427 static struct hda_input_mux alc262_fujitsu_capture_source = {
10431 { "Int Mic", 0x1 },
10436 static struct hda_input_mux alc262_HP_capture_source = {
10440 { "Front Mic", 0x1 },
10447 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10451 { "Front Mic", 0x2 },
10457 /* mute/unmute internal speaker according to the hp jacks and mute state */
10458 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10460 struct alc_spec *spec = codec->spec;
10463 if (force || !spec->sense_updated) {
10464 unsigned int present;
10465 /* need to execute and sync at first */
10466 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10467 /* check laptop HP jack */
10468 present = snd_hda_codec_read(codec, 0x14, 0,
10469 AC_VERB_GET_PIN_SENSE, 0);
10470 /* need to execute and sync at first */
10471 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10472 /* check docking HP jack */
10473 present |= snd_hda_codec_read(codec, 0x1b, 0,
10474 AC_VERB_GET_PIN_SENSE, 0);
10475 if (present & AC_PINSENSE_PRESENCE)
10476 spec->jack_present = 1;
10478 spec->jack_present = 0;
10479 spec->sense_updated = 1;
10481 /* unmute internal speaker only if both HPs are unplugged and
10482 * master switch is on
10484 if (spec->jack_present)
10485 mute = HDA_AMP_MUTE;
10487 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10488 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10489 HDA_AMP_MUTE, mute);
10492 /* unsolicited event for HP jack sensing */
10493 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10496 if ((res >> 26) != ALC_HP_EVENT)
10498 alc262_fujitsu_automute(codec, 1);
10501 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10503 alc262_fujitsu_automute(codec, 1);
10506 /* bind volumes of both NID 0x0c and 0x0d */
10507 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10508 .ops = &snd_hda_bind_vol,
10510 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10511 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10516 /* mute/unmute internal speaker according to the hp jack and mute state */
10517 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10519 struct alc_spec *spec = codec->spec;
10522 if (force || !spec->sense_updated) {
10523 unsigned int present_int_hp;
10524 /* need to execute and sync at first */
10525 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10526 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10527 AC_VERB_GET_PIN_SENSE, 0);
10528 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10529 spec->sense_updated = 1;
10531 if (spec->jack_present) {
10532 /* mute internal speaker */
10533 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10534 HDA_AMP_MUTE, HDA_AMP_MUTE);
10535 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10536 HDA_AMP_MUTE, HDA_AMP_MUTE);
10538 /* unmute internal speaker if necessary */
10539 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10540 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10541 HDA_AMP_MUTE, mute);
10542 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10543 HDA_AMP_MUTE, mute);
10547 /* unsolicited event for HP jack sensing */
10548 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10551 if ((res >> 26) != ALC_HP_EVENT)
10553 alc262_lenovo_3000_automute(codec, 1);
10556 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10557 int dir, int idx, long *valp)
10561 for (i = 0; i < 2; i++, valp++)
10562 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10564 *valp ? 0 : HDA_AMP_MUTE);
10568 /* bind hp and internal speaker mute (with plug check) */
10569 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10570 struct snd_ctl_elem_value *ucontrol)
10572 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10573 long *valp = ucontrol->value.integer.value;
10576 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10577 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10579 alc262_fujitsu_automute(codec, 0);
10583 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10584 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10586 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10587 .name = "Master Playback Switch",
10588 .info = snd_hda_mixer_amp_switch_info,
10589 .get = snd_hda_mixer_amp_switch_get,
10590 .put = alc262_fujitsu_master_sw_put,
10591 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10593 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10594 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10595 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10596 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10597 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10598 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10599 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10600 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10604 /* bind hp and internal speaker mute (with plug check) */
10605 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10606 struct snd_ctl_elem_value *ucontrol)
10608 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10609 long *valp = ucontrol->value.integer.value;
10612 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10614 alc262_lenovo_3000_automute(codec, 0);
10618 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10619 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10621 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10622 .name = "Master Playback Switch",
10623 .info = snd_hda_mixer_amp_switch_info,
10624 .get = snd_hda_mixer_amp_switch_get,
10625 .put = alc262_lenovo_3000_master_sw_put,
10626 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10628 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10629 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10630 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10631 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10632 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10633 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10634 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10635 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10639 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10640 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10641 ALC262_HIPPO_MASTER_SWITCH,
10642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10643 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10644 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10645 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10646 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10647 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10651 /* additional init verbs for Benq laptops */
10652 static struct hda_verb alc262_EAPD_verbs[] = {
10653 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10654 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10658 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10659 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10660 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10662 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10663 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10667 /* Samsung Q1 Ultra Vista model setup */
10668 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10669 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10670 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10673 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10674 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10678 static struct hda_verb alc262_ultra_verbs[] = {
10680 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10681 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10682 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10684 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10685 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10686 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10687 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10689 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10690 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10692 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10693 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10695 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10696 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10697 /* ADC, choose mic */
10698 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10699 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10700 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10701 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10702 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10703 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10704 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10705 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10706 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10707 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10711 /* mute/unmute internal speaker according to the hp jack and mute state */
10712 static void alc262_ultra_automute(struct hda_codec *codec)
10714 struct alc_spec *spec = codec->spec;
10718 /* auto-mute only when HP is used as HP */
10719 if (!spec->cur_mux[0]) {
10720 unsigned int present;
10721 /* need to execute and sync at first */
10722 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10723 present = snd_hda_codec_read(codec, 0x15, 0,
10724 AC_VERB_GET_PIN_SENSE, 0);
10725 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10726 if (spec->jack_present)
10727 mute = HDA_AMP_MUTE;
10729 /* mute/unmute internal speaker */
10730 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10731 HDA_AMP_MUTE, mute);
10732 /* mute/unmute HP */
10733 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10734 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10737 /* unsolicited event for HP jack sensing */
10738 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10741 if ((res >> 26) != ALC880_HP_EVENT)
10743 alc262_ultra_automute(codec);
10746 static struct hda_input_mux alc262_ultra_capture_source = {
10750 { "Headphone", 0x7 },
10754 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10755 struct snd_ctl_elem_value *ucontrol)
10757 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10758 struct alc_spec *spec = codec->spec;
10761 ret = alc_mux_enum_put(kcontrol, ucontrol);
10764 /* reprogram the HP pin as mic or HP according to the input source */
10765 snd_hda_codec_write_cache(codec, 0x15, 0,
10766 AC_VERB_SET_PIN_WIDGET_CONTROL,
10767 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10768 alc262_ultra_automute(codec); /* mute/unmute HP */
10772 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10773 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10774 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10776 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10777 .name = "Capture Source",
10778 .info = alc_mux_enum_info,
10779 .get = alc_mux_enum_get,
10780 .put = alc262_ultra_mux_enum_put,
10785 /* add playback controls from the parsed DAC table */
10786 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10787 const struct auto_pin_cfg *cfg)
10792 spec->multiout.num_dacs = 1; /* only use one dac */
10793 spec->multiout.dac_nids = spec->private_dac_nids;
10794 spec->multiout.dac_nids[0] = 2;
10796 nid = cfg->line_out_pins[0];
10798 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10799 "Front Playback Volume",
10800 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10803 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10804 "Front Playback Switch",
10805 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10810 nid = cfg->speaker_pins[0];
10813 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10814 "Speaker Playback Volume",
10815 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10819 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10820 "Speaker Playback Switch",
10821 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10826 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10827 "Speaker Playback Switch",
10828 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10834 nid = cfg->hp_pins[0];
10836 /* spec->multiout.hp_nid = 2; */
10838 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10839 "Headphone Playback Volume",
10840 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10844 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10845 "Headphone Playback Switch",
10846 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10851 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10852 "Headphone Playback Switch",
10853 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10862 static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec,
10863 const struct auto_pin_cfg *cfg)
10867 err = alc880_auto_create_analog_input_ctls(spec, cfg);
10870 /* digital-mic input pin is excluded in alc880_auto_create..()
10871 * because it's under 0x18
10873 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
10874 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
10875 struct hda_input_mux *imux = &spec->private_imux[0];
10876 imux->items[imux->num_items].label = "Int Mic";
10877 imux->items[imux->num_items].index = 0x09;
10885 * generic initialization of ADC, input mixers and output mixers
10887 static struct hda_verb alc262_volume_init_verbs[] = {
10889 * Unmute ADC0-2 and set the default input to mic-in
10891 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10892 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10893 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10894 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10895 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10896 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10898 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10900 * Note: PASD motherboards uses the Line In 2 as the input for
10901 * front panel mic (mic 2)
10903 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10904 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10905 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10906 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10907 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10908 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10911 * Set up output mixers (0x0c - 0x0f)
10913 /* set vol=0 to output mixers */
10914 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10915 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10916 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10918 /* set up input amps for analog loopback */
10919 /* Amp Indices: DAC = 0, mixer = 1 */
10920 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10921 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10922 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10923 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10924 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10925 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10927 /* FIXME: use matrix-type input source selection */
10928 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10929 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10930 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10931 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10932 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10933 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10935 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10936 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10937 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10938 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10940 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10941 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10942 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10943 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10948 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10950 * Unmute ADC0-2 and set the default input to mic-in
10952 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10953 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10954 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10955 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10956 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10957 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10959 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10961 * Note: PASD motherboards uses the Line In 2 as the input for
10962 * front panel mic (mic 2)
10964 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10965 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10966 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10967 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10968 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10969 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10970 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10971 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10974 * Set up output mixers (0x0c - 0x0e)
10976 /* set vol=0 to output mixers */
10977 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10978 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10979 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10981 /* set up input amps for analog loopback */
10982 /* Amp Indices: DAC = 0, mixer = 1 */
10983 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10984 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10985 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10986 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10987 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10988 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10990 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10991 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10992 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10994 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10997 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10998 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11000 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11001 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11002 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11003 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11004 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11006 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11007 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11008 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11009 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11010 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11011 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11014 /* FIXME: use matrix-type input source selection */
11015 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11016 /* Input mixer1: only unmute Mic */
11017 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11018 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11019 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11020 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11021 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11022 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11023 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11024 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11025 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11027 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11028 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11029 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11030 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11031 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11032 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11035 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11041 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11042 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11043 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11044 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11045 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11047 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11052 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11054 * Unmute ADC0-2 and set the default input to mic-in
11056 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11057 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11058 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11059 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11060 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11061 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11063 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11065 * Note: PASD motherboards uses the Line In 2 as the input for front
11066 * panel mic (mic 2)
11068 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11069 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11070 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11071 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11072 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11073 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11074 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11075 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11076 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11078 * Set up output mixers (0x0c - 0x0e)
11080 /* set vol=0 to output mixers */
11081 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11082 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11083 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11085 /* set up input amps for analog loopback */
11086 /* Amp Indices: DAC = 0, mixer = 1 */
11087 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11088 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11089 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11090 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11091 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11092 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11095 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11096 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11097 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11098 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11099 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11100 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11101 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11103 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11104 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11106 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11107 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11109 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11110 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11111 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11112 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11113 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11114 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11116 /* FIXME: use matrix-type input source selection */
11117 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11118 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11119 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11120 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11121 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11122 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11123 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11124 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11125 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11127 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11128 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11129 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11130 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11131 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11132 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11133 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11135 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11136 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11137 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11138 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11139 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11140 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11141 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11143 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11148 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11150 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11151 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11152 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11154 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11155 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11156 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11157 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11159 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11160 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11161 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11166 #ifdef CONFIG_SND_HDA_POWER_SAVE
11167 #define alc262_loopbacks alc880_loopbacks
11170 /* pcm configuration: identical with ALC880 */
11171 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11172 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11173 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11174 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11177 * BIOS auto configuration
11179 static int alc262_parse_auto_config(struct hda_codec *codec)
11181 struct alc_spec *spec = codec->spec;
11183 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11185 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11189 if (!spec->autocfg.line_outs) {
11190 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11191 spec->multiout.max_channels = 2;
11192 spec->no_analog = 1;
11195 return 0; /* can't find valid BIOS pin config */
11197 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11200 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
11204 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11207 if (spec->autocfg.dig_outs) {
11208 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11209 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11211 if (spec->autocfg.dig_in_pin)
11212 spec->dig_in_nid = ALC262_DIGIN_NID;
11214 if (spec->kctls.list)
11215 add_mixer(spec, spec->kctls.list);
11217 add_verb(spec, alc262_volume_init_verbs);
11218 spec->num_mux_defs = 1;
11219 spec->input_mux = &spec->private_imux[0];
11221 err = alc_auto_add_mic_boost(codec);
11225 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11230 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11231 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11232 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11233 #define alc262_auto_init_input_src alc882_auto_init_input_src
11236 /* init callback for auto-configuration model -- overriding the default init */
11237 static void alc262_auto_init(struct hda_codec *codec)
11239 struct alc_spec *spec = codec->spec;
11240 alc262_auto_init_multi_out(codec);
11241 alc262_auto_init_hp_out(codec);
11242 alc262_auto_init_analog_input(codec);
11243 alc262_auto_init_input_src(codec);
11244 if (spec->unsol_event)
11245 alc_inithook(codec);
11249 * configuration and preset
11251 static const char *alc262_models[ALC262_MODEL_LAST] = {
11252 [ALC262_BASIC] = "basic",
11253 [ALC262_HIPPO] = "hippo",
11254 [ALC262_HIPPO_1] = "hippo_1",
11255 [ALC262_FUJITSU] = "fujitsu",
11256 [ALC262_HP_BPC] = "hp-bpc",
11257 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11258 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11259 [ALC262_HP_RP5700] = "hp-rp5700",
11260 [ALC262_BENQ_ED8] = "benq",
11261 [ALC262_BENQ_T31] = "benq-t31",
11262 [ALC262_SONY_ASSAMD] = "sony-assamd",
11263 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11264 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11265 [ALC262_ULTRA] = "ultra",
11266 [ALC262_LENOVO_3000] = "lenovo-3000",
11267 [ALC262_NEC] = "nec",
11268 [ALC262_TYAN] = "tyan",
11269 [ALC262_AUTO] = "auto",
11272 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11273 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11274 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11275 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11277 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11279 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11281 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11282 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11283 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11284 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11285 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11286 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11287 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11288 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11289 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11290 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11291 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11292 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11293 ALC262_HP_TC_T5735),
11294 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11295 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11296 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11297 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11298 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11299 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11300 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11301 ALC262_SONY_ASSAMD),
11302 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11303 ALC262_TOSHIBA_RX1),
11304 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11305 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11306 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11307 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11308 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11310 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11311 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11312 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11313 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11314 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11318 static struct alc_config_preset alc262_presets[] = {
11320 .mixers = { alc262_base_mixer },
11321 .init_verbs = { alc262_init_verbs },
11322 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11323 .dac_nids = alc262_dac_nids,
11325 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11326 .channel_mode = alc262_modes,
11327 .input_mux = &alc262_capture_source,
11330 .mixers = { alc262_hippo_mixer },
11331 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11332 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11333 .dac_nids = alc262_dac_nids,
11335 .dig_out_nid = ALC262_DIGOUT_NID,
11336 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11337 .channel_mode = alc262_modes,
11338 .input_mux = &alc262_capture_source,
11339 .unsol_event = alc262_hippo_unsol_event,
11340 .init_hook = alc262_hippo_init_hook,
11342 [ALC262_HIPPO_1] = {
11343 .mixers = { alc262_hippo1_mixer },
11344 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11345 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11346 .dac_nids = alc262_dac_nids,
11348 .dig_out_nid = ALC262_DIGOUT_NID,
11349 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11350 .channel_mode = alc262_modes,
11351 .input_mux = &alc262_capture_source,
11352 .unsol_event = alc262_hippo_unsol_event,
11353 .init_hook = alc262_hippo1_init_hook,
11355 [ALC262_FUJITSU] = {
11356 .mixers = { alc262_fujitsu_mixer },
11357 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11358 alc262_fujitsu_unsol_verbs },
11359 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11360 .dac_nids = alc262_dac_nids,
11362 .dig_out_nid = ALC262_DIGOUT_NID,
11363 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11364 .channel_mode = alc262_modes,
11365 .input_mux = &alc262_fujitsu_capture_source,
11366 .unsol_event = alc262_fujitsu_unsol_event,
11367 .init_hook = alc262_fujitsu_init_hook,
11369 [ALC262_HP_BPC] = {
11370 .mixers = { alc262_HP_BPC_mixer },
11371 .init_verbs = { alc262_HP_BPC_init_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_HP_capture_source,
11378 .unsol_event = alc262_hp_bpc_unsol_event,
11379 .init_hook = alc262_hp_bpc_automute,
11381 [ALC262_HP_BPC_D7000_WF] = {
11382 .mixers = { alc262_HP_BPC_WildWest_mixer },
11383 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11384 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11385 .dac_nids = alc262_dac_nids,
11387 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11388 .channel_mode = alc262_modes,
11389 .input_mux = &alc262_HP_D7000_capture_source,
11390 .unsol_event = alc262_hp_wildwest_unsol_event,
11391 .init_hook = alc262_hp_wildwest_automute,
11393 [ALC262_HP_BPC_D7000_WL] = {
11394 .mixers = { alc262_HP_BPC_WildWest_mixer,
11395 alc262_HP_BPC_WildWest_option_mixer },
11396 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11397 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11398 .dac_nids = alc262_dac_nids,
11400 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11401 .channel_mode = alc262_modes,
11402 .input_mux = &alc262_HP_D7000_capture_source,
11403 .unsol_event = alc262_hp_wildwest_unsol_event,
11404 .init_hook = alc262_hp_wildwest_automute,
11406 [ALC262_HP_TC_T5735] = {
11407 .mixers = { alc262_hp_t5735_mixer },
11408 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11409 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11410 .dac_nids = alc262_dac_nids,
11412 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11413 .channel_mode = alc262_modes,
11414 .input_mux = &alc262_capture_source,
11415 .unsol_event = alc_automute_amp_unsol_event,
11416 .init_hook = alc262_hp_t5735_init_hook,
11418 [ALC262_HP_RP5700] = {
11419 .mixers = { alc262_hp_rp5700_mixer },
11420 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11421 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11422 .dac_nids = alc262_dac_nids,
11423 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11424 .channel_mode = alc262_modes,
11425 .input_mux = &alc262_hp_rp5700_capture_source,
11427 [ALC262_BENQ_ED8] = {
11428 .mixers = { alc262_base_mixer },
11429 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11430 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11431 .dac_nids = alc262_dac_nids,
11433 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11434 .channel_mode = alc262_modes,
11435 .input_mux = &alc262_capture_source,
11437 [ALC262_SONY_ASSAMD] = {
11438 .mixers = { alc262_sony_mixer },
11439 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11440 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11441 .dac_nids = alc262_dac_nids,
11443 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11444 .channel_mode = alc262_modes,
11445 .input_mux = &alc262_capture_source,
11446 .unsol_event = alc262_hippo_unsol_event,
11447 .init_hook = alc262_hippo_init_hook,
11449 [ALC262_BENQ_T31] = {
11450 .mixers = { alc262_benq_t31_mixer },
11451 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11452 alc_hp15_unsol_verbs },
11453 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11454 .dac_nids = alc262_dac_nids,
11456 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11457 .channel_mode = alc262_modes,
11458 .input_mux = &alc262_capture_source,
11459 .unsol_event = alc262_hippo_unsol_event,
11460 .init_hook = alc262_hippo_init_hook,
11463 .mixers = { alc262_ultra_mixer },
11464 .cap_mixer = alc262_ultra_capture_mixer,
11465 .init_verbs = { alc262_ultra_verbs },
11466 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11467 .dac_nids = alc262_dac_nids,
11468 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11469 .channel_mode = alc262_modes,
11470 .input_mux = &alc262_ultra_capture_source,
11471 .adc_nids = alc262_adc_nids, /* ADC0 */
11472 .capsrc_nids = alc262_capsrc_nids,
11473 .num_adc_nids = 1, /* single ADC */
11474 .unsol_event = alc262_ultra_unsol_event,
11475 .init_hook = alc262_ultra_automute,
11477 [ALC262_LENOVO_3000] = {
11478 .mixers = { alc262_lenovo_3000_mixer },
11479 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11480 alc262_lenovo_3000_unsol_verbs },
11481 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11482 .dac_nids = alc262_dac_nids,
11484 .dig_out_nid = ALC262_DIGOUT_NID,
11485 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11486 .channel_mode = alc262_modes,
11487 .input_mux = &alc262_fujitsu_capture_source,
11488 .unsol_event = alc262_lenovo_3000_unsol_event,
11491 .mixers = { alc262_nec_mixer },
11492 .init_verbs = { alc262_nec_verbs },
11493 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11494 .dac_nids = alc262_dac_nids,
11496 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11497 .channel_mode = alc262_modes,
11498 .input_mux = &alc262_capture_source,
11500 [ALC262_TOSHIBA_S06] = {
11501 .mixers = { alc262_toshiba_s06_mixer },
11502 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11503 alc262_eapd_verbs },
11504 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11505 .capsrc_nids = alc262_dmic_capsrc_nids,
11506 .dac_nids = alc262_dac_nids,
11507 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11508 .num_adc_nids = 1, /* single ADC */
11509 .dig_out_nid = ALC262_DIGOUT_NID,
11510 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11511 .channel_mode = alc262_modes,
11512 .input_mux = &alc262_dmic_capture_source,
11513 .unsol_event = alc262_toshiba_s06_unsol_event,
11514 .init_hook = alc262_toshiba_s06_init_hook,
11516 [ALC262_TOSHIBA_RX1] = {
11517 .mixers = { alc262_toshiba_rx1_mixer },
11518 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11519 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11520 .dac_nids = alc262_dac_nids,
11522 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11523 .channel_mode = alc262_modes,
11524 .input_mux = &alc262_capture_source,
11525 .unsol_event = alc262_hippo_unsol_event,
11526 .init_hook = alc262_hippo_init_hook,
11529 .mixers = { alc262_tyan_mixer },
11530 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11531 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11532 .dac_nids = alc262_dac_nids,
11534 .dig_out_nid = ALC262_DIGOUT_NID,
11535 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11536 .channel_mode = alc262_modes,
11537 .input_mux = &alc262_capture_source,
11538 .unsol_event = alc_automute_amp_unsol_event,
11539 .init_hook = alc262_tyan_init_hook,
11543 static int patch_alc262(struct hda_codec *codec)
11545 struct alc_spec *spec;
11549 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11553 codec->spec = spec;
11555 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11560 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11561 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11562 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11563 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11567 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11569 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11573 if (board_config < 0) {
11574 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11576 board_config = ALC262_AUTO;
11579 if (board_config == ALC262_AUTO) {
11580 /* automatic parse from the BIOS config */
11581 err = alc262_parse_auto_config(codec);
11587 "hda_codec: Cannot set up configuration "
11588 "from BIOS. Using base mode...\n");
11589 board_config = ALC262_BASIC;
11593 if (!spec->no_analog) {
11594 err = snd_hda_attach_beep_device(codec, 0x1);
11601 if (board_config != ALC262_AUTO)
11602 setup_preset(codec, &alc262_presets[board_config]);
11604 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11605 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11607 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11608 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11610 if (!spec->adc_nids && spec->input_mux) {
11612 /* check whether the digital-mic has to be supported */
11613 for (i = 0; i < spec->input_mux->num_items; i++) {
11614 if (spec->input_mux->items[i].index >= 9)
11617 if (i < spec->input_mux->num_items) {
11618 /* use only ADC0 */
11619 spec->adc_nids = alc262_dmic_adc_nids;
11620 spec->num_adc_nids = 1;
11621 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11623 /* all analog inputs */
11624 /* check whether NID 0x07 is valid */
11625 unsigned int wcap = get_wcaps(codec, 0x07);
11628 wcap = get_wcaps_type(wcap);
11629 if (wcap != AC_WID_AUD_IN) {
11630 spec->adc_nids = alc262_adc_nids_alt;
11631 spec->num_adc_nids =
11632 ARRAY_SIZE(alc262_adc_nids_alt);
11633 spec->capsrc_nids = alc262_capsrc_nids_alt;
11635 spec->adc_nids = alc262_adc_nids;
11636 spec->num_adc_nids =
11637 ARRAY_SIZE(alc262_adc_nids);
11638 spec->capsrc_nids = alc262_capsrc_nids;
11642 if (!spec->cap_mixer && !spec->no_analog)
11643 set_capture_mixer(codec);
11644 if (!spec->no_analog)
11645 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11647 spec->vmaster_nid = 0x0c;
11649 codec->patch_ops = alc_patch_ops;
11650 if (board_config == ALC262_AUTO)
11651 spec->init_hook = alc262_auto_init;
11652 #ifdef CONFIG_SND_HDA_POWER_SAVE
11653 if (!spec->loopback.amplist)
11654 spec->loopback.amplist = alc262_loopbacks;
11656 codec->proc_widget_hook = print_realtek_coef;
11662 * ALC268 channel source setting (2 channel)
11664 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11665 #define alc268_modes alc260_modes
11667 static hda_nid_t alc268_dac_nids[2] = {
11672 static hda_nid_t alc268_adc_nids[2] = {
11677 static hda_nid_t alc268_adc_nids_alt[1] = {
11682 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11684 static struct snd_kcontrol_new alc268_base_mixer[] = {
11685 /* output mixer control */
11686 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11687 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11688 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11689 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11690 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11691 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11692 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11696 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11697 /* output mixer control */
11698 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11699 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11700 ALC262_HIPPO_MASTER_SWITCH,
11701 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11702 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11703 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11707 /* bind Beep switches of both NID 0x0f and 0x10 */
11708 static struct hda_bind_ctls alc268_bind_beep_sw = {
11709 .ops = &snd_hda_bind_sw,
11711 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11712 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11717 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11718 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11719 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11723 static struct hda_verb alc268_eapd_verbs[] = {
11724 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11725 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11729 /* Toshiba specific */
11730 static struct hda_verb alc268_toshiba_verbs[] = {
11731 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11735 static struct hda_input_mux alc268_acer_lc_capture_source = {
11743 /* Acer specific */
11744 /* bind volumes of both NID 0x02 and 0x03 */
11745 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11746 .ops = &snd_hda_bind_vol,
11748 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11749 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11754 /* mute/unmute internal speaker according to the hp jack and mute state */
11755 static void alc268_acer_automute(struct hda_codec *codec, int force)
11757 struct alc_spec *spec = codec->spec;
11760 if (force || !spec->sense_updated) {
11761 unsigned int present;
11762 present = snd_hda_codec_read(codec, 0x14, 0,
11763 AC_VERB_GET_PIN_SENSE, 0);
11764 spec->jack_present = (present & 0x80000000) != 0;
11765 spec->sense_updated = 1;
11767 if (spec->jack_present)
11768 mute = HDA_AMP_MUTE; /* mute internal speaker */
11769 else /* unmute internal speaker if necessary */
11770 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11771 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11772 HDA_AMP_MUTE, mute);
11776 /* bind hp and internal speaker mute (with plug check) */
11777 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11778 struct snd_ctl_elem_value *ucontrol)
11780 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11781 long *valp = ucontrol->value.integer.value;
11784 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11786 alc268_acer_automute(codec, 0);
11790 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11791 /* output mixer control */
11792 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11794 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11795 .name = "Master Playback Switch",
11796 .info = snd_hda_mixer_amp_switch_info,
11797 .get = snd_hda_mixer_amp_switch_get,
11798 .put = alc268_acer_master_sw_put,
11799 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11801 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11805 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11806 /* output mixer control */
11807 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11809 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11810 .name = "Master Playback Switch",
11811 .info = snd_hda_mixer_amp_switch_info,
11812 .get = snd_hda_mixer_amp_switch_get,
11813 .put = alc268_acer_master_sw_put,
11814 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11816 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11817 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11818 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11822 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11823 /* output mixer control */
11824 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11826 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11827 .name = "Master Playback Switch",
11828 .info = snd_hda_mixer_amp_switch_info,
11829 .get = snd_hda_mixer_amp_switch_get,
11830 .put = alc268_acer_master_sw_put,
11831 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11833 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11834 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11838 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11839 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11840 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11841 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11842 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11843 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11844 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11848 static struct hda_verb alc268_acer_verbs[] = {
11849 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11850 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11851 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11852 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11853 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11854 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11855 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11859 /* unsolicited event for HP jack sensing */
11860 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11861 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11863 static void alc268_acer_unsol_event(struct hda_codec *codec,
11866 if ((res >> 26) != ALC880_HP_EVENT)
11868 alc268_acer_automute(codec, 1);
11871 static void alc268_acer_init_hook(struct hda_codec *codec)
11873 alc268_acer_automute(codec, 1);
11876 /* toggle speaker-output according to the hp-jack state */
11877 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11879 unsigned int present;
11880 unsigned char bits;
11882 present = snd_hda_codec_read(codec, 0x15, 0,
11883 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11884 bits = present ? AMP_IN_MUTE(0) : 0;
11885 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11886 AMP_IN_MUTE(0), bits);
11887 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11888 AMP_IN_MUTE(0), bits);
11892 static void alc268_acer_mic_automute(struct hda_codec *codec)
11894 unsigned int present;
11896 present = snd_hda_codec_read(codec, 0x18, 0,
11897 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11898 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11899 present ? 0x0 : 0x6);
11902 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11905 if ((res >> 26) == ALC880_HP_EVENT)
11906 alc268_aspire_one_speaker_automute(codec);
11907 if ((res >> 26) == ALC880_MIC_EVENT)
11908 alc268_acer_mic_automute(codec);
11911 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11913 alc268_aspire_one_speaker_automute(codec);
11914 alc268_acer_mic_automute(codec);
11917 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11918 /* output mixer control */
11919 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11920 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11921 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11922 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11923 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11924 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11928 static struct hda_verb alc268_dell_verbs[] = {
11929 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11930 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11931 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11935 /* mute/unmute internal speaker according to the hp jack and mute state */
11936 static void alc268_dell_init_hook(struct hda_codec *codec)
11938 struct alc_spec *spec = codec->spec;
11940 spec->autocfg.hp_pins[0] = 0x15;
11941 spec->autocfg.speaker_pins[0] = 0x14;
11942 alc_automute_pin(codec);
11945 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11946 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11947 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11948 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11949 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11950 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11951 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11952 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11953 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11957 static struct hda_verb alc267_quanta_il1_verbs[] = {
11958 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11959 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11963 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11965 unsigned int present;
11967 present = snd_hda_codec_read(codec, 0x18, 0,
11968 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11969 snd_hda_codec_write(codec, 0x23, 0,
11970 AC_VERB_SET_CONNECT_SEL,
11971 present ? 0x00 : 0x01);
11974 static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
11976 struct alc_spec *spec = codec->spec;
11978 spec->autocfg.hp_pins[0] = 0x15;
11979 spec->autocfg.speaker_pins[0] = 0x14;
11980 alc_automute_pin(codec);
11981 alc267_quanta_il1_mic_automute(codec);
11984 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11987 switch (res >> 26) {
11988 case ALC880_MIC_EVENT:
11989 alc267_quanta_il1_mic_automute(codec);
11992 alc_sku_unsol_event(codec, res);
11998 * generic initialization of ADC, input mixers and output mixers
12000 static struct hda_verb alc268_base_init_verbs[] = {
12001 /* Unmute DAC0-1 and set vol = 0 */
12002 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12003 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12006 * Set up output mixers (0x0c - 0x0e)
12008 /* set vol=0 to output mixers */
12009 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12010 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12012 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12013 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12015 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12016 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12017 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12018 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12019 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12020 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12021 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12022 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12024 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12025 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12026 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12027 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12028 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12030 /* set PCBEEP vol = 0, mute connections */
12031 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12032 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12033 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12035 /* Unmute Selector 23h,24h and set the default input to mic-in */
12037 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12038 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12039 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12040 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12046 * generic initialization of ADC, input mixers and output mixers
12048 static struct hda_verb alc268_volume_init_verbs[] = {
12049 /* set output DAC */
12050 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12051 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12053 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12054 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12055 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12056 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12057 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12059 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12060 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12061 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12063 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12064 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12066 /* set PCBEEP vol = 0, mute connections */
12067 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12068 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12069 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12074 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12075 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12076 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12078 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12079 /* The multiple "Capture Source" controls confuse alsamixer
12080 * So call somewhat different..
12082 /* .name = "Capture Source", */
12083 .name = "Input Source",
12085 .info = alc_mux_enum_info,
12086 .get = alc_mux_enum_get,
12087 .put = alc_mux_enum_put,
12092 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12093 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12094 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12095 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12096 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12098 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12099 /* The multiple "Capture Source" controls confuse alsamixer
12100 * So call somewhat different..
12102 /* .name = "Capture Source", */
12103 .name = "Input Source",
12105 .info = alc_mux_enum_info,
12106 .get = alc_mux_enum_get,
12107 .put = alc_mux_enum_put,
12112 static struct hda_input_mux alc268_capture_source = {
12116 { "Front Mic", 0x1 },
12122 static struct hda_input_mux alc268_acer_capture_source = {
12126 { "Internal Mic", 0x1 },
12131 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12135 { "Internal Mic", 0x6 },
12140 #ifdef CONFIG_SND_DEBUG
12141 static struct snd_kcontrol_new alc268_test_mixer[] = {
12142 /* Volume widgets */
12143 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12144 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12145 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12146 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12147 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12148 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12149 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12150 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12151 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12152 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12153 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12154 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12155 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12156 /* The below appears problematic on some hardwares */
12157 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12158 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12159 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12160 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12161 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12163 /* Modes for retasking pin widgets */
12164 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12165 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12166 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12167 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12169 /* Controls for GPIO pins, assuming they are configured as outputs */
12170 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12171 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12172 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12173 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12175 /* Switches to allow the digital SPDIF output pin to be enabled.
12176 * The ALC268 does not have an SPDIF input.
12178 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12180 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12181 * this output to turn on an external amplifier.
12183 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12184 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12190 /* create input playback/capture controls for the given pin */
12191 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12192 const char *ctlname, int idx)
12198 sprintf(name, "%s Playback Volume", ctlname);
12210 if (spec->multiout.dac_nids[0] != dac &&
12211 spec->multiout.dac_nids[1] != dac) {
12212 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12213 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12217 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12220 sprintf(name, "%s Playback Switch", ctlname);
12222 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12223 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12225 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12226 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12232 /* add playback controls from the parsed DAC table */
12233 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12234 const struct auto_pin_cfg *cfg)
12239 spec->multiout.dac_nids = spec->private_dac_nids;
12241 nid = cfg->line_out_pins[0];
12244 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12248 err = alc268_new_analog_output(spec, nid, name, 0);
12253 nid = cfg->speaker_pins[0];
12255 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12256 "Speaker Playback Volume",
12257 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12261 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12265 nid = cfg->hp_pins[0];
12267 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12272 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12274 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12275 "Mono Playback Switch",
12276 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12283 /* create playback/capture controls for input pins */
12284 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
12285 const struct auto_pin_cfg *cfg)
12287 struct hda_input_mux *imux = &spec->private_imux[0];
12290 for (i = 0; i < AUTO_PIN_LAST; i++) {
12291 switch(cfg->input_pins[i]) {
12293 idx1 = 0; /* Mic 1 */
12296 idx1 = 1; /* Mic 2 */
12299 idx1 = 2; /* Line In */
12306 idx1 = 6; /* digital mics */
12311 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12312 imux->items[imux->num_items].index = idx1;
12318 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12320 struct alc_spec *spec = codec->spec;
12321 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12322 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12323 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12324 unsigned int dac_vol1, dac_vol2;
12327 snd_hda_codec_write(codec, speaker_nid, 0,
12328 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12329 snd_hda_codec_write(codec, 0x0f, 0,
12330 AC_VERB_SET_AMP_GAIN_MUTE,
12332 snd_hda_codec_write(codec, 0x10, 0,
12333 AC_VERB_SET_AMP_GAIN_MUTE,
12336 snd_hda_codec_write(codec, 0x0f, 0,
12337 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12338 snd_hda_codec_write(codec, 0x10, 0,
12339 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12342 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12343 if (line_nid == 0x14)
12344 dac_vol2 = AMP_OUT_ZERO;
12345 else if (line_nid == 0x15)
12346 dac_vol1 = AMP_OUT_ZERO;
12347 if (hp_nid == 0x14)
12348 dac_vol2 = AMP_OUT_ZERO;
12349 else if (hp_nid == 0x15)
12350 dac_vol1 = AMP_OUT_ZERO;
12351 if (line_nid != 0x16 || hp_nid != 0x16 ||
12352 spec->autocfg.line_out_pins[1] != 0x16 ||
12353 spec->autocfg.line_out_pins[2] != 0x16)
12354 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12356 snd_hda_codec_write(codec, 0x02, 0,
12357 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12358 snd_hda_codec_write(codec, 0x03, 0,
12359 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12362 /* pcm configuration: identical with ALC880 */
12363 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12364 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12365 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12366 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12369 * BIOS auto configuration
12371 static int alc268_parse_auto_config(struct hda_codec *codec)
12373 struct alc_spec *spec = codec->spec;
12375 static hda_nid_t alc268_ignore[] = { 0 };
12377 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12381 if (!spec->autocfg.line_outs) {
12382 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12383 spec->multiout.max_channels = 2;
12384 spec->no_analog = 1;
12387 return 0; /* can't find valid BIOS pin config */
12389 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12392 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
12396 spec->multiout.max_channels = 2;
12399 /* digital only support output */
12400 if (spec->autocfg.dig_outs) {
12401 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12402 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12404 if (spec->kctls.list)
12405 add_mixer(spec, spec->kctls.list);
12407 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12408 add_mixer(spec, alc268_beep_mixer);
12410 add_verb(spec, alc268_volume_init_verbs);
12411 spec->num_mux_defs = 1;
12412 spec->input_mux = &spec->private_imux[0];
12414 err = alc_auto_add_mic_boost(codec);
12418 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12423 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12424 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12425 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12427 /* init callback for auto-configuration model -- overriding the default init */
12428 static void alc268_auto_init(struct hda_codec *codec)
12430 struct alc_spec *spec = codec->spec;
12431 alc268_auto_init_multi_out(codec);
12432 alc268_auto_init_hp_out(codec);
12433 alc268_auto_init_mono_speaker_out(codec);
12434 alc268_auto_init_analog_input(codec);
12435 if (spec->unsol_event)
12436 alc_inithook(codec);
12440 * configuration and preset
12442 static const char *alc268_models[ALC268_MODEL_LAST] = {
12443 [ALC267_QUANTA_IL1] = "quanta-il1",
12444 [ALC268_3ST] = "3stack",
12445 [ALC268_TOSHIBA] = "toshiba",
12446 [ALC268_ACER] = "acer",
12447 [ALC268_ACER_DMIC] = "acer-dmic",
12448 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12449 [ALC268_DELL] = "dell",
12450 [ALC268_ZEPTO] = "zepto",
12451 #ifdef CONFIG_SND_DEBUG
12452 [ALC268_TEST] = "test",
12454 [ALC268_AUTO] = "auto",
12457 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12458 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12459 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12460 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12461 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12462 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12463 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12464 ALC268_ACER_ASPIRE_ONE),
12465 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12466 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12467 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12469 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12470 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12471 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12473 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12474 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12475 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12476 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12480 static struct alc_config_preset alc268_presets[] = {
12481 [ALC267_QUANTA_IL1] = {
12482 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12483 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12484 alc267_quanta_il1_verbs },
12485 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12486 .dac_nids = alc268_dac_nids,
12487 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12488 .adc_nids = alc268_adc_nids_alt,
12490 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12491 .channel_mode = alc268_modes,
12492 .input_mux = &alc268_capture_source,
12493 .unsol_event = alc267_quanta_il1_unsol_event,
12494 .init_hook = alc267_quanta_il1_init_hook,
12497 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12498 alc268_beep_mixer },
12499 .init_verbs = { alc268_base_init_verbs },
12500 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12501 .dac_nids = alc268_dac_nids,
12502 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12503 .adc_nids = alc268_adc_nids_alt,
12504 .capsrc_nids = alc268_capsrc_nids,
12506 .dig_out_nid = ALC268_DIGOUT_NID,
12507 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12508 .channel_mode = alc268_modes,
12509 .input_mux = &alc268_capture_source,
12511 [ALC268_TOSHIBA] = {
12512 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12513 alc268_beep_mixer },
12514 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12515 alc268_toshiba_verbs },
12516 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12517 .dac_nids = alc268_dac_nids,
12518 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12519 .adc_nids = alc268_adc_nids_alt,
12520 .capsrc_nids = alc268_capsrc_nids,
12522 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12523 .channel_mode = alc268_modes,
12524 .input_mux = &alc268_capture_source,
12525 .unsol_event = alc268_toshiba_unsol_event,
12526 .init_hook = alc268_toshiba_init_hook,
12529 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12530 alc268_beep_mixer },
12531 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12532 alc268_acer_verbs },
12533 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12534 .dac_nids = alc268_dac_nids,
12535 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12536 .adc_nids = alc268_adc_nids_alt,
12537 .capsrc_nids = alc268_capsrc_nids,
12539 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12540 .channel_mode = alc268_modes,
12541 .input_mux = &alc268_acer_capture_source,
12542 .unsol_event = alc268_acer_unsol_event,
12543 .init_hook = alc268_acer_init_hook,
12545 [ALC268_ACER_DMIC] = {
12546 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12547 alc268_beep_mixer },
12548 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12549 alc268_acer_verbs },
12550 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12551 .dac_nids = alc268_dac_nids,
12552 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12553 .adc_nids = alc268_adc_nids_alt,
12554 .capsrc_nids = alc268_capsrc_nids,
12556 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12557 .channel_mode = alc268_modes,
12558 .input_mux = &alc268_acer_dmic_capture_source,
12559 .unsol_event = alc268_acer_unsol_event,
12560 .init_hook = alc268_acer_init_hook,
12562 [ALC268_ACER_ASPIRE_ONE] = {
12563 .mixers = { alc268_acer_aspire_one_mixer,
12565 alc268_capture_alt_mixer },
12566 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12567 alc268_acer_aspire_one_verbs },
12568 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12569 .dac_nids = alc268_dac_nids,
12570 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12571 .adc_nids = alc268_adc_nids_alt,
12572 .capsrc_nids = alc268_capsrc_nids,
12574 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12575 .channel_mode = alc268_modes,
12576 .input_mux = &alc268_acer_lc_capture_source,
12577 .unsol_event = alc268_acer_lc_unsol_event,
12578 .init_hook = alc268_acer_lc_init_hook,
12581 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12582 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12583 alc268_dell_verbs },
12584 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12585 .dac_nids = alc268_dac_nids,
12587 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12588 .channel_mode = alc268_modes,
12589 .unsol_event = alc_sku_unsol_event,
12590 .init_hook = alc268_dell_init_hook,
12591 .input_mux = &alc268_capture_source,
12594 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12595 alc268_beep_mixer },
12596 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12597 alc268_toshiba_verbs },
12598 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12599 .dac_nids = alc268_dac_nids,
12600 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12601 .adc_nids = alc268_adc_nids_alt,
12602 .capsrc_nids = alc268_capsrc_nids,
12604 .dig_out_nid = ALC268_DIGOUT_NID,
12605 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12606 .channel_mode = alc268_modes,
12607 .input_mux = &alc268_capture_source,
12608 .unsol_event = alc268_toshiba_unsol_event,
12609 .init_hook = alc268_toshiba_init_hook
12611 #ifdef CONFIG_SND_DEBUG
12613 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12614 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12615 alc268_volume_init_verbs },
12616 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12617 .dac_nids = alc268_dac_nids,
12618 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12619 .adc_nids = alc268_adc_nids_alt,
12620 .capsrc_nids = alc268_capsrc_nids,
12622 .dig_out_nid = ALC268_DIGOUT_NID,
12623 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12624 .channel_mode = alc268_modes,
12625 .input_mux = &alc268_capture_source,
12630 static int patch_alc268(struct hda_codec *codec)
12632 struct alc_spec *spec;
12634 int i, has_beep, err;
12636 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12640 codec->spec = spec;
12642 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12646 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12647 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12649 board_config = ALC268_AUTO;
12652 if (board_config == ALC268_AUTO) {
12653 /* automatic parse from the BIOS config */
12654 err = alc268_parse_auto_config(codec);
12660 "hda_codec: Cannot set up configuration "
12661 "from BIOS. Using base mode...\n");
12662 board_config = ALC268_3ST;
12666 if (board_config != ALC268_AUTO)
12667 setup_preset(codec, &alc268_presets[board_config]);
12669 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12670 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12671 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12673 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12676 for (i = 0; i < spec->num_mixers; i++) {
12677 if (spec->mixers[i] == alc268_beep_mixer) {
12684 err = snd_hda_attach_beep_device(codec, 0x1);
12689 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12690 /* override the amp caps for beep generator */
12691 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12692 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12693 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12694 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12695 (0 << AC_AMPCAP_MUTE_SHIFT));
12698 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12699 /* check whether NID 0x07 is valid */
12700 unsigned int wcap = get_wcaps(codec, 0x07);
12704 wcap = get_wcaps_type(wcap);
12705 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12706 spec->adc_nids = alc268_adc_nids_alt;
12707 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12708 add_mixer(spec, alc268_capture_alt_mixer);
12710 spec->adc_nids = alc268_adc_nids;
12711 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12712 add_mixer(spec, alc268_capture_mixer);
12714 spec->capsrc_nids = alc268_capsrc_nids;
12715 /* set default input source */
12716 for (i = 0; i < spec->num_adc_nids; i++)
12717 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12718 0, AC_VERB_SET_CONNECT_SEL,
12719 spec->input_mux->items[0].index);
12722 spec->vmaster_nid = 0x02;
12724 codec->patch_ops = alc_patch_ops;
12725 if (board_config == ALC268_AUTO)
12726 spec->init_hook = alc268_auto_init;
12728 codec->proc_widget_hook = print_realtek_coef;
12734 * ALC269 channel source setting (2 channel)
12736 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12738 #define alc269_dac_nids alc260_dac_nids
12740 static hda_nid_t alc269_adc_nids[1] = {
12745 static hda_nid_t alc269_capsrc_nids[1] = {
12749 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12753 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12761 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12769 #define alc269_modes alc260_modes
12770 #define alc269_capture_source alc880_lg_lw_capture_source
12772 static struct snd_kcontrol_new alc269_base_mixer[] = {
12773 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12774 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12775 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12776 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12778 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12779 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12780 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12781 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12782 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12783 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12784 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12788 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12789 /* output mixer control */
12790 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12792 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12793 .name = "Master Playback Switch",
12794 .info = snd_hda_mixer_amp_switch_info,
12795 .get = snd_hda_mixer_amp_switch_get,
12796 .put = alc268_acer_master_sw_put,
12797 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12799 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12800 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12801 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12802 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12803 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12804 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12808 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12809 /* output mixer control */
12810 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12812 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12813 .name = "Master Playback Switch",
12814 .info = snd_hda_mixer_amp_switch_info,
12815 .get = snd_hda_mixer_amp_switch_get,
12816 .put = alc268_acer_master_sw_put,
12817 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12819 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12820 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12821 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12822 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12823 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12824 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12825 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12826 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12827 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12831 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12832 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12833 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12834 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12835 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12839 /* capture mixer elements */
12840 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12841 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12842 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12843 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12848 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12850 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12851 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12852 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12854 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12855 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12856 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12860 static struct hda_verb alc269_lifebook_verbs[] = {
12861 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12862 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12863 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12864 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12865 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12866 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12867 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12868 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12869 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12870 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12874 /* toggle speaker-output according to the hp-jack state */
12875 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12877 unsigned int present;
12878 unsigned char bits;
12880 present = snd_hda_codec_read(codec, 0x15, 0,
12881 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12882 bits = present ? AMP_IN_MUTE(0) : 0;
12883 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12884 AMP_IN_MUTE(0), bits);
12885 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12886 AMP_IN_MUTE(0), bits);
12888 snd_hda_codec_write(codec, 0x20, 0,
12889 AC_VERB_SET_COEF_INDEX, 0x0c);
12890 snd_hda_codec_write(codec, 0x20, 0,
12891 AC_VERB_SET_PROC_COEF, 0x680);
12893 snd_hda_codec_write(codec, 0x20, 0,
12894 AC_VERB_SET_COEF_INDEX, 0x0c);
12895 snd_hda_codec_write(codec, 0x20, 0,
12896 AC_VERB_SET_PROC_COEF, 0x480);
12899 /* toggle speaker-output according to the hp-jacks state */
12900 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12902 unsigned int present;
12903 unsigned char bits;
12905 /* Check laptop headphone socket */
12906 present = snd_hda_codec_read(codec, 0x15, 0,
12907 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12909 /* Check port replicator headphone socket */
12910 present |= snd_hda_codec_read(codec, 0x1a, 0,
12911 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12913 bits = present ? AMP_IN_MUTE(0) : 0;
12914 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12915 AMP_IN_MUTE(0), bits);
12916 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12917 AMP_IN_MUTE(0), bits);
12919 snd_hda_codec_write(codec, 0x20, 0,
12920 AC_VERB_SET_COEF_INDEX, 0x0c);
12921 snd_hda_codec_write(codec, 0x20, 0,
12922 AC_VERB_SET_PROC_COEF, 0x680);
12924 snd_hda_codec_write(codec, 0x20, 0,
12925 AC_VERB_SET_COEF_INDEX, 0x0c);
12926 snd_hda_codec_write(codec, 0x20, 0,
12927 AC_VERB_SET_PROC_COEF, 0x480);
12930 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12932 unsigned int present;
12934 present = snd_hda_codec_read(codec, 0x18, 0,
12935 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12936 snd_hda_codec_write(codec, 0x23, 0,
12937 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12940 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12942 unsigned int present_laptop;
12943 unsigned int present_dock;
12945 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12946 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12948 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12949 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12951 /* Laptop mic port overrides dock mic port, design decision */
12953 snd_hda_codec_write(codec, 0x23, 0,
12954 AC_VERB_SET_CONNECT_SEL, 0x3);
12955 if (present_laptop)
12956 snd_hda_codec_write(codec, 0x23, 0,
12957 AC_VERB_SET_CONNECT_SEL, 0x0);
12958 if (!present_dock && !present_laptop)
12959 snd_hda_codec_write(codec, 0x23, 0,
12960 AC_VERB_SET_CONNECT_SEL, 0x1);
12963 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12966 if ((res >> 26) == ALC880_HP_EVENT)
12967 alc269_quanta_fl1_speaker_automute(codec);
12968 if ((res >> 26) == ALC880_MIC_EVENT)
12969 alc269_quanta_fl1_mic_automute(codec);
12972 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12975 if ((res >> 26) == ALC880_HP_EVENT)
12976 alc269_lifebook_speaker_automute(codec);
12977 if ((res >> 26) == ALC880_MIC_EVENT)
12978 alc269_lifebook_mic_autoswitch(codec);
12981 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12983 alc269_quanta_fl1_speaker_automute(codec);
12984 alc269_quanta_fl1_mic_automute(codec);
12987 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12989 alc269_lifebook_speaker_automute(codec);
12990 alc269_lifebook_mic_autoswitch(codec);
12993 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12994 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12995 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12996 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12997 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12998 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12999 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13000 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13004 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13005 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13006 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13007 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13008 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13009 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13010 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13014 /* toggle speaker-output according to the hp-jack state */
13015 static void alc269_speaker_automute(struct hda_codec *codec)
13017 unsigned int present;
13018 unsigned char bits;
13020 present = snd_hda_codec_read(codec, 0x15, 0,
13021 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13022 bits = present ? AMP_IN_MUTE(0) : 0;
13023 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13024 AMP_IN_MUTE(0), bits);
13025 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13026 AMP_IN_MUTE(0), bits);
13029 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
13031 unsigned int present;
13033 present = snd_hda_codec_read(codec, 0x18, 0,
13034 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13035 snd_hda_codec_write(codec, 0x23, 0,
13036 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
13039 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
13041 unsigned int present;
13043 present = snd_hda_codec_read(codec, 0x18, 0,
13044 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13045 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13046 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13047 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13048 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13051 /* unsolicited event for HP jack sensing */
13052 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
13055 if ((res >> 26) == ALC880_HP_EVENT)
13056 alc269_speaker_automute(codec);
13058 if ((res >> 26) == ALC880_MIC_EVENT)
13059 alc269_eeepc_dmic_automute(codec);
13062 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
13064 alc269_speaker_automute(codec);
13065 alc269_eeepc_dmic_automute(codec);
13068 /* unsolicited event for HP jack sensing */
13069 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
13072 if ((res >> 26) == ALC880_HP_EVENT)
13073 alc269_speaker_automute(codec);
13075 if ((res >> 26) == ALC880_MIC_EVENT)
13076 alc269_eeepc_amic_automute(codec);
13079 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
13081 alc269_speaker_automute(codec);
13082 alc269_eeepc_amic_automute(codec);
13086 * generic initialization of ADC, input mixers and output mixers
13088 static struct hda_verb alc269_init_verbs[] = {
13090 * Unmute ADC0 and set the default input to mic-in
13092 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13094 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13095 * analog-loopback mixer widget
13096 * Note: PASD motherboards uses the Line In 2 as the input for
13097 * front panel mic (mic 2)
13099 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13100 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13101 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13102 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13103 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13104 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13107 * Set up output mixers (0x0c - 0x0e)
13109 /* set vol=0 to output mixers */
13110 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13111 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13113 /* set up input amps for analog loopback */
13114 /* Amp Indices: DAC = 0, mixer = 1 */
13115 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13116 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13117 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13118 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13119 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13120 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13122 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13123 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13124 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13125 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13126 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13127 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13128 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13130 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13131 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13132 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13133 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13134 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13135 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13136 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13138 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13139 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13141 /* FIXME: use matrix-type input source selection */
13142 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13143 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13144 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13145 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13146 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13147 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13150 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13151 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13155 /* add playback controls from the parsed DAC table */
13156 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
13157 const struct auto_pin_cfg *cfg)
13162 spec->multiout.num_dacs = 1; /* only use one dac */
13163 spec->multiout.dac_nids = spec->private_dac_nids;
13164 spec->multiout.dac_nids[0] = 2;
13166 nid = cfg->line_out_pins[0];
13168 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13169 "Front Playback Volume",
13170 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
13173 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13174 "Front Playback Switch",
13175 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13180 nid = cfg->speaker_pins[0];
13182 if (!cfg->line_out_pins[0]) {
13183 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13184 "Speaker Playback Volume",
13185 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13191 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13192 "Speaker Playback Switch",
13193 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13198 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13199 "Speaker Playback Switch",
13200 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13206 nid = cfg->hp_pins[0];
13208 /* spec->multiout.hp_nid = 2; */
13209 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
13210 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13211 "Headphone Playback Volume",
13212 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13218 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13219 "Headphone Playback Switch",
13220 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13225 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13226 "Headphone Playback Switch",
13227 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13236 #define alc269_auto_create_analog_input_ctls \
13237 alc262_auto_create_analog_input_ctls
13239 #ifdef CONFIG_SND_HDA_POWER_SAVE
13240 #define alc269_loopbacks alc880_loopbacks
13243 /* pcm configuration: identical with ALC880 */
13244 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13245 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13246 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13247 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13249 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13253 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13254 /* NID is set in alc_build_pcms */
13256 .open = alc880_playback_pcm_open,
13257 .prepare = alc880_playback_pcm_prepare,
13258 .cleanup = alc880_playback_pcm_cleanup
13262 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13266 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13267 /* NID is set in alc_build_pcms */
13271 * BIOS auto configuration
13273 static int alc269_parse_auto_config(struct hda_codec *codec)
13275 struct alc_spec *spec = codec->spec;
13277 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13279 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13284 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13287 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
13291 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13293 if (spec->autocfg.dig_outs)
13294 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13296 if (spec->kctls.list)
13297 add_mixer(spec, spec->kctls.list);
13299 add_verb(spec, alc269_init_verbs);
13300 spec->num_mux_defs = 1;
13301 spec->input_mux = &spec->private_imux[0];
13302 /* set default input source */
13303 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13304 0, AC_VERB_SET_CONNECT_SEL,
13305 spec->input_mux->items[0].index);
13307 err = alc_auto_add_mic_boost(codec);
13311 if (!spec->cap_mixer && !spec->no_analog)
13312 set_capture_mixer(codec);
13314 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13319 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13320 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13321 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13324 /* init callback for auto-configuration model -- overriding the default init */
13325 static void alc269_auto_init(struct hda_codec *codec)
13327 struct alc_spec *spec = codec->spec;
13328 alc269_auto_init_multi_out(codec);
13329 alc269_auto_init_hp_out(codec);
13330 alc269_auto_init_analog_input(codec);
13331 if (spec->unsol_event)
13332 alc_inithook(codec);
13336 * configuration and preset
13338 static const char *alc269_models[ALC269_MODEL_LAST] = {
13339 [ALC269_BASIC] = "basic",
13340 [ALC269_QUANTA_FL1] = "quanta",
13341 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13342 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13343 [ALC269_FUJITSU] = "fujitsu",
13344 [ALC269_LIFEBOOK] = "lifebook"
13347 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13348 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13349 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13350 ALC269_ASUS_EEEPC_P703),
13351 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13352 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13353 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13354 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13355 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13356 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13357 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13358 ALC269_ASUS_EEEPC_P901),
13359 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13360 ALC269_ASUS_EEEPC_P901),
13361 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13362 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13363 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13367 static struct alc_config_preset alc269_presets[] = {
13369 .mixers = { alc269_base_mixer },
13370 .init_verbs = { alc269_init_verbs },
13371 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13372 .dac_nids = alc269_dac_nids,
13374 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13375 .channel_mode = alc269_modes,
13376 .input_mux = &alc269_capture_source,
13378 [ALC269_QUANTA_FL1] = {
13379 .mixers = { alc269_quanta_fl1_mixer },
13380 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13381 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13382 .dac_nids = alc269_dac_nids,
13384 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13385 .channel_mode = alc269_modes,
13386 .input_mux = &alc269_capture_source,
13387 .unsol_event = alc269_quanta_fl1_unsol_event,
13388 .init_hook = alc269_quanta_fl1_init_hook,
13390 [ALC269_ASUS_EEEPC_P703] = {
13391 .mixers = { alc269_eeepc_mixer },
13392 .cap_mixer = alc269_epc_capture_mixer,
13393 .init_verbs = { alc269_init_verbs,
13394 alc269_eeepc_amic_init_verbs },
13395 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13396 .dac_nids = alc269_dac_nids,
13398 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13399 .channel_mode = alc269_modes,
13400 .input_mux = &alc269_eeepc_amic_capture_source,
13401 .unsol_event = alc269_eeepc_amic_unsol_event,
13402 .init_hook = alc269_eeepc_amic_inithook,
13404 [ALC269_ASUS_EEEPC_P901] = {
13405 .mixers = { alc269_eeepc_mixer },
13406 .cap_mixer = alc269_epc_capture_mixer,
13407 .init_verbs = { alc269_init_verbs,
13408 alc269_eeepc_dmic_init_verbs },
13409 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13410 .dac_nids = alc269_dac_nids,
13412 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13413 .channel_mode = alc269_modes,
13414 .input_mux = &alc269_eeepc_dmic_capture_source,
13415 .unsol_event = alc269_eeepc_dmic_unsol_event,
13416 .init_hook = alc269_eeepc_dmic_inithook,
13418 [ALC269_FUJITSU] = {
13419 .mixers = { alc269_fujitsu_mixer },
13420 .cap_mixer = alc269_epc_capture_mixer,
13421 .init_verbs = { alc269_init_verbs,
13422 alc269_eeepc_dmic_init_verbs },
13423 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13424 .dac_nids = alc269_dac_nids,
13426 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13427 .channel_mode = alc269_modes,
13428 .input_mux = &alc269_eeepc_dmic_capture_source,
13429 .unsol_event = alc269_eeepc_dmic_unsol_event,
13430 .init_hook = alc269_eeepc_dmic_inithook,
13432 [ALC269_LIFEBOOK] = {
13433 .mixers = { alc269_lifebook_mixer },
13434 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13435 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13436 .dac_nids = alc269_dac_nids,
13438 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13439 .channel_mode = alc269_modes,
13440 .input_mux = &alc269_capture_source,
13441 .unsol_event = alc269_lifebook_unsol_event,
13442 .init_hook = alc269_lifebook_init_hook,
13446 static int patch_alc269(struct hda_codec *codec)
13448 struct alc_spec *spec;
13452 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13456 codec->spec = spec;
13458 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13460 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13464 if (board_config < 0) {
13465 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13467 board_config = ALC269_AUTO;
13470 if (board_config == ALC269_AUTO) {
13471 /* automatic parse from the BIOS config */
13472 err = alc269_parse_auto_config(codec);
13478 "hda_codec: Cannot set up configuration "
13479 "from BIOS. Using base mode...\n");
13480 board_config = ALC269_BASIC;
13484 err = snd_hda_attach_beep_device(codec, 0x1);
13490 if (board_config != ALC269_AUTO)
13491 setup_preset(codec, &alc269_presets[board_config]);
13493 if (codec->subsystem_id == 0x17aa3bf8) {
13494 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13495 * fix the sample rate of analog I/O to 44.1kHz
13497 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13498 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13500 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13501 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13503 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13504 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13506 spec->adc_nids = alc269_adc_nids;
13507 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13508 spec->capsrc_nids = alc269_capsrc_nids;
13509 if (!spec->cap_mixer)
13510 set_capture_mixer(codec);
13511 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13513 spec->vmaster_nid = 0x02;
13515 codec->patch_ops = alc_patch_ops;
13516 if (board_config == ALC269_AUTO)
13517 spec->init_hook = alc269_auto_init;
13518 #ifdef CONFIG_SND_HDA_POWER_SAVE
13519 if (!spec->loopback.amplist)
13520 spec->loopback.amplist = alc269_loopbacks;
13522 codec->proc_widget_hook = print_realtek_coef;
13528 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13532 * set the path ways for 2 channel output
13533 * need to set the codec line out and mic 1 pin widgets to inputs
13535 static struct hda_verb alc861_threestack_ch2_init[] = {
13536 /* set pin widget 1Ah (line in) for input */
13537 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13538 /* set pin widget 18h (mic1/2) for input, for mic also enable
13541 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13543 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13545 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13546 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13552 * need to set the codec line out and mic 1 pin widgets to outputs
13554 static struct hda_verb alc861_threestack_ch6_init[] = {
13555 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13556 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13557 /* set pin widget 18h (mic1) for output (CLFE)*/
13558 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13560 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13561 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13563 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13565 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13566 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13571 static struct hda_channel_mode alc861_threestack_modes[2] = {
13572 { 2, alc861_threestack_ch2_init },
13573 { 6, alc861_threestack_ch6_init },
13575 /* Set mic1 as input and unmute the mixer */
13576 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13577 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13578 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13581 /* Set mic1 as output and mute mixer */
13582 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13583 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13584 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13588 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13589 { 2, alc861_uniwill_m31_ch2_init },
13590 { 4, alc861_uniwill_m31_ch4_init },
13593 /* Set mic1 and line-in as input and unmute the mixer */
13594 static struct hda_verb alc861_asus_ch2_init[] = {
13595 /* set pin widget 1Ah (line in) for input */
13596 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13597 /* set pin widget 18h (mic1/2) for input, for mic also enable
13600 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13602 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13604 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13605 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13609 /* Set mic1 nad line-in as output and mute mixer */
13610 static struct hda_verb alc861_asus_ch6_init[] = {
13611 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13612 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13613 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13614 /* set pin widget 18h (mic1) for output (CLFE)*/
13615 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13616 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13617 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13618 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13620 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13622 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13623 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13628 static struct hda_channel_mode alc861_asus_modes[2] = {
13629 { 2, alc861_asus_ch2_init },
13630 { 6, alc861_asus_ch6_init },
13635 static struct snd_kcontrol_new alc861_base_mixer[] = {
13636 /* output mixer control */
13637 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13638 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13639 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13640 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13641 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13643 /*Input mixer control */
13644 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13645 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13646 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13647 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13648 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13649 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13650 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13651 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13652 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13653 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13658 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13659 /* output mixer control */
13660 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13661 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13662 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13663 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13664 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13666 /* Input mixer control */
13667 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13668 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13669 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13670 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13671 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13672 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13673 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13674 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13675 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13676 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13679 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13680 .name = "Channel Mode",
13681 .info = alc_ch_mode_info,
13682 .get = alc_ch_mode_get,
13683 .put = alc_ch_mode_put,
13684 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13689 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13690 /* output mixer control */
13691 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13692 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13693 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13698 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13699 /* output mixer control */
13700 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13701 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13702 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13703 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13704 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13706 /* Input mixer control */
13707 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13708 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13709 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13710 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13711 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13712 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13713 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13714 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13715 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13716 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13719 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13720 .name = "Channel Mode",
13721 .info = alc_ch_mode_info,
13722 .get = alc_ch_mode_get,
13723 .put = alc_ch_mode_put,
13724 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13729 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13730 /* output mixer control */
13731 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13732 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13733 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13734 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13735 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13737 /* Input mixer control */
13738 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13739 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13740 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13741 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13742 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13743 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13744 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13745 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13746 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13747 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13750 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13751 .name = "Channel Mode",
13752 .info = alc_ch_mode_info,
13753 .get = alc_ch_mode_get,
13754 .put = alc_ch_mode_put,
13755 .private_value = ARRAY_SIZE(alc861_asus_modes),
13760 /* additional mixer */
13761 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13762 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13763 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13768 * generic initialization of ADC, input mixers and output mixers
13770 static struct hda_verb alc861_base_init_verbs[] = {
13772 * Unmute ADC0 and set the default input to mic-in
13774 /* port-A for surround (rear panel) */
13775 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13776 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13777 /* port-B for mic-in (rear panel) with vref */
13778 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13779 /* port-C for line-in (rear panel) */
13780 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13781 /* port-D for Front */
13782 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13783 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13784 /* port-E for HP out (front panel) */
13785 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13786 /* route front PCM to HP */
13787 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13788 /* port-F for mic-in (front panel) with vref */
13789 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13790 /* port-G for CLFE (rear panel) */
13791 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13792 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13793 /* port-H for side (rear panel) */
13794 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13795 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13797 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13798 /* route front mic to ADC1*/
13799 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13800 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13802 /* Unmute DAC0~3 & spdif out*/
13803 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13804 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13805 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13806 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13807 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13809 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13810 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13811 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13812 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13813 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13815 /* Unmute Stereo Mixer 15 */
13816 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13817 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13818 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13819 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13821 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13822 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13823 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13824 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13825 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13826 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13827 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13828 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13829 /* hp used DAC 3 (Front) */
13830 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13831 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13836 static struct hda_verb alc861_threestack_init_verbs[] = {
13838 * Unmute ADC0 and set the default input to mic-in
13840 /* port-A for surround (rear panel) */
13841 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13842 /* port-B for mic-in (rear panel) with vref */
13843 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13844 /* port-C for line-in (rear panel) */
13845 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13846 /* port-D for Front */
13847 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13848 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13849 /* port-E for HP out (front panel) */
13850 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13851 /* route front PCM to HP */
13852 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13853 /* port-F for mic-in (front panel) with vref */
13854 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13855 /* port-G for CLFE (rear panel) */
13856 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13857 /* port-H for side (rear panel) */
13858 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13860 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13861 /* route front mic to ADC1*/
13862 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13863 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13864 /* Unmute DAC0~3 & spdif out*/
13865 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13866 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13867 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13868 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13869 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13871 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13872 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13873 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13874 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13875 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13877 /* Unmute Stereo Mixer 15 */
13878 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13879 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13880 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13883 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13884 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13885 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13886 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13887 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13888 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13889 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13890 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13891 /* hp used DAC 3 (Front) */
13892 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13893 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13897 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13899 * Unmute ADC0 and set the default input to mic-in
13901 /* port-A for surround (rear panel) */
13902 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13903 /* port-B for mic-in (rear panel) with vref */
13904 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13905 /* port-C for line-in (rear panel) */
13906 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13907 /* port-D for Front */
13908 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13909 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13910 /* port-E for HP out (front panel) */
13911 /* this has to be set to VREF80 */
13912 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13913 /* route front PCM to HP */
13914 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13915 /* port-F for mic-in (front panel) with vref */
13916 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13917 /* port-G for CLFE (rear panel) */
13918 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13919 /* port-H for side (rear panel) */
13920 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13922 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13923 /* route front mic to ADC1*/
13924 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13925 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13926 /* Unmute DAC0~3 & spdif out*/
13927 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13928 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13929 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13930 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13931 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13933 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13934 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13935 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13936 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13937 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13939 /* Unmute Stereo Mixer 15 */
13940 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13941 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13942 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13943 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13945 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13946 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13947 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13948 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13949 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13950 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13951 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13952 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13953 /* hp used DAC 3 (Front) */
13954 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13955 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13959 static struct hda_verb alc861_asus_init_verbs[] = {
13961 * Unmute ADC0 and set the default input to mic-in
13963 /* port-A for surround (rear panel)
13964 * according to codec#0 this is the HP jack
13966 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13967 /* route front PCM to HP */
13968 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13969 /* port-B for mic-in (rear panel) with vref */
13970 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13971 /* port-C for line-in (rear panel) */
13972 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13973 /* port-D for Front */
13974 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13975 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13976 /* port-E for HP out (front panel) */
13977 /* this has to be set to VREF80 */
13978 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13979 /* route front PCM to HP */
13980 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13981 /* port-F for mic-in (front panel) with vref */
13982 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13983 /* port-G for CLFE (rear panel) */
13984 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13985 /* port-H for side (rear panel) */
13986 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13988 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13989 /* route front mic to ADC1*/
13990 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13991 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13992 /* Unmute DAC0~3 & spdif out*/
13993 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13994 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13995 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13996 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13997 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13998 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13999 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14000 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14001 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14002 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14004 /* Unmute Stereo Mixer 15 */
14005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14006 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14007 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14008 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14010 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14011 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14012 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14013 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14014 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14015 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14016 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14017 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14018 /* hp used DAC 3 (Front) */
14019 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14020 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14024 /* additional init verbs for ASUS laptops */
14025 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14026 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14027 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14032 * generic initialization of ADC, input mixers and output mixers
14034 static struct hda_verb alc861_auto_init_verbs[] = {
14036 * Unmute ADC0 and set the default input to mic-in
14038 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14039 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14041 /* Unmute DAC0~3 & spdif out*/
14042 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14043 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14044 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14045 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14046 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14048 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14049 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14050 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14051 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14052 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14054 /* Unmute Stereo Mixer 15 */
14055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14056 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14058 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14060 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14061 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14062 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14063 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14064 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14065 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14066 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14067 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14069 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14070 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14071 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14072 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14073 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14074 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14075 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14076 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14078 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14083 static struct hda_verb alc861_toshiba_init_verbs[] = {
14084 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14089 /* toggle speaker-output according to the hp-jack state */
14090 static void alc861_toshiba_automute(struct hda_codec *codec)
14092 unsigned int present;
14094 present = snd_hda_codec_read(codec, 0x0f, 0,
14095 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14096 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14097 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14098 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14099 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14102 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14105 if ((res >> 26) == ALC880_HP_EVENT)
14106 alc861_toshiba_automute(codec);
14109 /* pcm configuration: identical with ALC880 */
14110 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14111 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14112 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14113 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14116 #define ALC861_DIGOUT_NID 0x07
14118 static struct hda_channel_mode alc861_8ch_modes[1] = {
14122 static hda_nid_t alc861_dac_nids[4] = {
14123 /* front, surround, clfe, side */
14124 0x03, 0x06, 0x05, 0x04
14127 static hda_nid_t alc660_dac_nids[3] = {
14128 /* front, clfe, surround */
14132 static hda_nid_t alc861_adc_nids[1] = {
14137 static struct hda_input_mux alc861_capture_source = {
14141 { "Front Mic", 0x3 },
14148 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14150 struct alc_spec *spec = codec->spec;
14151 hda_nid_t mix, srcs[5];
14154 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14156 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14159 for (i = 0; i < num; i++) {
14161 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14162 if (type != AC_WID_AUD_OUT)
14164 for (j = 0; j < spec->multiout.num_dacs; j++)
14165 if (spec->multiout.dac_nids[j] == srcs[i])
14167 if (j >= spec->multiout.num_dacs)
14173 /* fill in the dac_nids table from the parsed pin configuration */
14174 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14175 const struct auto_pin_cfg *cfg)
14177 struct alc_spec *spec = codec->spec;
14179 hda_nid_t nid, dac;
14181 spec->multiout.dac_nids = spec->private_dac_nids;
14182 for (i = 0; i < cfg->line_outs; i++) {
14183 nid = cfg->line_out_pins[i];
14184 dac = alc861_look_for_dac(codec, nid);
14187 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14192 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14193 hda_nid_t nid, unsigned int chs)
14196 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
14197 return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name,
14198 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14201 /* add playback controls from the parsed DAC table */
14202 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14203 const struct auto_pin_cfg *cfg)
14205 struct alc_spec *spec = codec->spec;
14206 static const char *chname[4] = {
14207 "Front", "Surround", NULL /*CLFE*/, "Side"
14212 if (cfg->line_outs == 1) {
14213 const char *pfx = NULL;
14216 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14219 nid = spec->multiout.dac_nids[0];
14220 return alc861_create_out_sw(codec, pfx, nid, 3);
14224 for (i = 0; i < cfg->line_outs; i++) {
14225 nid = spec->multiout.dac_nids[i];
14230 err = alc861_create_out_sw(codec, "Center", nid, 1);
14233 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14237 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14245 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14247 struct alc_spec *spec = codec->spec;
14254 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14255 nid = alc861_look_for_dac(codec, pin);
14257 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14260 spec->multiout.hp_nid = nid;
14266 /* create playback/capture controls for input pins */
14267 static int alc861_auto_create_analog_input_ctls(struct hda_codec *codec,
14268 const struct auto_pin_cfg *cfg)
14270 struct alc_spec *spec = codec->spec;
14271 struct hda_input_mux *imux = &spec->private_imux[0];
14272 int i, err, idx, idx1;
14274 for (i = 0; i < AUTO_PIN_LAST; i++) {
14275 switch (cfg->input_pins[i]) {
14278 idx = 2; /* Line In */
14282 idx = 2; /* Line In */
14286 idx = 1; /* Mic In */
14290 idx = 1; /* Mic In */
14300 err = new_analog_input(spec, cfg->input_pins[i],
14301 auto_pin_cfg_labels[i], idx, 0x15);
14305 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
14306 imux->items[imux->num_items].index = idx1;
14312 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14314 int pin_type, hda_nid_t dac)
14316 hda_nid_t mix, srcs[5];
14319 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14321 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14323 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14325 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14328 for (i = 0; i < num; i++) {
14330 if (srcs[i] == dac || srcs[i] == 0x15)
14331 mute = AMP_IN_UNMUTE(i);
14333 mute = AMP_IN_MUTE(i);
14334 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14339 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14341 struct alc_spec *spec = codec->spec;
14344 for (i = 0; i < spec->autocfg.line_outs; i++) {
14345 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14346 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14348 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14349 spec->multiout.dac_nids[i]);
14353 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14355 struct alc_spec *spec = codec->spec;
14358 pin = spec->autocfg.hp_pins[0];
14360 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14361 spec->multiout.hp_nid);
14362 pin = spec->autocfg.speaker_pins[0];
14364 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT,
14365 spec->multiout.dac_nids[0]);
14368 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14370 struct alc_spec *spec = codec->spec;
14373 for (i = 0; i < AUTO_PIN_LAST; i++) {
14374 hda_nid_t nid = spec->autocfg.input_pins[i];
14375 if (nid >= 0x0c && nid <= 0x11)
14376 alc_set_input_pin(codec, nid, i);
14380 /* parse the BIOS configuration and set up the alc_spec */
14381 /* return 1 if successful, 0 if the proper config is not found,
14382 * or a negative error code
14384 static int alc861_parse_auto_config(struct hda_codec *codec)
14386 struct alc_spec *spec = codec->spec;
14388 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14390 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14394 if (!spec->autocfg.line_outs)
14395 return 0; /* can't find valid BIOS pin config */
14397 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14400 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14403 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14406 err = alc861_auto_create_analog_input_ctls(codec, &spec->autocfg);
14410 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14412 if (spec->autocfg.dig_outs)
14413 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14415 if (spec->kctls.list)
14416 add_mixer(spec, spec->kctls.list);
14418 add_verb(spec, alc861_auto_init_verbs);
14420 spec->num_mux_defs = 1;
14421 spec->input_mux = &spec->private_imux[0];
14423 spec->adc_nids = alc861_adc_nids;
14424 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14425 set_capture_mixer(codec);
14427 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14432 /* additional initialization for auto-configuration model */
14433 static void alc861_auto_init(struct hda_codec *codec)
14435 struct alc_spec *spec = codec->spec;
14436 alc861_auto_init_multi_out(codec);
14437 alc861_auto_init_hp_out(codec);
14438 alc861_auto_init_analog_input(codec);
14439 if (spec->unsol_event)
14440 alc_inithook(codec);
14443 #ifdef CONFIG_SND_HDA_POWER_SAVE
14444 static struct hda_amp_list alc861_loopbacks[] = {
14445 { 0x15, HDA_INPUT, 0 },
14446 { 0x15, HDA_INPUT, 1 },
14447 { 0x15, HDA_INPUT, 2 },
14448 { 0x15, HDA_INPUT, 3 },
14455 * configuration and preset
14457 static const char *alc861_models[ALC861_MODEL_LAST] = {
14458 [ALC861_3ST] = "3stack",
14459 [ALC660_3ST] = "3stack-660",
14460 [ALC861_3ST_DIG] = "3stack-dig",
14461 [ALC861_6ST_DIG] = "6stack-dig",
14462 [ALC861_UNIWILL_M31] = "uniwill-m31",
14463 [ALC861_TOSHIBA] = "toshiba",
14464 [ALC861_ASUS] = "asus",
14465 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14466 [ALC861_AUTO] = "auto",
14469 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14470 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14471 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14472 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14473 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14474 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14475 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14476 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14477 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14478 * Any other models that need this preset?
14480 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14481 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14482 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14483 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14484 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14485 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14486 /* FIXME: the below seems conflict */
14487 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14488 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14489 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14493 static struct alc_config_preset alc861_presets[] = {
14495 .mixers = { alc861_3ST_mixer },
14496 .init_verbs = { alc861_threestack_init_verbs },
14497 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14498 .dac_nids = alc861_dac_nids,
14499 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14500 .channel_mode = alc861_threestack_modes,
14502 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14503 .adc_nids = alc861_adc_nids,
14504 .input_mux = &alc861_capture_source,
14506 [ALC861_3ST_DIG] = {
14507 .mixers = { alc861_base_mixer },
14508 .init_verbs = { alc861_threestack_init_verbs },
14509 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14510 .dac_nids = alc861_dac_nids,
14511 .dig_out_nid = ALC861_DIGOUT_NID,
14512 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14513 .channel_mode = alc861_threestack_modes,
14515 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14516 .adc_nids = alc861_adc_nids,
14517 .input_mux = &alc861_capture_source,
14519 [ALC861_6ST_DIG] = {
14520 .mixers = { alc861_base_mixer },
14521 .init_verbs = { alc861_base_init_verbs },
14522 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14523 .dac_nids = alc861_dac_nids,
14524 .dig_out_nid = ALC861_DIGOUT_NID,
14525 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14526 .channel_mode = alc861_8ch_modes,
14527 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14528 .adc_nids = alc861_adc_nids,
14529 .input_mux = &alc861_capture_source,
14532 .mixers = { alc861_3ST_mixer },
14533 .init_verbs = { alc861_threestack_init_verbs },
14534 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14535 .dac_nids = alc660_dac_nids,
14536 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14537 .channel_mode = alc861_threestack_modes,
14539 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14540 .adc_nids = alc861_adc_nids,
14541 .input_mux = &alc861_capture_source,
14543 [ALC861_UNIWILL_M31] = {
14544 .mixers = { alc861_uniwill_m31_mixer },
14545 .init_verbs = { alc861_uniwill_m31_init_verbs },
14546 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14547 .dac_nids = alc861_dac_nids,
14548 .dig_out_nid = ALC861_DIGOUT_NID,
14549 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14550 .channel_mode = alc861_uniwill_m31_modes,
14552 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14553 .adc_nids = alc861_adc_nids,
14554 .input_mux = &alc861_capture_source,
14556 [ALC861_TOSHIBA] = {
14557 .mixers = { alc861_toshiba_mixer },
14558 .init_verbs = { alc861_base_init_verbs,
14559 alc861_toshiba_init_verbs },
14560 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14561 .dac_nids = alc861_dac_nids,
14562 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14563 .channel_mode = alc883_3ST_2ch_modes,
14564 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14565 .adc_nids = alc861_adc_nids,
14566 .input_mux = &alc861_capture_source,
14567 .unsol_event = alc861_toshiba_unsol_event,
14568 .init_hook = alc861_toshiba_automute,
14571 .mixers = { alc861_asus_mixer },
14572 .init_verbs = { alc861_asus_init_verbs },
14573 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14574 .dac_nids = alc861_dac_nids,
14575 .dig_out_nid = ALC861_DIGOUT_NID,
14576 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14577 .channel_mode = alc861_asus_modes,
14580 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14581 .adc_nids = alc861_adc_nids,
14582 .input_mux = &alc861_capture_source,
14584 [ALC861_ASUS_LAPTOP] = {
14585 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14586 .init_verbs = { alc861_asus_init_verbs,
14587 alc861_asus_laptop_init_verbs },
14588 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14589 .dac_nids = alc861_dac_nids,
14590 .dig_out_nid = ALC861_DIGOUT_NID,
14591 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14592 .channel_mode = alc883_3ST_2ch_modes,
14594 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14595 .adc_nids = alc861_adc_nids,
14596 .input_mux = &alc861_capture_source,
14601 static int patch_alc861(struct hda_codec *codec)
14603 struct alc_spec *spec;
14607 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14611 codec->spec = spec;
14613 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14617 if (board_config < 0) {
14618 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14620 board_config = ALC861_AUTO;
14623 if (board_config == ALC861_AUTO) {
14624 /* automatic parse from the BIOS config */
14625 err = alc861_parse_auto_config(codec);
14631 "hda_codec: Cannot set up configuration "
14632 "from BIOS. Using base mode...\n");
14633 board_config = ALC861_3ST_DIG;
14637 err = snd_hda_attach_beep_device(codec, 0x23);
14643 if (board_config != ALC861_AUTO)
14644 setup_preset(codec, &alc861_presets[board_config]);
14646 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14647 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14649 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14650 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14652 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14654 spec->vmaster_nid = 0x03;
14656 codec->patch_ops = alc_patch_ops;
14657 if (board_config == ALC861_AUTO)
14658 spec->init_hook = alc861_auto_init;
14659 #ifdef CONFIG_SND_HDA_POWER_SAVE
14660 if (!spec->loopback.amplist)
14661 spec->loopback.amplist = alc861_loopbacks;
14663 codec->proc_widget_hook = print_realtek_coef;
14669 * ALC861-VD support
14673 * In addition, an independent DAC
14675 #define ALC861VD_DIGOUT_NID 0x06
14677 static hda_nid_t alc861vd_dac_nids[4] = {
14678 /* front, surr, clfe, side surr */
14679 0x02, 0x03, 0x04, 0x05
14682 /* dac_nids for ALC660vd are in a different order - according to
14683 * Realtek's driver.
14684 * This should probably result in a different mixer for 6stack models
14685 * of ALC660vd codecs, but for now there is only 3stack mixer
14686 * - and it is the same as in 861vd.
14687 * adc_nids in ALC660vd are (is) the same as in 861vd
14689 static hda_nid_t alc660vd_dac_nids[3] = {
14690 /* front, rear, clfe, rear_surr */
14694 static hda_nid_t alc861vd_adc_nids[1] = {
14699 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14702 /* FIXME: should be a matrix-type input source selection */
14703 static struct hda_input_mux alc861vd_capture_source = {
14707 { "Front Mic", 0x1 },
14713 static struct hda_input_mux alc861vd_dallas_capture_source = {
14716 { "Ext Mic", 0x0 },
14717 { "Int Mic", 0x1 },
14721 static struct hda_input_mux alc861vd_hp_capture_source = {
14724 { "Front Mic", 0x0 },
14725 { "ATAPI Mic", 0x1 },
14732 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14739 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14740 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14741 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14742 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14743 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14750 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14751 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14752 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14753 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14754 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14758 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14759 { 6, alc861vd_6stack_ch6_init },
14760 { 8, alc861vd_6stack_ch8_init },
14763 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14765 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14766 .name = "Channel Mode",
14767 .info = alc_ch_mode_info,
14768 .get = alc_ch_mode_get,
14769 .put = alc_ch_mode_put,
14774 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14775 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14777 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14778 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14779 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14781 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14782 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14784 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14786 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14788 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14789 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14791 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14792 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14794 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14796 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14798 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14800 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14801 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14802 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14804 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14805 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14807 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14808 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14813 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14814 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14815 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14817 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14819 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14820 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14821 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14823 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14824 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14825 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14827 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14828 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14830 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14831 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14836 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14837 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14838 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14839 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14841 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14843 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14844 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14845 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14847 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14848 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14849 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14851 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14852 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14857 /* Pin assignment: Speaker=0x14, HP = 0x15,
14858 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14860 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14861 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14862 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14863 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14864 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14865 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14866 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14867 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14868 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14869 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14870 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14874 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14875 * Front Mic=0x18, ATAPI Mic = 0x19,
14877 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14878 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14879 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14880 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14881 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14882 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14883 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14884 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14885 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14891 * generic initialization of ADC, input mixers and output mixers
14893 static struct hda_verb alc861vd_volume_init_verbs[] = {
14895 * Unmute ADC0 and set the default input to mic-in
14897 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14898 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14900 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14901 * the analog-loopback mixer widget
14903 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14904 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14905 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14906 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14907 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14908 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14910 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14911 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14912 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14913 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14914 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14917 * Set up output mixers (0x02 - 0x05)
14919 /* set vol=0 to output mixers */
14920 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14921 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14922 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14923 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14925 /* set up input amps for analog loopback */
14926 /* Amp Indices: DAC = 0, mixer = 1 */
14927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14928 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14929 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14930 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14931 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14932 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14933 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14934 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14940 * 3-stack pin configuration:
14941 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14943 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14945 * Set pin mode and muting
14947 /* set front pin widgets 0x14 for output */
14948 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14949 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14950 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14952 /* Mic (rear) pin: input vref at 80% */
14953 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14954 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14955 /* Front Mic pin: input vref at 80% */
14956 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14957 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14958 /* Line In pin: input */
14959 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14960 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14961 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14962 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14963 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14964 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14965 /* CD pin widget for input */
14966 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14972 * 6-stack pin configuration:
14974 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14976 * Set pin mode and muting
14978 /* set front pin widgets 0x14 for output */
14979 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14980 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14981 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14983 /* Rear Pin: output 1 (0x0d) */
14984 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14985 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14986 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14987 /* CLFE Pin: output 2 (0x0e) */
14988 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14989 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14990 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14991 /* Side Pin: output 3 (0x0f) */
14992 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14993 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14994 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14996 /* Mic (rear) pin: input vref at 80% */
14997 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14998 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14999 /* Front Mic pin: input vref at 80% */
15000 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15001 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15002 /* Line In pin: input */
15003 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15004 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15005 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15006 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15007 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15008 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15009 /* CD pin widget for input */
15010 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15015 static struct hda_verb alc861vd_eapd_verbs[] = {
15016 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15020 static struct hda_verb alc660vd_eapd_verbs[] = {
15021 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15022 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15026 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15027 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15028 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15029 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15030 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15031 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15035 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15037 unsigned int present;
15038 unsigned char bits;
15040 present = snd_hda_codec_read(codec, 0x18, 0,
15041 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15042 bits = present ? HDA_AMP_MUTE : 0;
15043 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15044 HDA_AMP_MUTE, bits);
15047 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15049 struct alc_spec *spec = codec->spec;
15051 spec->autocfg.hp_pins[0] = 0x1b;
15052 spec->autocfg.speaker_pins[0] = 0x14;
15053 alc_automute_amp(codec);
15054 alc861vd_lenovo_mic_automute(codec);
15057 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15060 switch (res >> 26) {
15061 case ALC880_MIC_EVENT:
15062 alc861vd_lenovo_mic_automute(codec);
15065 alc_automute_amp_unsol_event(codec, res);
15070 static struct hda_verb alc861vd_dallas_verbs[] = {
15071 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15072 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15073 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15074 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15076 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15077 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15078 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15079 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15080 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15082 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15083 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15085 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15086 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15087 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15088 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15089 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15090 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15091 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15092 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15094 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15095 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15096 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15097 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15098 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15099 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15100 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15101 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15105 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15106 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15108 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15109 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15110 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15115 /* toggle speaker-output according to the hp-jack state */
15116 static void alc861vd_dallas_init_hook(struct hda_codec *codec)
15118 struct alc_spec *spec = codec->spec;
15120 spec->autocfg.hp_pins[0] = 0x15;
15121 spec->autocfg.speaker_pins[0] = 0x14;
15122 alc_automute_amp(codec);
15125 #ifdef CONFIG_SND_HDA_POWER_SAVE
15126 #define alc861vd_loopbacks alc880_loopbacks
15129 /* pcm configuration: identical with ALC880 */
15130 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15131 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15132 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15133 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15136 * configuration and preset
15138 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15139 [ALC660VD_3ST] = "3stack-660",
15140 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15141 [ALC660VD_ASUS_V1S] = "asus-v1s",
15142 [ALC861VD_3ST] = "3stack",
15143 [ALC861VD_3ST_DIG] = "3stack-digout",
15144 [ALC861VD_6ST_DIG] = "6stack-digout",
15145 [ALC861VD_LENOVO] = "lenovo",
15146 [ALC861VD_DALLAS] = "dallas",
15147 [ALC861VD_HP] = "hp",
15148 [ALC861VD_AUTO] = "auto",
15151 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15152 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15153 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15154 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15155 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
15156 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15157 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15158 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15159 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15160 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15161 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15162 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15163 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15164 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15165 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15166 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15170 static struct alc_config_preset alc861vd_presets[] = {
15172 .mixers = { alc861vd_3st_mixer },
15173 .init_verbs = { alc861vd_volume_init_verbs,
15174 alc861vd_3stack_init_verbs },
15175 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15176 .dac_nids = alc660vd_dac_nids,
15177 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15178 .channel_mode = alc861vd_3stack_2ch_modes,
15179 .input_mux = &alc861vd_capture_source,
15181 [ALC660VD_3ST_DIG] = {
15182 .mixers = { alc861vd_3st_mixer },
15183 .init_verbs = { alc861vd_volume_init_verbs,
15184 alc861vd_3stack_init_verbs },
15185 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15186 .dac_nids = alc660vd_dac_nids,
15187 .dig_out_nid = ALC861VD_DIGOUT_NID,
15188 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15189 .channel_mode = alc861vd_3stack_2ch_modes,
15190 .input_mux = &alc861vd_capture_source,
15193 .mixers = { alc861vd_3st_mixer },
15194 .init_verbs = { alc861vd_volume_init_verbs,
15195 alc861vd_3stack_init_verbs },
15196 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15197 .dac_nids = alc861vd_dac_nids,
15198 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15199 .channel_mode = alc861vd_3stack_2ch_modes,
15200 .input_mux = &alc861vd_capture_source,
15202 [ALC861VD_3ST_DIG] = {
15203 .mixers = { alc861vd_3st_mixer },
15204 .init_verbs = { alc861vd_volume_init_verbs,
15205 alc861vd_3stack_init_verbs },
15206 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15207 .dac_nids = alc861vd_dac_nids,
15208 .dig_out_nid = ALC861VD_DIGOUT_NID,
15209 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15210 .channel_mode = alc861vd_3stack_2ch_modes,
15211 .input_mux = &alc861vd_capture_source,
15213 [ALC861VD_6ST_DIG] = {
15214 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15215 .init_verbs = { alc861vd_volume_init_verbs,
15216 alc861vd_6stack_init_verbs },
15217 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15218 .dac_nids = alc861vd_dac_nids,
15219 .dig_out_nid = ALC861VD_DIGOUT_NID,
15220 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15221 .channel_mode = alc861vd_6stack_modes,
15222 .input_mux = &alc861vd_capture_source,
15224 [ALC861VD_LENOVO] = {
15225 .mixers = { alc861vd_lenovo_mixer },
15226 .init_verbs = { alc861vd_volume_init_verbs,
15227 alc861vd_3stack_init_verbs,
15228 alc861vd_eapd_verbs,
15229 alc861vd_lenovo_unsol_verbs },
15230 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15231 .dac_nids = alc660vd_dac_nids,
15232 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15233 .channel_mode = alc861vd_3stack_2ch_modes,
15234 .input_mux = &alc861vd_capture_source,
15235 .unsol_event = alc861vd_lenovo_unsol_event,
15236 .init_hook = alc861vd_lenovo_init_hook,
15238 [ALC861VD_DALLAS] = {
15239 .mixers = { alc861vd_dallas_mixer },
15240 .init_verbs = { alc861vd_dallas_verbs },
15241 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15242 .dac_nids = alc861vd_dac_nids,
15243 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15244 .channel_mode = alc861vd_3stack_2ch_modes,
15245 .input_mux = &alc861vd_dallas_capture_source,
15246 .unsol_event = alc_automute_amp_unsol_event,
15247 .init_hook = alc861vd_dallas_init_hook,
15250 .mixers = { alc861vd_hp_mixer },
15251 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15252 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15253 .dac_nids = alc861vd_dac_nids,
15254 .dig_out_nid = ALC861VD_DIGOUT_NID,
15255 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15256 .channel_mode = alc861vd_3stack_2ch_modes,
15257 .input_mux = &alc861vd_hp_capture_source,
15258 .unsol_event = alc_automute_amp_unsol_event,
15259 .init_hook = alc861vd_dallas_init_hook,
15261 [ALC660VD_ASUS_V1S] = {
15262 .mixers = { alc861vd_lenovo_mixer },
15263 .init_verbs = { alc861vd_volume_init_verbs,
15264 alc861vd_3stack_init_verbs,
15265 alc861vd_eapd_verbs,
15266 alc861vd_lenovo_unsol_verbs },
15267 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15268 .dac_nids = alc660vd_dac_nids,
15269 .dig_out_nid = ALC861VD_DIGOUT_NID,
15270 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15271 .channel_mode = alc861vd_3stack_2ch_modes,
15272 .input_mux = &alc861vd_capture_source,
15273 .unsol_event = alc861vd_lenovo_unsol_event,
15274 .init_hook = alc861vd_lenovo_init_hook,
15279 * BIOS auto configuration
15281 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15282 hda_nid_t nid, int pin_type, int dac_idx)
15284 alc_set_pin_output(codec, nid, pin_type);
15287 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15289 struct alc_spec *spec = codec->spec;
15292 for (i = 0; i <= HDA_SIDE; i++) {
15293 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15294 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15296 alc861vd_auto_set_output_and_unmute(codec, nid,
15302 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15304 struct alc_spec *spec = codec->spec;
15307 pin = spec->autocfg.hp_pins[0];
15308 if (pin) /* connect to front and use dac 0 */
15309 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15310 pin = spec->autocfg.speaker_pins[0];
15312 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15315 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
15316 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15318 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15320 struct alc_spec *spec = codec->spec;
15323 for (i = 0; i < AUTO_PIN_LAST; i++) {
15324 hda_nid_t nid = spec->autocfg.input_pins[i];
15325 if (alc861vd_is_input_pin(nid)) {
15326 alc_set_input_pin(codec, nid, i);
15327 if (nid != ALC861VD_PIN_CD_NID &&
15328 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15329 snd_hda_codec_write(codec, nid, 0,
15330 AC_VERB_SET_AMP_GAIN_MUTE,
15336 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15338 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15339 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15341 /* add playback controls from the parsed DAC table */
15342 /* Based on ALC880 version. But ALC861VD has separate,
15343 * different NIDs for mute/unmute switch and volume control */
15344 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15345 const struct auto_pin_cfg *cfg)
15348 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15349 hda_nid_t nid_v, nid_s;
15352 for (i = 0; i < cfg->line_outs; i++) {
15353 if (!spec->multiout.dac_nids[i])
15355 nid_v = alc861vd_idx_to_mixer_vol(
15357 spec->multiout.dac_nids[i]));
15358 nid_s = alc861vd_idx_to_mixer_switch(
15360 spec->multiout.dac_nids[i]));
15364 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15365 "Center Playback Volume",
15366 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15370 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15371 "LFE Playback Volume",
15372 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15376 err = add_control(spec, ALC_CTL_BIND_MUTE,
15377 "Center Playback Switch",
15378 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15382 err = add_control(spec, ALC_CTL_BIND_MUTE,
15383 "LFE Playback Switch",
15384 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15389 sprintf(name, "%s Playback Volume", chname[i]);
15390 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15391 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15395 sprintf(name, "%s Playback Switch", chname[i]);
15396 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15397 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15406 /* add playback controls for speaker and HP outputs */
15407 /* Based on ALC880 version. But ALC861VD has separate,
15408 * different NIDs for mute/unmute switch and volume control */
15409 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15410 hda_nid_t pin, const char *pfx)
15412 hda_nid_t nid_v, nid_s;
15419 if (alc880_is_fixed_pin(pin)) {
15420 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15421 /* specify the DAC as the extra output */
15422 if (!spec->multiout.hp_nid)
15423 spec->multiout.hp_nid = nid_v;
15425 spec->multiout.extra_out_nid[0] = nid_v;
15426 /* control HP volume/switch on the output mixer amp */
15427 nid_v = alc861vd_idx_to_mixer_vol(
15428 alc880_fixed_pin_idx(pin));
15429 nid_s = alc861vd_idx_to_mixer_switch(
15430 alc880_fixed_pin_idx(pin));
15432 sprintf(name, "%s Playback Volume", pfx);
15433 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15434 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15437 sprintf(name, "%s Playback Switch", pfx);
15438 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15439 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15442 } else if (alc880_is_multi_pin(pin)) {
15443 /* set manual connection */
15444 /* we have only a switch on HP-out PIN */
15445 sprintf(name, "%s Playback Switch", pfx);
15446 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15447 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15454 /* parse the BIOS configuration and set up the alc_spec
15455 * return 1 if successful, 0 if the proper config is not found,
15456 * or a negative error code
15457 * Based on ALC880 version - had to change it to override
15458 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15459 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15461 struct alc_spec *spec = codec->spec;
15463 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15465 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15469 if (!spec->autocfg.line_outs)
15470 return 0; /* can't find valid BIOS pin config */
15472 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15475 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15478 err = alc861vd_auto_create_extra_out(spec,
15479 spec->autocfg.speaker_pins[0],
15483 err = alc861vd_auto_create_extra_out(spec,
15484 spec->autocfg.hp_pins[0],
15488 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15492 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15494 if (spec->autocfg.dig_outs)
15495 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15497 if (spec->kctls.list)
15498 add_mixer(spec, spec->kctls.list);
15500 add_verb(spec, alc861vd_volume_init_verbs);
15502 spec->num_mux_defs = 1;
15503 spec->input_mux = &spec->private_imux[0];
15505 err = alc_auto_add_mic_boost(codec);
15509 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15514 /* additional initialization for auto-configuration model */
15515 static void alc861vd_auto_init(struct hda_codec *codec)
15517 struct alc_spec *spec = codec->spec;
15518 alc861vd_auto_init_multi_out(codec);
15519 alc861vd_auto_init_hp_out(codec);
15520 alc861vd_auto_init_analog_input(codec);
15521 alc861vd_auto_init_input_src(codec);
15522 if (spec->unsol_event)
15523 alc_inithook(codec);
15526 static int patch_alc861vd(struct hda_codec *codec)
15528 struct alc_spec *spec;
15529 int err, board_config;
15531 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15535 codec->spec = spec;
15537 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15541 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15542 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15544 board_config = ALC861VD_AUTO;
15547 if (board_config == ALC861VD_AUTO) {
15548 /* automatic parse from the BIOS config */
15549 err = alc861vd_parse_auto_config(codec);
15555 "hda_codec: Cannot set up configuration "
15556 "from BIOS. Using base mode...\n");
15557 board_config = ALC861VD_3ST;
15561 err = snd_hda_attach_beep_device(codec, 0x23);
15567 if (board_config != ALC861VD_AUTO)
15568 setup_preset(codec, &alc861vd_presets[board_config]);
15570 if (codec->vendor_id == 0x10ec0660) {
15571 /* always turn on EAPD */
15572 add_verb(spec, alc660vd_eapd_verbs);
15575 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15576 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15578 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15579 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15581 if (!spec->adc_nids) {
15582 spec->adc_nids = alc861vd_adc_nids;
15583 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15585 if (!spec->capsrc_nids)
15586 spec->capsrc_nids = alc861vd_capsrc_nids;
15588 set_capture_mixer(codec);
15589 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15591 spec->vmaster_nid = 0x02;
15593 codec->patch_ops = alc_patch_ops;
15595 if (board_config == ALC861VD_AUTO)
15596 spec->init_hook = alc861vd_auto_init;
15597 #ifdef CONFIG_SND_HDA_POWER_SAVE
15598 if (!spec->loopback.amplist)
15599 spec->loopback.amplist = alc861vd_loopbacks;
15601 codec->proc_widget_hook = print_realtek_coef;
15609 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15610 * configuration. Each pin widget can choose any input DACs and a mixer.
15611 * Each ADC is connected from a mixer of all inputs. This makes possible
15612 * 6-channel independent captures.
15614 * In addition, an independent DAC for the multi-playback (not used in this
15617 #define ALC662_DIGOUT_NID 0x06
15618 #define ALC662_DIGIN_NID 0x0a
15620 static hda_nid_t alc662_dac_nids[4] = {
15621 /* front, rear, clfe, rear_surr */
15625 static hda_nid_t alc272_dac_nids[2] = {
15629 static hda_nid_t alc662_adc_nids[2] = {
15634 static hda_nid_t alc272_adc_nids[1] = {
15639 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15640 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15644 /* FIXME: should be a matrix-type input source selection */
15645 static struct hda_input_mux alc662_capture_source = {
15649 { "Front Mic", 0x1 },
15655 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15663 static struct hda_input_mux alc662_eeepc_capture_source = {
15671 static struct hda_input_mux alc663_capture_source = {
15675 { "Front Mic", 0x1 },
15680 static struct hda_input_mux alc663_m51va_capture_source = {
15683 { "Ext-Mic", 0x0 },
15688 #if 1 /* set to 0 for testing other input sources below */
15689 static struct hda_input_mux alc272_nc10_capture_source = {
15692 { "Autoselect Mic", 0x0 },
15693 { "Internal Mic", 0x1 },
15697 static struct hda_input_mux alc272_nc10_capture_source = {
15700 { "Autoselect Mic", 0x0 },
15701 { "Internal Mic", 0x1 },
15702 { "In-0x02", 0x2 },
15703 { "In-0x03", 0x3 },
15704 { "In-0x04", 0x4 },
15705 { "In-0x05", 0x5 },
15706 { "In-0x06", 0x6 },
15707 { "In-0x07", 0x7 },
15708 { "In-0x08", 0x8 },
15709 { "In-0x09", 0x9 },
15710 { "In-0x0a", 0x0a },
15711 { "In-0x0b", 0x0b },
15712 { "In-0x0c", 0x0c },
15713 { "In-0x0d", 0x0d },
15714 { "In-0x0e", 0x0e },
15715 { "In-0x0f", 0x0f },
15723 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15730 static struct hda_verb alc662_3ST_ch2_init[] = {
15731 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15732 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15733 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15734 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15741 static struct hda_verb alc662_3ST_ch6_init[] = {
15742 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15743 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15744 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15745 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15746 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15747 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15751 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15752 { 2, alc662_3ST_ch2_init },
15753 { 6, alc662_3ST_ch6_init },
15759 static struct hda_verb alc662_sixstack_ch6_init[] = {
15760 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15761 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15762 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15769 static struct hda_verb alc662_sixstack_ch8_init[] = {
15770 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15771 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15772 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15776 static struct hda_channel_mode alc662_5stack_modes[2] = {
15777 { 2, alc662_sixstack_ch6_init },
15778 { 6, alc662_sixstack_ch8_init },
15781 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15782 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15785 static struct snd_kcontrol_new alc662_base_mixer[] = {
15786 /* output mixer control */
15787 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15788 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15789 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15790 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15791 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15792 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15793 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15794 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15795 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15797 /*Input mixer control */
15798 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15799 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15800 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15801 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15802 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15803 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15804 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15805 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15809 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15810 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15811 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15812 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15813 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15814 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15815 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15816 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15817 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15818 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15819 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15820 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15824 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15825 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15826 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15827 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15828 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15829 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15830 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15831 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15832 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15833 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15834 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15835 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15836 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15837 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15838 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15839 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15840 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15841 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15845 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15846 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15847 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15848 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15849 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15850 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15851 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15852 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15853 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15854 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15858 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15859 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15860 ALC262_HIPPO_MASTER_SWITCH,
15862 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15863 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15864 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15866 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15867 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15868 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15872 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15873 ALC262_HIPPO_MASTER_SWITCH,
15874 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15875 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15876 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15877 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15878 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15879 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15880 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15881 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15882 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15886 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15887 .ops = &snd_hda_bind_vol,
15889 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15890 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15895 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15896 .ops = &snd_hda_bind_sw,
15898 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15899 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15904 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15905 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15906 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15908 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15912 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15913 .ops = &snd_hda_bind_sw,
15915 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15916 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15917 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15922 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15923 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15924 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15925 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15926 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15927 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15928 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15933 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15934 .ops = &snd_hda_bind_sw,
15936 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15937 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15938 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15943 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15944 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15945 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15946 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15947 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15948 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15949 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15953 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15954 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15955 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15956 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15957 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15958 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15959 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15960 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15964 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15965 .ops = &snd_hda_bind_vol,
15967 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15968 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15973 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15974 .ops = &snd_hda_bind_sw,
15976 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15977 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15982 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15983 HDA_BIND_VOL("Master Playback Volume",
15984 &alc663_asus_two_bind_master_vol),
15985 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15986 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15987 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15988 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15989 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15993 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15994 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15995 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15996 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15997 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15998 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15999 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16003 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16004 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16005 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16006 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16007 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16008 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16010 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16011 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16012 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16013 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16017 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16018 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16019 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16020 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16022 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16023 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16024 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16025 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16026 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16027 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16031 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16033 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16034 .name = "Channel Mode",
16035 .info = alc_ch_mode_info,
16036 .get = alc_ch_mode_get,
16037 .put = alc_ch_mode_put,
16042 static struct hda_verb alc662_init_verbs[] = {
16043 /* ADC: mute amp left and right */
16044 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16045 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16046 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16048 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16049 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16050 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16051 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16052 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16054 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16055 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16056 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16057 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16058 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16059 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16061 /* Front Pin: output 0 (0x0c) */
16062 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16063 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16065 /* Rear Pin: output 1 (0x0d) */
16066 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16069 /* CLFE Pin: output 2 (0x0e) */
16070 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16071 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16073 /* Mic (rear) pin: input vref at 80% */
16074 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16075 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16076 /* Front Mic pin: input vref at 80% */
16077 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16078 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16079 /* Line In pin: input */
16080 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16081 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16082 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16083 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16084 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16085 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16086 /* CD pin widget for input */
16087 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16089 /* FIXME: use matrix-type input source selection */
16090 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16092 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16093 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16095 /* always trun on EAPD */
16096 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16097 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16102 static struct hda_verb alc662_sue_init_verbs[] = {
16103 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16104 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16108 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16109 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16110 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16114 /* Set Unsolicited Event*/
16115 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16116 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16117 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16122 * generic initialization of ADC, input mixers and output mixers
16124 static struct hda_verb alc662_auto_init_verbs[] = {
16126 * Unmute ADC and set the default input to mic-in
16128 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16129 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16131 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16133 * Note: PASD motherboards uses the Line In 2 as the input for front
16134 * panel mic (mic 2)
16136 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16137 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16138 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16139 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16140 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16141 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16144 * Set up output mixers (0x0c - 0x0f)
16146 /* set vol=0 to output mixers */
16147 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16148 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16149 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16151 /* set up input amps for analog loopback */
16152 /* Amp Indices: DAC = 0, mixer = 1 */
16153 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16154 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16155 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16156 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16157 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16158 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16161 /* FIXME: use matrix-type input source selection */
16162 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16164 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16165 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16169 /* additional verbs for ALC663 */
16170 static struct hda_verb alc663_auto_init_verbs[] = {
16171 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16172 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16176 static struct hda_verb alc663_m51va_init_verbs[] = {
16177 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16178 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16179 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16180 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16181 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16182 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16183 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16184 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16185 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16189 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16190 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16191 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16192 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16193 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16194 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16195 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16196 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16200 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16201 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16202 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16203 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16204 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16206 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16207 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16208 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16212 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16213 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16214 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16215 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16216 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16217 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16218 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16219 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16223 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16224 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16225 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16226 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16227 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16228 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16229 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16230 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16231 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16232 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16233 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16234 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16235 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16239 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16240 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16241 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16242 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16243 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16244 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16245 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16246 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16247 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16248 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16249 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16250 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16251 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16255 static struct hda_verb alc663_g71v_init_verbs[] = {
16256 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16257 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16258 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16260 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16261 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16262 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16264 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16265 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16266 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16270 static struct hda_verb alc663_g50v_init_verbs[] = {
16271 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16272 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16273 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16275 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16276 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16280 static struct hda_verb alc662_ecs_init_verbs[] = {
16281 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16282 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16283 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16284 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16288 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16289 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16290 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16291 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16292 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16293 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16294 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16295 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16296 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16297 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16298 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16299 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16303 static struct hda_verb alc272_dell_init_verbs[] = {
16304 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16305 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16306 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16307 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16308 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16309 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16310 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16311 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16312 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16313 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16314 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16318 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16319 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16320 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16324 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16325 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16326 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16330 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16332 unsigned int present;
16333 unsigned char bits;
16335 present = snd_hda_codec_read(codec, 0x14, 0,
16336 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16337 bits = present ? HDA_AMP_MUTE : 0;
16338 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16339 HDA_AMP_MUTE, bits);
16342 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16344 unsigned int present;
16345 unsigned char bits;
16347 present = snd_hda_codec_read(codec, 0x1b, 0,
16348 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16349 bits = present ? HDA_AMP_MUTE : 0;
16350 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16351 HDA_AMP_MUTE, bits);
16352 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16353 HDA_AMP_MUTE, bits);
16356 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16359 if ((res >> 26) == ALC880_HP_EVENT)
16360 alc662_lenovo_101e_all_automute(codec);
16361 if ((res >> 26) == ALC880_FRONT_EVENT)
16362 alc662_lenovo_101e_ispeaker_automute(codec);
16365 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
16367 unsigned int present;
16369 present = snd_hda_codec_read(codec, 0x18, 0,
16370 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16371 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16372 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16373 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16374 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16375 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16376 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16377 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16378 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16381 /* unsolicited event for HP jack sensing */
16382 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16385 if ((res >> 26) == ALC880_MIC_EVENT)
16386 alc662_eeepc_mic_automute(codec);
16388 alc262_hippo_unsol_event(codec, res);
16391 static void alc662_eeepc_inithook(struct hda_codec *codec)
16393 alc262_hippo1_init_hook(codec);
16394 alc662_eeepc_mic_automute(codec);
16397 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
16399 struct alc_spec *spec = codec->spec;
16401 spec->autocfg.hp_pins[0] = 0x14;
16402 spec->autocfg.speaker_pins[0] = 0x1b;
16403 alc262_hippo_master_update(codec);
16406 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16408 unsigned int present;
16409 unsigned char bits;
16411 present = snd_hda_codec_read(codec, 0x21, 0,
16412 AC_VERB_GET_PIN_SENSE, 0)
16413 & AC_PINSENSE_PRESENCE;
16414 bits = present ? HDA_AMP_MUTE : 0;
16415 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16416 AMP_IN_MUTE(0), bits);
16417 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16418 AMP_IN_MUTE(0), bits);
16421 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16423 unsigned int present;
16424 unsigned char bits;
16426 present = snd_hda_codec_read(codec, 0x21, 0,
16427 AC_VERB_GET_PIN_SENSE, 0)
16428 & AC_PINSENSE_PRESENCE;
16429 bits = present ? HDA_AMP_MUTE : 0;
16430 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16431 AMP_IN_MUTE(0), bits);
16432 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16433 AMP_IN_MUTE(0), bits);
16434 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16435 AMP_IN_MUTE(0), bits);
16436 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16437 AMP_IN_MUTE(0), bits);
16440 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16442 unsigned int present;
16443 unsigned char bits;
16445 present = snd_hda_codec_read(codec, 0x15, 0,
16446 AC_VERB_GET_PIN_SENSE, 0)
16447 & AC_PINSENSE_PRESENCE;
16448 bits = present ? HDA_AMP_MUTE : 0;
16449 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16450 AMP_IN_MUTE(0), bits);
16451 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16452 AMP_IN_MUTE(0), bits);
16453 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16454 AMP_IN_MUTE(0), bits);
16455 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16456 AMP_IN_MUTE(0), bits);
16459 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16461 unsigned int present;
16462 unsigned char bits;
16464 present = snd_hda_codec_read(codec, 0x1b, 0,
16465 AC_VERB_GET_PIN_SENSE, 0)
16466 & AC_PINSENSE_PRESENCE;
16467 bits = present ? 0 : PIN_OUT;
16468 snd_hda_codec_write(codec, 0x14, 0,
16469 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16472 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16474 unsigned int present1, present2;
16476 present1 = snd_hda_codec_read(codec, 0x21, 0,
16477 AC_VERB_GET_PIN_SENSE, 0)
16478 & AC_PINSENSE_PRESENCE;
16479 present2 = snd_hda_codec_read(codec, 0x15, 0,
16480 AC_VERB_GET_PIN_SENSE, 0)
16481 & AC_PINSENSE_PRESENCE;
16483 if (present1 || present2) {
16484 snd_hda_codec_write_cache(codec, 0x14, 0,
16485 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16487 snd_hda_codec_write_cache(codec, 0x14, 0,
16488 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16492 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16494 unsigned int present1, present2;
16496 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16497 AC_VERB_GET_PIN_SENSE, 0)
16498 & AC_PINSENSE_PRESENCE;
16499 present2 = snd_hda_codec_read(codec, 0x15, 0,
16500 AC_VERB_GET_PIN_SENSE, 0)
16501 & AC_PINSENSE_PRESENCE;
16503 if (present1 || present2) {
16504 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16505 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16506 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16507 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16509 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16510 AMP_IN_MUTE(0), 0);
16511 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16512 AMP_IN_MUTE(0), 0);
16516 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16518 unsigned int present;
16520 present = snd_hda_codec_read(codec, 0x18, 0,
16521 AC_VERB_GET_PIN_SENSE, 0)
16522 & AC_PINSENSE_PRESENCE;
16523 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16524 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16525 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16526 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16527 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16528 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16529 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16530 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16533 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16536 switch (res >> 26) {
16537 case ALC880_HP_EVENT:
16538 alc663_m51va_speaker_automute(codec);
16540 case ALC880_MIC_EVENT:
16541 alc663_m51va_mic_automute(codec);
16546 static void alc663_m51va_inithook(struct hda_codec *codec)
16548 alc663_m51va_speaker_automute(codec);
16549 alc663_m51va_mic_automute(codec);
16552 /* ***************** Mode1 ******************************/
16553 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16556 switch (res >> 26) {
16557 case ALC880_HP_EVENT:
16558 alc663_m51va_speaker_automute(codec);
16560 case ALC880_MIC_EVENT:
16561 alc662_eeepc_mic_automute(codec);
16566 static void alc663_mode1_inithook(struct hda_codec *codec)
16568 alc663_m51va_speaker_automute(codec);
16569 alc662_eeepc_mic_automute(codec);
16571 /* ***************** Mode2 ******************************/
16572 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16575 switch (res >> 26) {
16576 case ALC880_HP_EVENT:
16577 alc662_f5z_speaker_automute(codec);
16579 case ALC880_MIC_EVENT:
16580 alc662_eeepc_mic_automute(codec);
16585 static void alc662_mode2_inithook(struct hda_codec *codec)
16587 alc662_f5z_speaker_automute(codec);
16588 alc662_eeepc_mic_automute(codec);
16590 /* ***************** Mode3 ******************************/
16591 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16594 switch (res >> 26) {
16595 case ALC880_HP_EVENT:
16596 alc663_two_hp_m1_speaker_automute(codec);
16598 case ALC880_MIC_EVENT:
16599 alc662_eeepc_mic_automute(codec);
16604 static void alc663_mode3_inithook(struct hda_codec *codec)
16606 alc663_two_hp_m1_speaker_automute(codec);
16607 alc662_eeepc_mic_automute(codec);
16609 /* ***************** Mode4 ******************************/
16610 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16613 switch (res >> 26) {
16614 case ALC880_HP_EVENT:
16615 alc663_21jd_two_speaker_automute(codec);
16617 case ALC880_MIC_EVENT:
16618 alc662_eeepc_mic_automute(codec);
16623 static void alc663_mode4_inithook(struct hda_codec *codec)
16625 alc663_21jd_two_speaker_automute(codec);
16626 alc662_eeepc_mic_automute(codec);
16628 /* ***************** Mode5 ******************************/
16629 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16632 switch (res >> 26) {
16633 case ALC880_HP_EVENT:
16634 alc663_15jd_two_speaker_automute(codec);
16636 case ALC880_MIC_EVENT:
16637 alc662_eeepc_mic_automute(codec);
16642 static void alc663_mode5_inithook(struct hda_codec *codec)
16644 alc663_15jd_two_speaker_automute(codec);
16645 alc662_eeepc_mic_automute(codec);
16647 /* ***************** Mode6 ******************************/
16648 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16651 switch (res >> 26) {
16652 case ALC880_HP_EVENT:
16653 alc663_two_hp_m2_speaker_automute(codec);
16655 case ALC880_MIC_EVENT:
16656 alc662_eeepc_mic_automute(codec);
16661 static void alc663_mode6_inithook(struct hda_codec *codec)
16663 alc663_two_hp_m2_speaker_automute(codec);
16664 alc662_eeepc_mic_automute(codec);
16667 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16669 unsigned int present;
16670 unsigned char bits;
16672 present = snd_hda_codec_read(codec, 0x21, 0,
16673 AC_VERB_GET_PIN_SENSE, 0)
16674 & AC_PINSENSE_PRESENCE;
16675 bits = present ? HDA_AMP_MUTE : 0;
16676 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16677 HDA_AMP_MUTE, bits);
16678 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16679 HDA_AMP_MUTE, bits);
16682 static void alc663_g71v_front_automute(struct hda_codec *codec)
16684 unsigned int present;
16685 unsigned char bits;
16687 present = snd_hda_codec_read(codec, 0x15, 0,
16688 AC_VERB_GET_PIN_SENSE, 0)
16689 & AC_PINSENSE_PRESENCE;
16690 bits = present ? HDA_AMP_MUTE : 0;
16691 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16692 HDA_AMP_MUTE, bits);
16695 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16698 switch (res >> 26) {
16699 case ALC880_HP_EVENT:
16700 alc663_g71v_hp_automute(codec);
16702 case ALC880_FRONT_EVENT:
16703 alc663_g71v_front_automute(codec);
16705 case ALC880_MIC_EVENT:
16706 alc662_eeepc_mic_automute(codec);
16711 static void alc663_g71v_inithook(struct hda_codec *codec)
16713 alc663_g71v_front_automute(codec);
16714 alc663_g71v_hp_automute(codec);
16715 alc662_eeepc_mic_automute(codec);
16718 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16721 switch (res >> 26) {
16722 case ALC880_HP_EVENT:
16723 alc663_m51va_speaker_automute(codec);
16725 case ALC880_MIC_EVENT:
16726 alc662_eeepc_mic_automute(codec);
16731 static void alc663_g50v_inithook(struct hda_codec *codec)
16733 alc663_m51va_speaker_automute(codec);
16734 alc662_eeepc_mic_automute(codec);
16737 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16738 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16739 ALC262_HIPPO_MASTER_SWITCH,
16741 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16742 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16743 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16745 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16746 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16747 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16751 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16752 /* Master Playback automatically created from Speaker and Headphone */
16753 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16754 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16755 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16756 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16758 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16759 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16760 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16762 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16763 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16764 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16768 #ifdef CONFIG_SND_HDA_POWER_SAVE
16769 #define alc662_loopbacks alc880_loopbacks
16773 /* pcm configuration: identical with ALC880 */
16774 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16775 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16776 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16777 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16780 * configuration and preset
16782 static const char *alc662_models[ALC662_MODEL_LAST] = {
16783 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16784 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16785 [ALC662_3ST_6ch] = "3stack-6ch",
16786 [ALC662_5ST_DIG] = "6stack-dig",
16787 [ALC662_LENOVO_101E] = "lenovo-101e",
16788 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16789 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16790 [ALC662_ECS] = "ecs",
16791 [ALC663_ASUS_M51VA] = "m51va",
16792 [ALC663_ASUS_G71V] = "g71v",
16793 [ALC663_ASUS_H13] = "h13",
16794 [ALC663_ASUS_G50V] = "g50v",
16795 [ALC663_ASUS_MODE1] = "asus-mode1",
16796 [ALC662_ASUS_MODE2] = "asus-mode2",
16797 [ALC663_ASUS_MODE3] = "asus-mode3",
16798 [ALC663_ASUS_MODE4] = "asus-mode4",
16799 [ALC663_ASUS_MODE5] = "asus-mode5",
16800 [ALC663_ASUS_MODE6] = "asus-mode6",
16801 [ALC272_DELL] = "dell",
16802 [ALC272_DELL_ZM1] = "dell-zm1",
16803 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16804 [ALC662_AUTO] = "auto",
16807 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16808 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16809 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16810 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16811 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16812 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16813 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16814 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16815 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16816 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16817 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16818 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16819 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16820 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16821 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16822 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16823 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16824 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16825 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16826 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16827 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16828 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16829 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16830 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16831 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16832 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16833 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16834 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16835 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16836 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16837 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16838 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16839 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16840 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16841 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16842 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16843 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16844 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16845 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16846 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16847 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16848 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16849 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16850 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16851 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16852 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16853 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16854 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16855 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16856 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16857 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16858 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16859 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16860 ALC662_3ST_6ch_DIG),
16861 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16862 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16863 ALC662_3ST_6ch_DIG),
16864 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16865 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16866 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16867 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16868 ALC662_3ST_6ch_DIG),
16869 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16874 static struct alc_config_preset alc662_presets[] = {
16875 [ALC662_3ST_2ch_DIG] = {
16876 .mixers = { alc662_3ST_2ch_mixer },
16877 .init_verbs = { alc662_init_verbs },
16878 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16879 .dac_nids = alc662_dac_nids,
16880 .dig_out_nid = ALC662_DIGOUT_NID,
16881 .dig_in_nid = ALC662_DIGIN_NID,
16882 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16883 .channel_mode = alc662_3ST_2ch_modes,
16884 .input_mux = &alc662_capture_source,
16886 [ALC662_3ST_6ch_DIG] = {
16887 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16888 .init_verbs = { alc662_init_verbs },
16889 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16890 .dac_nids = alc662_dac_nids,
16891 .dig_out_nid = ALC662_DIGOUT_NID,
16892 .dig_in_nid = ALC662_DIGIN_NID,
16893 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16894 .channel_mode = alc662_3ST_6ch_modes,
16896 .input_mux = &alc662_capture_source,
16898 [ALC662_3ST_6ch] = {
16899 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16900 .init_verbs = { alc662_init_verbs },
16901 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16902 .dac_nids = alc662_dac_nids,
16903 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16904 .channel_mode = alc662_3ST_6ch_modes,
16906 .input_mux = &alc662_capture_source,
16908 [ALC662_5ST_DIG] = {
16909 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16910 .init_verbs = { alc662_init_verbs },
16911 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16912 .dac_nids = alc662_dac_nids,
16913 .dig_out_nid = ALC662_DIGOUT_NID,
16914 .dig_in_nid = ALC662_DIGIN_NID,
16915 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16916 .channel_mode = alc662_5stack_modes,
16917 .input_mux = &alc662_capture_source,
16919 [ALC662_LENOVO_101E] = {
16920 .mixers = { alc662_lenovo_101e_mixer },
16921 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16922 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16923 .dac_nids = alc662_dac_nids,
16924 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16925 .channel_mode = alc662_3ST_2ch_modes,
16926 .input_mux = &alc662_lenovo_101e_capture_source,
16927 .unsol_event = alc662_lenovo_101e_unsol_event,
16928 .init_hook = alc662_lenovo_101e_all_automute,
16930 [ALC662_ASUS_EEEPC_P701] = {
16931 .mixers = { alc662_eeepc_p701_mixer },
16932 .init_verbs = { alc662_init_verbs,
16933 alc662_eeepc_sue_init_verbs },
16934 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16935 .dac_nids = alc662_dac_nids,
16936 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16937 .channel_mode = alc662_3ST_2ch_modes,
16938 .input_mux = &alc662_eeepc_capture_source,
16939 .unsol_event = alc662_eeepc_unsol_event,
16940 .init_hook = alc662_eeepc_inithook,
16942 [ALC662_ASUS_EEEPC_EP20] = {
16943 .mixers = { alc662_eeepc_ep20_mixer,
16944 alc662_chmode_mixer },
16945 .init_verbs = { alc662_init_verbs,
16946 alc662_eeepc_ep20_sue_init_verbs },
16947 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16948 .dac_nids = alc662_dac_nids,
16949 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16950 .channel_mode = alc662_3ST_6ch_modes,
16951 .input_mux = &alc662_lenovo_101e_capture_source,
16952 .unsol_event = alc662_eeepc_unsol_event,
16953 .init_hook = alc662_eeepc_ep20_inithook,
16956 .mixers = { alc662_ecs_mixer },
16957 .init_verbs = { alc662_init_verbs,
16958 alc662_ecs_init_verbs },
16959 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16960 .dac_nids = alc662_dac_nids,
16961 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16962 .channel_mode = alc662_3ST_2ch_modes,
16963 .input_mux = &alc662_eeepc_capture_source,
16964 .unsol_event = alc662_eeepc_unsol_event,
16965 .init_hook = alc662_eeepc_inithook,
16967 [ALC663_ASUS_M51VA] = {
16968 .mixers = { alc663_m51va_mixer },
16969 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16970 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16971 .dac_nids = alc662_dac_nids,
16972 .dig_out_nid = ALC662_DIGOUT_NID,
16973 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16974 .channel_mode = alc662_3ST_2ch_modes,
16975 .input_mux = &alc663_m51va_capture_source,
16976 .unsol_event = alc663_m51va_unsol_event,
16977 .init_hook = alc663_m51va_inithook,
16979 [ALC663_ASUS_G71V] = {
16980 .mixers = { alc663_g71v_mixer },
16981 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16982 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16983 .dac_nids = alc662_dac_nids,
16984 .dig_out_nid = ALC662_DIGOUT_NID,
16985 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16986 .channel_mode = alc662_3ST_2ch_modes,
16987 .input_mux = &alc662_eeepc_capture_source,
16988 .unsol_event = alc663_g71v_unsol_event,
16989 .init_hook = alc663_g71v_inithook,
16991 [ALC663_ASUS_H13] = {
16992 .mixers = { alc663_m51va_mixer },
16993 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16994 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16995 .dac_nids = alc662_dac_nids,
16996 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16997 .channel_mode = alc662_3ST_2ch_modes,
16998 .input_mux = &alc663_m51va_capture_source,
16999 .unsol_event = alc663_m51va_unsol_event,
17000 .init_hook = alc663_m51va_inithook,
17002 [ALC663_ASUS_G50V] = {
17003 .mixers = { alc663_g50v_mixer },
17004 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17005 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17006 .dac_nids = alc662_dac_nids,
17007 .dig_out_nid = ALC662_DIGOUT_NID,
17008 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17009 .channel_mode = alc662_3ST_6ch_modes,
17010 .input_mux = &alc663_capture_source,
17011 .unsol_event = alc663_g50v_unsol_event,
17012 .init_hook = alc663_g50v_inithook,
17014 [ALC663_ASUS_MODE1] = {
17015 .mixers = { alc663_m51va_mixer },
17016 .cap_mixer = alc662_auto_capture_mixer,
17017 .init_verbs = { alc662_init_verbs,
17018 alc663_21jd_amic_init_verbs },
17019 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17021 .dac_nids = alc662_dac_nids,
17022 .dig_out_nid = ALC662_DIGOUT_NID,
17023 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17024 .channel_mode = alc662_3ST_2ch_modes,
17025 .input_mux = &alc662_eeepc_capture_source,
17026 .unsol_event = alc663_mode1_unsol_event,
17027 .init_hook = alc663_mode1_inithook,
17029 [ALC662_ASUS_MODE2] = {
17030 .mixers = { alc662_1bjd_mixer },
17031 .cap_mixer = alc662_auto_capture_mixer,
17032 .init_verbs = { alc662_init_verbs,
17033 alc662_1bjd_amic_init_verbs },
17034 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17035 .dac_nids = alc662_dac_nids,
17036 .dig_out_nid = ALC662_DIGOUT_NID,
17037 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17038 .channel_mode = alc662_3ST_2ch_modes,
17039 .input_mux = &alc662_eeepc_capture_source,
17040 .unsol_event = alc662_mode2_unsol_event,
17041 .init_hook = alc662_mode2_inithook,
17043 [ALC663_ASUS_MODE3] = {
17044 .mixers = { alc663_two_hp_m1_mixer },
17045 .cap_mixer = alc662_auto_capture_mixer,
17046 .init_verbs = { alc662_init_verbs,
17047 alc663_two_hp_amic_m1_init_verbs },
17048 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17050 .dac_nids = alc662_dac_nids,
17051 .dig_out_nid = ALC662_DIGOUT_NID,
17052 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17053 .channel_mode = alc662_3ST_2ch_modes,
17054 .input_mux = &alc662_eeepc_capture_source,
17055 .unsol_event = alc663_mode3_unsol_event,
17056 .init_hook = alc663_mode3_inithook,
17058 [ALC663_ASUS_MODE4] = {
17059 .mixers = { alc663_asus_21jd_clfe_mixer },
17060 .cap_mixer = alc662_auto_capture_mixer,
17061 .init_verbs = { alc662_init_verbs,
17062 alc663_21jd_amic_init_verbs},
17063 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17065 .dac_nids = alc662_dac_nids,
17066 .dig_out_nid = ALC662_DIGOUT_NID,
17067 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17068 .channel_mode = alc662_3ST_2ch_modes,
17069 .input_mux = &alc662_eeepc_capture_source,
17070 .unsol_event = alc663_mode4_unsol_event,
17071 .init_hook = alc663_mode4_inithook,
17073 [ALC663_ASUS_MODE5] = {
17074 .mixers = { alc663_asus_15jd_clfe_mixer },
17075 .cap_mixer = alc662_auto_capture_mixer,
17076 .init_verbs = { alc662_init_verbs,
17077 alc663_15jd_amic_init_verbs },
17078 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17080 .dac_nids = alc662_dac_nids,
17081 .dig_out_nid = ALC662_DIGOUT_NID,
17082 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17083 .channel_mode = alc662_3ST_2ch_modes,
17084 .input_mux = &alc662_eeepc_capture_source,
17085 .unsol_event = alc663_mode5_unsol_event,
17086 .init_hook = alc663_mode5_inithook,
17088 [ALC663_ASUS_MODE6] = {
17089 .mixers = { alc663_two_hp_m2_mixer },
17090 .cap_mixer = alc662_auto_capture_mixer,
17091 .init_verbs = { alc662_init_verbs,
17092 alc663_two_hp_amic_m2_init_verbs },
17093 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17095 .dac_nids = alc662_dac_nids,
17096 .dig_out_nid = ALC662_DIGOUT_NID,
17097 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17098 .channel_mode = alc662_3ST_2ch_modes,
17099 .input_mux = &alc662_eeepc_capture_source,
17100 .unsol_event = alc663_mode6_unsol_event,
17101 .init_hook = alc663_mode6_inithook,
17104 .mixers = { alc663_m51va_mixer },
17105 .cap_mixer = alc272_auto_capture_mixer,
17106 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17107 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17108 .dac_nids = alc662_dac_nids,
17109 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17110 .adc_nids = alc272_adc_nids,
17111 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17112 .capsrc_nids = alc272_capsrc_nids,
17113 .channel_mode = alc662_3ST_2ch_modes,
17114 .input_mux = &alc663_m51va_capture_source,
17115 .unsol_event = alc663_m51va_unsol_event,
17116 .init_hook = alc663_m51va_inithook,
17118 [ALC272_DELL_ZM1] = {
17119 .mixers = { alc663_m51va_mixer },
17120 .cap_mixer = alc662_auto_capture_mixer,
17121 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17122 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17123 .dac_nids = alc662_dac_nids,
17124 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17125 .adc_nids = alc662_adc_nids,
17127 .capsrc_nids = alc662_capsrc_nids,
17128 .channel_mode = alc662_3ST_2ch_modes,
17129 .input_mux = &alc663_m51va_capture_source,
17130 .unsol_event = alc663_m51va_unsol_event,
17131 .init_hook = alc663_m51va_inithook,
17133 [ALC272_SAMSUNG_NC10] = {
17134 .mixers = { alc272_nc10_mixer },
17135 .init_verbs = { alc662_init_verbs,
17136 alc663_21jd_amic_init_verbs },
17137 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17138 .dac_nids = alc272_dac_nids,
17139 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17140 .channel_mode = alc662_3ST_2ch_modes,
17141 .input_mux = &alc272_nc10_capture_source,
17142 .unsol_event = alc663_mode4_unsol_event,
17143 .init_hook = alc663_mode4_inithook,
17149 * BIOS auto configuration
17152 /* add playback controls from the parsed DAC table */
17153 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
17154 const struct auto_pin_cfg *cfg)
17157 static const char *chname[4] = {
17158 "Front", "Surround", NULL /*CLFE*/, "Side"
17163 for (i = 0; i < cfg->line_outs; i++) {
17164 if (!spec->multiout.dac_nids[i])
17166 nid = alc880_idx_to_dac(i);
17169 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17170 "Center Playback Volume",
17171 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
17175 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17176 "LFE Playback Volume",
17177 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
17181 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17182 "Center Playback Switch",
17183 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17187 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17188 "LFE Playback Switch",
17189 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17194 sprintf(name, "%s Playback Volume", chname[i]);
17195 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17196 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
17200 sprintf(name, "%s Playback Switch", chname[i]);
17201 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17202 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
17211 /* add playback controls for speaker and HP outputs */
17212 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17223 /* ALC663 has a mono output pin on 0x17 */
17224 sprintf(name, "%s Playback Switch", pfx);
17225 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17226 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17230 if (alc880_is_fixed_pin(pin)) {
17231 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17232 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17233 /* specify the DAC as the extra output */
17234 if (!spec->multiout.hp_nid)
17235 spec->multiout.hp_nid = nid;
17237 spec->multiout.extra_out_nid[0] = nid;
17238 /* control HP volume/switch on the output mixer amp */
17239 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17240 sprintf(name, "%s Playback Volume", pfx);
17241 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17242 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17245 sprintf(name, "%s Playback Switch", pfx);
17246 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17247 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17250 } else if (alc880_is_multi_pin(pin)) {
17251 /* set manual connection */
17252 /* we have only a switch on HP-out PIN */
17253 sprintf(name, "%s Playback Switch", pfx);
17254 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17255 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17262 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
17264 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
17265 return (pincap & AC_PINCAP_IN) != 0;
17268 /* create playback/capture controls for input pins */
17269 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
17270 const struct auto_pin_cfg *cfg)
17272 struct alc_spec *spec = codec->spec;
17273 struct hda_input_mux *imux = &spec->private_imux[0];
17276 for (i = 0; i < AUTO_PIN_LAST; i++) {
17277 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
17278 idx = get_connection_index(codec, 0x0b,
17279 cfg->input_pins[i]);
17281 err = new_analog_input(spec, cfg->input_pins[i],
17282 auto_pin_cfg_labels[i],
17287 idx = get_connection_index(codec, 0x22,
17288 cfg->input_pins[i]);
17290 imux->items[imux->num_items].label =
17291 auto_pin_cfg_labels[i];
17292 imux->items[imux->num_items].index = idx;
17300 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17301 hda_nid_t nid, int pin_type,
17304 alc_set_pin_output(codec, nid, pin_type);
17305 /* need the manual connection? */
17306 if (alc880_is_multi_pin(nid)) {
17307 struct alc_spec *spec = codec->spec;
17308 int idx = alc880_multi_pin_idx(nid);
17309 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17310 AC_VERB_SET_CONNECT_SEL,
17311 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17315 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17317 struct alc_spec *spec = codec->spec;
17320 for (i = 0; i <= HDA_SIDE; i++) {
17321 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17322 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17324 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17329 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17331 struct alc_spec *spec = codec->spec;
17334 pin = spec->autocfg.hp_pins[0];
17335 if (pin) /* connect to front */
17337 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17338 pin = spec->autocfg.speaker_pins[0];
17340 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17343 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17345 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17347 struct alc_spec *spec = codec->spec;
17350 for (i = 0; i < AUTO_PIN_LAST; i++) {
17351 hda_nid_t nid = spec->autocfg.input_pins[i];
17352 if (alc662_is_input_pin(codec, nid)) {
17353 alc_set_input_pin(codec, nid, i);
17354 if (nid != ALC662_PIN_CD_NID &&
17355 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17356 snd_hda_codec_write(codec, nid, 0,
17357 AC_VERB_SET_AMP_GAIN_MUTE,
17363 #define alc662_auto_init_input_src alc882_auto_init_input_src
17365 static int alc662_parse_auto_config(struct hda_codec *codec)
17367 struct alc_spec *spec = codec->spec;
17369 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17371 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17375 if (!spec->autocfg.line_outs)
17376 return 0; /* can't find valid BIOS pin config */
17378 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17381 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17384 err = alc662_auto_create_extra_out(spec,
17385 spec->autocfg.speaker_pins[0],
17389 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17393 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
17397 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17399 if (spec->autocfg.dig_outs)
17400 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17402 if (spec->kctls.list)
17403 add_mixer(spec, spec->kctls.list);
17405 spec->num_mux_defs = 1;
17406 spec->input_mux = &spec->private_imux[0];
17408 add_verb(spec, alc662_auto_init_verbs);
17409 if (codec->vendor_id == 0x10ec0663)
17410 add_verb(spec, alc663_auto_init_verbs);
17412 err = alc_auto_add_mic_boost(codec);
17416 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17421 /* additional initialization for auto-configuration model */
17422 static void alc662_auto_init(struct hda_codec *codec)
17424 struct alc_spec *spec = codec->spec;
17425 alc662_auto_init_multi_out(codec);
17426 alc662_auto_init_hp_out(codec);
17427 alc662_auto_init_analog_input(codec);
17428 alc662_auto_init_input_src(codec);
17429 if (spec->unsol_event)
17430 alc_inithook(codec);
17433 static int patch_alc662(struct hda_codec *codec)
17435 struct alc_spec *spec;
17436 int err, board_config;
17438 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17442 codec->spec = spec;
17444 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17446 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17449 if (board_config < 0) {
17450 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17452 board_config = ALC662_AUTO;
17455 if (board_config == ALC662_AUTO) {
17456 /* automatic parse from the BIOS config */
17457 err = alc662_parse_auto_config(codec);
17463 "hda_codec: Cannot set up configuration "
17464 "from BIOS. Using base mode...\n");
17465 board_config = ALC662_3ST_2ch_DIG;
17469 err = snd_hda_attach_beep_device(codec, 0x1);
17475 if (board_config != ALC662_AUTO)
17476 setup_preset(codec, &alc662_presets[board_config]);
17478 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17479 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17481 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17482 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17484 if (!spec->adc_nids) {
17485 spec->adc_nids = alc662_adc_nids;
17486 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17488 if (!spec->capsrc_nids)
17489 spec->capsrc_nids = alc662_capsrc_nids;
17491 if (!spec->cap_mixer)
17492 set_capture_mixer(codec);
17493 if (codec->vendor_id == 0x10ec0662)
17494 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17496 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17498 spec->vmaster_nid = 0x02;
17500 codec->patch_ops = alc_patch_ops;
17501 if (board_config == ALC662_AUTO)
17502 spec->init_hook = alc662_auto_init;
17503 #ifdef CONFIG_SND_HDA_POWER_SAVE
17504 if (!spec->loopback.amplist)
17505 spec->loopback.amplist = alc662_loopbacks;
17507 codec->proc_widget_hook = print_realtek_coef;
17515 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17516 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17517 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17518 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17519 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17520 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17521 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17522 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17523 .patch = patch_alc861 },
17524 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17525 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17526 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17527 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17528 .patch = patch_alc882 },
17529 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17530 .patch = patch_alc662 },
17531 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17532 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17533 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17534 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17535 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17536 .patch = patch_alc882 },
17537 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17538 .patch = patch_alc882 },
17539 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17540 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17541 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17542 .patch = patch_alc882 },
17543 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17544 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17545 {} /* terminator */
17548 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17550 MODULE_LICENSE("GPL");
17551 MODULE_DESCRIPTION("Realtek HD-audio codec");
17553 static struct hda_codec_preset_list realtek_list = {
17554 .preset = snd_hda_preset_realtek,
17555 .owner = THIS_MODULE,
17558 static int __init patch_realtek_init(void)
17560 return snd_hda_add_codec_preset(&realtek_list);
17563 static void __exit patch_realtek_exit(void)
17565 snd_hda_delete_codec_preset(&realtek_list);
17568 module_init(patch_realtek_init)
17569 module_exit(patch_realtek_exit)