2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
134 ALC269_ASUS_EEEPC_P703,
135 ALC269_ASUS_EEEPC_P901,
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
216 ALC883_TARGA_2ch_DIG,
217 ALC883_TARGA_8ch_DIG,
220 ALC888_ACER_ASPIRE_4930G,
221 ALC888_ACER_ASPIRE_6530G,
222 ALC888_ACER_ASPIRE_8930G,
226 ALC883_LENOVO_101E_2ch,
227 ALC883_LENOVO_NB0763,
228 ALC888_LENOVO_MS7195_DIG,
235 ALC883_FUJITSU_PI2515,
236 ALC888_FUJITSU_XA3530,
237 ALC883_3ST_6ch_INTEL,
250 #define GPIO_MASK 0x03
252 /* extra amp-initialization sequence types */
261 struct alc_mic_route {
263 unsigned char mux_idx;
264 unsigned char amix_idx;
267 #define MUX_IDX_UNDEF ((unsigned char)-1)
270 /* codec parameterization */
271 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
272 unsigned int num_mixers;
273 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
274 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
276 const struct hda_verb *init_verbs[5]; /* initialization verbs
280 unsigned int num_init_verbs;
282 char stream_name_analog[32]; /* analog PCM stream */
283 struct hda_pcm_stream *stream_analog_playback;
284 struct hda_pcm_stream *stream_analog_capture;
285 struct hda_pcm_stream *stream_analog_alt_playback;
286 struct hda_pcm_stream *stream_analog_alt_capture;
288 char stream_name_digital[32]; /* digital PCM stream */
289 struct hda_pcm_stream *stream_digital_playback;
290 struct hda_pcm_stream *stream_digital_capture;
293 struct hda_multi_out multiout; /* playback set-up
294 * max_channels, dacs must be set
295 * dig_out_nid and hp_nid are optional
297 hda_nid_t alt_dac_nid;
298 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
302 unsigned int num_adc_nids;
304 hda_nid_t *capsrc_nids;
305 hda_nid_t dig_in_nid; /* digital-in NID; optional */
308 unsigned int num_mux_defs;
309 const struct hda_input_mux *input_mux;
310 unsigned int cur_mux[3];
311 struct alc_mic_route ext_mic;
312 struct alc_mic_route int_mic;
315 const struct hda_channel_mode *channel_mode;
316 int num_channel_mode;
318 int const_channel_count;
319 int ext_channel_count;
321 /* PCM information */
322 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
324 /* dynamic controls, init_verbs and input_mux */
325 struct auto_pin_cfg autocfg;
326 struct snd_array kctls;
327 struct hda_input_mux private_imux[3];
328 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
329 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
330 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
333 void (*init_hook)(struct hda_codec *codec);
334 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
336 /* for pin sensing */
337 unsigned int sense_updated: 1;
338 unsigned int jack_present: 1;
339 unsigned int master_sw: 1;
340 unsigned int auto_mic:1;
343 unsigned int no_analog :1; /* digital I/O only */
346 /* for virtual master */
347 hda_nid_t vmaster_nid;
348 #ifdef CONFIG_SND_HDA_POWER_SAVE
349 struct hda_loopback_check loopback;
354 unsigned int pll_coef_idx, pll_coef_bit;
358 * configuration template - to be copied to the spec instance
360 struct alc_config_preset {
361 struct snd_kcontrol_new *mixers[5]; /* should be identical size
364 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
365 const struct hda_verb *init_verbs[5];
366 unsigned int num_dacs;
368 hda_nid_t dig_out_nid; /* optional */
369 hda_nid_t hp_nid; /* optional */
370 hda_nid_t *slave_dig_outs;
371 unsigned int num_adc_nids;
373 hda_nid_t *capsrc_nids;
374 hda_nid_t dig_in_nid;
375 unsigned int num_channel_mode;
376 const struct hda_channel_mode *channel_mode;
378 int const_channel_count;
379 unsigned int num_mux_defs;
380 const struct hda_input_mux *input_mux;
381 void (*unsol_event)(struct hda_codec *, unsigned int);
382 void (*setup)(struct hda_codec *);
383 void (*init_hook)(struct hda_codec *);
384 #ifdef CONFIG_SND_HDA_POWER_SAVE
385 struct hda_amp_list *loopbacks;
393 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
394 struct snd_ctl_elem_info *uinfo)
396 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
397 struct alc_spec *spec = codec->spec;
398 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
399 if (mux_idx >= spec->num_mux_defs)
401 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
404 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
405 struct snd_ctl_elem_value *ucontrol)
407 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
408 struct alc_spec *spec = codec->spec;
409 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
411 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
415 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
416 struct snd_ctl_elem_value *ucontrol)
418 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
419 struct alc_spec *spec = codec->spec;
420 const struct hda_input_mux *imux;
421 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
422 unsigned int mux_idx;
423 hda_nid_t nid = spec->capsrc_nids ?
424 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
427 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
428 imux = &spec->input_mux[mux_idx];
430 type = get_wcaps_type(get_wcaps(codec, nid));
431 if (type == AC_WID_AUD_MIX) {
432 /* Matrix-mixer style (e.g. ALC882) */
433 unsigned int *cur_val = &spec->cur_mux[adc_idx];
436 idx = ucontrol->value.enumerated.item[0];
437 if (idx >= imux->num_items)
438 idx = imux->num_items - 1;
441 for (i = 0; i < imux->num_items; i++) {
442 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
443 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
444 imux->items[i].index,
450 /* MUX style (e.g. ALC880) */
451 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
452 &spec->cur_mux[adc_idx]);
457 * channel mode setting
459 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
460 struct snd_ctl_elem_info *uinfo)
462 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
463 struct alc_spec *spec = codec->spec;
464 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
465 spec->num_channel_mode);
468 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
469 struct snd_ctl_elem_value *ucontrol)
471 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
472 struct alc_spec *spec = codec->spec;
473 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
474 spec->num_channel_mode,
475 spec->ext_channel_count);
478 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
479 struct snd_ctl_elem_value *ucontrol)
481 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
482 struct alc_spec *spec = codec->spec;
483 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
484 spec->num_channel_mode,
485 &spec->ext_channel_count);
486 if (err >= 0 && !spec->const_channel_count) {
487 spec->multiout.max_channels = spec->ext_channel_count;
488 if (spec->need_dac_fix)
489 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
495 * Control the mode of pin widget settings via the mixer. "pc" is used
496 * instead of "%" to avoid consequences of accidently treating the % as
497 * being part of a format specifier. Maximum allowed length of a value is
498 * 63 characters plus NULL terminator.
500 * Note: some retasking pin complexes seem to ignore requests for input
501 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
502 * are requested. Therefore order this list so that this behaviour will not
503 * cause problems when mixer clients move through the enum sequentially.
504 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
507 static char *alc_pin_mode_names[] = {
508 "Mic 50pc bias", "Mic 80pc bias",
509 "Line in", "Line out", "Headphone out",
511 static unsigned char alc_pin_mode_values[] = {
512 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
514 /* The control can present all 5 options, or it can limit the options based
515 * in the pin being assumed to be exclusively an input or an output pin. In
516 * addition, "input" pins may or may not process the mic bias option
517 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
518 * accept requests for bias as of chip versions up to March 2006) and/or
519 * wiring in the computer.
521 #define ALC_PIN_DIR_IN 0x00
522 #define ALC_PIN_DIR_OUT 0x01
523 #define ALC_PIN_DIR_INOUT 0x02
524 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
525 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
527 /* Info about the pin modes supported by the different pin direction modes.
528 * For each direction the minimum and maximum values are given.
530 static signed char alc_pin_mode_dir_info[5][2] = {
531 { 0, 2 }, /* ALC_PIN_DIR_IN */
532 { 3, 4 }, /* ALC_PIN_DIR_OUT */
533 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
534 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
535 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
537 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
538 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
539 #define alc_pin_mode_n_items(_dir) \
540 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
542 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
543 struct snd_ctl_elem_info *uinfo)
545 unsigned int item_num = uinfo->value.enumerated.item;
546 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
548 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
550 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
552 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
553 item_num = alc_pin_mode_min(dir);
554 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
558 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
559 struct snd_ctl_elem_value *ucontrol)
562 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
563 hda_nid_t nid = kcontrol->private_value & 0xffff;
564 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
565 long *valp = ucontrol->value.integer.value;
566 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
567 AC_VERB_GET_PIN_WIDGET_CONTROL,
570 /* Find enumerated value for current pinctl setting */
571 i = alc_pin_mode_min(dir);
572 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
574 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
578 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
579 struct snd_ctl_elem_value *ucontrol)
582 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
583 hda_nid_t nid = kcontrol->private_value & 0xffff;
584 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
585 long val = *ucontrol->value.integer.value;
586 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
587 AC_VERB_GET_PIN_WIDGET_CONTROL,
590 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
591 val = alc_pin_mode_min(dir);
593 change = pinctl != alc_pin_mode_values[val];
595 /* Set pin mode to that requested */
596 snd_hda_codec_write_cache(codec, nid, 0,
597 AC_VERB_SET_PIN_WIDGET_CONTROL,
598 alc_pin_mode_values[val]);
600 /* Also enable the retasking pin's input/output as required
601 * for the requested pin mode. Enum values of 2 or less are
604 * Dynamically switching the input/output buffers probably
605 * reduces noise slightly (particularly on input) so we'll
606 * do it. However, having both input and output buffers
607 * enabled simultaneously doesn't seem to be problematic if
608 * this turns out to be necessary in the future.
611 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
612 HDA_AMP_MUTE, HDA_AMP_MUTE);
613 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
616 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
617 HDA_AMP_MUTE, HDA_AMP_MUTE);
618 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
625 #define ALC_PIN_MODE(xname, nid, dir) \
626 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
627 .info = alc_pin_mode_info, \
628 .get = alc_pin_mode_get, \
629 .put = alc_pin_mode_put, \
630 .private_value = nid | (dir<<16) }
632 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
633 * together using a mask with more than one bit set. This control is
634 * currently used only by the ALC260 test model. At this stage they are not
635 * needed for any "production" models.
637 #ifdef CONFIG_SND_DEBUG
638 #define alc_gpio_data_info snd_ctl_boolean_mono_info
640 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
641 struct snd_ctl_elem_value *ucontrol)
643 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
644 hda_nid_t nid = kcontrol->private_value & 0xffff;
645 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
646 long *valp = ucontrol->value.integer.value;
647 unsigned int val = snd_hda_codec_read(codec, nid, 0,
648 AC_VERB_GET_GPIO_DATA, 0x00);
650 *valp = (val & mask) != 0;
653 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
654 struct snd_ctl_elem_value *ucontrol)
657 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
658 hda_nid_t nid = kcontrol->private_value & 0xffff;
659 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
660 long val = *ucontrol->value.integer.value;
661 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
662 AC_VERB_GET_GPIO_DATA,
665 /* Set/unset the masked GPIO bit(s) as needed */
666 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
671 snd_hda_codec_write_cache(codec, nid, 0,
672 AC_VERB_SET_GPIO_DATA, gpio_data);
676 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
677 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
678 .info = alc_gpio_data_info, \
679 .get = alc_gpio_data_get, \
680 .put = alc_gpio_data_put, \
681 .private_value = nid | (mask<<16) }
682 #endif /* CONFIG_SND_DEBUG */
684 /* A switch control to allow the enabling of the digital IO pins on the
685 * ALC260. This is incredibly simplistic; the intention of this control is
686 * to provide something in the test model allowing digital outputs to be
687 * identified if present. If models are found which can utilise these
688 * outputs a more complete mixer control can be devised for those models if
691 #ifdef CONFIG_SND_DEBUG
692 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
694 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
695 struct snd_ctl_elem_value *ucontrol)
697 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
698 hda_nid_t nid = kcontrol->private_value & 0xffff;
699 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
700 long *valp = ucontrol->value.integer.value;
701 unsigned int val = snd_hda_codec_read(codec, nid, 0,
702 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
704 *valp = (val & mask) != 0;
707 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
708 struct snd_ctl_elem_value *ucontrol)
711 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
712 hda_nid_t nid = kcontrol->private_value & 0xffff;
713 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
714 long val = *ucontrol->value.integer.value;
715 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
716 AC_VERB_GET_DIGI_CONVERT_1,
719 /* Set/unset the masked control bit(s) as needed */
720 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
725 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
730 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
731 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
732 .info = alc_spdif_ctrl_info, \
733 .get = alc_spdif_ctrl_get, \
734 .put = alc_spdif_ctrl_put, \
735 .private_value = nid | (mask<<16) }
736 #endif /* CONFIG_SND_DEBUG */
738 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
739 * Again, this is only used in the ALC26x test models to help identify when
740 * the EAPD line must be asserted for features to work.
742 #ifdef CONFIG_SND_DEBUG
743 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
745 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
746 struct snd_ctl_elem_value *ucontrol)
748 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
749 hda_nid_t nid = kcontrol->private_value & 0xffff;
750 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
751 long *valp = ucontrol->value.integer.value;
752 unsigned int val = snd_hda_codec_read(codec, nid, 0,
753 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
755 *valp = (val & mask) != 0;
759 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
760 struct snd_ctl_elem_value *ucontrol)
763 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
764 hda_nid_t nid = kcontrol->private_value & 0xffff;
765 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
766 long val = *ucontrol->value.integer.value;
767 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
768 AC_VERB_GET_EAPD_BTLENABLE,
771 /* Set/unset the masked control bit(s) as needed */
772 change = (!val ? 0 : mask) != (ctrl_data & mask);
777 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
783 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
784 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
785 .info = alc_eapd_ctrl_info, \
786 .get = alc_eapd_ctrl_get, \
787 .put = alc_eapd_ctrl_put, \
788 .private_value = nid | (mask<<16) }
789 #endif /* CONFIG_SND_DEBUG */
792 * set up the input pin config (depending on the given auto-pin type)
794 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
797 unsigned int val = PIN_IN;
799 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
801 pincap = snd_hda_query_pin_caps(codec, nid);
802 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
803 if (pincap & AC_PINCAP_VREF_80)
805 else if (pincap & AC_PINCAP_VREF_50)
807 else if (pincap & AC_PINCAP_VREF_100)
809 else if (pincap & AC_PINCAP_VREF_GRD)
812 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
817 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
819 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
821 spec->mixers[spec->num_mixers++] = mix;
824 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
826 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
828 spec->init_verbs[spec->num_init_verbs++] = verb;
831 #ifdef CONFIG_PROC_FS
835 static void print_realtek_coef(struct snd_info_buffer *buffer,
836 struct hda_codec *codec, hda_nid_t nid)
842 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
843 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
844 coeff = snd_hda_codec_read(codec, nid, 0,
845 AC_VERB_GET_COEF_INDEX, 0);
846 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
849 #define print_realtek_coef NULL
853 * set up from the preset table
855 static void setup_preset(struct hda_codec *codec,
856 const struct alc_config_preset *preset)
858 struct alc_spec *spec = codec->spec;
861 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
862 add_mixer(spec, preset->mixers[i]);
863 spec->cap_mixer = preset->cap_mixer;
864 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
866 add_verb(spec, preset->init_verbs[i]);
868 spec->channel_mode = preset->channel_mode;
869 spec->num_channel_mode = preset->num_channel_mode;
870 spec->need_dac_fix = preset->need_dac_fix;
871 spec->const_channel_count = preset->const_channel_count;
873 if (preset->const_channel_count)
874 spec->multiout.max_channels = preset->const_channel_count;
876 spec->multiout.max_channels = spec->channel_mode[0].channels;
877 spec->ext_channel_count = spec->channel_mode[0].channels;
879 spec->multiout.num_dacs = preset->num_dacs;
880 spec->multiout.dac_nids = preset->dac_nids;
881 spec->multiout.dig_out_nid = preset->dig_out_nid;
882 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
883 spec->multiout.hp_nid = preset->hp_nid;
885 spec->num_mux_defs = preset->num_mux_defs;
886 if (!spec->num_mux_defs)
887 spec->num_mux_defs = 1;
888 spec->input_mux = preset->input_mux;
890 spec->num_adc_nids = preset->num_adc_nids;
891 spec->adc_nids = preset->adc_nids;
892 spec->capsrc_nids = preset->capsrc_nids;
893 spec->dig_in_nid = preset->dig_in_nid;
895 spec->unsol_event = preset->unsol_event;
896 spec->init_hook = preset->init_hook;
897 #ifdef CONFIG_SND_HDA_POWER_SAVE
898 spec->loopback.amplist = preset->loopbacks;
902 preset->setup(codec);
905 /* Enable GPIO mask and set output */
906 static struct hda_verb alc_gpio1_init_verbs[] = {
907 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
908 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
909 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
913 static struct hda_verb alc_gpio2_init_verbs[] = {
914 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
915 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
916 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
920 static struct hda_verb alc_gpio3_init_verbs[] = {
921 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
922 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
923 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
928 * Fix hardware PLL issue
929 * On some codecs, the analog PLL gating control must be off while
930 * the default value is 1.
932 static void alc_fix_pll(struct hda_codec *codec)
934 struct alc_spec *spec = codec->spec;
939 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
941 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
942 AC_VERB_GET_PROC_COEF, 0);
943 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
945 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
946 val & ~(1 << spec->pll_coef_bit));
949 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
950 unsigned int coef_idx, unsigned int coef_bit)
952 struct alc_spec *spec = codec->spec;
954 spec->pll_coef_idx = coef_idx;
955 spec->pll_coef_bit = coef_bit;
959 static void alc_automute_pin(struct hda_codec *codec)
961 struct alc_spec *spec = codec->spec;
962 unsigned int present, pincap;
963 unsigned int nid = spec->autocfg.hp_pins[0];
966 pincap = snd_hda_query_pin_caps(codec, nid);
967 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
968 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
969 present = snd_hda_codec_read(codec, nid, 0,
970 AC_VERB_GET_PIN_SENSE, 0);
971 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
972 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
973 nid = spec->autocfg.speaker_pins[i];
976 snd_hda_codec_write(codec, nid, 0,
977 AC_VERB_SET_PIN_WIDGET_CONTROL,
978 spec->jack_present ? 0 : PIN_OUT);
982 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
985 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
988 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
989 for (i = 0; i < nums; i++)
995 static void alc_mic_automute(struct hda_codec *codec)
997 struct alc_spec *spec = codec->spec;
998 struct alc_mic_route *dead, *alive;
999 unsigned int present, type;
1002 if (!spec->auto_mic)
1004 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1006 if (snd_BUG_ON(!spec->adc_nids))
1009 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1011 present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0,
1012 AC_VERB_GET_PIN_SENSE, 0);
1013 present &= AC_PINSENSE_PRESENCE;
1015 alive = &spec->ext_mic;
1016 dead = &spec->int_mic;
1018 alive = &spec->int_mic;
1019 dead = &spec->ext_mic;
1022 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1023 if (type == AC_WID_AUD_MIX) {
1024 /* Matrix-mixer style (e.g. ALC882) */
1025 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1028 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1030 HDA_AMP_MUTE, HDA_AMP_MUTE);
1032 /* MUX style (e.g. ALC880) */
1033 snd_hda_codec_write_cache(codec, cap_nid, 0,
1034 AC_VERB_SET_CONNECT_SEL,
1038 /* FIXME: analog mixer */
1041 /* unsolicited event for HP jack sensing */
1042 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1044 if (codec->vendor_id == 0x10ec0880)
1049 case ALC880_HP_EVENT:
1050 alc_automute_pin(codec);
1052 case ALC880_MIC_EVENT:
1053 alc_mic_automute(codec);
1058 static void alc_inithook(struct hda_codec *codec)
1060 alc_automute_pin(codec);
1061 alc_mic_automute(codec);
1064 /* additional initialization for ALC888 variants */
1065 static void alc888_coef_init(struct hda_codec *codec)
1069 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1070 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1071 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1072 if ((tmp & 0xf0) == 0x20)
1074 snd_hda_codec_read(codec, 0x20, 0,
1075 AC_VERB_SET_PROC_COEF, 0x830);
1078 snd_hda_codec_read(codec, 0x20, 0,
1079 AC_VERB_SET_PROC_COEF, 0x3030);
1082 static void alc889_coef_init(struct hda_codec *codec)
1086 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1087 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1088 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1089 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1092 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1097 case ALC_INIT_GPIO1:
1098 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1100 case ALC_INIT_GPIO2:
1101 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1103 case ALC_INIT_GPIO3:
1104 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1106 case ALC_INIT_DEFAULT:
1107 switch (codec->vendor_id) {
1109 snd_hda_codec_write(codec, 0x0f, 0,
1110 AC_VERB_SET_EAPD_BTLENABLE, 2);
1111 snd_hda_codec_write(codec, 0x10, 0,
1112 AC_VERB_SET_EAPD_BTLENABLE, 2);
1124 snd_hda_codec_write(codec, 0x14, 0,
1125 AC_VERB_SET_EAPD_BTLENABLE, 2);
1126 snd_hda_codec_write(codec, 0x15, 0,
1127 AC_VERB_SET_EAPD_BTLENABLE, 2);
1130 switch (codec->vendor_id) {
1132 snd_hda_codec_write(codec, 0x1a, 0,
1133 AC_VERB_SET_COEF_INDEX, 7);
1134 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1135 AC_VERB_GET_PROC_COEF, 0);
1136 snd_hda_codec_write(codec, 0x1a, 0,
1137 AC_VERB_SET_COEF_INDEX, 7);
1138 snd_hda_codec_write(codec, 0x1a, 0,
1139 AC_VERB_SET_PROC_COEF,
1149 alc889_coef_init(codec);
1152 alc888_coef_init(codec);
1156 snd_hda_codec_write(codec, 0x20, 0,
1157 AC_VERB_SET_COEF_INDEX, 7);
1158 tmp = snd_hda_codec_read(codec, 0x20, 0,
1159 AC_VERB_GET_PROC_COEF, 0);
1160 snd_hda_codec_write(codec, 0x20, 0,
1161 AC_VERB_SET_COEF_INDEX, 7);
1162 snd_hda_codec_write(codec, 0x20, 0,
1163 AC_VERB_SET_PROC_COEF,
1171 static void alc_init_auto_hp(struct hda_codec *codec)
1173 struct alc_spec *spec = codec->spec;
1175 if (!spec->autocfg.hp_pins[0])
1178 if (!spec->autocfg.speaker_pins[0]) {
1179 if (spec->autocfg.line_out_pins[0] &&
1180 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1181 spec->autocfg.speaker_pins[0] =
1182 spec->autocfg.line_out_pins[0];
1187 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1188 spec->autocfg.hp_pins[0]);
1189 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1190 AC_VERB_SET_UNSOLICITED_ENABLE,
1191 AC_USRSP_EN | ALC880_HP_EVENT);
1192 spec->unsol_event = alc_sku_unsol_event;
1195 static void alc_init_auto_mic(struct hda_codec *codec)
1197 struct alc_spec *spec = codec->spec;
1198 struct auto_pin_cfg *cfg = &spec->autocfg;
1199 hda_nid_t fixed, ext;
1202 /* there must be only two mic inputs exclusively */
1203 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1204 if (cfg->input_pins[i])
1208 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1209 hda_nid_t nid = cfg->input_pins[i];
1210 unsigned int defcfg;
1213 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1214 switch (get_defcfg_connect(defcfg)) {
1215 case AC_JACK_PORT_FIXED:
1217 return; /* already occupied */
1220 case AC_JACK_PORT_COMPLEX:
1222 return; /* already occupied */
1226 return; /* invalid entry */
1229 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1230 return; /* no unsol support */
1231 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1233 spec->ext_mic.pin = ext;
1234 spec->int_mic.pin = fixed;
1235 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1236 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1238 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1239 AC_VERB_SET_UNSOLICITED_ENABLE,
1240 AC_USRSP_EN | ALC880_MIC_EVENT);
1241 spec->unsol_event = alc_sku_unsol_event;
1244 /* check subsystem ID and set up device-specific initialization;
1245 * return 1 if initialized, 0 if invalid SSID
1247 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1248 * 31 ~ 16 : Manufacture ID
1250 * 7 ~ 0 : Assembly ID
1251 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1253 static int alc_subsystem_id(struct hda_codec *codec,
1254 hda_nid_t porta, hda_nid_t porte,
1257 unsigned int ass, tmp, i;
1259 struct alc_spec *spec = codec->spec;
1261 ass = codec->subsystem_id & 0xffff;
1262 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1265 /* invalid SSID, check the special NID pin defcfg instead */
1267 * 31~30 : port connectivity
1270 * 19~16 : Check sum (15:1)
1275 if (codec->vendor_id == 0x10ec0260)
1277 ass = snd_hda_codec_get_pincfg(codec, nid);
1278 snd_printd("realtek: No valid SSID, "
1279 "checking pincfg 0x%08x for NID 0x%x\n",
1281 if (!(ass & 1) && !(ass & 0x100000))
1283 if ((ass >> 30) != 1) /* no physical connection */
1288 for (i = 1; i < 16; i++) {
1292 if (((ass >> 16) & 0xf) != tmp)
1295 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1296 ass & 0xffff, codec->vendor_id);
1300 * 2 : 0 --> Desktop, 1 --> Laptop
1301 * 3~5 : External Amplifier control
1304 tmp = (ass & 0x38) >> 3; /* external Amp control */
1307 spec->init_amp = ALC_INIT_GPIO1;
1310 spec->init_amp = ALC_INIT_GPIO2;
1313 spec->init_amp = ALC_INIT_GPIO3;
1316 spec->init_amp = ALC_INIT_DEFAULT;
1320 /* is laptop or Desktop and enable the function "Mute internal speaker
1321 * when the external headphone out jack is plugged"
1323 if (!(ass & 0x8000))
1326 * 10~8 : Jack location
1327 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1329 * 15 : 1 --> enable the function "Mute internal speaker
1330 * when the external headphone out jack is plugged"
1332 if (!spec->autocfg.hp_pins[0]) {
1333 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1335 spec->autocfg.hp_pins[0] = porta;
1337 spec->autocfg.hp_pins[0] = porte;
1339 spec->autocfg.hp_pins[0] = portd;
1344 alc_init_auto_hp(codec);
1345 alc_init_auto_mic(codec);
1349 static void alc_ssid_check(struct hda_codec *codec,
1350 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1352 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1353 struct alc_spec *spec = codec->spec;
1354 snd_printd("realtek: "
1355 "Enable default setup for auto mode as fallback\n");
1356 spec->init_amp = ALC_INIT_DEFAULT;
1357 alc_init_auto_hp(codec);
1358 alc_init_auto_mic(codec);
1363 * Fix-up pin default configurations
1371 static void alc_fix_pincfg(struct hda_codec *codec,
1372 const struct snd_pci_quirk *quirk,
1373 const struct alc_pincfg **pinfix)
1375 const struct alc_pincfg *cfg;
1377 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1381 cfg = pinfix[quirk->value];
1382 for (; cfg->nid; cfg++)
1383 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1393 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1394 /* Mic-in jack as mic in */
1395 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1396 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1397 /* Line-in jack as Line in */
1398 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1399 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1400 /* Line-Out as Front */
1401 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1408 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1409 /* Mic-in jack as mic in */
1410 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1411 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1412 /* Line-in jack as Surround */
1413 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1414 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1415 /* Line-Out as Front */
1416 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1423 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1424 /* Mic-in jack as CLFE */
1425 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1426 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1427 /* Line-in jack as Surround */
1428 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1429 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1430 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1431 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1438 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1439 /* Mic-in jack as CLFE */
1440 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1441 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1442 /* Line-in jack as Surround */
1443 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1444 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1445 /* Line-Out as Side */
1446 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1450 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1451 { 2, alc888_4ST_ch2_intel_init },
1452 { 4, alc888_4ST_ch4_intel_init },
1453 { 6, alc888_4ST_ch6_intel_init },
1454 { 8, alc888_4ST_ch8_intel_init },
1458 * ALC888 Fujitsu Siemens Amillo xa3530
1461 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1462 /* Front Mic: set to PIN_IN (empty by default) */
1463 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1464 /* Connect Internal HP to Front */
1465 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1466 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1467 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1468 /* Connect Bass HP to Front */
1469 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1470 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1471 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1472 /* Connect Line-Out side jack (SPDIF) to Side */
1473 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1474 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1475 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1476 /* Connect Mic jack to CLFE */
1477 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1478 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1479 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1480 /* Connect Line-in jack to Surround */
1481 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1482 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1483 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1484 /* Connect HP out jack to Front */
1485 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1486 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1487 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1488 /* Enable unsolicited event for HP jack and Line-out jack */
1489 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1490 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1494 static void alc_automute_amp(struct hda_codec *codec)
1496 struct alc_spec *spec = codec->spec;
1497 unsigned int val, mute, pincap;
1501 spec->jack_present = 0;
1502 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1503 nid = spec->autocfg.hp_pins[i];
1506 pincap = snd_hda_query_pin_caps(codec, nid);
1507 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1508 snd_hda_codec_read(codec, nid, 0,
1509 AC_VERB_SET_PIN_SENSE, 0);
1510 val = snd_hda_codec_read(codec, nid, 0,
1511 AC_VERB_GET_PIN_SENSE, 0);
1512 if (val & AC_PINSENSE_PRESENCE) {
1513 spec->jack_present = 1;
1518 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1519 /* Toggle internal speakers muting */
1520 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1521 nid = spec->autocfg.speaker_pins[i];
1524 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1525 HDA_AMP_MUTE, mute);
1529 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1532 if (codec->vendor_id == 0x10ec0880)
1536 if (res == ALC880_HP_EVENT)
1537 alc_automute_amp(codec);
1540 static void alc889_automute_setup(struct hda_codec *codec)
1542 struct alc_spec *spec = codec->spec;
1544 spec->autocfg.hp_pins[0] = 0x15;
1545 spec->autocfg.speaker_pins[0] = 0x14;
1546 spec->autocfg.speaker_pins[1] = 0x16;
1547 spec->autocfg.speaker_pins[2] = 0x17;
1548 spec->autocfg.speaker_pins[3] = 0x19;
1549 spec->autocfg.speaker_pins[4] = 0x1a;
1552 static void alc889_intel_init_hook(struct hda_codec *codec)
1554 alc889_coef_init(codec);
1555 alc_automute_amp(codec);
1558 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1560 struct alc_spec *spec = codec->spec;
1562 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1563 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1564 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1565 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1569 * ALC888 Acer Aspire 4930G model
1572 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1573 /* Front Mic: set to PIN_IN (empty by default) */
1574 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1575 /* Unselect Front Mic by default in input mixer 3 */
1576 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1577 /* Enable unsolicited event for HP jack */
1578 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1579 /* Connect Internal HP to front */
1580 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1581 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1582 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1583 /* Connect HP out to front */
1584 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1585 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1586 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1591 * ALC888 Acer Aspire 6530G model
1594 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1595 /* Bias voltage on for external mic port */
1596 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1597 /* Front Mic: set to PIN_IN (empty by default) */
1598 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1599 /* Unselect Front Mic by default in input mixer 3 */
1600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1601 /* Enable unsolicited event for HP jack */
1602 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1603 /* Enable speaker output */
1604 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1605 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1606 /* Enable headphone output */
1607 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1608 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1609 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1614 * ALC889 Acer Aspire 8930G model
1617 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1618 /* Front Mic: set to PIN_IN (empty by default) */
1619 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1620 /* Unselect Front Mic by default in input mixer 3 */
1621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1622 /* Enable unsolicited event for HP jack */
1623 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1624 /* Connect Internal Front to Front */
1625 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1626 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1627 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1628 /* Connect Internal Rear to Rear */
1629 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1630 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1631 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1632 /* Connect Internal CLFE to CLFE */
1633 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1634 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1635 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1636 /* Connect HP out to Front */
1637 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1639 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1640 /* Enable all DACs */
1641 /* DAC DISABLE/MUTE 1? */
1642 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1643 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1644 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1645 /* DAC DISABLE/MUTE 2? */
1646 /* some bit here disables the other DACs. Init=0x4900 */
1647 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1648 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1649 /* Enable amplifiers */
1650 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1651 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1653 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1654 * which makes the stereo useless. However, either the mic or the ALC889
1655 * makes the signal become a difference/sum signal instead of standard
1656 * stereo, which is annoying. So instead we flip this bit which makes the
1657 * codec replicate the sum signal to both channels, turning it into a
1660 /* DMIC_CONTROL? Init value = 0x0001 */
1661 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1662 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1666 static struct hda_input_mux alc888_2_capture_sources[2] = {
1667 /* Front mic only available on one ADC */
1674 { "Front Mic", 0xb },
1687 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1688 /* Interal mic only available on one ADC */
1695 { "Input Mix", 0xa },
1705 { "Input Mix", 0xa },
1710 static struct hda_input_mux alc889_capture_sources[3] = {
1711 /* Digital mic only available on first "ADC" */
1718 { "Front Mic", 0xb },
1719 { "Input Mix", 0xa },
1728 { "Input Mix", 0xa },
1737 { "Input Mix", 0xa },
1742 static struct snd_kcontrol_new alc888_base_mixer[] = {
1743 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1744 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1745 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1746 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1747 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1749 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1750 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1751 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1752 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1753 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1754 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1755 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1756 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1757 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1758 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1759 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1760 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1764 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1766 struct alc_spec *spec = codec->spec;
1768 spec->autocfg.hp_pins[0] = 0x15;
1769 spec->autocfg.speaker_pins[0] = 0x14;
1772 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1774 struct alc_spec *spec = codec->spec;
1776 spec->autocfg.hp_pins[0] = 0x15;
1777 spec->autocfg.speaker_pins[0] = 0x14;
1778 spec->autocfg.speaker_pins[1] = 0x16;
1779 spec->autocfg.speaker_pins[2] = 0x17;
1782 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1784 struct alc_spec *spec = codec->spec;
1786 spec->autocfg.hp_pins[0] = 0x15;
1787 spec->autocfg.speaker_pins[0] = 0x14;
1788 spec->autocfg.speaker_pins[1] = 0x16;
1789 spec->autocfg.speaker_pins[2] = 0x1b;
1793 * ALC880 3-stack model
1795 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1796 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1797 * F-Mic = 0x1b, HP = 0x19
1800 static hda_nid_t alc880_dac_nids[4] = {
1801 /* front, rear, clfe, rear_surr */
1802 0x02, 0x05, 0x04, 0x03
1805 static hda_nid_t alc880_adc_nids[3] = {
1810 /* The datasheet says the node 0x07 is connected from inputs,
1811 * but it shows zero connection in the real implementation on some devices.
1812 * Note: this is a 915GAV bug, fixed on 915GLV
1814 static hda_nid_t alc880_adc_nids_alt[2] = {
1819 #define ALC880_DIGOUT_NID 0x06
1820 #define ALC880_DIGIN_NID 0x0a
1822 static struct hda_input_mux alc880_capture_source = {
1826 { "Front Mic", 0x3 },
1832 /* channel source setting (2/6 channel selection for 3-stack) */
1834 static struct hda_verb alc880_threestack_ch2_init[] = {
1835 /* set line-in to input, mute it */
1836 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1837 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1838 /* set mic-in to input vref 80%, mute it */
1839 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1840 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1845 static struct hda_verb alc880_threestack_ch6_init[] = {
1846 /* set line-in to output, unmute it */
1847 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1848 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1849 /* set mic-in to output, unmute it */
1850 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1851 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1855 static struct hda_channel_mode alc880_threestack_modes[2] = {
1856 { 2, alc880_threestack_ch2_init },
1857 { 6, alc880_threestack_ch6_init },
1860 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1861 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1862 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1863 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1864 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1865 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1866 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1867 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1868 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1869 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1870 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1871 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1872 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1874 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1875 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1876 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1877 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1879 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1880 .name = "Channel Mode",
1881 .info = alc_ch_mode_info,
1882 .get = alc_ch_mode_get,
1883 .put = alc_ch_mode_put,
1888 /* capture mixer elements */
1889 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1890 struct snd_ctl_elem_info *uinfo)
1892 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1893 struct alc_spec *spec = codec->spec;
1896 mutex_lock(&codec->control_mutex);
1897 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1899 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1900 mutex_unlock(&codec->control_mutex);
1904 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1905 unsigned int size, unsigned int __user *tlv)
1907 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1908 struct alc_spec *spec = codec->spec;
1911 mutex_lock(&codec->control_mutex);
1912 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1914 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1915 mutex_unlock(&codec->control_mutex);
1919 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1920 struct snd_ctl_elem_value *ucontrol);
1922 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1923 struct snd_ctl_elem_value *ucontrol,
1926 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1927 struct alc_spec *spec = codec->spec;
1928 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1931 mutex_lock(&codec->control_mutex);
1932 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1934 err = func(kcontrol, ucontrol);
1935 mutex_unlock(&codec->control_mutex);
1939 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1940 struct snd_ctl_elem_value *ucontrol)
1942 return alc_cap_getput_caller(kcontrol, ucontrol,
1943 snd_hda_mixer_amp_volume_get);
1946 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1947 struct snd_ctl_elem_value *ucontrol)
1949 return alc_cap_getput_caller(kcontrol, ucontrol,
1950 snd_hda_mixer_amp_volume_put);
1953 /* capture mixer elements */
1954 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1956 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1957 struct snd_ctl_elem_value *ucontrol)
1959 return alc_cap_getput_caller(kcontrol, ucontrol,
1960 snd_hda_mixer_amp_switch_get);
1963 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1964 struct snd_ctl_elem_value *ucontrol)
1966 return alc_cap_getput_caller(kcontrol, ucontrol,
1967 snd_hda_mixer_amp_switch_put);
1970 #define _DEFINE_CAPMIX(num) \
1972 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1973 .name = "Capture Switch", \
1974 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1976 .info = alc_cap_sw_info, \
1977 .get = alc_cap_sw_get, \
1978 .put = alc_cap_sw_put, \
1981 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1982 .name = "Capture Volume", \
1983 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1984 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1985 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1987 .info = alc_cap_vol_info, \
1988 .get = alc_cap_vol_get, \
1989 .put = alc_cap_vol_put, \
1990 .tlv = { .c = alc_cap_vol_tlv }, \
1993 #define _DEFINE_CAPSRC(num) \
1995 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1996 /* .name = "Capture Source", */ \
1997 .name = "Input Source", \
1999 .info = alc_mux_enum_info, \
2000 .get = alc_mux_enum_get, \
2001 .put = alc_mux_enum_put, \
2004 #define DEFINE_CAPMIX(num) \
2005 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2006 _DEFINE_CAPMIX(num), \
2007 _DEFINE_CAPSRC(num), \
2011 #define DEFINE_CAPMIX_NOSRC(num) \
2012 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2013 _DEFINE_CAPMIX(num), \
2017 /* up to three ADCs */
2021 DEFINE_CAPMIX_NOSRC(1);
2022 DEFINE_CAPMIX_NOSRC(2);
2023 DEFINE_CAPMIX_NOSRC(3);
2026 * ALC880 5-stack model
2028 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2030 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2031 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2034 /* additional mixers to alc880_three_stack_mixer */
2035 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2036 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2037 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2041 /* channel source setting (6/8 channel selection for 5-stack) */
2043 static struct hda_verb alc880_fivestack_ch6_init[] = {
2044 /* set line-in to input, mute it */
2045 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2046 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2051 static struct hda_verb alc880_fivestack_ch8_init[] = {
2052 /* set line-in to output, unmute it */
2053 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2054 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2058 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2059 { 6, alc880_fivestack_ch6_init },
2060 { 8, alc880_fivestack_ch8_init },
2065 * ALC880 6-stack model
2067 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2068 * Side = 0x05 (0x0f)
2069 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2070 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2073 static hda_nid_t alc880_6st_dac_nids[4] = {
2074 /* front, rear, clfe, rear_surr */
2075 0x02, 0x03, 0x04, 0x05
2078 static struct hda_input_mux alc880_6stack_capture_source = {
2082 { "Front Mic", 0x1 },
2088 /* fixed 8-channels */
2089 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2093 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2094 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2095 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2096 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2097 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2098 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2099 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2100 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2101 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2102 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2103 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2104 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2105 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2106 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2107 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2110 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2111 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2113 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2114 .name = "Channel Mode",
2115 .info = alc_ch_mode_info,
2116 .get = alc_ch_mode_get,
2117 .put = alc_ch_mode_put,
2126 * W810 has rear IO for:
2129 * Center/LFE (DAC 04)
2132 * The system also has a pair of internal speakers, and a headphone jack.
2133 * These are both connected to Line2 on the codec, hence to DAC 02.
2135 * There is a variable resistor to control the speaker or headphone
2136 * volume. This is a hardware-only device without a software API.
2138 * Plugging headphones in will disable the internal speakers. This is
2139 * implemented in hardware, not via the driver using jack sense. In
2140 * a similar fashion, plugging into the rear socket marked "front" will
2141 * disable both the speakers and headphones.
2143 * For input, there's a microphone jack, and an "audio in" jack.
2144 * These may not do anything useful with this driver yet, because I
2145 * haven't setup any initialization verbs for these yet...
2148 static hda_nid_t alc880_w810_dac_nids[3] = {
2149 /* front, rear/surround, clfe */
2153 /* fixed 6 channels */
2154 static struct hda_channel_mode alc880_w810_modes[1] = {
2158 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2159 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2160 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2161 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2162 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2163 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2164 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2165 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2166 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2167 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2168 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2176 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2177 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2181 static hda_nid_t alc880_z71v_dac_nids[1] = {
2184 #define ALC880_Z71V_HP_DAC 0x03
2186 /* fixed 2 channels */
2187 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2191 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2192 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2193 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2194 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2195 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2196 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2197 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2199 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2205 * ALC880 F1734 model
2207 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2208 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2211 static hda_nid_t alc880_f1734_dac_nids[1] = {
2214 #define ALC880_F1734_HP_DAC 0x02
2216 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2217 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2218 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2219 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2220 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2221 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2222 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2228 static struct hda_input_mux alc880_f1734_capture_source = {
2240 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2241 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2242 * Mic = 0x18, Line = 0x1a
2245 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2246 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2248 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2249 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2250 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2251 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2252 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2253 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2254 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2255 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2256 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2257 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2258 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2259 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2260 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2261 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2262 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2264 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2265 .name = "Channel Mode",
2266 .info = alc_ch_mode_info,
2267 .get = alc_ch_mode_get,
2268 .put = alc_ch_mode_put,
2274 * ALC880 ASUS W1V model
2276 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2277 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2278 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2281 /* additional mixers to alc880_asus_mixer */
2282 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2283 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2284 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2289 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2290 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2291 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2292 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2293 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2294 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2296 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2297 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2298 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2303 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2304 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2305 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2306 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2307 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2308 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2309 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2310 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2311 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2312 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2313 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2314 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2315 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2316 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2317 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2318 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2319 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2321 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2322 .name = "Channel Mode",
2323 .info = alc_ch_mode_info,
2324 .get = alc_ch_mode_get,
2325 .put = alc_ch_mode_put,
2330 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2331 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2332 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2333 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2334 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2335 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2336 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2337 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2338 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2339 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2340 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2344 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2345 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2346 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2347 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2348 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2349 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2350 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2355 * virtual master controls
2359 * slave controls for virtual master
2361 static const char *alc_slave_vols[] = {
2362 "Front Playback Volume",
2363 "Surround Playback Volume",
2364 "Center Playback Volume",
2365 "LFE Playback Volume",
2366 "Side Playback Volume",
2367 "Headphone Playback Volume",
2368 "Speaker Playback Volume",
2369 "Mono Playback Volume",
2370 "Line-Out Playback Volume",
2371 "PCM Playback Volume",
2375 static const char *alc_slave_sws[] = {
2376 "Front Playback Switch",
2377 "Surround Playback Switch",
2378 "Center Playback Switch",
2379 "LFE Playback Switch",
2380 "Side Playback Switch",
2381 "Headphone Playback Switch",
2382 "Speaker Playback Switch",
2383 "Mono Playback Switch",
2384 "IEC958 Playback Switch",
2389 * build control elements
2392 static void alc_free_kctls(struct hda_codec *codec);
2394 /* additional beep mixers; the actual parameters are overwritten at build */
2395 static struct snd_kcontrol_new alc_beep_mixer[] = {
2396 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2397 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2401 static int alc_build_controls(struct hda_codec *codec)
2403 struct alc_spec *spec = codec->spec;
2407 for (i = 0; i < spec->num_mixers; i++) {
2408 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2412 if (spec->cap_mixer) {
2413 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2417 if (spec->multiout.dig_out_nid) {
2418 err = snd_hda_create_spdif_out_ctls(codec,
2419 spec->multiout.dig_out_nid);
2422 if (!spec->no_analog) {
2423 err = snd_hda_create_spdif_share_sw(codec,
2427 spec->multiout.share_spdif = 1;
2430 if (spec->dig_in_nid) {
2431 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2436 /* create beep controls if needed */
2437 if (spec->beep_amp) {
2438 struct snd_kcontrol_new *knew;
2439 for (knew = alc_beep_mixer; knew->name; knew++) {
2440 struct snd_kcontrol *kctl;
2441 kctl = snd_ctl_new1(knew, codec);
2444 kctl->private_value = spec->beep_amp;
2445 err = snd_hda_ctl_add(codec, kctl);
2451 /* if we have no master control, let's create it */
2452 if (!spec->no_analog &&
2453 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2454 unsigned int vmaster_tlv[4];
2455 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2456 HDA_OUTPUT, vmaster_tlv);
2457 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2458 vmaster_tlv, alc_slave_vols);
2462 if (!spec->no_analog &&
2463 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2464 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2465 NULL, alc_slave_sws);
2470 alc_free_kctls(codec); /* no longer needed */
2476 * initialize the codec volumes, etc
2480 * generic initialization of ADC, input mixers and output mixers
2482 static struct hda_verb alc880_volume_init_verbs[] = {
2484 * Unmute ADC0-2 and set the default input to mic-in
2486 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2488 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2489 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2490 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2491 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2493 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2495 * Note: PASD motherboards uses the Line In 2 as the input for front
2498 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2499 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2500 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2501 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2502 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2503 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2508 * Set up output mixers (0x0c - 0x0f)
2510 /* set vol=0 to output mixers */
2511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2512 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2513 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2514 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2515 /* set up input amps for analog loopback */
2516 /* Amp Indices: DAC = 0, mixer = 1 */
2517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2519 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2520 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2521 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2522 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2523 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2524 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2530 * 3-stack pin configuration:
2531 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2533 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2535 * preset connection lists of input pins
2536 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2538 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2539 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2540 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2543 * Set pin mode and muting
2545 /* set front pin widgets 0x14 for output */
2546 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2548 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2549 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2550 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2551 /* Mic2 (as headphone out) for HP output */
2552 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2553 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2554 /* Line In pin widget for input */
2555 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2556 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2557 /* Line2 (as front mic) pin widget for input and vref at 80% */
2558 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2559 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2560 /* CD pin widget for input */
2561 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2567 * 5-stack pin configuration:
2568 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2569 * line-in/side = 0x1a, f-mic = 0x1b
2571 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2573 * preset connection lists of input pins
2574 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2576 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2577 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2580 * Set pin mode and muting
2582 /* set pin widgets 0x14-0x17 for output */
2583 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2584 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2585 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2586 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2587 /* unmute pins for output (no gain on this amp) */
2588 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2589 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2590 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2591 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2593 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2594 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2595 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2596 /* Mic2 (as headphone out) for HP output */
2597 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2598 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2599 /* Line In pin widget for input */
2600 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2601 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2602 /* Line2 (as front mic) pin widget for input and vref at 80% */
2603 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2604 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2605 /* CD pin widget for input */
2606 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2612 * W810 pin configuration:
2613 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2615 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2616 /* hphone/speaker input selector: front DAC */
2617 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2619 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2620 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2621 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2622 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2623 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2624 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2626 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2627 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2633 * Z71V pin configuration:
2634 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2636 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2637 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2638 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2639 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2640 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2642 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2643 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2644 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2645 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2651 * 6-stack pin configuration:
2652 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2653 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2655 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2656 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2658 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2659 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2660 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2661 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2662 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2663 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2664 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2665 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2667 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2668 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2669 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2670 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2671 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2672 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2673 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2674 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2675 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2681 * Uniwill pin configuration:
2682 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2685 static struct hda_verb alc880_uniwill_init_verbs[] = {
2686 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2689 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2690 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2692 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2693 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2694 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2695 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2696 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2697 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2698 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2699 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2700 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2701 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2703 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2704 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2705 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2706 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2707 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2708 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2709 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2710 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2711 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2713 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2714 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2721 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2723 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2724 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2726 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2727 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2728 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2729 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2730 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2731 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2733 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2734 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2735 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2736 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2737 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2739 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2740 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2741 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2742 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2743 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2744 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2746 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2747 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2752 static struct hda_verb alc880_beep_init_verbs[] = {
2753 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2757 /* auto-toggle front mic */
2758 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2760 unsigned int present;
2763 present = snd_hda_codec_read(codec, 0x18, 0,
2764 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2765 bits = present ? HDA_AMP_MUTE : 0;
2766 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2769 static void alc880_uniwill_setup(struct hda_codec *codec)
2771 struct alc_spec *spec = codec->spec;
2773 spec->autocfg.hp_pins[0] = 0x14;
2774 spec->autocfg.speaker_pins[0] = 0x15;
2775 spec->autocfg.speaker_pins[0] = 0x16;
2778 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2780 alc_automute_amp(codec);
2781 alc880_uniwill_mic_automute(codec);
2784 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2787 /* Looks like the unsol event is incompatible with the standard
2788 * definition. 4bit tag is placed at 28 bit!
2790 switch (res >> 28) {
2791 case ALC880_MIC_EVENT:
2792 alc880_uniwill_mic_automute(codec);
2795 alc_automute_amp_unsol_event(codec, res);
2800 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2802 struct alc_spec *spec = codec->spec;
2804 spec->autocfg.hp_pins[0] = 0x14;
2805 spec->autocfg.speaker_pins[0] = 0x15;
2808 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2810 unsigned int present;
2812 present = snd_hda_codec_read(codec, 0x21, 0,
2813 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2814 present &= HDA_AMP_VOLMASK;
2815 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2816 HDA_AMP_VOLMASK, present);
2817 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2818 HDA_AMP_VOLMASK, present);
2821 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2824 /* Looks like the unsol event is incompatible with the standard
2825 * definition. 4bit tag is placed at 28 bit!
2827 if ((res >> 28) == ALC880_DCVOL_EVENT)
2828 alc880_uniwill_p53_dcvol_automute(codec);
2830 alc_automute_amp_unsol_event(codec, res);
2834 * F1734 pin configuration:
2835 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2837 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2838 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2839 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2840 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2841 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2842 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2844 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2845 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2846 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2847 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2849 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2850 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2851 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2852 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2853 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2854 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2855 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2856 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2857 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2859 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2860 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2866 * ASUS pin configuration:
2867 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2869 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2870 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2871 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2872 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2873 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2875 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2876 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2877 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2878 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2879 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2880 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2881 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2882 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2884 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2885 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2886 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2887 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2888 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2889 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2890 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2891 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2892 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2897 /* Enable GPIO mask and set output */
2898 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2899 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2900 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2902 /* Clevo m520g init */
2903 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2904 /* headphone output */
2905 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2907 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2908 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2910 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2911 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2913 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2914 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2915 /* Mic1 (rear panel) */
2916 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2917 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2918 /* Mic2 (front panel) */
2919 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2920 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2922 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2923 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2924 /* change to EAPD mode */
2925 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2926 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2931 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2932 /* change to EAPD mode */
2933 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2934 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2936 /* Headphone output */
2937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2939 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2940 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2942 /* Line In pin widget for input */
2943 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2944 /* CD pin widget for input */
2945 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2946 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2947 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2949 /* change to EAPD mode */
2950 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2951 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2957 * LG m1 express dual
2960 * Rear Line-In/Out (blue): 0x14
2961 * Build-in Mic-In: 0x15
2963 * HP-Out (green): 0x1b
2964 * Mic-In/Out (red): 0x19
2968 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2969 static hda_nid_t alc880_lg_dac_nids[3] = {
2973 /* seems analog CD is not working */
2974 static struct hda_input_mux alc880_lg_capture_source = {
2979 { "Internal Mic", 0x6 },
2983 /* 2,4,6 channel modes */
2984 static struct hda_verb alc880_lg_ch2_init[] = {
2985 /* set line-in and mic-in to input */
2986 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2987 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2991 static struct hda_verb alc880_lg_ch4_init[] = {
2992 /* set line-in to out and mic-in to input */
2993 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2994 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2998 static struct hda_verb alc880_lg_ch6_init[] = {
2999 /* set line-in and mic-in to output */
3000 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3001 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3005 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3006 { 2, alc880_lg_ch2_init },
3007 { 4, alc880_lg_ch4_init },
3008 { 6, alc880_lg_ch6_init },
3011 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3012 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3013 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3014 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3015 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3016 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3017 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3018 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3019 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3022 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3023 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3024 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3025 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3027 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3028 .name = "Channel Mode",
3029 .info = alc_ch_mode_info,
3030 .get = alc_ch_mode_get,
3031 .put = alc_ch_mode_put,
3036 static struct hda_verb alc880_lg_init_verbs[] = {
3037 /* set capture source to mic-in */
3038 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3039 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3040 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3041 /* mute all amp mixer inputs */
3042 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3044 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3045 /* line-in to input */
3046 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3047 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3049 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3050 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3052 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3053 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3054 /* mic-in to input */
3055 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3056 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3057 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3059 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3060 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3061 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3063 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3067 /* toggle speaker-output according to the hp-jack state */
3068 static void alc880_lg_setup(struct hda_codec *codec)
3070 struct alc_spec *spec = codec->spec;
3072 spec->autocfg.hp_pins[0] = 0x1b;
3073 spec->autocfg.speaker_pins[0] = 0x17;
3082 * Built-in Mic-In: 0x19
3088 static struct hda_input_mux alc880_lg_lw_capture_source = {
3092 { "Internal Mic", 0x1 },
3097 #define alc880_lg_lw_modes alc880_threestack_modes
3099 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3100 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3101 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3102 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3103 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3104 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3105 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3106 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3107 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3108 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3109 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3111 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3112 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3113 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3115 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3116 .name = "Channel Mode",
3117 .info = alc_ch_mode_info,
3118 .get = alc_ch_mode_get,
3119 .put = alc_ch_mode_put,
3124 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3125 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3126 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3127 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3129 /* set capture source to mic-in */
3130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3131 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3132 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3135 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3136 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3138 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3139 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3140 /* mic-in to input */
3141 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3142 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3144 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3145 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3147 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3151 /* toggle speaker-output according to the hp-jack state */
3152 static void alc880_lg_lw_setup(struct hda_codec *codec)
3154 struct alc_spec *spec = codec->spec;
3156 spec->autocfg.hp_pins[0] = 0x1b;
3157 spec->autocfg.speaker_pins[0] = 0x14;
3160 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3161 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3162 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3164 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3165 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3166 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3170 static struct hda_input_mux alc880_medion_rim_capture_source = {
3174 { "Internal Mic", 0x1 },
3178 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3179 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3181 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3182 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3184 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3185 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3186 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3187 /* Mic2 (as headphone out) for HP output */
3188 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3189 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3190 /* Internal Speaker */
3191 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3192 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3194 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3195 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3197 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3201 /* toggle speaker-output according to the hp-jack state */
3202 static void alc880_medion_rim_automute(struct hda_codec *codec)
3204 struct alc_spec *spec = codec->spec;
3205 alc_automute_amp(codec);
3207 if (spec->jack_present)
3208 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3210 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3213 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3216 /* Looks like the unsol event is incompatible with the standard
3217 * definition. 4bit tag is placed at 28 bit!
3219 if ((res >> 28) == ALC880_HP_EVENT)
3220 alc880_medion_rim_automute(codec);
3223 static void alc880_medion_rim_setup(struct hda_codec *codec)
3225 struct alc_spec *spec = codec->spec;
3227 spec->autocfg.hp_pins[0] = 0x14;
3228 spec->autocfg.speaker_pins[0] = 0x1b;
3231 #ifdef CONFIG_SND_HDA_POWER_SAVE
3232 static struct hda_amp_list alc880_loopbacks[] = {
3233 { 0x0b, HDA_INPUT, 0 },
3234 { 0x0b, HDA_INPUT, 1 },
3235 { 0x0b, HDA_INPUT, 2 },
3236 { 0x0b, HDA_INPUT, 3 },
3237 { 0x0b, HDA_INPUT, 4 },
3241 static struct hda_amp_list alc880_lg_loopbacks[] = {
3242 { 0x0b, HDA_INPUT, 1 },
3243 { 0x0b, HDA_INPUT, 6 },
3244 { 0x0b, HDA_INPUT, 7 },
3253 static int alc_init(struct hda_codec *codec)
3255 struct alc_spec *spec = codec->spec;
3259 alc_auto_init_amp(codec, spec->init_amp);
3261 for (i = 0; i < spec->num_init_verbs; i++)
3262 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3264 if (spec->init_hook)
3265 spec->init_hook(codec);
3270 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3272 struct alc_spec *spec = codec->spec;
3274 if (spec->unsol_event)
3275 spec->unsol_event(codec, res);
3278 #ifdef CONFIG_SND_HDA_POWER_SAVE
3279 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3281 struct alc_spec *spec = codec->spec;
3282 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3287 * Analog playback callbacks
3289 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3290 struct hda_codec *codec,
3291 struct snd_pcm_substream *substream)
3293 struct alc_spec *spec = codec->spec;
3294 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3298 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3299 struct hda_codec *codec,
3300 unsigned int stream_tag,
3301 unsigned int format,
3302 struct snd_pcm_substream *substream)
3304 struct alc_spec *spec = codec->spec;
3305 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3306 stream_tag, format, substream);
3309 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3310 struct hda_codec *codec,
3311 struct snd_pcm_substream *substream)
3313 struct alc_spec *spec = codec->spec;
3314 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3320 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3321 struct hda_codec *codec,
3322 struct snd_pcm_substream *substream)
3324 struct alc_spec *spec = codec->spec;
3325 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3328 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3329 struct hda_codec *codec,
3330 unsigned int stream_tag,
3331 unsigned int format,
3332 struct snd_pcm_substream *substream)
3334 struct alc_spec *spec = codec->spec;
3335 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3336 stream_tag, format, substream);
3339 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3340 struct hda_codec *codec,
3341 struct snd_pcm_substream *substream)
3343 struct alc_spec *spec = codec->spec;
3344 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3347 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3348 struct hda_codec *codec,
3349 struct snd_pcm_substream *substream)
3351 struct alc_spec *spec = codec->spec;
3352 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3358 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3359 struct hda_codec *codec,
3360 unsigned int stream_tag,
3361 unsigned int format,
3362 struct snd_pcm_substream *substream)
3364 struct alc_spec *spec = codec->spec;
3366 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3367 stream_tag, 0, format);
3371 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3372 struct hda_codec *codec,
3373 struct snd_pcm_substream *substream)
3375 struct alc_spec *spec = codec->spec;
3377 snd_hda_codec_cleanup_stream(codec,
3378 spec->adc_nids[substream->number + 1]);
3385 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3389 /* NID is set in alc_build_pcms */
3391 .open = alc880_playback_pcm_open,
3392 .prepare = alc880_playback_pcm_prepare,
3393 .cleanup = alc880_playback_pcm_cleanup
3397 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3401 /* NID is set in alc_build_pcms */
3404 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3408 /* NID is set in alc_build_pcms */
3411 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3412 .substreams = 2, /* can be overridden */
3415 /* NID is set in alc_build_pcms */
3417 .prepare = alc880_alt_capture_pcm_prepare,
3418 .cleanup = alc880_alt_capture_pcm_cleanup
3422 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3426 /* NID is set in alc_build_pcms */
3428 .open = alc880_dig_playback_pcm_open,
3429 .close = alc880_dig_playback_pcm_close,
3430 .prepare = alc880_dig_playback_pcm_prepare,
3431 .cleanup = alc880_dig_playback_pcm_cleanup
3435 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3439 /* NID is set in alc_build_pcms */
3442 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3443 static struct hda_pcm_stream alc_pcm_null_stream = {
3449 static int alc_build_pcms(struct hda_codec *codec)
3451 struct alc_spec *spec = codec->spec;
3452 struct hda_pcm *info = spec->pcm_rec;
3455 codec->num_pcms = 1;
3456 codec->pcm_info = info;
3458 if (spec->no_analog)
3461 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3462 "%s Analog", codec->chip_name);
3463 info->name = spec->stream_name_analog;
3465 if (spec->stream_analog_playback) {
3466 if (snd_BUG_ON(!spec->multiout.dac_nids))
3468 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3469 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3471 if (spec->stream_analog_capture) {
3472 if (snd_BUG_ON(!spec->adc_nids))
3474 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3475 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3478 if (spec->channel_mode) {
3479 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3480 for (i = 0; i < spec->num_channel_mode; i++) {
3481 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3482 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3488 /* SPDIF for stream index #1 */
3489 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3490 snprintf(spec->stream_name_digital,
3491 sizeof(spec->stream_name_digital),
3492 "%s Digital", codec->chip_name);
3493 codec->num_pcms = 2;
3494 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3495 info = spec->pcm_rec + 1;
3496 info->name = spec->stream_name_digital;
3497 if (spec->dig_out_type)
3498 info->pcm_type = spec->dig_out_type;
3500 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3501 if (spec->multiout.dig_out_nid &&
3502 spec->stream_digital_playback) {
3503 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3504 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3506 if (spec->dig_in_nid &&
3507 spec->stream_digital_capture) {
3508 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3509 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3511 /* FIXME: do we need this for all Realtek codec models? */
3512 codec->spdif_status_reset = 1;
3515 if (spec->no_analog)
3518 /* If the use of more than one ADC is requested for the current
3519 * model, configure a second analog capture-only PCM.
3521 /* Additional Analaog capture for index #2 */
3522 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3523 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3524 codec->num_pcms = 3;
3525 info = spec->pcm_rec + 2;
3526 info->name = spec->stream_name_analog;
3527 if (spec->alt_dac_nid) {
3528 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3529 *spec->stream_analog_alt_playback;
3530 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3533 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3534 alc_pcm_null_stream;
3535 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3537 if (spec->num_adc_nids > 1) {
3538 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3539 *spec->stream_analog_alt_capture;
3540 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3542 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3543 spec->num_adc_nids - 1;
3545 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3546 alc_pcm_null_stream;
3547 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3554 static void alc_free_kctls(struct hda_codec *codec)
3556 struct alc_spec *spec = codec->spec;
3558 if (spec->kctls.list) {
3559 struct snd_kcontrol_new *kctl = spec->kctls.list;
3561 for (i = 0; i < spec->kctls.used; i++)
3562 kfree(kctl[i].name);
3564 snd_array_free(&spec->kctls);
3567 static void alc_free(struct hda_codec *codec)
3569 struct alc_spec *spec = codec->spec;
3574 alc_free_kctls(codec);
3576 snd_hda_detach_beep_device(codec);
3579 #ifdef SND_HDA_NEEDS_RESUME
3580 static int alc_resume(struct hda_codec *codec)
3582 codec->patch_ops.init(codec);
3583 snd_hda_codec_resume_amp(codec);
3584 snd_hda_codec_resume_cache(codec);
3591 static struct hda_codec_ops alc_patch_ops = {
3592 .build_controls = alc_build_controls,
3593 .build_pcms = alc_build_pcms,
3596 .unsol_event = alc_unsol_event,
3597 #ifdef SND_HDA_NEEDS_RESUME
3598 .resume = alc_resume,
3600 #ifdef CONFIG_SND_HDA_POWER_SAVE
3601 .check_power_status = alc_check_power_status,
3607 * Test configuration for debugging
3609 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3612 #ifdef CONFIG_SND_DEBUG
3613 static hda_nid_t alc880_test_dac_nids[4] = {
3614 0x02, 0x03, 0x04, 0x05
3617 static struct hda_input_mux alc880_test_capture_source = {
3626 { "Surround", 0x6 },
3630 static struct hda_channel_mode alc880_test_modes[4] = {
3637 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3638 struct snd_ctl_elem_info *uinfo)
3640 static char *texts[] = {
3641 "N/A", "Line Out", "HP Out",
3642 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3644 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3646 uinfo->value.enumerated.items = 8;
3647 if (uinfo->value.enumerated.item >= 8)
3648 uinfo->value.enumerated.item = 7;
3649 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3653 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3654 struct snd_ctl_elem_value *ucontrol)
3656 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3657 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3658 unsigned int pin_ctl, item = 0;
3660 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3661 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3662 if (pin_ctl & AC_PINCTL_OUT_EN) {
3663 if (pin_ctl & AC_PINCTL_HP_EN)
3667 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3668 switch (pin_ctl & AC_PINCTL_VREFEN) {
3669 case AC_PINCTL_VREF_HIZ: item = 3; break;
3670 case AC_PINCTL_VREF_50: item = 4; break;
3671 case AC_PINCTL_VREF_GRD: item = 5; break;
3672 case AC_PINCTL_VREF_80: item = 6; break;
3673 case AC_PINCTL_VREF_100: item = 7; break;
3676 ucontrol->value.enumerated.item[0] = item;
3680 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3681 struct snd_ctl_elem_value *ucontrol)
3683 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3684 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3685 static unsigned int ctls[] = {
3686 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3687 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3688 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3689 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3690 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3691 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3693 unsigned int old_ctl, new_ctl;
3695 old_ctl = snd_hda_codec_read(codec, nid, 0,
3696 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3697 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3698 if (old_ctl != new_ctl) {
3700 snd_hda_codec_write_cache(codec, nid, 0,
3701 AC_VERB_SET_PIN_WIDGET_CONTROL,
3703 val = ucontrol->value.enumerated.item[0] >= 3 ?
3705 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3712 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3713 struct snd_ctl_elem_info *uinfo)
3715 static char *texts[] = {
3716 "Front", "Surround", "CLFE", "Side"
3718 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3720 uinfo->value.enumerated.items = 4;
3721 if (uinfo->value.enumerated.item >= 4)
3722 uinfo->value.enumerated.item = 3;
3723 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3727 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3728 struct snd_ctl_elem_value *ucontrol)
3730 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3731 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3734 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3735 ucontrol->value.enumerated.item[0] = sel & 3;
3739 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3740 struct snd_ctl_elem_value *ucontrol)
3742 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3743 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3746 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3747 if (ucontrol->value.enumerated.item[0] != sel) {
3748 sel = ucontrol->value.enumerated.item[0] & 3;
3749 snd_hda_codec_write_cache(codec, nid, 0,
3750 AC_VERB_SET_CONNECT_SEL, sel);
3756 #define PIN_CTL_TEST(xname,nid) { \
3757 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3759 .info = alc_test_pin_ctl_info, \
3760 .get = alc_test_pin_ctl_get, \
3761 .put = alc_test_pin_ctl_put, \
3762 .private_value = nid \
3765 #define PIN_SRC_TEST(xname,nid) { \
3766 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3768 .info = alc_test_pin_src_info, \
3769 .get = alc_test_pin_src_get, \
3770 .put = alc_test_pin_src_put, \
3771 .private_value = nid \
3774 static struct snd_kcontrol_new alc880_test_mixer[] = {
3775 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3776 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3777 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3778 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3779 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3780 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3781 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3782 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3783 PIN_CTL_TEST("Front Pin Mode", 0x14),
3784 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3785 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3786 PIN_CTL_TEST("Side Pin Mode", 0x17),
3787 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3788 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3789 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3790 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3791 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3792 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3793 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3794 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3795 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3796 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3797 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3798 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3799 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3800 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3801 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3802 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3803 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3804 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3806 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3807 .name = "Channel Mode",
3808 .info = alc_ch_mode_info,
3809 .get = alc_ch_mode_get,
3810 .put = alc_ch_mode_put,
3815 static struct hda_verb alc880_test_init_verbs[] = {
3816 /* Unmute inputs of 0x0c - 0x0f */
3817 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3818 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3819 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3820 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3821 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3822 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3823 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3824 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3825 /* Vol output for 0x0c-0x0f */
3826 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3827 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3828 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3829 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3830 /* Set output pins 0x14-0x17 */
3831 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3832 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3833 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3834 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3835 /* Unmute output pins 0x14-0x17 */
3836 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3837 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3838 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3839 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3840 /* Set input pins 0x18-0x1c */
3841 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3842 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3843 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3844 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3845 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3846 /* Mute input pins 0x18-0x1b */
3847 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3848 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3849 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3850 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3852 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3853 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3854 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3855 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3856 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3857 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3858 /* Analog input/passthru */
3859 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3860 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3861 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3862 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3863 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3871 static const char *alc880_models[ALC880_MODEL_LAST] = {
3872 [ALC880_3ST] = "3stack",
3873 [ALC880_TCL_S700] = "tcl",
3874 [ALC880_3ST_DIG] = "3stack-digout",
3875 [ALC880_CLEVO] = "clevo",
3876 [ALC880_5ST] = "5stack",
3877 [ALC880_5ST_DIG] = "5stack-digout",
3878 [ALC880_W810] = "w810",
3879 [ALC880_Z71V] = "z71v",
3880 [ALC880_6ST] = "6stack",
3881 [ALC880_6ST_DIG] = "6stack-digout",
3882 [ALC880_ASUS] = "asus",
3883 [ALC880_ASUS_W1V] = "asus-w1v",
3884 [ALC880_ASUS_DIG] = "asus-dig",
3885 [ALC880_ASUS_DIG2] = "asus-dig2",
3886 [ALC880_UNIWILL_DIG] = "uniwill",
3887 [ALC880_UNIWILL_P53] = "uniwill-p53",
3888 [ALC880_FUJITSU] = "fujitsu",
3889 [ALC880_F1734] = "F1734",
3891 [ALC880_LG_LW] = "lg-lw",
3892 [ALC880_MEDION_RIM] = "medion",
3893 #ifdef CONFIG_SND_DEBUG
3894 [ALC880_TEST] = "test",
3896 [ALC880_AUTO] = "auto",
3899 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3900 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3901 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3902 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3903 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3904 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3905 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3906 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3907 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3908 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3909 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3910 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3911 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3912 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3913 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3914 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3915 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3916 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3917 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3918 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3919 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3920 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3921 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3922 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3923 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3924 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3925 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3926 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3927 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3928 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3929 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3930 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3931 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3932 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3933 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3934 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3935 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3936 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3937 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3938 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3939 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3940 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3941 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3942 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3943 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3944 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3945 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3946 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3947 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3948 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3949 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3950 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3951 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3952 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3953 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3954 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3955 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3956 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3957 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3958 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3959 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3960 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3961 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3962 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3963 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3964 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3965 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3966 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3967 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3969 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3970 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3971 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3976 * ALC880 codec presets
3978 static struct alc_config_preset alc880_presets[] = {
3980 .mixers = { alc880_three_stack_mixer },
3981 .init_verbs = { alc880_volume_init_verbs,
3982 alc880_pin_3stack_init_verbs },
3983 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3984 .dac_nids = alc880_dac_nids,
3985 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3986 .channel_mode = alc880_threestack_modes,
3988 .input_mux = &alc880_capture_source,
3990 [ALC880_3ST_DIG] = {
3991 .mixers = { alc880_three_stack_mixer },
3992 .init_verbs = { alc880_volume_init_verbs,
3993 alc880_pin_3stack_init_verbs },
3994 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3995 .dac_nids = alc880_dac_nids,
3996 .dig_out_nid = ALC880_DIGOUT_NID,
3997 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3998 .channel_mode = alc880_threestack_modes,
4000 .input_mux = &alc880_capture_source,
4002 [ALC880_TCL_S700] = {
4003 .mixers = { alc880_tcl_s700_mixer },
4004 .init_verbs = { alc880_volume_init_verbs,
4005 alc880_pin_tcl_S700_init_verbs,
4006 alc880_gpio2_init_verbs },
4007 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4008 .dac_nids = alc880_dac_nids,
4009 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4010 .num_adc_nids = 1, /* single ADC */
4012 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4013 .channel_mode = alc880_2_jack_modes,
4014 .input_mux = &alc880_capture_source,
4017 .mixers = { alc880_three_stack_mixer,
4018 alc880_five_stack_mixer},
4019 .init_verbs = { alc880_volume_init_verbs,
4020 alc880_pin_5stack_init_verbs },
4021 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4022 .dac_nids = alc880_dac_nids,
4023 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4024 .channel_mode = alc880_fivestack_modes,
4025 .input_mux = &alc880_capture_source,
4027 [ALC880_5ST_DIG] = {
4028 .mixers = { alc880_three_stack_mixer,
4029 alc880_five_stack_mixer },
4030 .init_verbs = { alc880_volume_init_verbs,
4031 alc880_pin_5stack_init_verbs },
4032 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4033 .dac_nids = alc880_dac_nids,
4034 .dig_out_nid = ALC880_DIGOUT_NID,
4035 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4036 .channel_mode = alc880_fivestack_modes,
4037 .input_mux = &alc880_capture_source,
4040 .mixers = { alc880_six_stack_mixer },
4041 .init_verbs = { alc880_volume_init_verbs,
4042 alc880_pin_6stack_init_verbs },
4043 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4044 .dac_nids = alc880_6st_dac_nids,
4045 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4046 .channel_mode = alc880_sixstack_modes,
4047 .input_mux = &alc880_6stack_capture_source,
4049 [ALC880_6ST_DIG] = {
4050 .mixers = { alc880_six_stack_mixer },
4051 .init_verbs = { alc880_volume_init_verbs,
4052 alc880_pin_6stack_init_verbs },
4053 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4054 .dac_nids = alc880_6st_dac_nids,
4055 .dig_out_nid = ALC880_DIGOUT_NID,
4056 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4057 .channel_mode = alc880_sixstack_modes,
4058 .input_mux = &alc880_6stack_capture_source,
4061 .mixers = { alc880_w810_base_mixer },
4062 .init_verbs = { alc880_volume_init_verbs,
4063 alc880_pin_w810_init_verbs,
4064 alc880_gpio2_init_verbs },
4065 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4066 .dac_nids = alc880_w810_dac_nids,
4067 .dig_out_nid = ALC880_DIGOUT_NID,
4068 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4069 .channel_mode = alc880_w810_modes,
4070 .input_mux = &alc880_capture_source,
4073 .mixers = { alc880_z71v_mixer },
4074 .init_verbs = { alc880_volume_init_verbs,
4075 alc880_pin_z71v_init_verbs },
4076 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4077 .dac_nids = alc880_z71v_dac_nids,
4078 .dig_out_nid = ALC880_DIGOUT_NID,
4080 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4081 .channel_mode = alc880_2_jack_modes,
4082 .input_mux = &alc880_capture_source,
4085 .mixers = { alc880_f1734_mixer },
4086 .init_verbs = { alc880_volume_init_verbs,
4087 alc880_pin_f1734_init_verbs },
4088 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4089 .dac_nids = alc880_f1734_dac_nids,
4091 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4092 .channel_mode = alc880_2_jack_modes,
4093 .input_mux = &alc880_f1734_capture_source,
4094 .unsol_event = alc880_uniwill_p53_unsol_event,
4095 .setup = alc880_uniwill_p53_setup,
4096 .init_hook = alc_automute_amp,
4099 .mixers = { alc880_asus_mixer },
4100 .init_verbs = { alc880_volume_init_verbs,
4101 alc880_pin_asus_init_verbs,
4102 alc880_gpio1_init_verbs },
4103 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4104 .dac_nids = alc880_asus_dac_nids,
4105 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4106 .channel_mode = alc880_asus_modes,
4108 .input_mux = &alc880_capture_source,
4110 [ALC880_ASUS_DIG] = {
4111 .mixers = { alc880_asus_mixer },
4112 .init_verbs = { alc880_volume_init_verbs,
4113 alc880_pin_asus_init_verbs,
4114 alc880_gpio1_init_verbs },
4115 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4116 .dac_nids = alc880_asus_dac_nids,
4117 .dig_out_nid = ALC880_DIGOUT_NID,
4118 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4119 .channel_mode = alc880_asus_modes,
4121 .input_mux = &alc880_capture_source,
4123 [ALC880_ASUS_DIG2] = {
4124 .mixers = { alc880_asus_mixer },
4125 .init_verbs = { alc880_volume_init_verbs,
4126 alc880_pin_asus_init_verbs,
4127 alc880_gpio2_init_verbs }, /* use GPIO2 */
4128 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4129 .dac_nids = alc880_asus_dac_nids,
4130 .dig_out_nid = ALC880_DIGOUT_NID,
4131 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4132 .channel_mode = alc880_asus_modes,
4134 .input_mux = &alc880_capture_source,
4136 [ALC880_ASUS_W1V] = {
4137 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4138 .init_verbs = { alc880_volume_init_verbs,
4139 alc880_pin_asus_init_verbs,
4140 alc880_gpio1_init_verbs },
4141 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4142 .dac_nids = alc880_asus_dac_nids,
4143 .dig_out_nid = ALC880_DIGOUT_NID,
4144 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4145 .channel_mode = alc880_asus_modes,
4147 .input_mux = &alc880_capture_source,
4149 [ALC880_UNIWILL_DIG] = {
4150 .mixers = { alc880_asus_mixer },
4151 .init_verbs = { alc880_volume_init_verbs,
4152 alc880_pin_asus_init_verbs },
4153 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4154 .dac_nids = alc880_asus_dac_nids,
4155 .dig_out_nid = ALC880_DIGOUT_NID,
4156 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4157 .channel_mode = alc880_asus_modes,
4159 .input_mux = &alc880_capture_source,
4161 [ALC880_UNIWILL] = {
4162 .mixers = { alc880_uniwill_mixer },
4163 .init_verbs = { alc880_volume_init_verbs,
4164 alc880_uniwill_init_verbs },
4165 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4166 .dac_nids = alc880_asus_dac_nids,
4167 .dig_out_nid = ALC880_DIGOUT_NID,
4168 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4169 .channel_mode = alc880_threestack_modes,
4171 .input_mux = &alc880_capture_source,
4172 .unsol_event = alc880_uniwill_unsol_event,
4173 .setup = alc880_uniwill_setup,
4174 .init_hook = alc880_uniwill_init_hook,
4176 [ALC880_UNIWILL_P53] = {
4177 .mixers = { alc880_uniwill_p53_mixer },
4178 .init_verbs = { alc880_volume_init_verbs,
4179 alc880_uniwill_p53_init_verbs },
4180 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4181 .dac_nids = alc880_asus_dac_nids,
4182 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4183 .channel_mode = alc880_threestack_modes,
4184 .input_mux = &alc880_capture_source,
4185 .unsol_event = alc880_uniwill_p53_unsol_event,
4186 .setup = alc880_uniwill_p53_setup,
4187 .init_hook = alc_automute_amp,
4189 [ALC880_FUJITSU] = {
4190 .mixers = { alc880_fujitsu_mixer },
4191 .init_verbs = { alc880_volume_init_verbs,
4192 alc880_uniwill_p53_init_verbs,
4193 alc880_beep_init_verbs },
4194 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4195 .dac_nids = alc880_dac_nids,
4196 .dig_out_nid = ALC880_DIGOUT_NID,
4197 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4198 .channel_mode = alc880_2_jack_modes,
4199 .input_mux = &alc880_capture_source,
4200 .unsol_event = alc880_uniwill_p53_unsol_event,
4201 .setup = alc880_uniwill_p53_setup,
4202 .init_hook = alc_automute_amp,
4205 .mixers = { alc880_three_stack_mixer },
4206 .init_verbs = { alc880_volume_init_verbs,
4207 alc880_pin_clevo_init_verbs },
4208 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4209 .dac_nids = alc880_dac_nids,
4211 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4212 .channel_mode = alc880_threestack_modes,
4214 .input_mux = &alc880_capture_source,
4217 .mixers = { alc880_lg_mixer },
4218 .init_verbs = { alc880_volume_init_verbs,
4219 alc880_lg_init_verbs },
4220 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4221 .dac_nids = alc880_lg_dac_nids,
4222 .dig_out_nid = ALC880_DIGOUT_NID,
4223 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4224 .channel_mode = alc880_lg_ch_modes,
4226 .input_mux = &alc880_lg_capture_source,
4227 .unsol_event = alc_automute_amp_unsol_event,
4228 .setup = alc880_lg_setup,
4229 .init_hook = alc_automute_amp,
4230 #ifdef CONFIG_SND_HDA_POWER_SAVE
4231 .loopbacks = alc880_lg_loopbacks,
4235 .mixers = { alc880_lg_lw_mixer },
4236 .init_verbs = { alc880_volume_init_verbs,
4237 alc880_lg_lw_init_verbs },
4238 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4239 .dac_nids = alc880_dac_nids,
4240 .dig_out_nid = ALC880_DIGOUT_NID,
4241 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4242 .channel_mode = alc880_lg_lw_modes,
4243 .input_mux = &alc880_lg_lw_capture_source,
4244 .unsol_event = alc_automute_amp_unsol_event,
4245 .setup = alc880_lg_lw_setup,
4246 .init_hook = alc_automute_amp,
4248 [ALC880_MEDION_RIM] = {
4249 .mixers = { alc880_medion_rim_mixer },
4250 .init_verbs = { alc880_volume_init_verbs,
4251 alc880_medion_rim_init_verbs,
4252 alc_gpio2_init_verbs },
4253 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4254 .dac_nids = alc880_dac_nids,
4255 .dig_out_nid = ALC880_DIGOUT_NID,
4256 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4257 .channel_mode = alc880_2_jack_modes,
4258 .input_mux = &alc880_medion_rim_capture_source,
4259 .unsol_event = alc880_medion_rim_unsol_event,
4260 .setup = alc880_medion_rim_setup,
4261 .init_hook = alc880_medion_rim_automute,
4263 #ifdef CONFIG_SND_DEBUG
4265 .mixers = { alc880_test_mixer },
4266 .init_verbs = { alc880_test_init_verbs },
4267 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4268 .dac_nids = alc880_test_dac_nids,
4269 .dig_out_nid = ALC880_DIGOUT_NID,
4270 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4271 .channel_mode = alc880_test_modes,
4272 .input_mux = &alc880_test_capture_source,
4278 * Automatic parse of I/O pins from the BIOS configuration
4283 ALC_CTL_WIDGET_MUTE,
4286 static struct snd_kcontrol_new alc880_control_templates[] = {
4287 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4288 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4289 HDA_BIND_MUTE(NULL, 0, 0, 0),
4292 /* add dynamic controls */
4293 static int add_control(struct alc_spec *spec, int type, const char *name,
4296 struct snd_kcontrol_new *knew;
4298 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4299 knew = snd_array_new(&spec->kctls);
4302 *knew = alc880_control_templates[type];
4303 knew->name = kstrdup(name, GFP_KERNEL);
4306 knew->private_value = val;
4310 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4311 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4312 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4313 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4314 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4315 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4316 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4317 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4318 #define ALC880_PIN_CD_NID 0x1c
4320 /* fill in the dac_nids table from the parsed pin configuration */
4321 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4322 const struct auto_pin_cfg *cfg)
4328 memset(assigned, 0, sizeof(assigned));
4329 spec->multiout.dac_nids = spec->private_dac_nids;
4331 /* check the pins hardwired to audio widget */
4332 for (i = 0; i < cfg->line_outs; i++) {
4333 nid = cfg->line_out_pins[i];
4334 if (alc880_is_fixed_pin(nid)) {
4335 int idx = alc880_fixed_pin_idx(nid);
4336 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4340 /* left pins can be connect to any audio widget */
4341 for (i = 0; i < cfg->line_outs; i++) {
4342 nid = cfg->line_out_pins[i];
4343 if (alc880_is_fixed_pin(nid))
4345 /* search for an empty channel */
4346 for (j = 0; j < cfg->line_outs; j++) {
4348 spec->multiout.dac_nids[i] =
4349 alc880_idx_to_dac(j);
4355 spec->multiout.num_dacs = cfg->line_outs;
4359 /* add playback controls from the parsed DAC table */
4360 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4361 const struct auto_pin_cfg *cfg)
4364 static const char *chname[4] = {
4365 "Front", "Surround", NULL /*CLFE*/, "Side"
4370 for (i = 0; i < cfg->line_outs; i++) {
4371 if (!spec->multiout.dac_nids[i])
4373 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4376 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4377 "Center Playback Volume",
4378 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4382 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4383 "LFE Playback Volume",
4384 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4388 err = add_control(spec, ALC_CTL_BIND_MUTE,
4389 "Center Playback Switch",
4390 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4394 err = add_control(spec, ALC_CTL_BIND_MUTE,
4395 "LFE Playback Switch",
4396 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4402 if (cfg->line_outs == 1 &&
4403 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4407 sprintf(name, "%s Playback Volume", pfx);
4408 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4409 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4413 sprintf(name, "%s Playback Switch", pfx);
4414 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4415 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4424 /* add playback controls for speaker and HP outputs */
4425 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4435 if (alc880_is_fixed_pin(pin)) {
4436 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4437 /* specify the DAC as the extra output */
4438 if (!spec->multiout.hp_nid)
4439 spec->multiout.hp_nid = nid;
4441 spec->multiout.extra_out_nid[0] = nid;
4442 /* control HP volume/switch on the output mixer amp */
4443 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4444 sprintf(name, "%s Playback Volume", pfx);
4445 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4446 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4449 sprintf(name, "%s Playback Switch", pfx);
4450 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4451 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4454 } else if (alc880_is_multi_pin(pin)) {
4455 /* set manual connection */
4456 /* we have only a switch on HP-out PIN */
4457 sprintf(name, "%s Playback Switch", pfx);
4458 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4459 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4466 /* create input playback/capture controls for the given pin */
4467 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4468 const char *ctlname,
4469 int idx, hda_nid_t mix_nid)
4474 sprintf(name, "%s Playback Volume", ctlname);
4475 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4476 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4479 sprintf(name, "%s Playback Switch", ctlname);
4480 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4481 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4487 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4489 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4490 return (pincap & AC_PINCAP_IN) != 0;
4493 /* create playback/capture controls for input pins */
4494 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4495 const struct auto_pin_cfg *cfg,
4497 hda_nid_t cap1, hda_nid_t cap2)
4499 struct alc_spec *spec = codec->spec;
4500 struct hda_input_mux *imux = &spec->private_imux[0];
4503 for (i = 0; i < AUTO_PIN_LAST; i++) {
4506 pin = cfg->input_pins[i];
4507 if (!alc_is_input_pin(codec, pin))
4511 idx = get_connection_index(codec, mixer, pin);
4513 err = new_analog_input(spec, pin,
4514 auto_pin_cfg_labels[i],
4523 idx = get_connection_index(codec, cap1, pin);
4524 if (idx < 0 && cap2)
4525 idx = get_connection_index(codec, cap2, pin);
4527 imux->items[imux->num_items].label =
4528 auto_pin_cfg_labels[i];
4529 imux->items[imux->num_items].index = idx;
4536 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4537 const struct auto_pin_cfg *cfg)
4539 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4542 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4543 unsigned int pin_type)
4545 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4548 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4552 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4553 hda_nid_t nid, int pin_type,
4556 alc_set_pin_output(codec, nid, pin_type);
4557 /* need the manual connection? */
4558 if (alc880_is_multi_pin(nid)) {
4559 struct alc_spec *spec = codec->spec;
4560 int idx = alc880_multi_pin_idx(nid);
4561 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4562 AC_VERB_SET_CONNECT_SEL,
4563 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4567 static int get_pin_type(int line_out_type)
4569 if (line_out_type == AUTO_PIN_HP_OUT)
4575 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4577 struct alc_spec *spec = codec->spec;
4580 for (i = 0; i < spec->autocfg.line_outs; i++) {
4581 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4582 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4583 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4587 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4589 struct alc_spec *spec = codec->spec;
4592 pin = spec->autocfg.speaker_pins[0];
4593 if (pin) /* connect to front */
4594 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4595 pin = spec->autocfg.hp_pins[0];
4596 if (pin) /* connect to front */
4597 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4600 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4602 struct alc_spec *spec = codec->spec;
4605 for (i = 0; i < AUTO_PIN_LAST; i++) {
4606 hda_nid_t nid = spec->autocfg.input_pins[i];
4607 if (alc_is_input_pin(codec, nid)) {
4608 alc_set_input_pin(codec, nid, i);
4609 if (nid != ALC880_PIN_CD_NID &&
4610 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4611 snd_hda_codec_write(codec, nid, 0,
4612 AC_VERB_SET_AMP_GAIN_MUTE,
4618 /* parse the BIOS configuration and set up the alc_spec */
4619 /* return 1 if successful, 0 if the proper config is not found,
4620 * or a negative error code
4622 static int alc880_parse_auto_config(struct hda_codec *codec)
4624 struct alc_spec *spec = codec->spec;
4626 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4628 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4632 if (!spec->autocfg.line_outs)
4633 return 0; /* can't find valid BIOS pin config */
4635 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4638 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4641 err = alc880_auto_create_extra_out(spec,
4642 spec->autocfg.speaker_pins[0],
4646 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4650 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4654 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4656 /* check multiple SPDIF-out (for recent codecs) */
4657 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4659 err = snd_hda_get_connections(codec,
4660 spec->autocfg.dig_out_pins[i],
4665 spec->multiout.dig_out_nid = dig_nid;
4667 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4668 spec->slave_dig_outs[i - 1] = dig_nid;
4669 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4673 if (spec->autocfg.dig_in_pin)
4674 spec->dig_in_nid = ALC880_DIGIN_NID;
4676 if (spec->kctls.list)
4677 add_mixer(spec, spec->kctls.list);
4679 add_verb(spec, alc880_volume_init_verbs);
4681 spec->num_mux_defs = 1;
4682 spec->input_mux = &spec->private_imux[0];
4684 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4689 /* additional initialization for auto-configuration model */
4690 static void alc880_auto_init(struct hda_codec *codec)
4692 struct alc_spec *spec = codec->spec;
4693 alc880_auto_init_multi_out(codec);
4694 alc880_auto_init_extra_out(codec);
4695 alc880_auto_init_analog_input(codec);
4696 if (spec->unsol_event)
4697 alc_inithook(codec);
4700 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4701 * one of two digital mic pins, e.g. on ALC272
4703 static void fixup_automic_adc(struct hda_codec *codec)
4705 struct alc_spec *spec = codec->spec;
4708 for (i = 0; i < spec->num_adc_nids; i++) {
4709 hda_nid_t cap = spec->capsrc_nids ?
4710 spec->capsrc_nids[i] : spec->adc_nids[i];
4713 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4716 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4719 spec->int_mic.mux_idx = iidx;
4720 spec->ext_mic.mux_idx = eidx;
4721 if (spec->capsrc_nids)
4722 spec->capsrc_nids += i;
4723 spec->adc_nids += i;
4724 spec->num_adc_nids = 1;
4727 snd_printd(KERN_INFO "hda_codec: %s: "
4728 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4729 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4730 spec->auto_mic = 0; /* disable auto-mic to be sure */
4733 static void set_capture_mixer(struct hda_codec *codec)
4735 struct alc_spec *spec = codec->spec;
4736 static struct snd_kcontrol_new *caps[2][3] = {
4737 { alc_capture_mixer_nosrc1,
4738 alc_capture_mixer_nosrc2,
4739 alc_capture_mixer_nosrc3 },
4740 { alc_capture_mixer1,
4742 alc_capture_mixer3 },
4744 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4746 if (spec->auto_mic) {
4748 fixup_automic_adc(codec);
4749 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4753 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4757 #define set_beep_amp(spec, nid, idx, dir) \
4758 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4761 * OK, here we have finally the patch for ALC880
4764 static int patch_alc880(struct hda_codec *codec)
4766 struct alc_spec *spec;
4770 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4776 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4779 if (board_config < 0) {
4780 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4782 board_config = ALC880_AUTO;
4785 if (board_config == ALC880_AUTO) {
4786 /* automatic parse from the BIOS config */
4787 err = alc880_parse_auto_config(codec);
4793 "hda_codec: Cannot set up configuration "
4794 "from BIOS. Using 3-stack mode...\n");
4795 board_config = ALC880_3ST;
4799 err = snd_hda_attach_beep_device(codec, 0x1);
4805 if (board_config != ALC880_AUTO)
4806 setup_preset(codec, &alc880_presets[board_config]);
4808 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4809 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4810 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4812 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4813 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4815 if (!spec->adc_nids && spec->input_mux) {
4816 /* check whether NID 0x07 is valid */
4817 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4819 wcap = get_wcaps_type(wcap);
4820 if (wcap != AC_WID_AUD_IN) {
4821 spec->adc_nids = alc880_adc_nids_alt;
4822 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4824 spec->adc_nids = alc880_adc_nids;
4825 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4828 set_capture_mixer(codec);
4829 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4831 spec->vmaster_nid = 0x0c;
4833 codec->patch_ops = alc_patch_ops;
4834 if (board_config == ALC880_AUTO)
4835 spec->init_hook = alc880_auto_init;
4836 #ifdef CONFIG_SND_HDA_POWER_SAVE
4837 if (!spec->loopback.amplist)
4838 spec->loopback.amplist = alc880_loopbacks;
4840 codec->proc_widget_hook = print_realtek_coef;
4850 static hda_nid_t alc260_dac_nids[1] = {
4855 static hda_nid_t alc260_adc_nids[1] = {
4860 static hda_nid_t alc260_adc_nids_alt[1] = {
4865 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4866 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4868 static hda_nid_t alc260_dual_adc_nids[2] = {
4873 #define ALC260_DIGOUT_NID 0x03
4874 #define ALC260_DIGIN_NID 0x06
4876 static struct hda_input_mux alc260_capture_source = {
4880 { "Front Mic", 0x1 },
4886 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4887 * headphone jack and the internal CD lines since these are the only pins at
4888 * which audio can appear. For flexibility, also allow the option of
4889 * recording the mixer output on the second ADC (ADC0 doesn't have a
4890 * connection to the mixer output).
4892 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4896 { "Mic/Line", 0x0 },
4898 { "Headphone", 0x2 },
4904 { "Mic/Line", 0x0 },
4906 { "Headphone", 0x2 },
4913 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4914 * the Fujitsu S702x, but jacks are marked differently.
4916 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4923 { "Headphone", 0x5 },
4932 { "Headphone", 0x6 },
4938 /* Maxdata Favorit 100XS */
4939 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4943 { "Line/Mic", 0x0 },
4950 { "Line/Mic", 0x0 },
4958 * This is just place-holder, so there's something for alc_build_pcms to look
4959 * at when it calculates the maximum number of channels. ALC260 has no mixer
4960 * element which allows changing the channel mode, so the verb list is
4963 static struct hda_channel_mode alc260_modes[1] = {
4968 /* Mixer combinations
4970 * basic: base_output + input + pc_beep + capture
4971 * HP: base_output + input + capture_alt
4972 * HP_3013: hp_3013 + input + capture
4973 * fujitsu: fujitsu + capture
4974 * acer: acer + capture
4977 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4978 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4979 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4980 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4981 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4982 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4983 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4987 static struct snd_kcontrol_new alc260_input_mixer[] = {
4988 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4989 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4990 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4991 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4993 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4994 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4995 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4999 /* update HP, line and mono out pins according to the master switch */
5000 static void alc260_hp_master_update(struct hda_codec *codec,
5001 hda_nid_t hp, hda_nid_t line,
5004 struct alc_spec *spec = codec->spec;
5005 unsigned int val = spec->master_sw ? PIN_HP : 0;
5006 /* change HP and line-out pins */
5007 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5009 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5011 /* mono (speaker) depending on the HP jack sense */
5012 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5013 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5017 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5018 struct snd_ctl_elem_value *ucontrol)
5020 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5021 struct alc_spec *spec = codec->spec;
5022 *ucontrol->value.integer.value = spec->master_sw;
5026 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5027 struct snd_ctl_elem_value *ucontrol)
5029 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5030 struct alc_spec *spec = codec->spec;
5031 int val = !!*ucontrol->value.integer.value;
5032 hda_nid_t hp, line, mono;
5034 if (val == spec->master_sw)
5036 spec->master_sw = val;
5037 hp = (kcontrol->private_value >> 16) & 0xff;
5038 line = (kcontrol->private_value >> 8) & 0xff;
5039 mono = kcontrol->private_value & 0xff;
5040 alc260_hp_master_update(codec, hp, line, mono);
5044 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5046 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5047 .name = "Master Playback Switch",
5048 .info = snd_ctl_boolean_mono_info,
5049 .get = alc260_hp_master_sw_get,
5050 .put = alc260_hp_master_sw_put,
5051 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5053 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5054 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5055 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5056 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5057 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5059 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5063 static struct hda_verb alc260_hp_unsol_verbs[] = {
5064 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5068 static void alc260_hp_automute(struct hda_codec *codec)
5070 struct alc_spec *spec = codec->spec;
5071 unsigned int present;
5073 present = snd_hda_codec_read(codec, 0x10, 0,
5074 AC_VERB_GET_PIN_SENSE, 0);
5075 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5076 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5079 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5081 if ((res >> 26) == ALC880_HP_EVENT)
5082 alc260_hp_automute(codec);
5085 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5087 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5088 .name = "Master Playback Switch",
5089 .info = snd_ctl_boolean_mono_info,
5090 .get = alc260_hp_master_sw_get,
5091 .put = alc260_hp_master_sw_put,
5092 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5094 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5095 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5096 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5097 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5098 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5099 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5100 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5101 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5105 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5106 .ops = &snd_hda_bind_vol,
5108 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5109 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5110 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5115 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5116 .ops = &snd_hda_bind_sw,
5118 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5119 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5124 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5125 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5126 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5127 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5132 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5133 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5137 static void alc260_hp_3013_automute(struct hda_codec *codec)
5139 struct alc_spec *spec = codec->spec;
5140 unsigned int present;
5142 present = snd_hda_codec_read(codec, 0x15, 0,
5143 AC_VERB_GET_PIN_SENSE, 0);
5144 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5145 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5148 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5151 if ((res >> 26) == ALC880_HP_EVENT)
5152 alc260_hp_3013_automute(codec);
5155 static void alc260_hp_3012_automute(struct hda_codec *codec)
5157 unsigned int present, bits;
5159 present = snd_hda_codec_read(codec, 0x10, 0,
5160 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
5162 bits = present ? 0 : PIN_OUT;
5163 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5165 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5167 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5171 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5174 if ((res >> 26) == ALC880_HP_EVENT)
5175 alc260_hp_3012_automute(codec);
5178 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5179 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5181 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5182 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5183 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5184 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5185 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5186 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5187 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5188 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5189 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5190 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5191 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5195 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5196 * versions of the ALC260 don't act on requests to enable mic bias from NID
5197 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5198 * datasheet doesn't mention this restriction. At this stage it's not clear
5199 * whether this behaviour is intentional or is a hardware bug in chip
5200 * revisions available in early 2006. Therefore for now allow the
5201 * "Headphone Jack Mode" control to span all choices, but if it turns out
5202 * that the lack of mic bias for this NID is intentional we could change the
5203 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5205 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5206 * don't appear to make the mic bias available from the "line" jack, even
5207 * though the NID used for this jack (0x14) can supply it. The theory is
5208 * that perhaps Acer have included blocking capacitors between the ALC260
5209 * and the output jack. If this turns out to be the case for all such
5210 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5211 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5213 * The C20x Tablet series have a mono internal speaker which is controlled
5214 * via the chip's Mono sum widget and pin complex, so include the necessary
5215 * controls for such models. On models without a "mono speaker" the control
5216 * won't do anything.
5218 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5219 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5220 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5221 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5222 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5224 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5226 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5227 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5229 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5230 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5231 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5232 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5233 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5237 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5239 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5240 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5241 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5242 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5243 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5244 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5245 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5249 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5250 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5252 static struct snd_kcontrol_new alc260_will_mixer[] = {
5253 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5254 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5255 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5256 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5257 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5258 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5259 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5260 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5261 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5262 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5266 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5267 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5269 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5270 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5271 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5273 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5274 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5275 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5276 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5277 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5278 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5279 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5284 * initialization verbs
5286 static struct hda_verb alc260_init_verbs[] = {
5287 /* Line In pin widget for input */
5288 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5289 /* CD pin widget for input */
5290 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5291 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5292 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5293 /* Mic2 (front panel) pin widget for input and vref at 80% */
5294 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5295 /* LINE-2 is used for line-out in rear */
5296 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5297 /* select line-out */
5298 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5300 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5302 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5304 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5305 /* mute capture amp left and right */
5306 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5307 /* set connection select to line in (default select for this ADC) */
5308 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5309 /* mute capture amp left and right */
5310 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5311 /* set connection select to line in (default select for this ADC) */
5312 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5313 /* set vol=0 Line-Out mixer amp left and right */
5314 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5315 /* unmute pin widget amp left and right (no gain on this amp) */
5316 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5317 /* set vol=0 HP mixer amp left and right */
5318 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5319 /* unmute pin widget amp left and right (no gain on this amp) */
5320 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5321 /* set vol=0 Mono mixer amp left and right */
5322 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5323 /* unmute pin widget amp left and right (no gain on this amp) */
5324 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5325 /* unmute LINE-2 out pin */
5326 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5327 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5330 /* mute analog inputs */
5331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5336 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5337 /* mute Front out path */
5338 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5339 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5340 /* mute Headphone out path */
5341 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5342 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5343 /* mute Mono out path */
5344 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5345 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5349 #if 0 /* should be identical with alc260_init_verbs? */
5350 static struct hda_verb alc260_hp_init_verbs[] = {
5351 /* Headphone and output */
5352 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5354 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5355 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5356 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5357 /* Mic2 (front panel) pin widget for input and vref at 80% */
5358 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5359 /* Line In pin widget for input */
5360 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5361 /* Line-2 pin widget for output */
5362 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5363 /* CD pin widget for input */
5364 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5365 /* unmute amp left and right */
5366 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5367 /* set connection select to line in (default select for this ADC) */
5368 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5369 /* unmute Line-Out mixer amp left and right (volume = 0) */
5370 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5371 /* mute pin widget amp left and right (no gain on this amp) */
5372 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5373 /* unmute HP mixer amp left and right (volume = 0) */
5374 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5375 /* mute pin widget amp left and right (no gain on this amp) */
5376 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5377 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5380 /* mute analog inputs */
5381 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5382 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5383 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5384 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5385 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5386 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5387 /* Unmute Front out path */
5388 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5389 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5390 /* Unmute Headphone out path */
5391 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5392 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5393 /* Unmute Mono out path */
5394 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5395 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5400 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5401 /* Line out and output */
5402 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5404 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5405 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5406 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5407 /* Mic2 (front panel) pin widget for input and vref at 80% */
5408 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5409 /* Line In pin widget for input */
5410 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5411 /* Headphone pin widget for output */
5412 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5413 /* CD pin widget for input */
5414 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5415 /* unmute amp left and right */
5416 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5417 /* set connection select to line in (default select for this ADC) */
5418 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5419 /* unmute Line-Out mixer amp left and right (volume = 0) */
5420 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5421 /* mute pin widget amp left and right (no gain on this amp) */
5422 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5423 /* unmute HP mixer amp left and right (volume = 0) */
5424 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5425 /* mute pin widget amp left and right (no gain on this amp) */
5426 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5427 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5430 /* mute analog inputs */
5431 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5432 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5433 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5434 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5435 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5436 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5437 /* Unmute Front out path */
5438 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5439 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5440 /* Unmute Headphone out path */
5441 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5442 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5443 /* Unmute Mono out path */
5444 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5445 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5449 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5450 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5451 * audio = 0x16, internal speaker = 0x10.
5453 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5454 /* Disable all GPIOs */
5455 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5456 /* Internal speaker is connected to headphone pin */
5457 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5458 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5459 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5460 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5461 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5462 /* Ensure all other unused pins are disabled and muted. */
5463 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5464 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5465 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5466 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5467 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5468 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5469 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5470 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5472 /* Disable digital (SPDIF) pins */
5473 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5474 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5476 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5477 * when acting as an output.
5479 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5481 /* Start with output sum widgets muted and their output gains at min */
5482 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5483 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5484 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5485 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5486 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5487 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5488 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5489 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5490 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5492 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5493 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5494 /* Unmute Line1 pin widget output buffer since it starts as an output.
5495 * If the pin mode is changed by the user the pin mode control will
5496 * take care of enabling the pin's input/output buffers as needed.
5497 * Therefore there's no need to enable the input buffer at this
5500 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5501 /* Unmute input buffer of pin widget used for Line-in (no equiv
5504 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5506 /* Mute capture amp left and right */
5507 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5508 /* Set ADC connection select to match default mixer setting - line
5511 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5513 /* Do the same for the second ADC: mute capture input amp and
5514 * set ADC connection to line in (on mic1 pin)
5516 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5517 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5519 /* Mute all inputs to mixer widget (even unconnected ones) */
5520 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5521 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5522 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5523 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5524 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5525 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5526 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5527 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5532 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5533 * similar laptops (adapted from Fujitsu init verbs).
5535 static struct hda_verb alc260_acer_init_verbs[] = {
5536 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5537 * the headphone jack. Turn this on and rely on the standard mute
5538 * methods whenever the user wants to turn these outputs off.
5540 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5541 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5542 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5543 /* Internal speaker/Headphone jack is connected to Line-out pin */
5544 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5545 /* Internal microphone/Mic jack is connected to Mic1 pin */
5546 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5547 /* Line In jack is connected to Line1 pin */
5548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5549 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5550 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5551 /* Ensure all other unused pins are disabled and muted. */
5552 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5553 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5554 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5555 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5556 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5557 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5558 /* Disable digital (SPDIF) pins */
5559 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5560 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5562 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5563 * bus when acting as outputs.
5565 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5566 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5568 /* Start with output sum widgets muted and their output gains at min */
5569 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5570 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5571 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5572 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5573 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5574 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5575 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5576 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5577 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5579 /* Unmute Line-out pin widget amp left and right
5580 * (no equiv mixer ctrl)
5582 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5583 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5584 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5585 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5586 * inputs. If the pin mode is changed by the user the pin mode control
5587 * will take care of enabling the pin's input/output buffers as needed.
5588 * Therefore there's no need to enable the input buffer at this
5591 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5592 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5594 /* Mute capture amp left and right */
5595 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5596 /* Set ADC connection select to match default mixer setting - mic
5599 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5601 /* Do similar with the second ADC: mute capture input amp and
5602 * set ADC connection to mic to match ALSA's default state.
5604 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5605 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5607 /* Mute all inputs to mixer widget (even unconnected ones) */
5608 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5609 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5610 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5611 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5612 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5613 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5620 /* Initialisation sequence for Maxdata Favorit 100XS
5621 * (adapted from Acer init verbs).
5623 static struct hda_verb alc260_favorit100_init_verbs[] = {
5624 /* GPIO 0 enables the output jack.
5625 * Turn this on and rely on the standard mute
5626 * methods whenever the user wants to turn these outputs off.
5628 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5629 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5630 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5631 /* Line/Mic input jack is connected to Mic1 pin */
5632 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5633 /* Ensure all other unused pins are disabled and muted. */
5634 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5635 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5636 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5637 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5638 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5639 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5640 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5641 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5642 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5643 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5644 /* Disable digital (SPDIF) pins */
5645 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5646 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5648 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5649 * bus when acting as outputs.
5651 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5652 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5654 /* Start with output sum widgets muted and their output gains at min */
5655 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5656 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5657 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5658 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5659 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5660 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5661 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5662 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5663 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5665 /* Unmute Line-out pin widget amp left and right
5666 * (no equiv mixer ctrl)
5668 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5669 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5670 * inputs. If the pin mode is changed by the user the pin mode control
5671 * will take care of enabling the pin's input/output buffers as needed.
5672 * Therefore there's no need to enable the input buffer at this
5675 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5677 /* Mute capture amp left and right */
5678 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5679 /* Set ADC connection select to match default mixer setting - mic
5682 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5684 /* Do similar with the second ADC: mute capture input amp and
5685 * set ADC connection to mic to match ALSA's default state.
5687 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5688 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5690 /* Mute all inputs to mixer widget (even unconnected ones) */
5691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5692 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5693 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5694 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5695 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5696 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5697 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5698 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5703 static struct hda_verb alc260_will_verbs[] = {
5704 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5705 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5706 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5707 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5708 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5709 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5713 static struct hda_verb alc260_replacer_672v_verbs[] = {
5714 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5715 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5716 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5718 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5719 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5720 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5722 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5726 /* toggle speaker-output according to the hp-jack state */
5727 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5729 unsigned int present;
5731 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5732 present = snd_hda_codec_read(codec, 0x0f, 0,
5733 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5735 snd_hda_codec_write_cache(codec, 0x01, 0,
5736 AC_VERB_SET_GPIO_DATA, 1);
5737 snd_hda_codec_write_cache(codec, 0x0f, 0,
5738 AC_VERB_SET_PIN_WIDGET_CONTROL,
5741 snd_hda_codec_write_cache(codec, 0x01, 0,
5742 AC_VERB_SET_GPIO_DATA, 0);
5743 snd_hda_codec_write_cache(codec, 0x0f, 0,
5744 AC_VERB_SET_PIN_WIDGET_CONTROL,
5749 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5752 if ((res >> 26) == ALC880_HP_EVENT)
5753 alc260_replacer_672v_automute(codec);
5756 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5757 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5758 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5759 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5760 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5761 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5762 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5763 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5764 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5765 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5766 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5770 /* Test configuration for debugging, modelled after the ALC880 test
5773 #ifdef CONFIG_SND_DEBUG
5774 static hda_nid_t alc260_test_dac_nids[1] = {
5777 static hda_nid_t alc260_test_adc_nids[2] = {
5780 /* For testing the ALC260, each input MUX needs its own definition since
5781 * the signal assignments are different. This assumes that the first ADC
5784 static struct hda_input_mux alc260_test_capture_sources[2] = {
5788 { "MIC1 pin", 0x0 },
5789 { "MIC2 pin", 0x1 },
5790 { "LINE1 pin", 0x2 },
5791 { "LINE2 pin", 0x3 },
5793 { "LINE-OUT pin", 0x5 },
5794 { "HP-OUT pin", 0x6 },
5800 { "MIC1 pin", 0x0 },
5801 { "MIC2 pin", 0x1 },
5802 { "LINE1 pin", 0x2 },
5803 { "LINE2 pin", 0x3 },
5806 { "LINE-OUT pin", 0x6 },
5807 { "HP-OUT pin", 0x7 },
5811 static struct snd_kcontrol_new alc260_test_mixer[] = {
5812 /* Output driver widgets */
5813 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5814 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5815 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5816 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5817 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5818 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5820 /* Modes for retasking pin widgets
5821 * Note: the ALC260 doesn't seem to act on requests to enable mic
5822 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5823 * mention this restriction. At this stage it's not clear whether
5824 * this behaviour is intentional or is a hardware bug in chip
5825 * revisions available at least up until early 2006. Therefore for
5826 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5827 * choices, but if it turns out that the lack of mic bias for these
5828 * NIDs is intentional we could change their modes from
5829 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5831 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5832 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5833 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5834 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5835 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5836 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5838 /* Loopback mixer controls */
5839 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5840 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5841 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5842 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5843 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5844 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5845 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5846 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5847 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5848 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5849 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5850 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5851 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5852 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5854 /* Controls for GPIO pins, assuming they are configured as outputs */
5855 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5856 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5857 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5858 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5860 /* Switches to allow the digital IO pins to be enabled. The datasheet
5861 * is ambigious as to which NID is which; testing on laptops which
5862 * make this output available should provide clarification.
5864 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5865 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5867 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5868 * this output to turn on an external amplifier.
5870 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5871 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5875 static struct hda_verb alc260_test_init_verbs[] = {
5876 /* Enable all GPIOs as outputs with an initial value of 0 */
5877 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5878 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5879 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5881 /* Enable retasking pins as output, initially without power amp */
5882 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5883 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5884 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5885 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5886 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5887 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5889 /* Disable digital (SPDIF) pins initially, but users can enable
5890 * them via a mixer switch. In the case of SPDIF-out, this initverb
5891 * payload also sets the generation to 0, output to be in "consumer"
5892 * PCM format, copyright asserted, no pre-emphasis and no validity
5895 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5896 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5898 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5899 * OUT1 sum bus when acting as an output.
5901 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5902 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5903 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5904 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5906 /* Start with output sum widgets muted and their output gains at min */
5907 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5908 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5909 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5910 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5911 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5912 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5913 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5914 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5915 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5917 /* Unmute retasking pin widget output buffers since the default
5918 * state appears to be output. As the pin mode is changed by the
5919 * user the pin mode control will take care of enabling the pin's
5920 * input/output buffers as needed.
5922 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5923 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5924 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5925 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5926 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5927 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5928 /* Also unmute the mono-out pin widget */
5929 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5931 /* Mute capture amp left and right */
5932 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5933 /* Set ADC connection select to match default mixer setting (mic1
5936 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5938 /* Do the same for the second ADC: mute capture input amp and
5939 * set ADC connection to mic1 pin
5941 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5942 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5944 /* Mute all inputs to mixer widget (even unconnected ones) */
5945 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5946 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5947 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5948 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5949 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5950 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5951 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5952 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5958 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5959 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5961 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5962 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5965 * for BIOS auto-configuration
5968 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5969 const char *pfx, int *vol_bits)
5972 unsigned long vol_val, sw_val;
5976 if (nid >= 0x0f && nid < 0x11) {
5977 nid_vol = nid - 0x7;
5978 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5979 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5980 } else if (nid == 0x11) {
5981 nid_vol = nid - 0x7;
5982 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5983 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5984 } else if (nid >= 0x12 && nid <= 0x15) {
5986 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5987 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5991 if (!(*vol_bits & (1 << nid_vol))) {
5992 /* first control for the volume widget */
5993 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5994 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5997 *vol_bits |= (1 << nid_vol);
5999 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
6000 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
6006 /* add playback controls from the parsed DAC table */
6007 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6008 const struct auto_pin_cfg *cfg)
6014 spec->multiout.num_dacs = 1;
6015 spec->multiout.dac_nids = spec->private_dac_nids;
6016 spec->multiout.dac_nids[0] = 0x02;
6018 nid = cfg->line_out_pins[0];
6021 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6023 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6027 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6032 nid = cfg->speaker_pins[0];
6034 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6039 nid = cfg->hp_pins[0];
6041 err = alc260_add_playback_controls(spec, nid, "Headphone",
6049 /* create playback/capture controls for input pins */
6050 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6051 const struct auto_pin_cfg *cfg)
6053 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6056 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6057 hda_nid_t nid, int pin_type,
6060 alc_set_pin_output(codec, nid, pin_type);
6061 /* need the manual connection? */
6063 int idx = nid - 0x12;
6064 snd_hda_codec_write(codec, idx + 0x0b, 0,
6065 AC_VERB_SET_CONNECT_SEL, sel_idx);
6069 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6071 struct alc_spec *spec = codec->spec;
6074 nid = spec->autocfg.line_out_pins[0];
6076 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6077 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6080 nid = spec->autocfg.speaker_pins[0];
6082 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6084 nid = spec->autocfg.hp_pins[0];
6086 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6089 #define ALC260_PIN_CD_NID 0x16
6090 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6092 struct alc_spec *spec = codec->spec;
6095 for (i = 0; i < AUTO_PIN_LAST; i++) {
6096 hda_nid_t nid = spec->autocfg.input_pins[i];
6098 alc_set_input_pin(codec, nid, i);
6099 if (nid != ALC260_PIN_CD_NID &&
6100 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6101 snd_hda_codec_write(codec, nid, 0,
6102 AC_VERB_SET_AMP_GAIN_MUTE,
6109 * generic initialization of ADC, input mixers and output mixers
6111 static struct hda_verb alc260_volume_init_verbs[] = {
6113 * Unmute ADC0-1 and set the default input to mic-in
6115 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6116 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6117 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6118 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6120 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6122 * Note: PASD motherboards uses the Line In 2 as the input for
6123 * front panel mic (mic 2)
6125 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6126 /* mute analog inputs */
6127 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6128 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6129 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6131 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6134 * Set up output mixers (0x08 - 0x0a)
6136 /* set vol=0 to output mixers */
6137 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6138 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6139 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6140 /* set up input amps for analog loopback */
6141 /* Amp Indices: DAC = 0, mixer = 1 */
6142 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6143 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6144 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6145 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6146 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6147 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6152 static int alc260_parse_auto_config(struct hda_codec *codec)
6154 struct alc_spec *spec = codec->spec;
6156 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6158 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6162 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6165 if (!spec->kctls.list)
6166 return 0; /* can't find valid BIOS pin config */
6167 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6171 spec->multiout.max_channels = 2;
6173 if (spec->autocfg.dig_outs)
6174 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6175 if (spec->kctls.list)
6176 add_mixer(spec, spec->kctls.list);
6178 add_verb(spec, alc260_volume_init_verbs);
6180 spec->num_mux_defs = 1;
6181 spec->input_mux = &spec->private_imux[0];
6183 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6188 /* additional initialization for auto-configuration model */
6189 static void alc260_auto_init(struct hda_codec *codec)
6191 struct alc_spec *spec = codec->spec;
6192 alc260_auto_init_multi_out(codec);
6193 alc260_auto_init_analog_input(codec);
6194 if (spec->unsol_event)
6195 alc_inithook(codec);
6198 #ifdef CONFIG_SND_HDA_POWER_SAVE
6199 static struct hda_amp_list alc260_loopbacks[] = {
6200 { 0x07, HDA_INPUT, 0 },
6201 { 0x07, HDA_INPUT, 1 },
6202 { 0x07, HDA_INPUT, 2 },
6203 { 0x07, HDA_INPUT, 3 },
6204 { 0x07, HDA_INPUT, 4 },
6210 * ALC260 configurations
6212 static const char *alc260_models[ALC260_MODEL_LAST] = {
6213 [ALC260_BASIC] = "basic",
6215 [ALC260_HP_3013] = "hp-3013",
6216 [ALC260_HP_DC7600] = "hp-dc7600",
6217 [ALC260_FUJITSU_S702X] = "fujitsu",
6218 [ALC260_ACER] = "acer",
6219 [ALC260_WILL] = "will",
6220 [ALC260_REPLACER_672V] = "replacer",
6221 [ALC260_FAVORIT100] = "favorit100",
6222 #ifdef CONFIG_SND_DEBUG
6223 [ALC260_TEST] = "test",
6225 [ALC260_AUTO] = "auto",
6228 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6229 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6230 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6231 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6232 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6233 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6234 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6235 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6236 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6237 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6238 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6239 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6240 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6241 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6242 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6243 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6244 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6245 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6246 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6247 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6251 static struct alc_config_preset alc260_presets[] = {
6253 .mixers = { alc260_base_output_mixer,
6254 alc260_input_mixer },
6255 .init_verbs = { alc260_init_verbs },
6256 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6257 .dac_nids = alc260_dac_nids,
6258 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6259 .adc_nids = alc260_adc_nids,
6260 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6261 .channel_mode = alc260_modes,
6262 .input_mux = &alc260_capture_source,
6265 .mixers = { alc260_hp_output_mixer,
6266 alc260_input_mixer },
6267 .init_verbs = { alc260_init_verbs,
6268 alc260_hp_unsol_verbs },
6269 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6270 .dac_nids = alc260_dac_nids,
6271 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6272 .adc_nids = alc260_adc_nids_alt,
6273 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6274 .channel_mode = alc260_modes,
6275 .input_mux = &alc260_capture_source,
6276 .unsol_event = alc260_hp_unsol_event,
6277 .init_hook = alc260_hp_automute,
6279 [ALC260_HP_DC7600] = {
6280 .mixers = { alc260_hp_dc7600_mixer,
6281 alc260_input_mixer },
6282 .init_verbs = { alc260_init_verbs,
6283 alc260_hp_dc7600_verbs },
6284 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6285 .dac_nids = alc260_dac_nids,
6286 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6287 .adc_nids = alc260_adc_nids_alt,
6288 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6289 .channel_mode = alc260_modes,
6290 .input_mux = &alc260_capture_source,
6291 .unsol_event = alc260_hp_3012_unsol_event,
6292 .init_hook = alc260_hp_3012_automute,
6294 [ALC260_HP_3013] = {
6295 .mixers = { alc260_hp_3013_mixer,
6296 alc260_input_mixer },
6297 .init_verbs = { alc260_hp_3013_init_verbs,
6298 alc260_hp_3013_unsol_verbs },
6299 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6300 .dac_nids = alc260_dac_nids,
6301 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6302 .adc_nids = alc260_adc_nids_alt,
6303 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6304 .channel_mode = alc260_modes,
6305 .input_mux = &alc260_capture_source,
6306 .unsol_event = alc260_hp_3013_unsol_event,
6307 .init_hook = alc260_hp_3013_automute,
6309 [ALC260_FUJITSU_S702X] = {
6310 .mixers = { alc260_fujitsu_mixer },
6311 .init_verbs = { alc260_fujitsu_init_verbs },
6312 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6313 .dac_nids = alc260_dac_nids,
6314 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6315 .adc_nids = alc260_dual_adc_nids,
6316 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6317 .channel_mode = alc260_modes,
6318 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6319 .input_mux = alc260_fujitsu_capture_sources,
6322 .mixers = { alc260_acer_mixer },
6323 .init_verbs = { alc260_acer_init_verbs },
6324 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6325 .dac_nids = alc260_dac_nids,
6326 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6327 .adc_nids = alc260_dual_adc_nids,
6328 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6329 .channel_mode = alc260_modes,
6330 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6331 .input_mux = alc260_acer_capture_sources,
6333 [ALC260_FAVORIT100] = {
6334 .mixers = { alc260_favorit100_mixer },
6335 .init_verbs = { alc260_favorit100_init_verbs },
6336 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6337 .dac_nids = alc260_dac_nids,
6338 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6339 .adc_nids = alc260_dual_adc_nids,
6340 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6341 .channel_mode = alc260_modes,
6342 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6343 .input_mux = alc260_favorit100_capture_sources,
6346 .mixers = { alc260_will_mixer },
6347 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6348 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6349 .dac_nids = alc260_dac_nids,
6350 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6351 .adc_nids = alc260_adc_nids,
6352 .dig_out_nid = ALC260_DIGOUT_NID,
6353 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6354 .channel_mode = alc260_modes,
6355 .input_mux = &alc260_capture_source,
6357 [ALC260_REPLACER_672V] = {
6358 .mixers = { alc260_replacer_672v_mixer },
6359 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6360 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6361 .dac_nids = alc260_dac_nids,
6362 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6363 .adc_nids = alc260_adc_nids,
6364 .dig_out_nid = ALC260_DIGOUT_NID,
6365 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6366 .channel_mode = alc260_modes,
6367 .input_mux = &alc260_capture_source,
6368 .unsol_event = alc260_replacer_672v_unsol_event,
6369 .init_hook = alc260_replacer_672v_automute,
6371 #ifdef CONFIG_SND_DEBUG
6373 .mixers = { alc260_test_mixer },
6374 .init_verbs = { alc260_test_init_verbs },
6375 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6376 .dac_nids = alc260_test_dac_nids,
6377 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6378 .adc_nids = alc260_test_adc_nids,
6379 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6380 .channel_mode = alc260_modes,
6381 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6382 .input_mux = alc260_test_capture_sources,
6387 static int patch_alc260(struct hda_codec *codec)
6389 struct alc_spec *spec;
6390 int err, board_config;
6392 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6398 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6401 if (board_config < 0) {
6402 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6404 board_config = ALC260_AUTO;
6407 if (board_config == ALC260_AUTO) {
6408 /* automatic parse from the BIOS config */
6409 err = alc260_parse_auto_config(codec);
6415 "hda_codec: Cannot set up configuration "
6416 "from BIOS. Using base mode...\n");
6417 board_config = ALC260_BASIC;
6421 err = snd_hda_attach_beep_device(codec, 0x1);
6427 if (board_config != ALC260_AUTO)
6428 setup_preset(codec, &alc260_presets[board_config]);
6430 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6431 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6433 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6434 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6436 if (!spec->adc_nids && spec->input_mux) {
6437 /* check whether NID 0x04 is valid */
6438 unsigned int wcap = get_wcaps(codec, 0x04);
6439 wcap = get_wcaps_type(wcap);
6441 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6442 spec->adc_nids = alc260_adc_nids_alt;
6443 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6445 spec->adc_nids = alc260_adc_nids;
6446 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6449 set_capture_mixer(codec);
6450 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6452 spec->vmaster_nid = 0x08;
6454 codec->patch_ops = alc_patch_ops;
6455 if (board_config == ALC260_AUTO)
6456 spec->init_hook = alc260_auto_init;
6457 #ifdef CONFIG_SND_HDA_POWER_SAVE
6458 if (!spec->loopback.amplist)
6459 spec->loopback.amplist = alc260_loopbacks;
6461 codec->proc_widget_hook = print_realtek_coef;
6468 * ALC882/883/885/888/889 support
6470 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6471 * configuration. Each pin widget can choose any input DACs and a mixer.
6472 * Each ADC is connected from a mixer of all inputs. This makes possible
6473 * 6-channel independent captures.
6475 * In addition, an independent DAC for the multi-playback (not used in this
6478 #define ALC882_DIGOUT_NID 0x06
6479 #define ALC882_DIGIN_NID 0x0a
6480 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6481 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6482 #define ALC1200_DIGOUT_NID 0x10
6485 static struct hda_channel_mode alc882_ch_modes[1] = {
6490 static hda_nid_t alc882_dac_nids[4] = {
6491 /* front, rear, clfe, rear_surr */
6492 0x02, 0x03, 0x04, 0x05
6494 #define alc883_dac_nids alc882_dac_nids
6497 #define alc882_adc_nids alc880_adc_nids
6498 #define alc882_adc_nids_alt alc880_adc_nids_alt
6499 #define alc883_adc_nids alc882_adc_nids_alt
6500 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6501 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6502 #define alc889_adc_nids alc880_adc_nids
6504 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6505 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6506 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6507 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6508 #define alc889_capsrc_nids alc882_capsrc_nids
6511 /* FIXME: should be a matrix-type input source selection */
6513 static struct hda_input_mux alc882_capture_source = {
6517 { "Front Mic", 0x1 },
6523 #define alc883_capture_source alc882_capture_source
6525 static struct hda_input_mux alc889_capture_source = {
6528 { "Front Mic", 0x0 },
6534 static struct hda_input_mux mb5_capture_source = {
6543 static struct hda_input_mux alc883_3stack_6ch_intel = {
6547 { "Front Mic", 0x0 },
6553 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6561 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6571 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6579 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6583 { "Front Mic", 0x1 },
6588 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6596 static struct hda_input_mux alc889A_mb31_capture_source = {
6600 /* Front Mic (0x01) unused */
6602 /* Line 2 (0x03) unused */
6603 /* CD (0x04) unsused? */
6610 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6617 static struct hda_verb alc882_3ST_ch2_init[] = {
6618 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6619 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6620 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6621 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6628 static struct hda_verb alc882_3ST_ch4_init[] = {
6629 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6630 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6631 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6632 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6633 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6640 static struct hda_verb alc882_3ST_ch6_init[] = {
6641 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6642 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6643 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6644 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6645 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6646 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6650 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6651 { 2, alc882_3ST_ch2_init },
6652 { 4, alc882_3ST_ch4_init },
6653 { 6, alc882_3ST_ch6_init },
6656 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6661 static struct hda_verb alc882_sixstack_ch6_init[] = {
6662 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6663 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6664 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6665 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6672 static struct hda_verb alc882_sixstack_ch8_init[] = {
6673 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6674 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6675 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6676 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6680 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6681 { 6, alc882_sixstack_ch6_init },
6682 { 8, alc882_sixstack_ch8_init },
6686 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6692 static struct hda_verb alc885_mbp_ch2_init[] = {
6693 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6694 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6695 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6702 static struct hda_verb alc885_mbp_ch6_init[] = {
6703 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6704 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6705 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6706 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6707 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6711 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6712 { 2, alc885_mbp_ch2_init },
6713 { 6, alc885_mbp_ch6_init },
6718 * Speakers/Woofer/HP = Front
6721 static struct hda_verb alc885_mb5_ch2_init[] = {
6722 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6723 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6729 * Speakers/HP = Front
6733 static struct hda_verb alc885_mb5_ch6_init[] = {
6734 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6735 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6736 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6740 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6741 { 2, alc885_mb5_ch2_init },
6742 { 6, alc885_mb5_ch6_init },
6749 static struct hda_verb alc883_4ST_ch2_init[] = {
6750 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6751 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6752 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6753 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6754 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6755 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6762 static struct hda_verb alc883_4ST_ch4_init[] = {
6763 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6764 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6765 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6766 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6767 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6768 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6769 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6776 static struct hda_verb alc883_4ST_ch6_init[] = {
6777 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6778 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6779 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6780 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6781 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6782 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6783 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6784 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6791 static struct hda_verb alc883_4ST_ch8_init[] = {
6792 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6793 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6794 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6795 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6796 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6797 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6798 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6799 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6800 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6804 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6805 { 2, alc883_4ST_ch2_init },
6806 { 4, alc883_4ST_ch4_init },
6807 { 6, alc883_4ST_ch6_init },
6808 { 8, alc883_4ST_ch8_init },
6815 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6816 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6817 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6818 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6819 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6826 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6827 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6828 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6829 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6830 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6831 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6838 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6839 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6840 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6841 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6842 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6843 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6844 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6848 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6849 { 2, alc883_3ST_ch2_intel_init },
6850 { 4, alc883_3ST_ch4_intel_init },
6851 { 6, alc883_3ST_ch6_intel_init },
6857 static struct hda_verb alc889_ch2_intel_init[] = {
6858 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6859 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6860 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6861 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6862 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6863 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6870 static struct hda_verb alc889_ch6_intel_init[] = {
6871 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6872 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6873 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6874 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6875 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6876 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6883 static struct hda_verb alc889_ch8_intel_init[] = {
6884 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6885 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6886 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6887 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6888 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6889 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6890 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6894 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6895 { 2, alc889_ch2_intel_init },
6896 { 6, alc889_ch6_intel_init },
6897 { 8, alc889_ch8_intel_init },
6903 static struct hda_verb alc883_sixstack_ch6_init[] = {
6904 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6905 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6906 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6907 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6914 static struct hda_verb alc883_sixstack_ch8_init[] = {
6915 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6916 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6917 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6918 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6922 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6923 { 6, alc883_sixstack_ch6_init },
6924 { 8, alc883_sixstack_ch8_init },
6928 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6929 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6931 static struct snd_kcontrol_new alc882_base_mixer[] = {
6932 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6933 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6934 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6935 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6936 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6937 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6938 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6939 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6940 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6941 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6942 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6943 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6944 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6945 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6946 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6948 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6949 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6950 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6951 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6952 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6956 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6957 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6958 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6959 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6960 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6961 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6962 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6963 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6964 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6965 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6966 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6970 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6971 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6972 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6973 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6974 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6975 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6976 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6977 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6978 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6979 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6980 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6981 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6982 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6983 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6984 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6988 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6989 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6990 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6991 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6992 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6993 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6994 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6995 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6996 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6997 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7001 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7002 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7003 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7004 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7005 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7006 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7007 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7008 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7009 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7010 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7011 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7012 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7013 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7014 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7018 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7019 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7021 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7022 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7023 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7024 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7025 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7026 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7027 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7028 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7029 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7030 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7031 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7032 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7033 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7034 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7038 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7039 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7040 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7041 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7042 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7043 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7044 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7045 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7046 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7047 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7048 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7052 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7054 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7055 .name = "Channel Mode",
7056 .info = alc_ch_mode_info,
7057 .get = alc_ch_mode_get,
7058 .put = alc_ch_mode_put,
7063 static struct hda_verb alc882_base_init_verbs[] = {
7064 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7065 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7066 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7067 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7069 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7070 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7071 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7073 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7074 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7075 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7077 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7078 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7079 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7081 /* mute analog input loopbacks */
7082 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7088 /* Front Pin: output 0 (0x0c) */
7089 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7090 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7091 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7092 /* Rear Pin: output 1 (0x0d) */
7093 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7094 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7095 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7096 /* CLFE Pin: output 2 (0x0e) */
7097 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7098 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7099 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7100 /* Side Pin: output 3 (0x0f) */
7101 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7102 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7103 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7104 /* Mic (rear) pin: input vref at 80% */
7105 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7106 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7107 /* Front Mic pin: input vref at 80% */
7108 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7109 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7110 /* Line In pin: input */
7111 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7112 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7113 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7114 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7115 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7116 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7117 /* CD pin widget for input */
7118 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7120 /* FIXME: use matrix-type input source selection */
7121 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7123 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7124 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7125 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7126 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7128 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7129 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7130 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7131 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7132 /* ADC2: mute amp left and right */
7133 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7134 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7135 /* ADC3: mute amp left and right */
7136 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7137 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7142 static struct hda_verb alc882_adc1_init_verbs[] = {
7143 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7144 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7145 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7146 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7147 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7148 /* ADC1: mute amp left and right */
7149 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7150 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7154 static struct hda_verb alc882_eapd_verbs[] = {
7155 /* change to EAPD mode */
7156 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7157 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7161 static struct hda_verb alc889_eapd_verbs[] = {
7162 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7163 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7167 static struct hda_verb alc_hp15_unsol_verbs[] = {
7168 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7169 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7173 static struct hda_verb alc885_init_verbs[] = {
7174 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7175 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7176 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7177 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7179 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7180 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7181 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7183 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7184 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7185 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7187 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7188 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7189 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7191 /* mute analog input loopbacks */
7192 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7193 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7194 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7196 /* Front HP Pin: output 0 (0x0c) */
7197 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7198 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7199 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7200 /* Front Pin: output 0 (0x0c) */
7201 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7202 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7203 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7204 /* Rear Pin: output 1 (0x0d) */
7205 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7206 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7207 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7208 /* CLFE Pin: output 2 (0x0e) */
7209 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7210 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7211 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7212 /* Side Pin: output 3 (0x0f) */
7213 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7214 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7215 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7216 /* Mic (rear) pin: input vref at 80% */
7217 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7218 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7219 /* Front Mic pin: input vref at 80% */
7220 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7221 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7222 /* Line In pin: input */
7223 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7224 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7226 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7228 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7229 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7230 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7232 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7233 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7234 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7236 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7237 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7238 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7239 /* ADC2: mute amp left and right */
7240 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7241 /* ADC3: mute amp left and right */
7242 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7247 static struct hda_verb alc885_init_input_verbs[] = {
7248 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7249 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7250 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7255 /* Unmute Selector 24h and set the default input to front mic */
7256 static struct hda_verb alc889_init_input_verbs[] = {
7257 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7258 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7263 #define alc883_init_verbs alc882_base_init_verbs
7266 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7267 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7268 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7269 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7270 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7271 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7272 /* FIXME: this looks suspicious...
7273 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7274 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7279 static struct hda_verb alc882_macpro_init_verbs[] = {
7280 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7281 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7282 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7283 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7284 /* Front Pin: output 0 (0x0c) */
7285 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7286 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7287 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7288 /* Front Mic pin: input vref at 80% */
7289 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7290 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7291 /* Speaker: output */
7292 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7293 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7294 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7295 /* Headphone output (output 0 - 0x0c) */
7296 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7297 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7298 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7300 /* FIXME: use matrix-type input source selection */
7301 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7302 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7303 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7304 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7305 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7306 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7311 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7317 /* ADC1: mute amp left and right */
7318 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7319 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7320 /* ADC2: mute amp left and right */
7321 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7322 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7323 /* ADC3: mute amp left and right */
7324 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7325 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7331 static struct hda_verb alc885_mb5_init_verbs[] = {
7333 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7334 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7335 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7336 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7338 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7339 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7340 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7341 /* Surround mixer */
7342 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7343 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7344 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7346 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7350 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7351 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7352 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7353 /* Front Pin (0x0c) */
7354 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7355 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7356 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7357 /* LFE Pin (0x0e) */
7358 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7359 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7360 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7362 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7363 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7364 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7365 /* Front Mic pin: input vref at 80% */
7366 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7367 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7369 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7370 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7374 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7375 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7379 /* Macbook Pro rev3 */
7380 static struct hda_verb alc885_mbp3_init_verbs[] = {
7381 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7384 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7386 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7387 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7388 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7389 /* Front Pin: output 0 (0x0c) */
7390 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7391 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7392 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7393 /* HP Pin: output 0 (0x0d) */
7394 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7395 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7396 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7397 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7398 /* Mic (rear) pin: input vref at 80% */
7399 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7400 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7401 /* Front Mic pin: input vref at 80% */
7402 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7403 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7404 /* Line In pin: use output 1 when in LineOut mode */
7405 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7406 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7407 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7409 /* FIXME: use matrix-type input source selection */
7410 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7411 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7412 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7413 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7414 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7415 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7417 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7418 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7419 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7420 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7422 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7423 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7424 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7425 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7426 /* ADC1: mute amp left and right */
7427 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7428 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7429 /* ADC2: mute amp left and right */
7430 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7431 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7432 /* ADC3: mute amp left and right */
7433 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7434 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7439 /* iMac 24 mixer. */
7440 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7441 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7442 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7446 /* iMac 24 init verbs. */
7447 static struct hda_verb alc885_imac24_init_verbs[] = {
7448 /* Internal speakers: output 0 (0x0c) */
7449 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7450 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7451 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7452 /* Internal speakers: output 0 (0x0c) */
7453 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7454 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7455 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7456 /* Headphone: output 0 (0x0c) */
7457 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7458 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7459 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7460 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7461 /* Front Mic: input vref at 80% */
7462 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7463 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7467 /* Toggle speaker-output according to the hp-jack state */
7468 static void alc885_imac24_setup(struct hda_codec *codec)
7470 struct alc_spec *spec = codec->spec;
7472 spec->autocfg.hp_pins[0] = 0x14;
7473 spec->autocfg.speaker_pins[0] = 0x18;
7474 spec->autocfg.speaker_pins[1] = 0x1a;
7477 static void alc885_mbp3_setup(struct hda_codec *codec)
7479 struct alc_spec *spec = codec->spec;
7481 spec->autocfg.hp_pins[0] = 0x15;
7482 spec->autocfg.speaker_pins[0] = 0x14;
7486 static struct hda_verb alc882_targa_verbs[] = {
7487 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7488 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7490 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7491 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7493 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7494 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7495 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7497 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7501 /* toggle speaker-output according to the hp-jack state */
7502 static void alc882_targa_automute(struct hda_codec *codec)
7504 struct alc_spec *spec = codec->spec;
7505 alc_automute_amp(codec);
7506 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7507 spec->jack_present ? 1 : 3);
7510 static void alc882_targa_setup(struct hda_codec *codec)
7512 struct alc_spec *spec = codec->spec;
7514 spec->autocfg.hp_pins[0] = 0x14;
7515 spec->autocfg.speaker_pins[0] = 0x1b;
7518 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7520 if ((res >> 26) == ALC880_HP_EVENT)
7521 alc882_targa_automute(codec);
7524 static struct hda_verb alc882_asus_a7j_verbs[] = {
7525 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7528 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7529 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7530 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7532 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7533 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7534 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7536 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7537 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7538 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7542 static struct hda_verb alc882_asus_a7m_verbs[] = {
7543 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7546 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7547 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7548 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7550 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7551 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7552 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7554 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7555 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7556 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7560 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7562 unsigned int gpiostate, gpiomask, gpiodir;
7564 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7565 AC_VERB_GET_GPIO_DATA, 0);
7568 gpiostate |= (1 << pin);
7570 gpiostate &= ~(1 << pin);
7572 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7573 AC_VERB_GET_GPIO_MASK, 0);
7574 gpiomask |= (1 << pin);
7576 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7577 AC_VERB_GET_GPIO_DIRECTION, 0);
7578 gpiodir |= (1 << pin);
7581 snd_hda_codec_write(codec, codec->afg, 0,
7582 AC_VERB_SET_GPIO_MASK, gpiomask);
7583 snd_hda_codec_write(codec, codec->afg, 0,
7584 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7588 snd_hda_codec_write(codec, codec->afg, 0,
7589 AC_VERB_SET_GPIO_DATA, gpiostate);
7592 /* set up GPIO at initialization */
7593 static void alc885_macpro_init_hook(struct hda_codec *codec)
7595 alc882_gpio_mute(codec, 0, 0);
7596 alc882_gpio_mute(codec, 1, 0);
7599 /* set up GPIO and update auto-muting at initialization */
7600 static void alc885_imac24_init_hook(struct hda_codec *codec)
7602 alc885_macpro_init_hook(codec);
7603 alc_automute_amp(codec);
7607 * generic initialization of ADC, input mixers and output mixers
7609 static struct hda_verb alc883_auto_init_verbs[] = {
7611 * Unmute ADC0-2 and set the default input to mic-in
7613 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7614 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7615 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7616 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7618 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7620 * Note: PASD motherboards uses the Line In 2 as the input for
7621 * front panel mic (mic 2)
7623 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7631 * Set up output mixers (0x0c - 0x0f)
7633 /* set vol=0 to output mixers */
7634 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7635 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7636 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7637 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7638 /* set up input amps for analog loopback */
7639 /* Amp Indices: DAC = 0, mixer = 1 */
7640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7642 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7643 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7644 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7645 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7646 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7648 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7649 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7651 /* FIXME: use matrix-type input source selection */
7652 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7655 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7656 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7657 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7660 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7661 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7662 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7667 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7668 static struct hda_verb alc889A_mb31_ch2_init[] = {
7669 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7670 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7671 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7672 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7676 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7677 static struct hda_verb alc889A_mb31_ch4_init[] = {
7678 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7679 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7680 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7681 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7685 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7686 static struct hda_verb alc889A_mb31_ch5_init[] = {
7687 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7688 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7689 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7690 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7694 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7695 static struct hda_verb alc889A_mb31_ch6_init[] = {
7696 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7697 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7698 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7699 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7703 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7704 { 2, alc889A_mb31_ch2_init },
7705 { 4, alc889A_mb31_ch4_init },
7706 { 5, alc889A_mb31_ch5_init },
7707 { 6, alc889A_mb31_ch6_init },
7710 static struct hda_verb alc883_medion_eapd_verbs[] = {
7711 /* eanable EAPD on medion laptop */
7712 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7713 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7717 #define alc883_base_mixer alc882_base_mixer
7719 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7720 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7721 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7722 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7723 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7724 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7725 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7726 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7727 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7728 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7729 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7730 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7731 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7732 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7736 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7737 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7738 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7739 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7740 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7741 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7742 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7743 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7744 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7745 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7746 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7750 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7751 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7752 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7753 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7754 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7755 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7756 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7757 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7758 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7759 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7760 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7764 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7765 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7766 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7767 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7768 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7769 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7770 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7771 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7772 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7773 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7774 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7775 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7776 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7777 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7781 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7782 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7783 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7784 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7785 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7786 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7787 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7788 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7789 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7790 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7791 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7792 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7793 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7794 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7796 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7797 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7798 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7799 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7800 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7804 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7805 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7806 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7807 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7808 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7809 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7811 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7812 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7813 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7814 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7815 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7816 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7817 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7818 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7819 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7820 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7821 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7822 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7823 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7824 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7828 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7829 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7830 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7831 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7832 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7833 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7835 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7836 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7837 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7838 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7839 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7840 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7841 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7842 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7843 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7844 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7845 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7846 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7847 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7848 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7852 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7853 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7854 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7855 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7856 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7857 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7858 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7859 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7860 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7861 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7862 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7863 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7864 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7865 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7866 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7867 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7868 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7869 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7870 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7871 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7875 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7876 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7877 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7878 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7879 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7880 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7881 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7882 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7883 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7884 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7885 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7886 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7887 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7888 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7889 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7890 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7891 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7895 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7896 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7897 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7898 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7899 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7900 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7901 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7902 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7904 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7905 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7906 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7910 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7911 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7912 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7913 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7914 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7915 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7916 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7917 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7918 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7922 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7923 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7924 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7926 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7927 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7930 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7931 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7935 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7936 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7937 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7938 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7939 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7940 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7942 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7943 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7944 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7948 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7949 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7950 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7951 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7952 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7953 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7954 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7955 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7956 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7960 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
7961 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7962 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7963 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7964 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
7965 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7966 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7967 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7968 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7970 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7971 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7975 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7976 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7977 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7978 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7979 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7980 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7981 0x0d, 1, 0x0, HDA_OUTPUT),
7982 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7983 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7984 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7985 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7986 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7987 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7988 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7989 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7990 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7991 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7992 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7994 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7995 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7996 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8000 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8002 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8003 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8004 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8005 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8006 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8008 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8009 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8010 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8011 /* Output switches */
8012 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8013 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8014 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8016 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8017 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8019 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8020 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8021 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8022 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8026 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8027 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8028 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8029 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8030 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8031 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8032 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8036 static struct hda_bind_ctls alc883_bind_cap_vol = {
8037 .ops = &snd_hda_bind_vol,
8039 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8040 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8045 static struct hda_bind_ctls alc883_bind_cap_switch = {
8046 .ops = &snd_hda_bind_sw,
8048 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8049 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8054 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8055 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8056 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8057 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8058 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8059 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8060 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8061 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8062 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8066 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8067 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8068 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8070 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8071 /* .name = "Capture Source", */
8072 .name = "Input Source",
8074 .info = alc_mux_enum_info,
8075 .get = alc_mux_enum_get,
8076 .put = alc_mux_enum_put,
8081 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8083 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8084 .name = "Channel Mode",
8085 .info = alc_ch_mode_info,
8086 .get = alc_ch_mode_get,
8087 .put = alc_ch_mode_put,
8092 /* toggle speaker-output according to the hp-jack state */
8093 static void alc883_mitac_setup(struct hda_codec *codec)
8095 struct alc_spec *spec = codec->spec;
8097 spec->autocfg.hp_pins[0] = 0x15;
8098 spec->autocfg.speaker_pins[0] = 0x14;
8099 spec->autocfg.speaker_pins[1] = 0x17;
8102 /* auto-toggle front mic */
8104 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8106 unsigned int present;
8109 present = snd_hda_codec_read(codec, 0x18, 0,
8110 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8111 bits = present ? HDA_AMP_MUTE : 0;
8112 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8116 static struct hda_verb alc883_mitac_verbs[] = {
8118 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8119 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8121 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8122 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8124 /* enable unsolicited event */
8125 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8126 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8131 static struct hda_verb alc883_clevo_m720_verbs[] = {
8133 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8134 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8136 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8137 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8139 /* enable unsolicited event */
8140 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8141 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8146 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8148 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8149 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8151 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8152 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8154 /* enable unsolicited event */
8155 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8160 static struct hda_verb alc883_targa_verbs[] = {
8161 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8164 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8165 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8167 /* Connect Line-Out side jack (SPDIF) to Side */
8168 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8169 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8170 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8171 /* Connect Mic jack to CLFE */
8172 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8173 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8174 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8175 /* Connect Line-in jack to Surround */
8176 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8177 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8178 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8179 /* Connect HP out jack to Front */
8180 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8181 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8182 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8184 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8189 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8190 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8191 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8192 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8196 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8197 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8198 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8199 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8200 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8204 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8205 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8206 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8207 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8208 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8209 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8213 static struct hda_verb alc883_haier_w66_verbs[] = {
8214 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8215 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8217 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8219 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8220 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8221 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8222 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8226 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8227 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8228 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8229 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8230 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8231 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8232 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8233 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8234 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8238 static struct hda_verb alc888_6st_dell_verbs[] = {
8239 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8243 static struct hda_verb alc883_vaiott_verbs[] = {
8245 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8246 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8248 /* enable unsolicited event */
8249 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8254 static void alc888_3st_hp_setup(struct hda_codec *codec)
8256 struct alc_spec *spec = codec->spec;
8258 spec->autocfg.hp_pins[0] = 0x1b;
8259 spec->autocfg.speaker_pins[0] = 0x14;
8260 spec->autocfg.speaker_pins[1] = 0x16;
8261 spec->autocfg.speaker_pins[2] = 0x18;
8264 static struct hda_verb alc888_3st_hp_verbs[] = {
8265 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8266 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8267 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8268 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8275 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8276 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8277 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8278 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8279 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8286 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8287 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8288 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8289 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8290 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8291 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8298 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8299 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8300 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8301 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8302 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8303 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8304 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8308 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8309 { 2, alc888_3st_hp_2ch_init },
8310 { 4, alc888_3st_hp_4ch_init },
8311 { 6, alc888_3st_hp_6ch_init },
8314 /* toggle front-jack and RCA according to the hp-jack state */
8315 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8317 unsigned int present;
8319 present = snd_hda_codec_read(codec, 0x1b, 0,
8320 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8321 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8322 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8323 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8324 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8327 /* toggle RCA according to the front-jack state */
8328 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8330 unsigned int present;
8332 present = snd_hda_codec_read(codec, 0x14, 0,
8333 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8334 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8335 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8338 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8341 if ((res >> 26) == ALC880_HP_EVENT)
8342 alc888_lenovo_ms7195_front_automute(codec);
8343 if ((res >> 26) == ALC880_FRONT_EVENT)
8344 alc888_lenovo_ms7195_rca_automute(codec);
8347 static struct hda_verb alc883_medion_md2_verbs[] = {
8348 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8349 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8353 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8357 /* toggle speaker-output according to the hp-jack state */
8358 static void alc883_medion_md2_setup(struct hda_codec *codec)
8360 struct alc_spec *spec = codec->spec;
8362 spec->autocfg.hp_pins[0] = 0x14;
8363 spec->autocfg.speaker_pins[0] = 0x15;
8366 /* toggle speaker-output according to the hp-jack state */
8367 #define alc883_targa_init_hook alc882_targa_init_hook
8368 #define alc883_targa_unsol_event alc882_targa_unsol_event
8370 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8372 unsigned int present;
8374 present = snd_hda_codec_read(codec, 0x18, 0,
8375 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8376 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8377 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8380 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8382 struct alc_spec *spec = codec->spec;
8384 spec->autocfg.hp_pins[0] = 0x15;
8385 spec->autocfg.speaker_pins[0] = 0x14;
8388 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8390 alc_automute_amp(codec);
8391 alc883_clevo_m720_mic_automute(codec);
8394 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8397 switch (res >> 26) {
8398 case ALC880_MIC_EVENT:
8399 alc883_clevo_m720_mic_automute(codec);
8402 alc_automute_amp_unsol_event(codec, res);
8407 /* toggle speaker-output according to the hp-jack state */
8408 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8410 struct alc_spec *spec = codec->spec;
8412 spec->autocfg.hp_pins[0] = 0x14;
8413 spec->autocfg.speaker_pins[0] = 0x15;
8416 static void alc883_haier_w66_setup(struct hda_codec *codec)
8418 struct alc_spec *spec = codec->spec;
8420 spec->autocfg.hp_pins[0] = 0x1b;
8421 spec->autocfg.speaker_pins[0] = 0x14;
8424 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8426 unsigned int present;
8429 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8430 & AC_PINSENSE_PRESENCE;
8431 bits = present ? HDA_AMP_MUTE : 0;
8432 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8433 HDA_AMP_MUTE, bits);
8436 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8438 unsigned int present;
8441 present = snd_hda_codec_read(codec, 0x1b, 0,
8442 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8443 bits = present ? HDA_AMP_MUTE : 0;
8444 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8445 HDA_AMP_MUTE, bits);
8446 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8447 HDA_AMP_MUTE, bits);
8450 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8453 if ((res >> 26) == ALC880_HP_EVENT)
8454 alc883_lenovo_101e_all_automute(codec);
8455 if ((res >> 26) == ALC880_FRONT_EVENT)
8456 alc883_lenovo_101e_ispeaker_automute(codec);
8459 /* toggle speaker-output according to the hp-jack state */
8460 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8462 struct alc_spec *spec = codec->spec;
8464 spec->autocfg.hp_pins[0] = 0x14;
8465 spec->autocfg.speaker_pins[0] = 0x15;
8466 spec->autocfg.speaker_pins[1] = 0x16;
8469 static struct hda_verb alc883_acer_eapd_verbs[] = {
8470 /* HP Pin: output 0 (0x0c) */
8471 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8472 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8473 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8474 /* Front Pin: output 0 (0x0c) */
8475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8476 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8477 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8478 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8479 /* eanable EAPD on medion laptop */
8480 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8481 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8482 /* enable unsolicited event */
8483 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8487 static void alc888_6st_dell_setup(struct hda_codec *codec)
8489 struct alc_spec *spec = codec->spec;
8491 spec->autocfg.hp_pins[0] = 0x1b;
8492 spec->autocfg.speaker_pins[0] = 0x14;
8493 spec->autocfg.speaker_pins[1] = 0x15;
8494 spec->autocfg.speaker_pins[2] = 0x16;
8495 spec->autocfg.speaker_pins[3] = 0x17;
8498 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8500 struct alc_spec *spec = codec->spec;
8502 spec->autocfg.hp_pins[0] = 0x1b;
8503 spec->autocfg.speaker_pins[0] = 0x14;
8504 spec->autocfg.speaker_pins[1] = 0x15;
8505 spec->autocfg.speaker_pins[2] = 0x16;
8506 spec->autocfg.speaker_pins[3] = 0x17;
8507 spec->autocfg.speaker_pins[4] = 0x1a;
8510 static void alc883_vaiott_setup(struct hda_codec *codec)
8512 struct alc_spec *spec = codec->spec;
8514 spec->autocfg.hp_pins[0] = 0x15;
8515 spec->autocfg.speaker_pins[0] = 0x14;
8516 spec->autocfg.speaker_pins[1] = 0x17;
8519 static struct hda_verb alc888_asus_m90v_verbs[] = {
8520 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8521 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8522 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8523 /* enable unsolicited event */
8524 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8525 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8529 static void alc883_mode2_setup(struct hda_codec *codec)
8531 struct alc_spec *spec = codec->spec;
8533 spec->autocfg.hp_pins[0] = 0x1b;
8534 spec->autocfg.speaker_pins[0] = 0x14;
8535 spec->autocfg.speaker_pins[1] = 0x15;
8536 spec->autocfg.speaker_pins[2] = 0x16;
8537 spec->ext_mic.pin = 0x18;
8538 spec->int_mic.pin = 0x19;
8539 spec->ext_mic.mux_idx = 0;
8540 spec->int_mic.mux_idx = 1;
8544 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8545 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8546 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8547 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8548 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8549 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8550 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8551 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8552 /* enable unsolicited event */
8553 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8557 static void alc883_eee1601_inithook(struct hda_codec *codec)
8559 struct alc_spec *spec = codec->spec;
8561 spec->autocfg.hp_pins[0] = 0x14;
8562 spec->autocfg.speaker_pins[0] = 0x1b;
8563 alc_automute_pin(codec);
8566 static struct hda_verb alc889A_mb31_verbs[] = {
8567 /* Init rear pin (used as headphone output) */
8568 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8569 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8570 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8571 /* Init line pin (used as output in 4ch and 6ch mode) */
8572 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8573 /* Init line 2 pin (used as headphone out by default) */
8574 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8575 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8579 /* Mute speakers according to the headphone jack state */
8580 static void alc889A_mb31_automute(struct hda_codec *codec)
8582 unsigned int present;
8584 /* Mute only in 2ch or 4ch mode */
8585 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8587 present = snd_hda_codec_read(codec, 0x15, 0,
8588 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8589 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8590 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8591 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8592 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8596 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8598 if ((res >> 26) == ALC880_HP_EVENT)
8599 alc889A_mb31_automute(codec);
8603 #ifdef CONFIG_SND_HDA_POWER_SAVE
8604 #define alc882_loopbacks alc880_loopbacks
8607 /* pcm configuration: identical with ALC880 */
8608 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8609 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8610 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8611 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8613 static hda_nid_t alc883_slave_dig_outs[] = {
8614 ALC1200_DIGOUT_NID, 0,
8617 static hda_nid_t alc1200_slave_dig_outs[] = {
8618 ALC883_DIGOUT_NID, 0,
8622 * configuration and preset
8624 static const char *alc882_models[ALC882_MODEL_LAST] = {
8625 [ALC882_3ST_DIG] = "3stack-dig",
8626 [ALC882_6ST_DIG] = "6stack-dig",
8627 [ALC882_ARIMA] = "arima",
8628 [ALC882_W2JC] = "w2jc",
8629 [ALC882_TARGA] = "targa",
8630 [ALC882_ASUS_A7J] = "asus-a7j",
8631 [ALC882_ASUS_A7M] = "asus-a7m",
8632 [ALC885_MACPRO] = "macpro",
8633 [ALC885_MB5] = "mb5",
8634 [ALC885_MBP3] = "mbp3",
8635 [ALC885_IMAC24] = "imac24",
8636 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8637 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8638 [ALC883_3ST_6ch] = "3stack-6ch",
8639 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8640 [ALC883_TARGA_DIG] = "targa-dig",
8641 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8642 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8643 [ALC883_ACER] = "acer",
8644 [ALC883_ACER_ASPIRE] = "acer-aspire",
8645 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8646 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8647 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8648 [ALC883_MEDION] = "medion",
8649 [ALC883_MEDION_MD2] = "medion-md2",
8650 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8651 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8652 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8653 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8654 [ALC888_LENOVO_SKY] = "lenovo-sky",
8655 [ALC883_HAIER_W66] = "haier-w66",
8656 [ALC888_3ST_HP] = "3stack-hp",
8657 [ALC888_6ST_DELL] = "6stack-dell",
8658 [ALC883_MITAC] = "mitac",
8659 [ALC883_CLEVO_M720] = "clevo-m720",
8660 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8661 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8662 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8663 [ALC889A_INTEL] = "intel-alc889a",
8664 [ALC889_INTEL] = "intel-x58",
8665 [ALC1200_ASUS_P5Q] = "asus-p5q",
8666 [ALC889A_MB31] = "mb31",
8667 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8668 [ALC882_AUTO] = "auto",
8671 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8672 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8674 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8675 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8676 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8677 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8678 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8679 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8680 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8681 ALC888_ACER_ASPIRE_4930G),
8682 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8683 ALC888_ACER_ASPIRE_4930G),
8684 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8685 ALC888_ACER_ASPIRE_8930G),
8686 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8687 ALC888_ACER_ASPIRE_8930G),
8688 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8689 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8690 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8691 ALC888_ACER_ASPIRE_6530G),
8692 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8693 ALC888_ACER_ASPIRE_6530G),
8694 /* default Acer -- disabled as it causes more problems.
8695 * model=auto should work fine now
8697 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8699 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8701 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8702 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8703 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8704 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8705 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8706 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8708 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8709 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8710 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8711 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8712 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8713 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8714 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8715 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8716 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8717 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8718 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8720 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8721 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8722 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8723 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8724 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8725 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8726 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8727 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8728 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8730 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8731 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8732 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8733 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8734 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8735 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8736 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8737 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8738 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8739 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8740 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8741 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8742 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8743 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8744 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8745 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8746 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8747 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8748 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8749 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8750 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8751 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8752 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8753 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8754 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8755 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8756 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8757 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8758 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8760 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8761 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8762 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8763 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8764 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8765 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8766 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8767 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8768 ALC883_FUJITSU_PI2515),
8769 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8770 ALC888_FUJITSU_XA3530),
8771 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8772 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8773 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8774 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8775 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8776 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8777 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8778 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8779 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8781 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8782 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8783 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8784 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8785 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8786 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8787 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8792 /* codec SSID table for Intel Mac */
8793 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8794 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8795 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8796 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8797 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8798 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8799 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8800 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8801 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8802 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8803 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8804 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8805 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8806 * no perfect solution yet
8808 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8812 static struct alc_config_preset alc882_presets[] = {
8813 [ALC882_3ST_DIG] = {
8814 .mixers = { alc882_base_mixer },
8815 .init_verbs = { alc882_base_init_verbs,
8816 alc882_adc1_init_verbs },
8817 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8818 .dac_nids = alc882_dac_nids,
8819 .dig_out_nid = ALC882_DIGOUT_NID,
8820 .dig_in_nid = ALC882_DIGIN_NID,
8821 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8822 .channel_mode = alc882_ch_modes,
8824 .input_mux = &alc882_capture_source,
8826 [ALC882_6ST_DIG] = {
8827 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8828 .init_verbs = { alc882_base_init_verbs,
8829 alc882_adc1_init_verbs },
8830 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8831 .dac_nids = alc882_dac_nids,
8832 .dig_out_nid = ALC882_DIGOUT_NID,
8833 .dig_in_nid = ALC882_DIGIN_NID,
8834 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8835 .channel_mode = alc882_sixstack_modes,
8836 .input_mux = &alc882_capture_source,
8839 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8840 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8841 alc882_eapd_verbs },
8842 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8843 .dac_nids = alc882_dac_nids,
8844 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8845 .channel_mode = alc882_sixstack_modes,
8846 .input_mux = &alc882_capture_source,
8849 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8850 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8851 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8852 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8853 .dac_nids = alc882_dac_nids,
8854 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8855 .channel_mode = alc880_threestack_modes,
8857 .input_mux = &alc882_capture_source,
8858 .dig_out_nid = ALC882_DIGOUT_NID,
8861 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8862 .init_verbs = { alc885_mbp3_init_verbs,
8863 alc880_gpio1_init_verbs },
8864 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8865 .dac_nids = alc882_dac_nids,
8866 .channel_mode = alc885_mbp_6ch_modes,
8867 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
8868 .input_mux = &alc882_capture_source,
8869 .dig_out_nid = ALC882_DIGOUT_NID,
8870 .dig_in_nid = ALC882_DIGIN_NID,
8871 .unsol_event = alc_automute_amp_unsol_event,
8872 .setup = alc885_mbp3_setup,
8873 .init_hook = alc_automute_amp,
8876 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8877 .init_verbs = { alc885_mb5_init_verbs,
8878 alc880_gpio1_init_verbs },
8879 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8880 .dac_nids = alc882_dac_nids,
8881 .channel_mode = alc885_mb5_6ch_modes,
8882 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8883 .input_mux = &mb5_capture_source,
8884 .dig_out_nid = ALC882_DIGOUT_NID,
8885 .dig_in_nid = ALC882_DIGIN_NID,
8888 .mixers = { alc882_macpro_mixer },
8889 .init_verbs = { alc882_macpro_init_verbs },
8890 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8891 .dac_nids = alc882_dac_nids,
8892 .dig_out_nid = ALC882_DIGOUT_NID,
8893 .dig_in_nid = ALC882_DIGIN_NID,
8894 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8895 .channel_mode = alc882_ch_modes,
8896 .input_mux = &alc882_capture_source,
8897 .init_hook = alc885_macpro_init_hook,
8900 .mixers = { alc885_imac24_mixer },
8901 .init_verbs = { alc885_imac24_init_verbs },
8902 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8903 .dac_nids = alc882_dac_nids,
8904 .dig_out_nid = ALC882_DIGOUT_NID,
8905 .dig_in_nid = ALC882_DIGIN_NID,
8906 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8907 .channel_mode = alc882_ch_modes,
8908 .input_mux = &alc882_capture_source,
8909 .unsol_event = alc_automute_amp_unsol_event,
8910 .setup = alc885_imac24_setup,
8911 .init_hook = alc885_imac24_init_hook,
8914 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
8915 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8916 alc880_gpio3_init_verbs, alc882_targa_verbs},
8917 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8918 .dac_nids = alc882_dac_nids,
8919 .dig_out_nid = ALC882_DIGOUT_NID,
8920 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8921 .adc_nids = alc882_adc_nids,
8922 .capsrc_nids = alc882_capsrc_nids,
8923 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8924 .channel_mode = alc882_3ST_6ch_modes,
8926 .input_mux = &alc882_capture_source,
8927 .unsol_event = alc882_targa_unsol_event,
8928 .setup = alc882_targa_setup,
8929 .init_hook = alc882_targa_automute,
8931 [ALC882_ASUS_A7J] = {
8932 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
8933 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8934 alc882_asus_a7j_verbs},
8935 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8936 .dac_nids = alc882_dac_nids,
8937 .dig_out_nid = ALC882_DIGOUT_NID,
8938 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8939 .adc_nids = alc882_adc_nids,
8940 .capsrc_nids = alc882_capsrc_nids,
8941 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8942 .channel_mode = alc882_3ST_6ch_modes,
8944 .input_mux = &alc882_capture_source,
8946 [ALC882_ASUS_A7M] = {
8947 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
8948 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8949 alc882_eapd_verbs, alc880_gpio1_init_verbs,
8950 alc882_asus_a7m_verbs },
8951 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8952 .dac_nids = alc882_dac_nids,
8953 .dig_out_nid = ALC882_DIGOUT_NID,
8954 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8955 .channel_mode = alc880_threestack_modes,
8957 .input_mux = &alc882_capture_source,
8959 [ALC883_3ST_2ch_DIG] = {
8960 .mixers = { alc883_3ST_2ch_mixer },
8961 .init_verbs = { alc883_init_verbs },
8962 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8963 .dac_nids = alc883_dac_nids,
8964 .dig_out_nid = ALC883_DIGOUT_NID,
8965 .dig_in_nid = ALC883_DIGIN_NID,
8966 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8967 .channel_mode = alc883_3ST_2ch_modes,
8968 .input_mux = &alc883_capture_source,
8970 [ALC883_3ST_6ch_DIG] = {
8971 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8972 .init_verbs = { alc883_init_verbs },
8973 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8974 .dac_nids = alc883_dac_nids,
8975 .dig_out_nid = ALC883_DIGOUT_NID,
8976 .dig_in_nid = ALC883_DIGIN_NID,
8977 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8978 .channel_mode = alc883_3ST_6ch_modes,
8980 .input_mux = &alc883_capture_source,
8982 [ALC883_3ST_6ch] = {
8983 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8984 .init_verbs = { alc883_init_verbs },
8985 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8986 .dac_nids = alc883_dac_nids,
8987 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8988 .channel_mode = alc883_3ST_6ch_modes,
8990 .input_mux = &alc883_capture_source,
8992 [ALC883_3ST_6ch_INTEL] = {
8993 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8994 .init_verbs = { alc883_init_verbs },
8995 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8996 .dac_nids = alc883_dac_nids,
8997 .dig_out_nid = ALC883_DIGOUT_NID,
8998 .dig_in_nid = ALC883_DIGIN_NID,
8999 .slave_dig_outs = alc883_slave_dig_outs,
9000 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9001 .channel_mode = alc883_3ST_6ch_intel_modes,
9003 .input_mux = &alc883_3stack_6ch_intel,
9006 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9007 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9008 alc_hp15_unsol_verbs },
9009 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9010 .dac_nids = alc883_dac_nids,
9011 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9012 .adc_nids = alc889_adc_nids,
9013 .dig_out_nid = ALC883_DIGOUT_NID,
9014 .dig_in_nid = ALC883_DIGIN_NID,
9015 .slave_dig_outs = alc883_slave_dig_outs,
9016 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9017 .channel_mode = alc889_8ch_intel_modes,
9018 .capsrc_nids = alc889_capsrc_nids,
9019 .input_mux = &alc889_capture_source,
9020 .setup = alc889_automute_setup,
9021 .init_hook = alc_automute_amp,
9022 .unsol_event = alc_automute_amp_unsol_event,
9026 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9027 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9028 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9029 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9030 .dac_nids = alc883_dac_nids,
9031 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9032 .adc_nids = alc889_adc_nids,
9033 .dig_out_nid = ALC883_DIGOUT_NID,
9034 .dig_in_nid = ALC883_DIGIN_NID,
9035 .slave_dig_outs = alc883_slave_dig_outs,
9036 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9037 .channel_mode = alc889_8ch_intel_modes,
9038 .capsrc_nids = alc889_capsrc_nids,
9039 .input_mux = &alc889_capture_source,
9040 .setup = alc889_automute_setup,
9041 .init_hook = alc889_intel_init_hook,
9042 .unsol_event = alc_automute_amp_unsol_event,
9045 [ALC883_6ST_DIG] = {
9046 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9047 .init_verbs = { alc883_init_verbs },
9048 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9049 .dac_nids = alc883_dac_nids,
9050 .dig_out_nid = ALC883_DIGOUT_NID,
9051 .dig_in_nid = ALC883_DIGIN_NID,
9052 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9053 .channel_mode = alc883_sixstack_modes,
9054 .input_mux = &alc883_capture_source,
9056 [ALC883_TARGA_DIG] = {
9057 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9058 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9059 alc883_targa_verbs},
9060 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9061 .dac_nids = alc883_dac_nids,
9062 .dig_out_nid = ALC883_DIGOUT_NID,
9063 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9064 .channel_mode = alc883_3ST_6ch_modes,
9066 .input_mux = &alc883_capture_source,
9067 .unsol_event = alc883_targa_unsol_event,
9068 .setup = alc882_targa_setup,
9069 .init_hook = alc882_targa_automute,
9071 [ALC883_TARGA_2ch_DIG] = {
9072 .mixers = { alc883_targa_2ch_mixer},
9073 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9074 alc883_targa_verbs},
9075 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9076 .dac_nids = alc883_dac_nids,
9077 .adc_nids = alc883_adc_nids_alt,
9078 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9079 .dig_out_nid = ALC883_DIGOUT_NID,
9080 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9081 .channel_mode = alc883_3ST_2ch_modes,
9082 .input_mux = &alc883_capture_source,
9083 .unsol_event = alc883_targa_unsol_event,
9084 .setup = alc882_targa_setup,
9085 .init_hook = alc882_targa_automute,
9087 [ALC883_TARGA_8ch_DIG] = {
9088 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9089 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9090 alc883_targa_verbs },
9091 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9092 .dac_nids = alc883_dac_nids,
9093 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9094 .adc_nids = alc883_adc_nids_rev,
9095 .capsrc_nids = alc883_capsrc_nids_rev,
9096 .dig_out_nid = ALC883_DIGOUT_NID,
9097 .dig_in_nid = ALC883_DIGIN_NID,
9098 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9099 .channel_mode = alc883_4ST_8ch_modes,
9101 .input_mux = &alc883_capture_source,
9102 .unsol_event = alc883_targa_unsol_event,
9103 .setup = alc882_targa_setup,
9104 .init_hook = alc882_targa_automute,
9107 .mixers = { alc883_base_mixer },
9108 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9109 * and the headphone jack. Turn this on and rely on the
9110 * standard mute methods whenever the user wants to turn
9111 * these outputs off.
9113 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9114 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9115 .dac_nids = alc883_dac_nids,
9116 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9117 .channel_mode = alc883_3ST_2ch_modes,
9118 .input_mux = &alc883_capture_source,
9120 [ALC883_ACER_ASPIRE] = {
9121 .mixers = { alc883_acer_aspire_mixer },
9122 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9123 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9124 .dac_nids = alc883_dac_nids,
9125 .dig_out_nid = ALC883_DIGOUT_NID,
9126 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9127 .channel_mode = alc883_3ST_2ch_modes,
9128 .input_mux = &alc883_capture_source,
9129 .unsol_event = alc_automute_amp_unsol_event,
9130 .setup = alc883_acer_aspire_setup,
9131 .init_hook = alc_automute_amp,
9133 [ALC888_ACER_ASPIRE_4930G] = {
9134 .mixers = { alc888_base_mixer,
9135 alc883_chmode_mixer },
9136 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9137 alc888_acer_aspire_4930g_verbs },
9138 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9139 .dac_nids = alc883_dac_nids,
9140 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9141 .adc_nids = alc883_adc_nids_rev,
9142 .capsrc_nids = alc883_capsrc_nids_rev,
9143 .dig_out_nid = ALC883_DIGOUT_NID,
9144 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9145 .channel_mode = alc883_3ST_6ch_modes,
9148 ARRAY_SIZE(alc888_2_capture_sources),
9149 .input_mux = alc888_2_capture_sources,
9150 .unsol_event = alc_automute_amp_unsol_event,
9151 .setup = alc888_acer_aspire_4930g_setup,
9152 .init_hook = alc_automute_amp,
9154 [ALC888_ACER_ASPIRE_6530G] = {
9155 .mixers = { alc888_acer_aspire_6530_mixer },
9156 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9157 alc888_acer_aspire_6530g_verbs },
9158 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9159 .dac_nids = alc883_dac_nids,
9160 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9161 .adc_nids = alc883_adc_nids_rev,
9162 .capsrc_nids = alc883_capsrc_nids_rev,
9163 .dig_out_nid = ALC883_DIGOUT_NID,
9164 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9165 .channel_mode = alc883_3ST_2ch_modes,
9167 ARRAY_SIZE(alc888_2_capture_sources),
9168 .input_mux = alc888_acer_aspire_6530_sources,
9169 .unsol_event = alc_automute_amp_unsol_event,
9170 .setup = alc888_acer_aspire_6530g_setup,
9171 .init_hook = alc_automute_amp,
9173 [ALC888_ACER_ASPIRE_8930G] = {
9174 .mixers = { alc888_base_mixer,
9175 alc883_chmode_mixer },
9176 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9177 alc889_acer_aspire_8930g_verbs },
9178 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9179 .dac_nids = alc883_dac_nids,
9180 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9181 .adc_nids = alc889_adc_nids,
9182 .capsrc_nids = alc889_capsrc_nids,
9183 .dig_out_nid = ALC883_DIGOUT_NID,
9184 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9185 .channel_mode = alc883_3ST_6ch_modes,
9187 .const_channel_count = 6,
9189 ARRAY_SIZE(alc889_capture_sources),
9190 .input_mux = alc889_capture_sources,
9191 .unsol_event = alc_automute_amp_unsol_event,
9192 .setup = alc889_acer_aspire_8930g_setup,
9193 .init_hook = alc_automute_amp,
9196 .mixers = { alc883_fivestack_mixer,
9197 alc883_chmode_mixer },
9198 .init_verbs = { alc883_init_verbs,
9199 alc883_medion_eapd_verbs },
9200 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9201 .dac_nids = alc883_dac_nids,
9202 .adc_nids = alc883_adc_nids_alt,
9203 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9204 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9205 .channel_mode = alc883_sixstack_modes,
9206 .input_mux = &alc883_capture_source,
9208 [ALC883_MEDION_MD2] = {
9209 .mixers = { alc883_medion_md2_mixer},
9210 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9211 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9212 .dac_nids = alc883_dac_nids,
9213 .dig_out_nid = ALC883_DIGOUT_NID,
9214 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9215 .channel_mode = alc883_3ST_2ch_modes,
9216 .input_mux = &alc883_capture_source,
9217 .unsol_event = alc_automute_amp_unsol_event,
9218 .setup = alc883_medion_md2_setup,
9219 .init_hook = alc_automute_amp,
9221 [ALC883_LAPTOP_EAPD] = {
9222 .mixers = { alc883_base_mixer },
9223 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9224 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9225 .dac_nids = alc883_dac_nids,
9226 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9227 .channel_mode = alc883_3ST_2ch_modes,
9228 .input_mux = &alc883_capture_source,
9230 [ALC883_CLEVO_M720] = {
9231 .mixers = { alc883_clevo_m720_mixer },
9232 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9233 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9234 .dac_nids = alc883_dac_nids,
9235 .dig_out_nid = ALC883_DIGOUT_NID,
9236 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9237 .channel_mode = alc883_3ST_2ch_modes,
9238 .input_mux = &alc883_capture_source,
9239 .unsol_event = alc883_clevo_m720_unsol_event,
9240 .setup = alc883_clevo_m720_setup,
9241 .init_hook = alc883_clevo_m720_init_hook,
9243 [ALC883_LENOVO_101E_2ch] = {
9244 .mixers = { alc883_lenovo_101e_2ch_mixer},
9245 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9246 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9247 .dac_nids = alc883_dac_nids,
9248 .adc_nids = alc883_adc_nids_alt,
9249 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9250 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9251 .channel_mode = alc883_3ST_2ch_modes,
9252 .input_mux = &alc883_lenovo_101e_capture_source,
9253 .unsol_event = alc883_lenovo_101e_unsol_event,
9254 .init_hook = alc883_lenovo_101e_all_automute,
9256 [ALC883_LENOVO_NB0763] = {
9257 .mixers = { alc883_lenovo_nb0763_mixer },
9258 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9259 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9260 .dac_nids = alc883_dac_nids,
9261 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9262 .channel_mode = alc883_3ST_2ch_modes,
9264 .input_mux = &alc883_lenovo_nb0763_capture_source,
9265 .unsol_event = alc_automute_amp_unsol_event,
9266 .setup = alc883_medion_md2_setup,
9267 .init_hook = alc_automute_amp,
9269 [ALC888_LENOVO_MS7195_DIG] = {
9270 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9271 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9272 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9273 .dac_nids = alc883_dac_nids,
9274 .dig_out_nid = ALC883_DIGOUT_NID,
9275 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9276 .channel_mode = alc883_3ST_6ch_modes,
9278 .input_mux = &alc883_capture_source,
9279 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9280 .init_hook = alc888_lenovo_ms7195_front_automute,
9282 [ALC883_HAIER_W66] = {
9283 .mixers = { alc883_targa_2ch_mixer},
9284 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9285 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9286 .dac_nids = alc883_dac_nids,
9287 .dig_out_nid = ALC883_DIGOUT_NID,
9288 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9289 .channel_mode = alc883_3ST_2ch_modes,
9290 .input_mux = &alc883_capture_source,
9291 .unsol_event = alc_automute_amp_unsol_event,
9292 .setup = alc883_haier_w66_setup,
9293 .init_hook = alc_automute_amp,
9296 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9297 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9298 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9299 .dac_nids = alc883_dac_nids,
9300 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9301 .channel_mode = alc888_3st_hp_modes,
9303 .input_mux = &alc883_capture_source,
9304 .unsol_event = alc_automute_amp_unsol_event,
9305 .setup = alc888_3st_hp_setup,
9306 .init_hook = alc_automute_amp,
9308 [ALC888_6ST_DELL] = {
9309 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9310 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9311 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9312 .dac_nids = alc883_dac_nids,
9313 .dig_out_nid = ALC883_DIGOUT_NID,
9314 .dig_in_nid = ALC883_DIGIN_NID,
9315 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9316 .channel_mode = alc883_sixstack_modes,
9317 .input_mux = &alc883_capture_source,
9318 .unsol_event = alc_automute_amp_unsol_event,
9319 .setup = alc888_6st_dell_setup,
9320 .init_hook = alc_automute_amp,
9323 .mixers = { alc883_mitac_mixer },
9324 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9325 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9326 .dac_nids = alc883_dac_nids,
9327 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9328 .channel_mode = alc883_3ST_2ch_modes,
9329 .input_mux = &alc883_capture_source,
9330 .unsol_event = alc_automute_amp_unsol_event,
9331 .setup = alc883_mitac_setup,
9332 .init_hook = alc_automute_amp,
9334 [ALC883_FUJITSU_PI2515] = {
9335 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9336 .init_verbs = { alc883_init_verbs,
9337 alc883_2ch_fujitsu_pi2515_verbs},
9338 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9339 .dac_nids = alc883_dac_nids,
9340 .dig_out_nid = ALC883_DIGOUT_NID,
9341 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9342 .channel_mode = alc883_3ST_2ch_modes,
9343 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9344 .unsol_event = alc_automute_amp_unsol_event,
9345 .setup = alc883_2ch_fujitsu_pi2515_setup,
9346 .init_hook = alc_automute_amp,
9348 [ALC888_FUJITSU_XA3530] = {
9349 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9350 .init_verbs = { alc883_init_verbs,
9351 alc888_fujitsu_xa3530_verbs },
9352 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9353 .dac_nids = alc883_dac_nids,
9354 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9355 .adc_nids = alc883_adc_nids_rev,
9356 .capsrc_nids = alc883_capsrc_nids_rev,
9357 .dig_out_nid = ALC883_DIGOUT_NID,
9358 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9359 .channel_mode = alc888_4ST_8ch_intel_modes,
9361 ARRAY_SIZE(alc888_2_capture_sources),
9362 .input_mux = alc888_2_capture_sources,
9363 .unsol_event = alc_automute_amp_unsol_event,
9364 .setup = alc888_fujitsu_xa3530_setup,
9365 .init_hook = alc_automute_amp,
9367 [ALC888_LENOVO_SKY] = {
9368 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9369 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9370 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9371 .dac_nids = alc883_dac_nids,
9372 .dig_out_nid = ALC883_DIGOUT_NID,
9373 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9374 .channel_mode = alc883_sixstack_modes,
9376 .input_mux = &alc883_lenovo_sky_capture_source,
9377 .unsol_event = alc_automute_amp_unsol_event,
9378 .setup = alc888_lenovo_sky_setup,
9379 .init_hook = alc_automute_amp,
9381 [ALC888_ASUS_M90V] = {
9382 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9383 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9384 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9385 .dac_nids = alc883_dac_nids,
9386 .dig_out_nid = ALC883_DIGOUT_NID,
9387 .dig_in_nid = ALC883_DIGIN_NID,
9388 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9389 .channel_mode = alc883_3ST_6ch_modes,
9391 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9392 .unsol_event = alc_sku_unsol_event,
9393 .setup = alc883_mode2_setup,
9394 .init_hook = alc_inithook,
9396 [ALC888_ASUS_EEE1601] = {
9397 .mixers = { alc883_asus_eee1601_mixer },
9398 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9399 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9400 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9401 .dac_nids = alc883_dac_nids,
9402 .dig_out_nid = ALC883_DIGOUT_NID,
9403 .dig_in_nid = ALC883_DIGIN_NID,
9404 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9405 .channel_mode = alc883_3ST_2ch_modes,
9407 .input_mux = &alc883_asus_eee1601_capture_source,
9408 .unsol_event = alc_sku_unsol_event,
9409 .init_hook = alc883_eee1601_inithook,
9411 [ALC1200_ASUS_P5Q] = {
9412 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9413 .init_verbs = { alc883_init_verbs },
9414 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9415 .dac_nids = alc883_dac_nids,
9416 .dig_out_nid = ALC1200_DIGOUT_NID,
9417 .dig_in_nid = ALC883_DIGIN_NID,
9418 .slave_dig_outs = alc1200_slave_dig_outs,
9419 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9420 .channel_mode = alc883_sixstack_modes,
9421 .input_mux = &alc883_capture_source,
9424 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9425 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9426 alc880_gpio1_init_verbs },
9427 .adc_nids = alc883_adc_nids,
9428 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9429 .dac_nids = alc883_dac_nids,
9430 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9431 .channel_mode = alc889A_mb31_6ch_modes,
9432 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9433 .input_mux = &alc889A_mb31_capture_source,
9434 .dig_out_nid = ALC883_DIGOUT_NID,
9435 .unsol_event = alc889A_mb31_unsol_event,
9436 .init_hook = alc889A_mb31_automute,
9438 [ALC883_SONY_VAIO_TT] = {
9439 .mixers = { alc883_vaiott_mixer },
9440 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9441 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9442 .dac_nids = alc883_dac_nids,
9443 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9444 .channel_mode = alc883_3ST_2ch_modes,
9445 .input_mux = &alc883_capture_source,
9446 .unsol_event = alc_automute_amp_unsol_event,
9447 .setup = alc883_vaiott_setup,
9448 .init_hook = alc_automute_amp,
9457 PINFIX_ABIT_AW9D_MAX
9460 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9461 { 0x15, 0x01080104 }, /* side */
9462 { 0x16, 0x01011012 }, /* rear */
9463 { 0x17, 0x01016011 }, /* clfe */
9467 static const struct alc_pincfg *alc882_pin_fixes[] = {
9468 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
9471 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
9472 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9477 * BIOS auto configuration
9479 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9480 const struct auto_pin_cfg *cfg)
9482 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9485 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9486 hda_nid_t nid, int pin_type,
9490 struct alc_spec *spec = codec->spec;
9493 alc_set_pin_output(codec, nid, pin_type);
9494 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9497 idx = spec->multiout.dac_nids[dac_idx] - 2;
9498 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9502 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9504 struct alc_spec *spec = codec->spec;
9507 for (i = 0; i <= HDA_SIDE; i++) {
9508 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9509 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9511 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9516 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9518 struct alc_spec *spec = codec->spec;
9521 pin = spec->autocfg.hp_pins[0];
9522 if (pin) /* connect to front */
9524 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9525 pin = spec->autocfg.speaker_pins[0];
9527 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9530 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9532 struct alc_spec *spec = codec->spec;
9535 for (i = 0; i < AUTO_PIN_LAST; i++) {
9536 hda_nid_t nid = spec->autocfg.input_pins[i];
9539 alc_set_input_pin(codec, nid, i);
9540 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9541 snd_hda_codec_write(codec, nid, 0,
9542 AC_VERB_SET_AMP_GAIN_MUTE,
9547 static void alc882_auto_init_input_src(struct hda_codec *codec)
9549 struct alc_spec *spec = codec->spec;
9552 for (c = 0; c < spec->num_adc_nids; c++) {
9553 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9554 hda_nid_t nid = spec->capsrc_nids[c];
9555 unsigned int mux_idx;
9556 const struct hda_input_mux *imux;
9557 int conns, mute, idx, item;
9559 conns = snd_hda_get_connections(codec, nid, conn_list,
9560 ARRAY_SIZE(conn_list));
9563 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9564 imux = &spec->input_mux[mux_idx];
9565 for (idx = 0; idx < conns; idx++) {
9566 /* if the current connection is the selected one,
9567 * unmute it as default - otherwise mute it
9569 mute = AMP_IN_MUTE(idx);
9570 for (item = 0; item < imux->num_items; item++) {
9571 if (imux->items[item].index == idx) {
9572 if (spec->cur_mux[c] == item)
9573 mute = AMP_IN_UNMUTE(idx);
9577 /* check if we have a selector or mixer
9578 * we could check for the widget type instead, but
9579 * just check for Amp-In presence (in case of mixer
9580 * without amp-in there is something wrong, this
9581 * function shouldn't be used or capsrc nid is wrong)
9583 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9584 snd_hda_codec_write(codec, nid, 0,
9585 AC_VERB_SET_AMP_GAIN_MUTE,
9587 else if (mute != AMP_IN_MUTE(idx))
9588 snd_hda_codec_write(codec, nid, 0,
9589 AC_VERB_SET_CONNECT_SEL,
9595 /* add mic boosts if needed */
9596 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9598 struct alc_spec *spec = codec->spec;
9602 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9603 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9604 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9606 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9610 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9611 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9612 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9614 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9621 /* almost identical with ALC880 parser... */
9622 static int alc882_parse_auto_config(struct hda_codec *codec)
9624 struct alc_spec *spec = codec->spec;
9625 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9628 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9632 if (!spec->autocfg.line_outs)
9633 return 0; /* can't find valid BIOS pin config */
9635 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9638 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9641 err = alc880_auto_create_extra_out(spec,
9642 spec->autocfg.speaker_pins[0],
9646 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9650 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9654 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9656 /* check multiple SPDIF-out (for recent codecs) */
9657 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9659 err = snd_hda_get_connections(codec,
9660 spec->autocfg.dig_out_pins[i],
9665 spec->multiout.dig_out_nid = dig_nid;
9667 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9668 spec->slave_dig_outs[i - 1] = dig_nid;
9669 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
9673 if (spec->autocfg.dig_in_pin)
9674 spec->dig_in_nid = ALC880_DIGIN_NID;
9676 if (spec->kctls.list)
9677 add_mixer(spec, spec->kctls.list);
9679 add_verb(spec, alc883_auto_init_verbs);
9680 /* if ADC 0x07 is available, initialize it, too */
9681 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9682 add_verb(spec, alc882_adc1_init_verbs);
9684 spec->num_mux_defs = 1;
9685 spec->input_mux = &spec->private_imux[0];
9687 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9689 err = alc_auto_add_mic_boost(codec);
9693 return 1; /* config found */
9696 /* additional initialization for auto-configuration model */
9697 static void alc882_auto_init(struct hda_codec *codec)
9699 struct alc_spec *spec = codec->spec;
9700 alc882_auto_init_multi_out(codec);
9701 alc882_auto_init_hp_out(codec);
9702 alc882_auto_init_analog_input(codec);
9703 alc882_auto_init_input_src(codec);
9704 if (spec->unsol_event)
9705 alc_inithook(codec);
9708 static int patch_alc882(struct hda_codec *codec)
9710 struct alc_spec *spec;
9711 int err, board_config;
9713 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9719 switch (codec->vendor_id) {
9724 /* ALC883 and variants */
9725 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9729 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9733 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9734 board_config = snd_hda_check_board_codec_sid_config(codec,
9735 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9737 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9738 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9740 board_config = ALC882_AUTO;
9743 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
9745 if (board_config == ALC882_AUTO) {
9746 /* automatic parse from the BIOS config */
9747 err = alc882_parse_auto_config(codec);
9753 "hda_codec: Cannot set up configuration "
9754 "from BIOS. Using base mode...\n");
9755 board_config = ALC882_3ST_DIG;
9759 err = snd_hda_attach_beep_device(codec, 0x1);
9765 if (board_config != ALC882_AUTO)
9766 setup_preset(codec, &alc882_presets[board_config]);
9768 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9769 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9770 /* FIXME: setup DAC5 */
9771 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9772 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9774 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9775 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9777 if (codec->vendor_id == 0x10ec0888)
9778 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9780 if (!spec->adc_nids && spec->input_mux) {
9782 spec->num_adc_nids = 0;
9783 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9785 hda_nid_t nid = alc882_adc_nids[i];
9786 unsigned int wcap = get_wcaps(codec, nid);
9788 wcap = get_wcaps_type(wcap);
9789 if (wcap != AC_WID_AUD_IN)
9791 spec->private_adc_nids[spec->num_adc_nids] = nid;
9792 err = snd_hda_get_connections(codec, nid, &cap, 1);
9795 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9796 spec->num_adc_nids++;
9798 spec->adc_nids = spec->private_adc_nids;
9799 spec->capsrc_nids = spec->private_capsrc_nids;
9802 set_capture_mixer(codec);
9803 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9805 spec->vmaster_nid = 0x0c;
9807 codec->patch_ops = alc_patch_ops;
9808 if (board_config == ALC882_AUTO)
9809 spec->init_hook = alc882_auto_init;
9810 #ifdef CONFIG_SND_HDA_POWER_SAVE
9811 if (!spec->loopback.amplist)
9812 spec->loopback.amplist = alc882_loopbacks;
9814 codec->proc_widget_hook = print_realtek_coef;
9824 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9825 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9827 #define alc262_dac_nids alc260_dac_nids
9828 #define alc262_adc_nids alc882_adc_nids
9829 #define alc262_adc_nids_alt alc882_adc_nids_alt
9830 #define alc262_capsrc_nids alc882_capsrc_nids
9831 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9833 #define alc262_modes alc260_modes
9834 #define alc262_capture_source alc882_capture_source
9836 static hda_nid_t alc262_dmic_adc_nids[1] = {
9841 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9843 static struct snd_kcontrol_new alc262_base_mixer[] = {
9844 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9845 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9846 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9847 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9848 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9849 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9850 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9851 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9852 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9853 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9854 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9855 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9856 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9857 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9858 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9859 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9863 /* update HP, line and mono-out pins according to the master switch */
9864 static void alc262_hp_master_update(struct hda_codec *codec)
9866 struct alc_spec *spec = codec->spec;
9867 int val = spec->master_sw;
9870 snd_hda_codec_write_cache(codec, 0x1b, 0,
9871 AC_VERB_SET_PIN_WIDGET_CONTROL,
9873 snd_hda_codec_write_cache(codec, 0x15, 0,
9874 AC_VERB_SET_PIN_WIDGET_CONTROL,
9876 /* mono (speaker) depending on the HP jack sense */
9877 val = val && !spec->jack_present;
9878 snd_hda_codec_write_cache(codec, 0x16, 0,
9879 AC_VERB_SET_PIN_WIDGET_CONTROL,
9883 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9885 struct alc_spec *spec = codec->spec;
9886 unsigned int presence;
9887 presence = snd_hda_codec_read(codec, 0x1b, 0,
9888 AC_VERB_GET_PIN_SENSE, 0);
9889 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9890 alc262_hp_master_update(codec);
9893 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9895 if ((res >> 26) != ALC880_HP_EVENT)
9897 alc262_hp_bpc_automute(codec);
9900 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9902 struct alc_spec *spec = codec->spec;
9903 unsigned int presence;
9904 presence = snd_hda_codec_read(codec, 0x15, 0,
9905 AC_VERB_GET_PIN_SENSE, 0);
9906 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9907 alc262_hp_master_update(codec);
9910 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9913 if ((res >> 26) != ALC880_HP_EVENT)
9915 alc262_hp_wildwest_automute(codec);
9918 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9920 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9921 struct snd_ctl_elem_value *ucontrol)
9923 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9924 struct alc_spec *spec = codec->spec;
9925 int val = !!*ucontrol->value.integer.value;
9927 if (val == spec->master_sw)
9929 spec->master_sw = val;
9930 alc262_hp_master_update(codec);
9934 #define ALC262_HP_MASTER_SWITCH \
9936 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9937 .name = "Master Playback Switch", \
9938 .info = snd_ctl_boolean_mono_info, \
9939 .get = alc262_hp_master_sw_get, \
9940 .put = alc262_hp_master_sw_put, \
9943 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9944 ALC262_HP_MASTER_SWITCH,
9945 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9946 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9947 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9948 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9950 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9952 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9953 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9954 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9955 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9956 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9957 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9958 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9959 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9960 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9961 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9962 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9963 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9967 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9968 ALC262_HP_MASTER_SWITCH,
9969 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9970 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9971 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9972 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9973 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9975 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9977 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9978 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9979 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9980 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9981 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9982 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9983 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9987 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9988 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9989 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9990 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9994 /* mute/unmute internal speaker according to the hp jack and mute state */
9995 static void alc262_hp_t5735_setup(struct hda_codec *codec)
9997 struct alc_spec *spec = codec->spec;
9999 spec->autocfg.hp_pins[0] = 0x15;
10000 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10003 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10004 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10005 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10006 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10007 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10008 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10009 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10010 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10014 static struct hda_verb alc262_hp_t5735_verbs[] = {
10015 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10016 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10018 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10022 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10023 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10024 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10025 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10026 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10027 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10028 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10032 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10033 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10034 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10035 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10036 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10037 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10038 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10039 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10040 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10041 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10042 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10046 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10053 /* bind hp and internal speaker mute (with plug check) as master switch */
10054 static void alc262_hippo_master_update(struct hda_codec *codec)
10056 struct alc_spec *spec = codec->spec;
10057 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10058 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10059 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10063 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10064 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10065 HDA_AMP_MUTE, mute);
10066 /* mute internal speaker per jack sense */
10067 if (spec->jack_present)
10068 mute = HDA_AMP_MUTE;
10070 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10071 HDA_AMP_MUTE, mute);
10072 if (speaker_nid && speaker_nid != line_nid)
10073 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10074 HDA_AMP_MUTE, mute);
10077 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10079 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10080 struct snd_ctl_elem_value *ucontrol)
10082 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10083 struct alc_spec *spec = codec->spec;
10084 int val = !!*ucontrol->value.integer.value;
10086 if (val == spec->master_sw)
10088 spec->master_sw = val;
10089 alc262_hippo_master_update(codec);
10093 #define ALC262_HIPPO_MASTER_SWITCH \
10095 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10096 .name = "Master Playback Switch", \
10097 .info = snd_ctl_boolean_mono_info, \
10098 .get = alc262_hippo_master_sw_get, \
10099 .put = alc262_hippo_master_sw_put, \
10102 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10103 ALC262_HIPPO_MASTER_SWITCH,
10104 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10105 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10106 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10107 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10108 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10109 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10110 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10111 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10112 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10113 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10114 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10115 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10119 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10120 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10121 ALC262_HIPPO_MASTER_SWITCH,
10122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10123 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10124 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10125 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10127 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10128 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10129 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10130 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10131 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10135 /* mute/unmute internal speaker according to the hp jack and mute state */
10136 static void alc262_hippo_automute(struct hda_codec *codec)
10138 struct alc_spec *spec = codec->spec;
10139 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10140 unsigned int present;
10142 /* need to execute and sync at first */
10143 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10144 present = snd_hda_codec_read(codec, hp_nid, 0,
10145 AC_VERB_GET_PIN_SENSE, 0);
10146 spec->jack_present = (present & 0x80000000) != 0;
10147 alc262_hippo_master_update(codec);
10150 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10152 if ((res >> 26) != ALC880_HP_EVENT)
10154 alc262_hippo_automute(codec);
10157 static void alc262_hippo_setup(struct hda_codec *codec)
10159 struct alc_spec *spec = codec->spec;
10161 spec->autocfg.hp_pins[0] = 0x15;
10162 spec->autocfg.speaker_pins[0] = 0x14;
10165 static void alc262_hippo1_setup(struct hda_codec *codec)
10167 struct alc_spec *spec = codec->spec;
10169 spec->autocfg.hp_pins[0] = 0x1b;
10170 spec->autocfg.speaker_pins[0] = 0x14;
10174 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10175 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10176 ALC262_HIPPO_MASTER_SWITCH,
10177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10179 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10180 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10184 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10185 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10186 ALC262_HIPPO_MASTER_SWITCH,
10187 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10188 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10189 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10190 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10191 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10195 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10196 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10197 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10198 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10199 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10200 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10201 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10203 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10204 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10205 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10206 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10207 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10211 static struct hda_verb alc262_tyan_verbs[] = {
10212 /* Headphone automute */
10213 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10214 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10215 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10217 /* P11 AUX_IN, white 4-pin connector */
10218 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10219 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10220 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10221 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10226 /* unsolicited event for HP jack sensing */
10227 static void alc262_tyan_setup(struct hda_codec *codec)
10229 struct alc_spec *spec = codec->spec;
10231 spec->autocfg.hp_pins[0] = 0x1b;
10232 spec->autocfg.speaker_pins[0] = 0x15;
10236 #define alc262_capture_mixer alc882_capture_mixer
10237 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10240 * generic initialization of ADC, input mixers and output mixers
10242 static struct hda_verb alc262_init_verbs[] = {
10244 * Unmute ADC0-2 and set the default input to mic-in
10246 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10247 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10248 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10249 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10250 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10251 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10253 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10255 * Note: PASD motherboards uses the Line In 2 as the input for
10256 * front panel mic (mic 2)
10258 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10259 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10260 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10261 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10262 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10263 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10266 * Set up output mixers (0x0c - 0x0e)
10268 /* set vol=0 to output mixers */
10269 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10270 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10271 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10272 /* set up input amps for analog loopback */
10273 /* Amp Indices: DAC = 0, mixer = 1 */
10274 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10275 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10276 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10277 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10278 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10279 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10281 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10283 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10284 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10285 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10286 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10288 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10289 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10290 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10291 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10292 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10294 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10295 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10297 /* FIXME: use matrix-type input source selection */
10298 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10299 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10302 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10303 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10318 static struct hda_verb alc262_eapd_verbs[] = {
10319 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10320 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10324 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10325 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10326 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10327 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10329 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10330 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10334 static struct hda_verb alc262_sony_unsol_verbs[] = {
10335 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10336 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10337 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10339 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10340 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10344 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10345 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10346 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10348 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10349 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10353 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10354 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10355 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10356 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10357 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10358 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10359 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10360 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10361 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10365 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10367 struct alc_spec *spec = codec->spec;
10369 spec->autocfg.hp_pins[0] = 0x15;
10370 spec->autocfg.speaker_pins[0] = 0x14;
10371 spec->ext_mic.pin = 0x18;
10372 spec->ext_mic.mux_idx = 0;
10373 spec->int_mic.pin = 0x12;
10374 spec->int_mic.mux_idx = 9;
10375 spec->auto_mic = 1;
10381 * 0x16 = internal speaker
10382 * 0x18 = external mic
10385 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10386 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10387 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10391 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10393 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10394 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10398 static struct hda_verb alc262_nec_verbs[] = {
10399 /* Unmute Speaker */
10400 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10403 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10404 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10406 /* External mic to headphone */
10407 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10408 /* External mic to speaker */
10409 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10415 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10416 * 0x1b = port replicator headphone out
10419 #define ALC_HP_EVENT 0x37
10421 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10422 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10423 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10424 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10425 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10429 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10430 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10431 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10435 static struct hda_input_mux alc262_fujitsu_capture_source = {
10439 { "Int Mic", 0x1 },
10444 static struct hda_input_mux alc262_HP_capture_source = {
10448 { "Front Mic", 0x1 },
10455 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10459 { "Front Mic", 0x2 },
10465 /* mute/unmute internal speaker according to the hp jacks and mute state */
10466 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10468 struct alc_spec *spec = codec->spec;
10471 if (force || !spec->sense_updated) {
10472 unsigned int present;
10473 /* need to execute and sync at first */
10474 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10475 /* check laptop HP jack */
10476 present = snd_hda_codec_read(codec, 0x14, 0,
10477 AC_VERB_GET_PIN_SENSE, 0);
10478 /* need to execute and sync at first */
10479 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10480 /* check docking HP jack */
10481 present |= snd_hda_codec_read(codec, 0x1b, 0,
10482 AC_VERB_GET_PIN_SENSE, 0);
10483 if (present & AC_PINSENSE_PRESENCE)
10484 spec->jack_present = 1;
10486 spec->jack_present = 0;
10487 spec->sense_updated = 1;
10489 /* unmute internal speaker only if both HPs are unplugged and
10490 * master switch is on
10492 if (spec->jack_present)
10493 mute = HDA_AMP_MUTE;
10495 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10496 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10497 HDA_AMP_MUTE, mute);
10500 /* unsolicited event for HP jack sensing */
10501 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10504 if ((res >> 26) != ALC_HP_EVENT)
10506 alc262_fujitsu_automute(codec, 1);
10509 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10511 alc262_fujitsu_automute(codec, 1);
10514 /* bind volumes of both NID 0x0c and 0x0d */
10515 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10516 .ops = &snd_hda_bind_vol,
10518 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10519 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10524 /* mute/unmute internal speaker according to the hp jack and mute state */
10525 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10527 struct alc_spec *spec = codec->spec;
10530 if (force || !spec->sense_updated) {
10531 unsigned int present_int_hp;
10532 /* need to execute and sync at first */
10533 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10534 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10535 AC_VERB_GET_PIN_SENSE, 0);
10536 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10537 spec->sense_updated = 1;
10539 if (spec->jack_present) {
10540 /* mute internal speaker */
10541 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10542 HDA_AMP_MUTE, HDA_AMP_MUTE);
10543 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10544 HDA_AMP_MUTE, HDA_AMP_MUTE);
10546 /* unmute internal speaker if necessary */
10547 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10548 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10549 HDA_AMP_MUTE, mute);
10550 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10551 HDA_AMP_MUTE, mute);
10555 /* unsolicited event for HP jack sensing */
10556 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10559 if ((res >> 26) != ALC_HP_EVENT)
10561 alc262_lenovo_3000_automute(codec, 1);
10564 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10565 int dir, int idx, long *valp)
10569 for (i = 0; i < 2; i++, valp++)
10570 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10572 *valp ? 0 : HDA_AMP_MUTE);
10576 /* bind hp and internal speaker mute (with plug check) */
10577 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10578 struct snd_ctl_elem_value *ucontrol)
10580 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10581 long *valp = ucontrol->value.integer.value;
10584 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10585 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10587 alc262_fujitsu_automute(codec, 0);
10591 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10592 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10594 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10595 .name = "Master Playback Switch",
10596 .info = snd_hda_mixer_amp_switch_info,
10597 .get = snd_hda_mixer_amp_switch_get,
10598 .put = alc262_fujitsu_master_sw_put,
10599 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10601 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10602 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10603 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10604 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10605 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10606 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10607 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10608 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10612 /* bind hp and internal speaker mute (with plug check) */
10613 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10614 struct snd_ctl_elem_value *ucontrol)
10616 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10617 long *valp = ucontrol->value.integer.value;
10620 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10622 alc262_lenovo_3000_automute(codec, 0);
10626 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10627 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10629 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10630 .name = "Master Playback Switch",
10631 .info = snd_hda_mixer_amp_switch_info,
10632 .get = snd_hda_mixer_amp_switch_get,
10633 .put = alc262_lenovo_3000_master_sw_put,
10634 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10636 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10637 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10638 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10639 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10640 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10641 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10642 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10643 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10647 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10648 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10649 ALC262_HIPPO_MASTER_SWITCH,
10650 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10651 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10652 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10653 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10654 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10655 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10659 /* additional init verbs for Benq laptops */
10660 static struct hda_verb alc262_EAPD_verbs[] = {
10661 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10662 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10666 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10667 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10668 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10670 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10671 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10675 /* Samsung Q1 Ultra Vista model setup */
10676 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10677 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10678 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10681 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10682 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10686 static struct hda_verb alc262_ultra_verbs[] = {
10688 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10689 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10690 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10692 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10693 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10694 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10695 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10697 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10698 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10699 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10700 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10701 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10703 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10704 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10705 /* ADC, choose mic */
10706 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10707 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10708 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10709 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10710 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10711 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10712 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10713 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10714 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10715 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10719 /* mute/unmute internal speaker according to the hp jack and mute state */
10720 static void alc262_ultra_automute(struct hda_codec *codec)
10722 struct alc_spec *spec = codec->spec;
10726 /* auto-mute only when HP is used as HP */
10727 if (!spec->cur_mux[0]) {
10728 unsigned int present;
10729 /* need to execute and sync at first */
10730 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10731 present = snd_hda_codec_read(codec, 0x15, 0,
10732 AC_VERB_GET_PIN_SENSE, 0);
10733 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10734 if (spec->jack_present)
10735 mute = HDA_AMP_MUTE;
10737 /* mute/unmute internal speaker */
10738 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10739 HDA_AMP_MUTE, mute);
10740 /* mute/unmute HP */
10741 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10742 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10745 /* unsolicited event for HP jack sensing */
10746 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10749 if ((res >> 26) != ALC880_HP_EVENT)
10751 alc262_ultra_automute(codec);
10754 static struct hda_input_mux alc262_ultra_capture_source = {
10758 { "Headphone", 0x7 },
10762 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10763 struct snd_ctl_elem_value *ucontrol)
10765 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10766 struct alc_spec *spec = codec->spec;
10769 ret = alc_mux_enum_put(kcontrol, ucontrol);
10772 /* reprogram the HP pin as mic or HP according to the input source */
10773 snd_hda_codec_write_cache(codec, 0x15, 0,
10774 AC_VERB_SET_PIN_WIDGET_CONTROL,
10775 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10776 alc262_ultra_automute(codec); /* mute/unmute HP */
10780 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10781 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10782 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10784 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10785 .name = "Capture Source",
10786 .info = alc_mux_enum_info,
10787 .get = alc_mux_enum_get,
10788 .put = alc262_ultra_mux_enum_put,
10793 /* We use two mixers depending on the output pin; 0x16 is a mono output
10794 * and thus it's bound with a different mixer.
10795 * This function returns which mixer amp should be used.
10797 static int alc262_check_volbit(hda_nid_t nid)
10801 else if (nid == 0x16)
10807 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
10808 const char *pfx, int *vbits)
10814 vbit = alc262_check_volbit(nid);
10817 if (*vbits & vbit) /* a volume control for this mixer already there */
10820 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
10822 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
10824 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
10825 return add_control(spec, ALC_CTL_WIDGET_VOL, name, val);
10828 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
10836 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
10838 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
10840 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
10841 return add_control(spec, ALC_CTL_WIDGET_MUTE, name, val);
10844 /* add playback controls from the parsed DAC table */
10845 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10846 const struct auto_pin_cfg *cfg)
10852 spec->multiout.num_dacs = 1; /* only use one dac */
10853 spec->multiout.dac_nids = spec->private_dac_nids;
10854 spec->multiout.dac_nids[0] = 2;
10856 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
10858 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
10862 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
10865 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
10868 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
10872 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
10873 alc262_check_volbit(cfg->speaker_pins[0]) |
10874 alc262_check_volbit(cfg->hp_pins[0]);
10875 if (vbits == 1 || vbits == 2)
10876 pfx = "Master"; /* only one mixer is used */
10877 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
10882 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
10885 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
10889 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
10896 #define alc262_auto_create_input_ctls \
10897 alc880_auto_create_input_ctls
10900 * generic initialization of ADC, input mixers and output mixers
10902 static struct hda_verb alc262_volume_init_verbs[] = {
10904 * Unmute ADC0-2 and set the default input to mic-in
10906 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10907 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10908 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10909 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10910 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10911 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10913 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10915 * Note: PASD motherboards uses the Line In 2 as the input for
10916 * front panel mic (mic 2)
10918 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10919 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10920 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10921 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10922 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10923 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10926 * Set up output mixers (0x0c - 0x0f)
10928 /* set vol=0 to output mixers */
10929 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10930 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10931 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10933 /* set up input amps for analog loopback */
10934 /* Amp Indices: DAC = 0, mixer = 1 */
10935 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10936 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10937 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10938 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10939 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10940 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10942 /* FIXME: use matrix-type input source selection */
10943 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10944 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10945 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10946 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10947 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10948 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10950 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10951 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10952 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10953 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10955 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10956 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10957 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10958 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10963 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10965 * Unmute ADC0-2 and set the default input to mic-in
10967 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10968 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10969 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10970 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10971 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10972 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10974 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10976 * Note: PASD motherboards uses the Line In 2 as the input for
10977 * front panel mic (mic 2)
10979 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10980 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10981 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10982 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10983 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10984 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10985 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10986 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10989 * Set up output mixers (0x0c - 0x0e)
10991 /* set vol=0 to output mixers */
10992 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10993 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10994 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10996 /* set up input amps for analog loopback */
10997 /* Amp Indices: DAC = 0, mixer = 1 */
10998 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10999 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11000 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11001 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11002 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11003 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11005 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11006 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11007 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11009 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11010 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11012 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11013 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11015 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11016 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11017 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11018 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11019 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11021 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11022 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11023 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11024 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11025 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11026 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11029 /* FIXME: use matrix-type input source selection */
11030 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11031 /* Input mixer1: only unmute Mic */
11032 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11033 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11034 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11035 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11036 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11037 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11038 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11039 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11040 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11042 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11043 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11044 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11045 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11046 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11047 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11048 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11049 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11050 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11053 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11054 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11055 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11056 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11057 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11058 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11059 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11060 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11062 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11067 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11069 * Unmute ADC0-2 and set the default input to mic-in
11071 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11072 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11073 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11074 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11075 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11076 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11078 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11080 * Note: PASD motherboards uses the Line In 2 as the input for front
11081 * panel mic (mic 2)
11083 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11088 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11089 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11090 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11091 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11093 * Set up output mixers (0x0c - 0x0e)
11095 /* set vol=0 to output mixers */
11096 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11097 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11098 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11100 /* set up input amps for analog loopback */
11101 /* Amp Indices: DAC = 0, mixer = 1 */
11102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11103 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11104 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11105 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11106 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11107 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11110 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11111 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11112 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11113 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11114 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11115 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11116 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11118 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11119 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11121 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11122 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11124 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11125 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11126 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11127 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11128 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11129 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11131 /* FIXME: use matrix-type input source selection */
11132 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11133 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11134 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11135 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11136 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11137 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11138 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11139 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11140 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11142 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11143 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11144 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11145 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11146 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11147 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11148 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11150 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11151 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11152 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11153 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11154 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11155 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11156 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11158 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11163 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11165 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11166 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11167 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11169 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11170 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11171 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11172 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11174 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11175 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11176 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11181 #ifdef CONFIG_SND_HDA_POWER_SAVE
11182 #define alc262_loopbacks alc880_loopbacks
11185 /* pcm configuration: identical with ALC880 */
11186 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11187 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11188 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11189 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11192 * BIOS auto configuration
11194 static int alc262_parse_auto_config(struct hda_codec *codec)
11196 struct alc_spec *spec = codec->spec;
11198 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11200 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11204 if (!spec->autocfg.line_outs) {
11205 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11206 spec->multiout.max_channels = 2;
11207 spec->no_analog = 1;
11210 return 0; /* can't find valid BIOS pin config */
11212 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11215 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11219 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11222 if (spec->autocfg.dig_outs) {
11223 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11224 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11226 if (spec->autocfg.dig_in_pin)
11227 spec->dig_in_nid = ALC262_DIGIN_NID;
11229 if (spec->kctls.list)
11230 add_mixer(spec, spec->kctls.list);
11232 add_verb(spec, alc262_volume_init_verbs);
11233 spec->num_mux_defs = 1;
11234 spec->input_mux = &spec->private_imux[0];
11236 err = alc_auto_add_mic_boost(codec);
11240 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11245 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11246 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11247 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11248 #define alc262_auto_init_input_src alc882_auto_init_input_src
11251 /* init callback for auto-configuration model -- overriding the default init */
11252 static void alc262_auto_init(struct hda_codec *codec)
11254 struct alc_spec *spec = codec->spec;
11255 alc262_auto_init_multi_out(codec);
11256 alc262_auto_init_hp_out(codec);
11257 alc262_auto_init_analog_input(codec);
11258 alc262_auto_init_input_src(codec);
11259 if (spec->unsol_event)
11260 alc_inithook(codec);
11264 * configuration and preset
11266 static const char *alc262_models[ALC262_MODEL_LAST] = {
11267 [ALC262_BASIC] = "basic",
11268 [ALC262_HIPPO] = "hippo",
11269 [ALC262_HIPPO_1] = "hippo_1",
11270 [ALC262_FUJITSU] = "fujitsu",
11271 [ALC262_HP_BPC] = "hp-bpc",
11272 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11273 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11274 [ALC262_HP_RP5700] = "hp-rp5700",
11275 [ALC262_BENQ_ED8] = "benq",
11276 [ALC262_BENQ_T31] = "benq-t31",
11277 [ALC262_SONY_ASSAMD] = "sony-assamd",
11278 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11279 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11280 [ALC262_ULTRA] = "ultra",
11281 [ALC262_LENOVO_3000] = "lenovo-3000",
11282 [ALC262_NEC] = "nec",
11283 [ALC262_TYAN] = "tyan",
11284 [ALC262_AUTO] = "auto",
11287 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11288 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11289 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11290 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11292 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11294 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11296 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11297 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11298 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11299 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11300 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11301 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11302 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11303 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11304 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11305 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11306 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11307 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11308 ALC262_HP_TC_T5735),
11309 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11310 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11311 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11312 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11313 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11314 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11315 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11316 ALC262_SONY_ASSAMD),
11317 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11318 ALC262_TOSHIBA_RX1),
11319 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11320 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11321 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11322 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11323 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11325 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11326 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11327 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11328 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11329 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11333 static struct alc_config_preset alc262_presets[] = {
11335 .mixers = { alc262_base_mixer },
11336 .init_verbs = { alc262_init_verbs },
11337 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11338 .dac_nids = alc262_dac_nids,
11340 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11341 .channel_mode = alc262_modes,
11342 .input_mux = &alc262_capture_source,
11345 .mixers = { alc262_hippo_mixer },
11346 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11347 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11348 .dac_nids = alc262_dac_nids,
11350 .dig_out_nid = ALC262_DIGOUT_NID,
11351 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11352 .channel_mode = alc262_modes,
11353 .input_mux = &alc262_capture_source,
11354 .unsol_event = alc262_hippo_unsol_event,
11355 .setup = alc262_hippo_setup,
11356 .init_hook = alc262_hippo_automute,
11358 [ALC262_HIPPO_1] = {
11359 .mixers = { alc262_hippo1_mixer },
11360 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11361 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11362 .dac_nids = alc262_dac_nids,
11364 .dig_out_nid = ALC262_DIGOUT_NID,
11365 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11366 .channel_mode = alc262_modes,
11367 .input_mux = &alc262_capture_source,
11368 .unsol_event = alc262_hippo_unsol_event,
11369 .setup = alc262_hippo1_setup,
11370 .init_hook = alc262_hippo_automute,
11372 [ALC262_FUJITSU] = {
11373 .mixers = { alc262_fujitsu_mixer },
11374 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11375 alc262_fujitsu_unsol_verbs },
11376 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11377 .dac_nids = alc262_dac_nids,
11379 .dig_out_nid = ALC262_DIGOUT_NID,
11380 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11381 .channel_mode = alc262_modes,
11382 .input_mux = &alc262_fujitsu_capture_source,
11383 .unsol_event = alc262_fujitsu_unsol_event,
11384 .init_hook = alc262_fujitsu_init_hook,
11386 [ALC262_HP_BPC] = {
11387 .mixers = { alc262_HP_BPC_mixer },
11388 .init_verbs = { alc262_HP_BPC_init_verbs },
11389 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11390 .dac_nids = alc262_dac_nids,
11392 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11393 .channel_mode = alc262_modes,
11394 .input_mux = &alc262_HP_capture_source,
11395 .unsol_event = alc262_hp_bpc_unsol_event,
11396 .init_hook = alc262_hp_bpc_automute,
11398 [ALC262_HP_BPC_D7000_WF] = {
11399 .mixers = { alc262_HP_BPC_WildWest_mixer },
11400 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11401 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11402 .dac_nids = alc262_dac_nids,
11404 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11405 .channel_mode = alc262_modes,
11406 .input_mux = &alc262_HP_D7000_capture_source,
11407 .unsol_event = alc262_hp_wildwest_unsol_event,
11408 .init_hook = alc262_hp_wildwest_automute,
11410 [ALC262_HP_BPC_D7000_WL] = {
11411 .mixers = { alc262_HP_BPC_WildWest_mixer,
11412 alc262_HP_BPC_WildWest_option_mixer },
11413 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11414 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11415 .dac_nids = alc262_dac_nids,
11417 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11418 .channel_mode = alc262_modes,
11419 .input_mux = &alc262_HP_D7000_capture_source,
11420 .unsol_event = alc262_hp_wildwest_unsol_event,
11421 .init_hook = alc262_hp_wildwest_automute,
11423 [ALC262_HP_TC_T5735] = {
11424 .mixers = { alc262_hp_t5735_mixer },
11425 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11426 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11427 .dac_nids = alc262_dac_nids,
11429 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11430 .channel_mode = alc262_modes,
11431 .input_mux = &alc262_capture_source,
11432 .unsol_event = alc_automute_amp_unsol_event,
11433 .setup = alc262_hp_t5735_setup,
11434 .init_hook = alc_automute_amp,
11436 [ALC262_HP_RP5700] = {
11437 .mixers = { alc262_hp_rp5700_mixer },
11438 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11439 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11440 .dac_nids = alc262_dac_nids,
11441 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11442 .channel_mode = alc262_modes,
11443 .input_mux = &alc262_hp_rp5700_capture_source,
11445 [ALC262_BENQ_ED8] = {
11446 .mixers = { alc262_base_mixer },
11447 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11448 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11449 .dac_nids = alc262_dac_nids,
11451 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11452 .channel_mode = alc262_modes,
11453 .input_mux = &alc262_capture_source,
11455 [ALC262_SONY_ASSAMD] = {
11456 .mixers = { alc262_sony_mixer },
11457 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11458 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11459 .dac_nids = alc262_dac_nids,
11461 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11462 .channel_mode = alc262_modes,
11463 .input_mux = &alc262_capture_source,
11464 .unsol_event = alc262_hippo_unsol_event,
11465 .setup = alc262_hippo_setup,
11466 .init_hook = alc262_hippo_automute,
11468 [ALC262_BENQ_T31] = {
11469 .mixers = { alc262_benq_t31_mixer },
11470 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11471 alc_hp15_unsol_verbs },
11472 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11473 .dac_nids = alc262_dac_nids,
11475 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11476 .channel_mode = alc262_modes,
11477 .input_mux = &alc262_capture_source,
11478 .unsol_event = alc262_hippo_unsol_event,
11479 .setup = alc262_hippo_setup,
11480 .init_hook = alc262_hippo_automute,
11483 .mixers = { alc262_ultra_mixer },
11484 .cap_mixer = alc262_ultra_capture_mixer,
11485 .init_verbs = { alc262_ultra_verbs },
11486 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11487 .dac_nids = alc262_dac_nids,
11488 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11489 .channel_mode = alc262_modes,
11490 .input_mux = &alc262_ultra_capture_source,
11491 .adc_nids = alc262_adc_nids, /* ADC0 */
11492 .capsrc_nids = alc262_capsrc_nids,
11493 .num_adc_nids = 1, /* single ADC */
11494 .unsol_event = alc262_ultra_unsol_event,
11495 .init_hook = alc262_ultra_automute,
11497 [ALC262_LENOVO_3000] = {
11498 .mixers = { alc262_lenovo_3000_mixer },
11499 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11500 alc262_lenovo_3000_unsol_verbs },
11501 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11502 .dac_nids = alc262_dac_nids,
11504 .dig_out_nid = ALC262_DIGOUT_NID,
11505 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11506 .channel_mode = alc262_modes,
11507 .input_mux = &alc262_fujitsu_capture_source,
11508 .unsol_event = alc262_lenovo_3000_unsol_event,
11511 .mixers = { alc262_nec_mixer },
11512 .init_verbs = { alc262_nec_verbs },
11513 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11514 .dac_nids = alc262_dac_nids,
11516 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11517 .channel_mode = alc262_modes,
11518 .input_mux = &alc262_capture_source,
11520 [ALC262_TOSHIBA_S06] = {
11521 .mixers = { alc262_toshiba_s06_mixer },
11522 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11523 alc262_eapd_verbs },
11524 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11525 .capsrc_nids = alc262_dmic_capsrc_nids,
11526 .dac_nids = alc262_dac_nids,
11527 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11528 .num_adc_nids = 1, /* single ADC */
11529 .dig_out_nid = ALC262_DIGOUT_NID,
11530 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11531 .channel_mode = alc262_modes,
11532 .unsol_event = alc_sku_unsol_event,
11533 .setup = alc262_toshiba_s06_setup,
11534 .init_hook = alc_inithook,
11536 [ALC262_TOSHIBA_RX1] = {
11537 .mixers = { alc262_toshiba_rx1_mixer },
11538 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11539 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11540 .dac_nids = alc262_dac_nids,
11542 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11543 .channel_mode = alc262_modes,
11544 .input_mux = &alc262_capture_source,
11545 .unsol_event = alc262_hippo_unsol_event,
11546 .setup = alc262_hippo_setup,
11547 .init_hook = alc262_hippo_automute,
11550 .mixers = { alc262_tyan_mixer },
11551 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11552 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11553 .dac_nids = alc262_dac_nids,
11555 .dig_out_nid = ALC262_DIGOUT_NID,
11556 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11557 .channel_mode = alc262_modes,
11558 .input_mux = &alc262_capture_source,
11559 .unsol_event = alc_automute_amp_unsol_event,
11560 .setup = alc262_tyan_setup,
11561 .init_hook = alc_automute_amp,
11565 static int patch_alc262(struct hda_codec *codec)
11567 struct alc_spec *spec;
11571 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11575 codec->spec = spec;
11577 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11582 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11583 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11584 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11585 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11589 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11591 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11595 if (board_config < 0) {
11596 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11598 board_config = ALC262_AUTO;
11601 if (board_config == ALC262_AUTO) {
11602 /* automatic parse from the BIOS config */
11603 err = alc262_parse_auto_config(codec);
11609 "hda_codec: Cannot set up configuration "
11610 "from BIOS. Using base mode...\n");
11611 board_config = ALC262_BASIC;
11615 if (!spec->no_analog) {
11616 err = snd_hda_attach_beep_device(codec, 0x1);
11623 if (board_config != ALC262_AUTO)
11624 setup_preset(codec, &alc262_presets[board_config]);
11626 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11627 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11629 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11630 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11632 if (!spec->adc_nids && spec->input_mux) {
11634 /* check whether the digital-mic has to be supported */
11635 for (i = 0; i < spec->input_mux->num_items; i++) {
11636 if (spec->input_mux->items[i].index >= 9)
11639 if (i < spec->input_mux->num_items) {
11640 /* use only ADC0 */
11641 spec->adc_nids = alc262_dmic_adc_nids;
11642 spec->num_adc_nids = 1;
11643 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11645 /* all analog inputs */
11646 /* check whether NID 0x07 is valid */
11647 unsigned int wcap = get_wcaps(codec, 0x07);
11650 wcap = get_wcaps_type(wcap);
11651 if (wcap != AC_WID_AUD_IN) {
11652 spec->adc_nids = alc262_adc_nids_alt;
11653 spec->num_adc_nids =
11654 ARRAY_SIZE(alc262_adc_nids_alt);
11655 spec->capsrc_nids = alc262_capsrc_nids_alt;
11657 spec->adc_nids = alc262_adc_nids;
11658 spec->num_adc_nids =
11659 ARRAY_SIZE(alc262_adc_nids);
11660 spec->capsrc_nids = alc262_capsrc_nids;
11664 if (!spec->cap_mixer && !spec->no_analog)
11665 set_capture_mixer(codec);
11666 if (!spec->no_analog)
11667 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11669 spec->vmaster_nid = 0x0c;
11671 codec->patch_ops = alc_patch_ops;
11672 if (board_config == ALC262_AUTO)
11673 spec->init_hook = alc262_auto_init;
11674 #ifdef CONFIG_SND_HDA_POWER_SAVE
11675 if (!spec->loopback.amplist)
11676 spec->loopback.amplist = alc262_loopbacks;
11678 codec->proc_widget_hook = print_realtek_coef;
11684 * ALC268 channel source setting (2 channel)
11686 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11687 #define alc268_modes alc260_modes
11689 static hda_nid_t alc268_dac_nids[2] = {
11694 static hda_nid_t alc268_adc_nids[2] = {
11699 static hda_nid_t alc268_adc_nids_alt[1] = {
11704 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11706 static struct snd_kcontrol_new alc268_base_mixer[] = {
11707 /* output mixer control */
11708 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11709 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11710 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11711 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11712 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11713 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11714 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11718 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11719 /* output mixer control */
11720 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11721 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11722 ALC262_HIPPO_MASTER_SWITCH,
11723 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11724 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11725 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11729 /* bind Beep switches of both NID 0x0f and 0x10 */
11730 static struct hda_bind_ctls alc268_bind_beep_sw = {
11731 .ops = &snd_hda_bind_sw,
11733 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11734 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11739 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11740 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11741 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11745 static struct hda_verb alc268_eapd_verbs[] = {
11746 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11747 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11751 /* Toshiba specific */
11752 static struct hda_verb alc268_toshiba_verbs[] = {
11753 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11757 /* Acer specific */
11758 /* bind volumes of both NID 0x02 and 0x03 */
11759 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11760 .ops = &snd_hda_bind_vol,
11762 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11763 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11768 /* mute/unmute internal speaker according to the hp jack and mute state */
11769 static void alc268_acer_automute(struct hda_codec *codec, int force)
11771 struct alc_spec *spec = codec->spec;
11774 if (force || !spec->sense_updated) {
11775 unsigned int present;
11776 present = snd_hda_codec_read(codec, 0x14, 0,
11777 AC_VERB_GET_PIN_SENSE, 0);
11778 spec->jack_present = (present & 0x80000000) != 0;
11779 spec->sense_updated = 1;
11781 if (spec->jack_present)
11782 mute = HDA_AMP_MUTE; /* mute internal speaker */
11783 else /* unmute internal speaker if necessary */
11784 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11785 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11786 HDA_AMP_MUTE, mute);
11790 /* bind hp and internal speaker mute (with plug check) */
11791 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11792 struct snd_ctl_elem_value *ucontrol)
11794 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11795 long *valp = ucontrol->value.integer.value;
11798 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11800 alc268_acer_automute(codec, 0);
11804 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11805 /* output mixer control */
11806 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11808 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11809 .name = "Master Playback Switch",
11810 .info = snd_hda_mixer_amp_switch_info,
11811 .get = snd_hda_mixer_amp_switch_get,
11812 .put = alc268_acer_master_sw_put,
11813 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11815 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11819 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11820 /* output mixer control */
11821 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11823 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11824 .name = "Master Playback Switch",
11825 .info = snd_hda_mixer_amp_switch_info,
11826 .get = snd_hda_mixer_amp_switch_get,
11827 .put = alc268_acer_master_sw_put,
11828 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11830 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11831 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11832 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11836 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11837 /* output mixer control */
11838 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11840 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11841 .name = "Master Playback Switch",
11842 .info = snd_hda_mixer_amp_switch_info,
11843 .get = snd_hda_mixer_amp_switch_get,
11844 .put = alc268_acer_master_sw_put,
11845 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11847 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11848 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11852 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11853 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11854 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11855 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11856 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11857 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11858 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11862 static struct hda_verb alc268_acer_verbs[] = {
11863 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11864 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11865 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11866 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11867 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11868 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11869 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11873 /* unsolicited event for HP jack sensing */
11874 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11875 #define alc268_toshiba_setup alc262_hippo_setup
11876 #define alc268_toshiba_automute alc262_hippo_automute
11878 static void alc268_acer_unsol_event(struct hda_codec *codec,
11881 if ((res >> 26) != ALC880_HP_EVENT)
11883 alc268_acer_automute(codec, 1);
11886 static void alc268_acer_init_hook(struct hda_codec *codec)
11888 alc268_acer_automute(codec, 1);
11891 /* toggle speaker-output according to the hp-jack state */
11892 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11894 unsigned int present;
11895 unsigned char bits;
11897 present = snd_hda_codec_read(codec, 0x15, 0,
11898 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11899 bits = present ? AMP_IN_MUTE(0) : 0;
11900 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11901 AMP_IN_MUTE(0), bits);
11902 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11903 AMP_IN_MUTE(0), bits);
11906 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11909 switch (res >> 26) {
11910 case ALC880_HP_EVENT:
11911 alc268_aspire_one_speaker_automute(codec);
11913 case ALC880_MIC_EVENT:
11914 alc_mic_automute(codec);
11919 static void alc268_acer_lc_setup(struct hda_codec *codec)
11921 struct alc_spec *spec = codec->spec;
11922 spec->ext_mic.pin = 0x18;
11923 spec->ext_mic.mux_idx = 0;
11924 spec->int_mic.pin = 0x12;
11925 spec->int_mic.mux_idx = 6;
11926 spec->auto_mic = 1;
11929 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11931 alc268_aspire_one_speaker_automute(codec);
11932 alc_mic_automute(codec);
11935 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11936 /* output mixer control */
11937 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11938 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11939 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11940 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11941 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11942 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11946 static struct hda_verb alc268_dell_verbs[] = {
11947 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11948 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11949 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11950 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11954 /* mute/unmute internal speaker according to the hp jack and mute state */
11955 static void alc268_dell_setup(struct hda_codec *codec)
11957 struct alc_spec *spec = codec->spec;
11959 spec->autocfg.hp_pins[0] = 0x15;
11960 spec->autocfg.speaker_pins[0] = 0x14;
11961 spec->ext_mic.pin = 0x18;
11962 spec->ext_mic.mux_idx = 0;
11963 spec->int_mic.pin = 0x19;
11964 spec->int_mic.mux_idx = 1;
11965 spec->auto_mic = 1;
11968 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11969 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11970 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11971 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11972 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11973 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11974 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11975 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11976 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11980 static struct hda_verb alc267_quanta_il1_verbs[] = {
11981 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11982 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11986 static void alc267_quanta_il1_setup(struct hda_codec *codec)
11988 struct alc_spec *spec = codec->spec;
11989 spec->autocfg.hp_pins[0] = 0x15;
11990 spec->autocfg.speaker_pins[0] = 0x14;
11991 spec->ext_mic.pin = 0x18;
11992 spec->ext_mic.mux_idx = 0;
11993 spec->int_mic.pin = 0x19;
11994 spec->int_mic.mux_idx = 1;
11995 spec->auto_mic = 1;
11999 * generic initialization of ADC, input mixers and output mixers
12001 static struct hda_verb alc268_base_init_verbs[] = {
12002 /* Unmute DAC0-1 and set vol = 0 */
12003 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12004 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12007 * Set up output mixers (0x0c - 0x0e)
12009 /* set vol=0 to output mixers */
12010 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12011 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12013 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12014 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12016 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12017 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12018 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12019 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12020 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12021 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12022 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12023 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12025 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12026 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12027 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12028 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12029 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12031 /* set PCBEEP vol = 0, mute connections */
12032 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12033 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12034 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12036 /* Unmute Selector 23h,24h and set the default input to mic-in */
12038 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12039 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12040 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12041 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12047 * generic initialization of ADC, input mixers and output mixers
12049 static struct hda_verb alc268_volume_init_verbs[] = {
12050 /* set output DAC */
12051 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12052 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12054 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12055 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12056 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12057 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12058 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12060 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12061 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12062 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12064 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12065 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12067 /* set PCBEEP vol = 0, mute connections */
12068 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12069 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12070 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12075 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12076 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12077 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12081 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12082 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12083 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12088 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12089 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12090 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12091 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12092 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12097 static struct hda_input_mux alc268_capture_source = {
12101 { "Front Mic", 0x1 },
12107 static struct hda_input_mux alc268_acer_capture_source = {
12111 { "Internal Mic", 0x1 },
12116 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12120 { "Internal Mic", 0x6 },
12125 #ifdef CONFIG_SND_DEBUG
12126 static struct snd_kcontrol_new alc268_test_mixer[] = {
12127 /* Volume widgets */
12128 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12129 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12130 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12131 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12132 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12133 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12134 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12135 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12136 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12137 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12138 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12139 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12140 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12141 /* The below appears problematic on some hardwares */
12142 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12143 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12144 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12145 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12146 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12148 /* Modes for retasking pin widgets */
12149 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12150 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12151 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12152 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12154 /* Controls for GPIO pins, assuming they are configured as outputs */
12155 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12156 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12157 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12158 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12160 /* Switches to allow the digital SPDIF output pin to be enabled.
12161 * The ALC268 does not have an SPDIF input.
12163 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12165 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12166 * this output to turn on an external amplifier.
12168 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12169 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12175 /* create input playback/capture controls for the given pin */
12176 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12177 const char *ctlname, int idx)
12183 sprintf(name, "%s Playback Volume", ctlname);
12195 if (spec->multiout.dac_nids[0] != dac &&
12196 spec->multiout.dac_nids[1] != dac) {
12197 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12198 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12202 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12205 sprintf(name, "%s Playback Switch", ctlname);
12207 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12208 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12210 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12211 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12217 /* add playback controls from the parsed DAC table */
12218 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12219 const struct auto_pin_cfg *cfg)
12224 spec->multiout.dac_nids = spec->private_dac_nids;
12226 nid = cfg->line_out_pins[0];
12229 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12233 err = alc268_new_analog_output(spec, nid, name, 0);
12238 nid = cfg->speaker_pins[0];
12240 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12241 "Speaker Playback Volume",
12242 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12246 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12250 nid = cfg->hp_pins[0];
12252 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12257 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12259 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12260 "Mono Playback Switch",
12261 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12268 /* create playback/capture controls for input pins */
12269 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12270 const struct auto_pin_cfg *cfg)
12272 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12275 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12277 struct alc_spec *spec = codec->spec;
12278 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12279 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12280 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12281 unsigned int dac_vol1, dac_vol2;
12284 snd_hda_codec_write(codec, speaker_nid, 0,
12285 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12286 snd_hda_codec_write(codec, 0x0f, 0,
12287 AC_VERB_SET_AMP_GAIN_MUTE,
12289 snd_hda_codec_write(codec, 0x10, 0,
12290 AC_VERB_SET_AMP_GAIN_MUTE,
12293 snd_hda_codec_write(codec, 0x0f, 0,
12294 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12295 snd_hda_codec_write(codec, 0x10, 0,
12296 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12299 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12300 if (line_nid == 0x14)
12301 dac_vol2 = AMP_OUT_ZERO;
12302 else if (line_nid == 0x15)
12303 dac_vol1 = AMP_OUT_ZERO;
12304 if (hp_nid == 0x14)
12305 dac_vol2 = AMP_OUT_ZERO;
12306 else if (hp_nid == 0x15)
12307 dac_vol1 = AMP_OUT_ZERO;
12308 if (line_nid != 0x16 || hp_nid != 0x16 ||
12309 spec->autocfg.line_out_pins[1] != 0x16 ||
12310 spec->autocfg.line_out_pins[2] != 0x16)
12311 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12313 snd_hda_codec_write(codec, 0x02, 0,
12314 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12315 snd_hda_codec_write(codec, 0x03, 0,
12316 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12319 /* pcm configuration: identical with ALC880 */
12320 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12321 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12322 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12323 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12326 * BIOS auto configuration
12328 static int alc268_parse_auto_config(struct hda_codec *codec)
12330 struct alc_spec *spec = codec->spec;
12332 static hda_nid_t alc268_ignore[] = { 0 };
12334 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12338 if (!spec->autocfg.line_outs) {
12339 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12340 spec->multiout.max_channels = 2;
12341 spec->no_analog = 1;
12344 return 0; /* can't find valid BIOS pin config */
12346 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12349 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12353 spec->multiout.max_channels = 2;
12356 /* digital only support output */
12357 if (spec->autocfg.dig_outs) {
12358 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12359 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12361 if (spec->kctls.list)
12362 add_mixer(spec, spec->kctls.list);
12364 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12365 add_mixer(spec, alc268_beep_mixer);
12367 add_verb(spec, alc268_volume_init_verbs);
12368 spec->num_mux_defs = 2;
12369 spec->input_mux = &spec->private_imux[0];
12371 err = alc_auto_add_mic_boost(codec);
12375 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12380 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12381 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12382 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12384 /* init callback for auto-configuration model -- overriding the default init */
12385 static void alc268_auto_init(struct hda_codec *codec)
12387 struct alc_spec *spec = codec->spec;
12388 alc268_auto_init_multi_out(codec);
12389 alc268_auto_init_hp_out(codec);
12390 alc268_auto_init_mono_speaker_out(codec);
12391 alc268_auto_init_analog_input(codec);
12392 if (spec->unsol_event)
12393 alc_inithook(codec);
12397 * configuration and preset
12399 static const char *alc268_models[ALC268_MODEL_LAST] = {
12400 [ALC267_QUANTA_IL1] = "quanta-il1",
12401 [ALC268_3ST] = "3stack",
12402 [ALC268_TOSHIBA] = "toshiba",
12403 [ALC268_ACER] = "acer",
12404 [ALC268_ACER_DMIC] = "acer-dmic",
12405 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12406 [ALC268_DELL] = "dell",
12407 [ALC268_ZEPTO] = "zepto",
12408 #ifdef CONFIG_SND_DEBUG
12409 [ALC268_TEST] = "test",
12411 [ALC268_AUTO] = "auto",
12414 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12415 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12416 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12417 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12418 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12419 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12420 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12421 ALC268_ACER_ASPIRE_ONE),
12422 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12423 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12424 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12426 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12427 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12428 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12429 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12430 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12431 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12435 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12436 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12437 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12438 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12439 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12444 static struct alc_config_preset alc268_presets[] = {
12445 [ALC267_QUANTA_IL1] = {
12446 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12447 alc268_capture_nosrc_mixer },
12448 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12449 alc267_quanta_il1_verbs },
12450 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12451 .dac_nids = alc268_dac_nids,
12452 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12453 .adc_nids = alc268_adc_nids_alt,
12455 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12456 .channel_mode = alc268_modes,
12457 .unsol_event = alc_sku_unsol_event,
12458 .setup = alc267_quanta_il1_setup,
12459 .init_hook = alc_inithook,
12462 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12463 alc268_beep_mixer },
12464 .init_verbs = { alc268_base_init_verbs },
12465 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12466 .dac_nids = alc268_dac_nids,
12467 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12468 .adc_nids = alc268_adc_nids_alt,
12469 .capsrc_nids = alc268_capsrc_nids,
12471 .dig_out_nid = ALC268_DIGOUT_NID,
12472 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12473 .channel_mode = alc268_modes,
12474 .input_mux = &alc268_capture_source,
12476 [ALC268_TOSHIBA] = {
12477 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12478 alc268_beep_mixer },
12479 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12480 alc268_toshiba_verbs },
12481 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12482 .dac_nids = alc268_dac_nids,
12483 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12484 .adc_nids = alc268_adc_nids_alt,
12485 .capsrc_nids = alc268_capsrc_nids,
12487 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12488 .channel_mode = alc268_modes,
12489 .input_mux = &alc268_capture_source,
12490 .unsol_event = alc268_toshiba_unsol_event,
12491 .setup = alc268_toshiba_setup,
12492 .init_hook = alc268_toshiba_automute,
12495 .mixers = { alc268_acer_mixer, alc268_capture_nosrc_mixer,
12496 alc268_beep_mixer },
12497 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12498 alc268_acer_verbs },
12499 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12500 .dac_nids = alc268_dac_nids,
12501 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12502 .adc_nids = alc268_adc_nids_alt,
12503 .capsrc_nids = alc268_capsrc_nids,
12505 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12506 .channel_mode = alc268_modes,
12507 .input_mux = &alc268_acer_capture_source,
12508 .unsol_event = alc268_acer_unsol_event,
12509 .init_hook = alc268_acer_init_hook,
12511 [ALC268_ACER_DMIC] = {
12512 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12513 alc268_beep_mixer },
12514 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12515 alc268_acer_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_acer_dmic_capture_source,
12525 .unsol_event = alc268_acer_unsol_event,
12526 .init_hook = alc268_acer_init_hook,
12528 [ALC268_ACER_ASPIRE_ONE] = {
12529 .mixers = { alc268_acer_aspire_one_mixer,
12531 alc268_capture_nosrc_mixer },
12532 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12533 alc268_acer_aspire_one_verbs },
12534 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12535 .dac_nids = alc268_dac_nids,
12536 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12537 .adc_nids = alc268_adc_nids_alt,
12538 .capsrc_nids = alc268_capsrc_nids,
12540 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12541 .channel_mode = alc268_modes,
12542 .unsol_event = alc268_acer_lc_unsol_event,
12543 .setup = alc268_acer_lc_setup,
12544 .init_hook = alc268_acer_lc_init_hook,
12547 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12548 alc268_capture_nosrc_mixer },
12549 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12550 alc268_dell_verbs },
12551 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12552 .dac_nids = alc268_dac_nids,
12553 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12554 .adc_nids = alc268_adc_nids_alt,
12555 .capsrc_nids = alc268_capsrc_nids,
12557 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12558 .channel_mode = alc268_modes,
12559 .unsol_event = alc_sku_unsol_event,
12560 .setup = alc268_dell_setup,
12561 .init_hook = alc_inithook,
12564 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12565 alc268_beep_mixer },
12566 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12567 alc268_toshiba_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 .dig_out_nid = ALC268_DIGOUT_NID,
12575 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12576 .channel_mode = alc268_modes,
12577 .input_mux = &alc268_capture_source,
12578 .setup = alc268_toshiba_setup,
12579 .init_hook = alc268_toshiba_automute,
12581 #ifdef CONFIG_SND_DEBUG
12583 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12584 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12585 alc268_volume_init_verbs },
12586 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12587 .dac_nids = alc268_dac_nids,
12588 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12589 .adc_nids = alc268_adc_nids_alt,
12590 .capsrc_nids = alc268_capsrc_nids,
12592 .dig_out_nid = ALC268_DIGOUT_NID,
12593 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12594 .channel_mode = alc268_modes,
12595 .input_mux = &alc268_capture_source,
12600 static int patch_alc268(struct hda_codec *codec)
12602 struct alc_spec *spec;
12604 int i, has_beep, err;
12606 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12610 codec->spec = spec;
12612 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12616 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12617 board_config = snd_hda_check_board_codec_sid_config(codec,
12618 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12620 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12621 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12623 board_config = ALC268_AUTO;
12626 if (board_config == ALC268_AUTO) {
12627 /* automatic parse from the BIOS config */
12628 err = alc268_parse_auto_config(codec);
12634 "hda_codec: Cannot set up configuration "
12635 "from BIOS. Using base mode...\n");
12636 board_config = ALC268_3ST;
12640 if (board_config != ALC268_AUTO)
12641 setup_preset(codec, &alc268_presets[board_config]);
12643 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12644 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12645 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12647 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12650 for (i = 0; i < spec->num_mixers; i++) {
12651 if (spec->mixers[i] == alc268_beep_mixer) {
12658 err = snd_hda_attach_beep_device(codec, 0x1);
12663 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12664 /* override the amp caps for beep generator */
12665 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12666 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12667 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12668 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12669 (0 << AC_AMPCAP_MUTE_SHIFT));
12672 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12673 /* check whether NID 0x07 is valid */
12674 unsigned int wcap = get_wcaps(codec, 0x07);
12678 wcap = get_wcaps_type(wcap);
12679 if (spec->auto_mic ||
12680 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12681 spec->adc_nids = alc268_adc_nids_alt;
12682 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12683 if (spec->auto_mic || spec->input_mux->num_items == 1)
12684 add_mixer(spec, alc268_capture_nosrc_mixer);
12686 add_mixer(spec, alc268_capture_alt_mixer);
12688 spec->adc_nids = alc268_adc_nids;
12689 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12690 add_mixer(spec, alc268_capture_mixer);
12692 spec->capsrc_nids = alc268_capsrc_nids;
12693 /* set default input source */
12694 for (i = 0; i < spec->num_adc_nids; i++)
12695 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12696 0, AC_VERB_SET_CONNECT_SEL,
12697 i < spec->num_mux_defs ?
12698 spec->input_mux[i].items[0].index :
12699 spec->input_mux->items[0].index);
12702 spec->vmaster_nid = 0x02;
12704 codec->patch_ops = alc_patch_ops;
12705 if (board_config == ALC268_AUTO)
12706 spec->init_hook = alc268_auto_init;
12708 codec->proc_widget_hook = print_realtek_coef;
12714 * ALC269 channel source setting (2 channel)
12716 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12718 #define alc269_dac_nids alc260_dac_nids
12720 static hda_nid_t alc269_adc_nids[1] = {
12725 static hda_nid_t alc269_capsrc_nids[1] = {
12729 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12733 #define alc269_modes alc260_modes
12734 #define alc269_capture_source alc880_lg_lw_capture_source
12736 static struct snd_kcontrol_new alc269_base_mixer[] = {
12737 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12738 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12739 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12740 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12741 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12742 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12743 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12744 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12745 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12746 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12747 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12748 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12752 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12753 /* output mixer control */
12754 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12756 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12757 .name = "Master Playback Switch",
12758 .info = snd_hda_mixer_amp_switch_info,
12759 .get = snd_hda_mixer_amp_switch_get,
12760 .put = alc268_acer_master_sw_put,
12761 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12763 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12764 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12765 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12766 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12767 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12768 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12772 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12773 /* output mixer control */
12774 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12776 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12777 .name = "Master Playback Switch",
12778 .info = snd_hda_mixer_amp_switch_info,
12779 .get = snd_hda_mixer_amp_switch_get,
12780 .put = alc268_acer_master_sw_put,
12781 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12783 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12784 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12785 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12786 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12787 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12788 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12789 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12790 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12791 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12795 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12796 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12797 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12798 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12799 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12803 /* capture mixer elements */
12804 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12805 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12806 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12807 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12812 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12814 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12815 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12816 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12817 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12818 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12819 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12820 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12824 static struct hda_verb alc269_lifebook_verbs[] = {
12825 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12826 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12827 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12828 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12829 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12830 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12831 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12832 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12833 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12834 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12838 /* toggle speaker-output according to the hp-jack state */
12839 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12841 unsigned int present;
12842 unsigned char bits;
12844 present = snd_hda_codec_read(codec, 0x15, 0,
12845 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12846 bits = present ? AMP_IN_MUTE(0) : 0;
12847 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12848 AMP_IN_MUTE(0), bits);
12849 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12850 AMP_IN_MUTE(0), bits);
12852 snd_hda_codec_write(codec, 0x20, 0,
12853 AC_VERB_SET_COEF_INDEX, 0x0c);
12854 snd_hda_codec_write(codec, 0x20, 0,
12855 AC_VERB_SET_PROC_COEF, 0x680);
12857 snd_hda_codec_write(codec, 0x20, 0,
12858 AC_VERB_SET_COEF_INDEX, 0x0c);
12859 snd_hda_codec_write(codec, 0x20, 0,
12860 AC_VERB_SET_PROC_COEF, 0x480);
12863 /* toggle speaker-output according to the hp-jacks state */
12864 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12866 unsigned int present;
12867 unsigned char bits;
12869 /* Check laptop headphone socket */
12870 present = snd_hda_codec_read(codec, 0x15, 0,
12871 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12873 /* Check port replicator headphone socket */
12874 present |= snd_hda_codec_read(codec, 0x1a, 0,
12875 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12877 bits = present ? AMP_IN_MUTE(0) : 0;
12878 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12879 AMP_IN_MUTE(0), bits);
12880 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12881 AMP_IN_MUTE(0), bits);
12883 snd_hda_codec_write(codec, 0x20, 0,
12884 AC_VERB_SET_COEF_INDEX, 0x0c);
12885 snd_hda_codec_write(codec, 0x20, 0,
12886 AC_VERB_SET_PROC_COEF, 0x680);
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, 0x480);
12894 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12896 unsigned int present_laptop;
12897 unsigned int present_dock;
12899 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12900 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12902 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12903 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12905 /* Laptop mic port overrides dock mic port, design decision */
12907 snd_hda_codec_write(codec, 0x23, 0,
12908 AC_VERB_SET_CONNECT_SEL, 0x3);
12909 if (present_laptop)
12910 snd_hda_codec_write(codec, 0x23, 0,
12911 AC_VERB_SET_CONNECT_SEL, 0x0);
12912 if (!present_dock && !present_laptop)
12913 snd_hda_codec_write(codec, 0x23, 0,
12914 AC_VERB_SET_CONNECT_SEL, 0x1);
12917 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12920 switch (res >> 26) {
12921 case ALC880_HP_EVENT:
12922 alc269_quanta_fl1_speaker_automute(codec);
12924 case ALC880_MIC_EVENT:
12925 alc_mic_automute(codec);
12930 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12933 if ((res >> 26) == ALC880_HP_EVENT)
12934 alc269_lifebook_speaker_automute(codec);
12935 if ((res >> 26) == ALC880_MIC_EVENT)
12936 alc269_lifebook_mic_autoswitch(codec);
12939 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
12941 struct alc_spec *spec = codec->spec;
12942 spec->ext_mic.pin = 0x18;
12943 spec->ext_mic.mux_idx = 0;
12944 spec->int_mic.pin = 0x19;
12945 spec->int_mic.mux_idx = 1;
12946 spec->auto_mic = 1;
12949 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12951 alc269_quanta_fl1_speaker_automute(codec);
12952 alc_mic_automute(codec);
12955 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12957 alc269_lifebook_speaker_automute(codec);
12958 alc269_lifebook_mic_autoswitch(codec);
12961 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12962 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12963 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12964 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12965 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12966 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12967 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12968 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12972 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12973 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12974 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12975 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12976 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12977 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12978 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12982 /* toggle speaker-output according to the hp-jack state */
12983 static void alc269_speaker_automute(struct hda_codec *codec)
12985 unsigned int present;
12986 unsigned char bits;
12988 present = snd_hda_codec_read(codec, 0x15, 0,
12989 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12990 bits = present ? AMP_IN_MUTE(0) : 0;
12991 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12992 AMP_IN_MUTE(0), bits);
12993 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12994 AMP_IN_MUTE(0), bits);
12997 /* unsolicited event for HP jack sensing */
12998 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13001 switch (res >> 26) {
13002 case ALC880_HP_EVENT:
13003 alc269_speaker_automute(codec);
13005 case ALC880_MIC_EVENT:
13006 alc_mic_automute(codec);
13011 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13013 struct alc_spec *spec = codec->spec;
13014 spec->ext_mic.pin = 0x18;
13015 spec->ext_mic.mux_idx = 0;
13016 spec->int_mic.pin = 0x12;
13017 spec->int_mic.mux_idx = 5;
13018 spec->auto_mic = 1;
13021 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13023 struct alc_spec *spec = codec->spec;
13024 spec->ext_mic.pin = 0x18;
13025 spec->ext_mic.mux_idx = 0;
13026 spec->int_mic.pin = 0x19;
13027 spec->int_mic.mux_idx = 1;
13028 spec->auto_mic = 1;
13031 static void alc269_eeepc_inithook(struct hda_codec *codec)
13033 alc269_speaker_automute(codec);
13034 alc_mic_automute(codec);
13038 * generic initialization of ADC, input mixers and output mixers
13040 static struct hda_verb alc269_init_verbs[] = {
13042 * Unmute ADC0 and set the default input to mic-in
13044 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13046 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13047 * analog-loopback mixer widget
13048 * Note: PASD motherboards uses the Line In 2 as the input for
13049 * front panel mic (mic 2)
13051 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13052 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13053 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13054 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13055 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13056 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13059 * Set up output mixers (0x0c - 0x0e)
13061 /* set vol=0 to output mixers */
13062 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13063 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13065 /* set up input amps for analog loopback */
13066 /* Amp Indices: DAC = 0, mixer = 1 */
13067 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13068 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13069 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13070 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13071 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13072 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13074 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13075 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13076 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13077 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13078 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13079 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13080 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13082 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13083 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13084 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13085 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13086 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13087 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13088 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13090 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13091 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13093 /* FIXME: use matrix-type input source selection */
13094 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13095 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13096 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13097 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13098 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13099 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13102 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13103 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13107 #define alc269_auto_create_multi_out_ctls \
13108 alc268_auto_create_multi_out_ctls
13109 #define alc269_auto_create_input_ctls \
13110 alc268_auto_create_input_ctls
13112 #ifdef CONFIG_SND_HDA_POWER_SAVE
13113 #define alc269_loopbacks alc880_loopbacks
13116 /* pcm configuration: identical with ALC880 */
13117 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13118 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13119 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13120 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13122 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13126 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13127 /* NID is set in alc_build_pcms */
13129 .open = alc880_playback_pcm_open,
13130 .prepare = alc880_playback_pcm_prepare,
13131 .cleanup = alc880_playback_pcm_cleanup
13135 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13139 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13140 /* NID is set in alc_build_pcms */
13144 * BIOS auto configuration
13146 static int alc269_parse_auto_config(struct hda_codec *codec)
13148 struct alc_spec *spec = codec->spec;
13150 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13152 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13157 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13160 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13164 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13166 if (spec->autocfg.dig_outs)
13167 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13169 if (spec->kctls.list)
13170 add_mixer(spec, spec->kctls.list);
13172 add_verb(spec, alc269_init_verbs);
13173 spec->num_mux_defs = 1;
13174 spec->input_mux = &spec->private_imux[0];
13175 /* set default input source */
13176 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13177 0, AC_VERB_SET_CONNECT_SEL,
13178 spec->input_mux->items[0].index);
13180 err = alc_auto_add_mic_boost(codec);
13184 if (!spec->cap_mixer && !spec->no_analog)
13185 set_capture_mixer(codec);
13187 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13192 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13193 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13194 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13197 /* init callback for auto-configuration model -- overriding the default init */
13198 static void alc269_auto_init(struct hda_codec *codec)
13200 struct alc_spec *spec = codec->spec;
13201 alc269_auto_init_multi_out(codec);
13202 alc269_auto_init_hp_out(codec);
13203 alc269_auto_init_analog_input(codec);
13204 if (spec->unsol_event)
13205 alc_inithook(codec);
13209 * configuration and preset
13211 static const char *alc269_models[ALC269_MODEL_LAST] = {
13212 [ALC269_BASIC] = "basic",
13213 [ALC269_QUANTA_FL1] = "quanta",
13214 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13215 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13216 [ALC269_FUJITSU] = "fujitsu",
13217 [ALC269_LIFEBOOK] = "lifebook"
13220 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13221 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13222 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13223 ALC269_ASUS_EEEPC_P703),
13224 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13225 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13226 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13227 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13228 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13229 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13230 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13231 ALC269_ASUS_EEEPC_P901),
13232 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13233 ALC269_ASUS_EEEPC_P901),
13234 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13235 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13236 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13240 static struct alc_config_preset alc269_presets[] = {
13242 .mixers = { alc269_base_mixer },
13243 .init_verbs = { alc269_init_verbs },
13244 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13245 .dac_nids = alc269_dac_nids,
13247 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13248 .channel_mode = alc269_modes,
13249 .input_mux = &alc269_capture_source,
13251 [ALC269_QUANTA_FL1] = {
13252 .mixers = { alc269_quanta_fl1_mixer },
13253 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13254 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13255 .dac_nids = alc269_dac_nids,
13257 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13258 .channel_mode = alc269_modes,
13259 .input_mux = &alc269_capture_source,
13260 .unsol_event = alc269_quanta_fl1_unsol_event,
13261 .setup = alc269_quanta_fl1_setup,
13262 .init_hook = alc269_quanta_fl1_init_hook,
13264 [ALC269_ASUS_EEEPC_P703] = {
13265 .mixers = { alc269_eeepc_mixer },
13266 .cap_mixer = alc269_epc_capture_mixer,
13267 .init_verbs = { alc269_init_verbs,
13268 alc269_eeepc_amic_init_verbs },
13269 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13270 .dac_nids = alc269_dac_nids,
13272 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13273 .channel_mode = alc269_modes,
13274 .unsol_event = alc269_eeepc_unsol_event,
13275 .setup = alc269_eeepc_amic_setup,
13276 .init_hook = alc269_eeepc_inithook,
13278 [ALC269_ASUS_EEEPC_P901] = {
13279 .mixers = { alc269_eeepc_mixer },
13280 .cap_mixer = alc269_epc_capture_mixer,
13281 .init_verbs = { alc269_init_verbs,
13282 alc269_eeepc_dmic_init_verbs },
13283 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13284 .dac_nids = alc269_dac_nids,
13286 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13287 .channel_mode = alc269_modes,
13288 .unsol_event = alc269_eeepc_unsol_event,
13289 .setup = alc269_eeepc_dmic_setup,
13290 .init_hook = alc269_eeepc_inithook,
13292 [ALC269_FUJITSU] = {
13293 .mixers = { alc269_fujitsu_mixer },
13294 .cap_mixer = alc269_epc_capture_mixer,
13295 .init_verbs = { alc269_init_verbs,
13296 alc269_eeepc_dmic_init_verbs },
13297 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13298 .dac_nids = alc269_dac_nids,
13300 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13301 .channel_mode = alc269_modes,
13302 .unsol_event = alc269_eeepc_unsol_event,
13303 .setup = alc269_eeepc_dmic_setup,
13304 .init_hook = alc269_eeepc_inithook,
13306 [ALC269_LIFEBOOK] = {
13307 .mixers = { alc269_lifebook_mixer },
13308 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13309 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13310 .dac_nids = alc269_dac_nids,
13312 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13313 .channel_mode = alc269_modes,
13314 .input_mux = &alc269_capture_source,
13315 .unsol_event = alc269_lifebook_unsol_event,
13316 .init_hook = alc269_lifebook_init_hook,
13320 static int patch_alc269(struct hda_codec *codec)
13322 struct alc_spec *spec;
13326 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13330 codec->spec = spec;
13332 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13334 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13338 if (board_config < 0) {
13339 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13341 board_config = ALC269_AUTO;
13344 if (board_config == ALC269_AUTO) {
13345 /* automatic parse from the BIOS config */
13346 err = alc269_parse_auto_config(codec);
13352 "hda_codec: Cannot set up configuration "
13353 "from BIOS. Using base mode...\n");
13354 board_config = ALC269_BASIC;
13358 err = snd_hda_attach_beep_device(codec, 0x1);
13364 if (board_config != ALC269_AUTO)
13365 setup_preset(codec, &alc269_presets[board_config]);
13367 if (codec->subsystem_id == 0x17aa3bf8) {
13368 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13369 * fix the sample rate of analog I/O to 44.1kHz
13371 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13372 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13374 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13375 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13377 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13378 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13380 spec->adc_nids = alc269_adc_nids;
13381 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13382 spec->capsrc_nids = alc269_capsrc_nids;
13383 if (!spec->cap_mixer)
13384 set_capture_mixer(codec);
13385 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13387 spec->vmaster_nid = 0x02;
13389 codec->patch_ops = alc_patch_ops;
13390 if (board_config == ALC269_AUTO)
13391 spec->init_hook = alc269_auto_init;
13392 #ifdef CONFIG_SND_HDA_POWER_SAVE
13393 if (!spec->loopback.amplist)
13394 spec->loopback.amplist = alc269_loopbacks;
13396 codec->proc_widget_hook = print_realtek_coef;
13402 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13406 * set the path ways for 2 channel output
13407 * need to set the codec line out and mic 1 pin widgets to inputs
13409 static struct hda_verb alc861_threestack_ch2_init[] = {
13410 /* set pin widget 1Ah (line in) for input */
13411 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13412 /* set pin widget 18h (mic1/2) for input, for mic also enable
13415 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13417 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13419 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13420 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13426 * need to set the codec line out and mic 1 pin widgets to outputs
13428 static struct hda_verb alc861_threestack_ch6_init[] = {
13429 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13430 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13431 /* set pin widget 18h (mic1) for output (CLFE)*/
13432 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13434 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13435 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13437 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13439 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13440 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13445 static struct hda_channel_mode alc861_threestack_modes[2] = {
13446 { 2, alc861_threestack_ch2_init },
13447 { 6, alc861_threestack_ch6_init },
13449 /* Set mic1 as input and unmute the mixer */
13450 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13451 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13452 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13455 /* Set mic1 as output and mute mixer */
13456 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13457 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13458 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13462 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13463 { 2, alc861_uniwill_m31_ch2_init },
13464 { 4, alc861_uniwill_m31_ch4_init },
13467 /* Set mic1 and line-in as input and unmute the mixer */
13468 static struct hda_verb alc861_asus_ch2_init[] = {
13469 /* set pin widget 1Ah (line in) for input */
13470 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13471 /* set pin widget 18h (mic1/2) for input, for mic also enable
13474 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13476 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13478 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13479 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13483 /* Set mic1 nad line-in as output and mute mixer */
13484 static struct hda_verb alc861_asus_ch6_init[] = {
13485 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13486 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13487 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13488 /* set pin widget 18h (mic1) for output (CLFE)*/
13489 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13490 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13491 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13492 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13494 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13496 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13497 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13502 static struct hda_channel_mode alc861_asus_modes[2] = {
13503 { 2, alc861_asus_ch2_init },
13504 { 6, alc861_asus_ch6_init },
13509 static struct snd_kcontrol_new alc861_base_mixer[] = {
13510 /* output mixer control */
13511 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13512 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13513 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13514 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13515 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13517 /*Input mixer control */
13518 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13519 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13520 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13521 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13522 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13523 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13524 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13525 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13526 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13527 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13532 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13533 /* output mixer control */
13534 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13535 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13536 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13537 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13538 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13540 /* Input mixer control */
13541 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13542 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13543 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13544 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13545 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13546 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13547 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13548 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13549 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13550 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13553 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13554 .name = "Channel Mode",
13555 .info = alc_ch_mode_info,
13556 .get = alc_ch_mode_get,
13557 .put = alc_ch_mode_put,
13558 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13563 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13564 /* output mixer control */
13565 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13566 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13567 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13572 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13573 /* output mixer control */
13574 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13575 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13576 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13577 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13578 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13580 /* Input mixer control */
13581 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13582 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13583 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13584 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13585 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13586 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13587 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13588 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13589 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13590 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13593 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13594 .name = "Channel Mode",
13595 .info = alc_ch_mode_info,
13596 .get = alc_ch_mode_get,
13597 .put = alc_ch_mode_put,
13598 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13603 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13604 /* output mixer control */
13605 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13606 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13607 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13608 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13609 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13611 /* Input mixer control */
13612 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13613 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13614 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13615 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13616 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13617 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13618 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13619 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13620 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13621 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13624 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13625 .name = "Channel Mode",
13626 .info = alc_ch_mode_info,
13627 .get = alc_ch_mode_get,
13628 .put = alc_ch_mode_put,
13629 .private_value = ARRAY_SIZE(alc861_asus_modes),
13634 /* additional mixer */
13635 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13636 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13637 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13642 * generic initialization of ADC, input mixers and output mixers
13644 static struct hda_verb alc861_base_init_verbs[] = {
13646 * Unmute ADC0 and set the default input to mic-in
13648 /* port-A for surround (rear panel) */
13649 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13650 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13651 /* port-B for mic-in (rear panel) with vref */
13652 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13653 /* port-C for line-in (rear panel) */
13654 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13655 /* port-D for Front */
13656 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13657 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13658 /* port-E for HP out (front panel) */
13659 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13660 /* route front PCM to HP */
13661 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13662 /* port-F for mic-in (front panel) with vref */
13663 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13664 /* port-G for CLFE (rear panel) */
13665 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13666 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13667 /* port-H for side (rear panel) */
13668 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13669 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13671 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13672 /* route front mic to ADC1*/
13673 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13674 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13676 /* Unmute DAC0~3 & spdif out*/
13677 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13678 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13679 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13680 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13681 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13683 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13684 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13685 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13686 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13687 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13689 /* Unmute Stereo Mixer 15 */
13690 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13692 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13693 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13695 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13696 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13697 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13698 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13699 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13700 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13701 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13702 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13703 /* hp used DAC 3 (Front) */
13704 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13705 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13710 static struct hda_verb alc861_threestack_init_verbs[] = {
13712 * Unmute ADC0 and set the default input to mic-in
13714 /* port-A for surround (rear panel) */
13715 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13716 /* port-B for mic-in (rear panel) with vref */
13717 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13718 /* port-C for line-in (rear panel) */
13719 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13720 /* port-D for Front */
13721 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13722 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13723 /* port-E for HP out (front panel) */
13724 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13725 /* route front PCM to HP */
13726 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13727 /* port-F for mic-in (front panel) with vref */
13728 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13729 /* port-G for CLFE (rear panel) */
13730 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13731 /* port-H for side (rear panel) */
13732 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13734 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13735 /* route front mic to ADC1*/
13736 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13737 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13738 /* Unmute DAC0~3 & spdif out*/
13739 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13740 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13741 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13742 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13743 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13745 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13746 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13747 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13748 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13749 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13751 /* Unmute Stereo Mixer 15 */
13752 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13753 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13754 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13755 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13757 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13758 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13759 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13760 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13761 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13762 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13763 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13764 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13765 /* hp used DAC 3 (Front) */
13766 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13767 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13771 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13773 * Unmute ADC0 and set the default input to mic-in
13775 /* port-A for surround (rear panel) */
13776 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 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 /* this has to be set to VREF80 */
13786 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13787 /* route front PCM to HP */
13788 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13789 /* port-F for mic-in (front panel) with vref */
13790 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13791 /* port-G for CLFE (rear panel) */
13792 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13793 /* port-H for side (rear panel) */
13794 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13796 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13797 /* route front mic to ADC1*/
13798 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13799 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13800 /* Unmute DAC0~3 & spdif out*/
13801 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13802 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13803 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13804 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13805 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13807 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13808 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13809 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13810 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13811 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13813 /* Unmute Stereo Mixer 15 */
13814 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13815 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13816 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13817 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13819 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13820 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13821 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13822 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13823 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13824 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13825 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13826 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13827 /* hp used DAC 3 (Front) */
13828 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13829 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13833 static struct hda_verb alc861_asus_init_verbs[] = {
13835 * Unmute ADC0 and set the default input to mic-in
13837 /* port-A for surround (rear panel)
13838 * according to codec#0 this is the HP jack
13840 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13841 /* route front PCM to HP */
13842 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13843 /* port-B for mic-in (rear panel) with vref */
13844 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13845 /* port-C for line-in (rear panel) */
13846 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13847 /* port-D for Front */
13848 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13849 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13850 /* port-E for HP out (front panel) */
13851 /* this has to be set to VREF80 */
13852 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13853 /* route front PCM to HP */
13854 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13855 /* port-F for mic-in (front panel) with vref */
13856 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13857 /* port-G for CLFE (rear panel) */
13858 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13859 /* port-H for side (rear panel) */
13860 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13862 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13863 /* route front mic to ADC1*/
13864 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13865 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13866 /* Unmute DAC0~3 & spdif out*/
13867 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13868 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13869 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13870 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13871 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13872 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13873 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13874 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13875 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13876 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13878 /* Unmute Stereo Mixer 15 */
13879 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13880 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13882 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13884 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13885 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13886 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13887 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13888 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13889 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13890 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13891 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13892 /* hp used DAC 3 (Front) */
13893 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13894 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13898 /* additional init verbs for ASUS laptops */
13899 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13900 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13901 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13906 * generic initialization of ADC, input mixers and output mixers
13908 static struct hda_verb alc861_auto_init_verbs[] = {
13910 * Unmute ADC0 and set the default input to mic-in
13912 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13913 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13915 /* Unmute DAC0~3 & spdif out*/
13916 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13917 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13918 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13919 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13920 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13922 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13923 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13924 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13925 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13926 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13928 /* Unmute Stereo Mixer 15 */
13929 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13931 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13932 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13934 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13935 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13936 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13937 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13938 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13939 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13940 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13941 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13943 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13944 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13945 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13946 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13947 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13948 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13949 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13950 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13952 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13957 static struct hda_verb alc861_toshiba_init_verbs[] = {
13958 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13963 /* toggle speaker-output according to the hp-jack state */
13964 static void alc861_toshiba_automute(struct hda_codec *codec)
13966 unsigned int present;
13968 present = snd_hda_codec_read(codec, 0x0f, 0,
13969 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13970 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13971 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13972 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13973 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13976 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13979 if ((res >> 26) == ALC880_HP_EVENT)
13980 alc861_toshiba_automute(codec);
13983 /* pcm configuration: identical with ALC880 */
13984 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13985 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13986 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13987 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13990 #define ALC861_DIGOUT_NID 0x07
13992 static struct hda_channel_mode alc861_8ch_modes[1] = {
13996 static hda_nid_t alc861_dac_nids[4] = {
13997 /* front, surround, clfe, side */
13998 0x03, 0x06, 0x05, 0x04
14001 static hda_nid_t alc660_dac_nids[3] = {
14002 /* front, clfe, surround */
14006 static hda_nid_t alc861_adc_nids[1] = {
14011 static struct hda_input_mux alc861_capture_source = {
14015 { "Front Mic", 0x3 },
14022 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14024 struct alc_spec *spec = codec->spec;
14025 hda_nid_t mix, srcs[5];
14028 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14030 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14033 for (i = 0; i < num; i++) {
14035 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14036 if (type != AC_WID_AUD_OUT)
14038 for (j = 0; j < spec->multiout.num_dacs; j++)
14039 if (spec->multiout.dac_nids[j] == srcs[i])
14041 if (j >= spec->multiout.num_dacs)
14047 /* fill in the dac_nids table from the parsed pin configuration */
14048 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14049 const struct auto_pin_cfg *cfg)
14051 struct alc_spec *spec = codec->spec;
14053 hda_nid_t nid, dac;
14055 spec->multiout.dac_nids = spec->private_dac_nids;
14056 for (i = 0; i < cfg->line_outs; i++) {
14057 nid = cfg->line_out_pins[i];
14058 dac = alc861_look_for_dac(codec, nid);
14061 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14066 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14067 hda_nid_t nid, unsigned int chs)
14070 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
14071 return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name,
14072 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14075 /* add playback controls from the parsed DAC table */
14076 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14077 const struct auto_pin_cfg *cfg)
14079 struct alc_spec *spec = codec->spec;
14080 static const char *chname[4] = {
14081 "Front", "Surround", NULL /*CLFE*/, "Side"
14086 if (cfg->line_outs == 1) {
14087 const char *pfx = NULL;
14090 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14093 nid = spec->multiout.dac_nids[0];
14094 return alc861_create_out_sw(codec, pfx, nid, 3);
14098 for (i = 0; i < cfg->line_outs; i++) {
14099 nid = spec->multiout.dac_nids[i];
14104 err = alc861_create_out_sw(codec, "Center", nid, 1);
14107 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14111 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14119 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14121 struct alc_spec *spec = codec->spec;
14128 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14129 nid = alc861_look_for_dac(codec, pin);
14131 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14134 spec->multiout.hp_nid = nid;
14140 /* create playback/capture controls for input pins */
14141 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14142 const struct auto_pin_cfg *cfg)
14144 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14147 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14149 int pin_type, hda_nid_t dac)
14151 hda_nid_t mix, srcs[5];
14154 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14156 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14158 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14160 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14163 for (i = 0; i < num; i++) {
14165 if (srcs[i] == dac || srcs[i] == 0x15)
14166 mute = AMP_IN_UNMUTE(i);
14168 mute = AMP_IN_MUTE(i);
14169 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14174 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14176 struct alc_spec *spec = codec->spec;
14179 for (i = 0; i < spec->autocfg.line_outs; i++) {
14180 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14181 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14183 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14184 spec->multiout.dac_nids[i]);
14188 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14190 struct alc_spec *spec = codec->spec;
14193 pin = spec->autocfg.hp_pins[0];
14195 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14196 spec->multiout.hp_nid);
14197 pin = spec->autocfg.speaker_pins[0];
14199 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT,
14200 spec->multiout.dac_nids[0]);
14203 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14205 struct alc_spec *spec = codec->spec;
14208 for (i = 0; i < AUTO_PIN_LAST; i++) {
14209 hda_nid_t nid = spec->autocfg.input_pins[i];
14210 if (nid >= 0x0c && nid <= 0x11)
14211 alc_set_input_pin(codec, nid, i);
14215 /* parse the BIOS configuration and set up the alc_spec */
14216 /* return 1 if successful, 0 if the proper config is not found,
14217 * or a negative error code
14219 static int alc861_parse_auto_config(struct hda_codec *codec)
14221 struct alc_spec *spec = codec->spec;
14223 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14225 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14229 if (!spec->autocfg.line_outs)
14230 return 0; /* can't find valid BIOS pin config */
14232 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14235 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14238 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14241 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14245 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14247 if (spec->autocfg.dig_outs)
14248 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14250 if (spec->kctls.list)
14251 add_mixer(spec, spec->kctls.list);
14253 add_verb(spec, alc861_auto_init_verbs);
14255 spec->num_mux_defs = 1;
14256 spec->input_mux = &spec->private_imux[0];
14258 spec->adc_nids = alc861_adc_nids;
14259 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14260 set_capture_mixer(codec);
14262 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14267 /* additional initialization for auto-configuration model */
14268 static void alc861_auto_init(struct hda_codec *codec)
14270 struct alc_spec *spec = codec->spec;
14271 alc861_auto_init_multi_out(codec);
14272 alc861_auto_init_hp_out(codec);
14273 alc861_auto_init_analog_input(codec);
14274 if (spec->unsol_event)
14275 alc_inithook(codec);
14278 #ifdef CONFIG_SND_HDA_POWER_SAVE
14279 static struct hda_amp_list alc861_loopbacks[] = {
14280 { 0x15, HDA_INPUT, 0 },
14281 { 0x15, HDA_INPUT, 1 },
14282 { 0x15, HDA_INPUT, 2 },
14283 { 0x15, HDA_INPUT, 3 },
14290 * configuration and preset
14292 static const char *alc861_models[ALC861_MODEL_LAST] = {
14293 [ALC861_3ST] = "3stack",
14294 [ALC660_3ST] = "3stack-660",
14295 [ALC861_3ST_DIG] = "3stack-dig",
14296 [ALC861_6ST_DIG] = "6stack-dig",
14297 [ALC861_UNIWILL_M31] = "uniwill-m31",
14298 [ALC861_TOSHIBA] = "toshiba",
14299 [ALC861_ASUS] = "asus",
14300 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14301 [ALC861_AUTO] = "auto",
14304 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14305 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14306 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14307 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14308 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14309 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14310 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14311 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14312 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14313 * Any other models that need this preset?
14315 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14316 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14317 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14318 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14319 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14320 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14321 /* FIXME: the below seems conflict */
14322 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14323 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14324 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14328 static struct alc_config_preset alc861_presets[] = {
14330 .mixers = { alc861_3ST_mixer },
14331 .init_verbs = { alc861_threestack_init_verbs },
14332 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14333 .dac_nids = alc861_dac_nids,
14334 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14335 .channel_mode = alc861_threestack_modes,
14337 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14338 .adc_nids = alc861_adc_nids,
14339 .input_mux = &alc861_capture_source,
14341 [ALC861_3ST_DIG] = {
14342 .mixers = { alc861_base_mixer },
14343 .init_verbs = { alc861_threestack_init_verbs },
14344 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14345 .dac_nids = alc861_dac_nids,
14346 .dig_out_nid = ALC861_DIGOUT_NID,
14347 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14348 .channel_mode = alc861_threestack_modes,
14350 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14351 .adc_nids = alc861_adc_nids,
14352 .input_mux = &alc861_capture_source,
14354 [ALC861_6ST_DIG] = {
14355 .mixers = { alc861_base_mixer },
14356 .init_verbs = { alc861_base_init_verbs },
14357 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14358 .dac_nids = alc861_dac_nids,
14359 .dig_out_nid = ALC861_DIGOUT_NID,
14360 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14361 .channel_mode = alc861_8ch_modes,
14362 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14363 .adc_nids = alc861_adc_nids,
14364 .input_mux = &alc861_capture_source,
14367 .mixers = { alc861_3ST_mixer },
14368 .init_verbs = { alc861_threestack_init_verbs },
14369 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14370 .dac_nids = alc660_dac_nids,
14371 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14372 .channel_mode = alc861_threestack_modes,
14374 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14375 .adc_nids = alc861_adc_nids,
14376 .input_mux = &alc861_capture_source,
14378 [ALC861_UNIWILL_M31] = {
14379 .mixers = { alc861_uniwill_m31_mixer },
14380 .init_verbs = { alc861_uniwill_m31_init_verbs },
14381 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14382 .dac_nids = alc861_dac_nids,
14383 .dig_out_nid = ALC861_DIGOUT_NID,
14384 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14385 .channel_mode = alc861_uniwill_m31_modes,
14387 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14388 .adc_nids = alc861_adc_nids,
14389 .input_mux = &alc861_capture_source,
14391 [ALC861_TOSHIBA] = {
14392 .mixers = { alc861_toshiba_mixer },
14393 .init_verbs = { alc861_base_init_verbs,
14394 alc861_toshiba_init_verbs },
14395 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14396 .dac_nids = alc861_dac_nids,
14397 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14398 .channel_mode = alc883_3ST_2ch_modes,
14399 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14400 .adc_nids = alc861_adc_nids,
14401 .input_mux = &alc861_capture_source,
14402 .unsol_event = alc861_toshiba_unsol_event,
14403 .init_hook = alc861_toshiba_automute,
14406 .mixers = { alc861_asus_mixer },
14407 .init_verbs = { alc861_asus_init_verbs },
14408 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14409 .dac_nids = alc861_dac_nids,
14410 .dig_out_nid = ALC861_DIGOUT_NID,
14411 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14412 .channel_mode = alc861_asus_modes,
14415 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14416 .adc_nids = alc861_adc_nids,
14417 .input_mux = &alc861_capture_source,
14419 [ALC861_ASUS_LAPTOP] = {
14420 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14421 .init_verbs = { alc861_asus_init_verbs,
14422 alc861_asus_laptop_init_verbs },
14423 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14424 .dac_nids = alc861_dac_nids,
14425 .dig_out_nid = ALC861_DIGOUT_NID,
14426 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14427 .channel_mode = alc883_3ST_2ch_modes,
14429 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14430 .adc_nids = alc861_adc_nids,
14431 .input_mux = &alc861_capture_source,
14436 static int patch_alc861(struct hda_codec *codec)
14438 struct alc_spec *spec;
14442 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14446 codec->spec = spec;
14448 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14452 if (board_config < 0) {
14453 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14455 board_config = ALC861_AUTO;
14458 if (board_config == ALC861_AUTO) {
14459 /* automatic parse from the BIOS config */
14460 err = alc861_parse_auto_config(codec);
14466 "hda_codec: Cannot set up configuration "
14467 "from BIOS. Using base mode...\n");
14468 board_config = ALC861_3ST_DIG;
14472 err = snd_hda_attach_beep_device(codec, 0x23);
14478 if (board_config != ALC861_AUTO)
14479 setup_preset(codec, &alc861_presets[board_config]);
14481 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14482 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14484 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14485 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14487 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14489 spec->vmaster_nid = 0x03;
14491 codec->patch_ops = alc_patch_ops;
14492 if (board_config == ALC861_AUTO)
14493 spec->init_hook = alc861_auto_init;
14494 #ifdef CONFIG_SND_HDA_POWER_SAVE
14495 if (!spec->loopback.amplist)
14496 spec->loopback.amplist = alc861_loopbacks;
14498 codec->proc_widget_hook = print_realtek_coef;
14504 * ALC861-VD support
14508 * In addition, an independent DAC
14510 #define ALC861VD_DIGOUT_NID 0x06
14512 static hda_nid_t alc861vd_dac_nids[4] = {
14513 /* front, surr, clfe, side surr */
14514 0x02, 0x03, 0x04, 0x05
14517 /* dac_nids for ALC660vd are in a different order - according to
14518 * Realtek's driver.
14519 * This should probably result in a different mixer for 6stack models
14520 * of ALC660vd codecs, but for now there is only 3stack mixer
14521 * - and it is the same as in 861vd.
14522 * adc_nids in ALC660vd are (is) the same as in 861vd
14524 static hda_nid_t alc660vd_dac_nids[3] = {
14525 /* front, rear, clfe, rear_surr */
14529 static hda_nid_t alc861vd_adc_nids[1] = {
14534 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14537 /* FIXME: should be a matrix-type input source selection */
14538 static struct hda_input_mux alc861vd_capture_source = {
14542 { "Front Mic", 0x1 },
14548 static struct hda_input_mux alc861vd_dallas_capture_source = {
14551 { "Ext Mic", 0x0 },
14552 { "Int Mic", 0x1 },
14556 static struct hda_input_mux alc861vd_hp_capture_source = {
14559 { "Front Mic", 0x0 },
14560 { "ATAPI Mic", 0x1 },
14567 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14574 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14575 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14576 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14577 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14578 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14585 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14586 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14587 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14588 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14589 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14593 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14594 { 6, alc861vd_6stack_ch6_init },
14595 { 8, alc861vd_6stack_ch8_init },
14598 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14600 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14601 .name = "Channel Mode",
14602 .info = alc_ch_mode_info,
14603 .get = alc_ch_mode_get,
14604 .put = alc_ch_mode_put,
14609 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14610 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14612 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14613 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14614 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14616 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14617 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14619 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14621 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14623 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14624 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14626 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14627 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14629 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14631 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14632 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14633 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14635 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14636 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14637 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14639 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14640 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14642 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14643 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14648 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14649 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14650 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14652 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14654 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14658 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14659 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14660 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14662 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14663 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14665 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14666 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14671 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14672 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14673 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14674 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14676 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14678 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14682 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14683 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14684 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14686 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14687 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14692 /* Pin assignment: Speaker=0x14, HP = 0x15,
14693 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14695 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14696 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14697 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14698 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14699 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14700 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14701 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14702 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14703 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14704 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14705 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14709 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14710 * Front Mic=0x18, ATAPI Mic = 0x19,
14712 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14713 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14714 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14715 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14716 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14717 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14718 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14719 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14720 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14726 * generic initialization of ADC, input mixers and output mixers
14728 static struct hda_verb alc861vd_volume_init_verbs[] = {
14730 * Unmute ADC0 and set the default input to mic-in
14732 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14733 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14735 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14736 * the analog-loopback mixer widget
14738 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14739 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14740 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14741 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14742 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14743 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14745 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14746 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14747 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14748 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14749 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14752 * Set up output mixers (0x02 - 0x05)
14754 /* set vol=0 to output mixers */
14755 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14756 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14757 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14758 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14760 /* set up input amps for analog loopback */
14761 /* Amp Indices: DAC = 0, mixer = 1 */
14762 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14763 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14764 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14765 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14766 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14767 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14768 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14769 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14775 * 3-stack pin configuration:
14776 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14778 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14780 * Set pin mode and muting
14782 /* set front pin widgets 0x14 for output */
14783 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14784 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14785 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14787 /* Mic (rear) pin: input vref at 80% */
14788 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14789 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14790 /* Front Mic pin: input vref at 80% */
14791 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14792 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14793 /* Line In pin: input */
14794 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14795 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14796 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14797 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14798 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14799 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14800 /* CD pin widget for input */
14801 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14807 * 6-stack pin configuration:
14809 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14811 * Set pin mode and muting
14813 /* set front pin widgets 0x14 for output */
14814 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14815 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14816 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14818 /* Rear Pin: output 1 (0x0d) */
14819 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14820 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14821 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14822 /* CLFE Pin: output 2 (0x0e) */
14823 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14824 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14825 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14826 /* Side Pin: output 3 (0x0f) */
14827 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14828 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14829 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14831 /* Mic (rear) pin: input vref at 80% */
14832 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14833 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14834 /* Front Mic pin: input vref at 80% */
14835 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14836 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14837 /* Line In pin: input */
14838 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14839 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14840 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14841 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14842 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14843 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14844 /* CD pin widget for input */
14845 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14850 static struct hda_verb alc861vd_eapd_verbs[] = {
14851 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14855 static struct hda_verb alc660vd_eapd_verbs[] = {
14856 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14857 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14861 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14862 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14864 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14865 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14866 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14870 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14872 unsigned int present;
14873 unsigned char bits;
14875 present = snd_hda_codec_read(codec, 0x18, 0,
14876 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14877 bits = present ? HDA_AMP_MUTE : 0;
14878 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14879 HDA_AMP_MUTE, bits);
14882 static void alc861vd_lenovo_setup(struct hda_codec *codec)
14884 struct alc_spec *spec = codec->spec;
14885 spec->autocfg.hp_pins[0] = 0x1b;
14886 spec->autocfg.speaker_pins[0] = 0x14;
14889 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14891 alc_automute_amp(codec);
14892 alc861vd_lenovo_mic_automute(codec);
14895 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14898 switch (res >> 26) {
14899 case ALC880_MIC_EVENT:
14900 alc861vd_lenovo_mic_automute(codec);
14903 alc_automute_amp_unsol_event(codec, res);
14908 static struct hda_verb alc861vd_dallas_verbs[] = {
14909 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14910 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14911 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14912 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14914 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14915 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14916 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14917 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14918 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14919 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14920 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14921 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14923 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14924 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14925 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14926 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14927 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14928 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14929 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14930 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14932 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14933 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14934 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14935 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14936 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14937 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14938 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14939 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14941 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14942 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14943 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14944 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14946 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14947 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14948 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14953 /* toggle speaker-output according to the hp-jack state */
14954 static void alc861vd_dallas_setup(struct hda_codec *codec)
14956 struct alc_spec *spec = codec->spec;
14958 spec->autocfg.hp_pins[0] = 0x15;
14959 spec->autocfg.speaker_pins[0] = 0x14;
14962 #ifdef CONFIG_SND_HDA_POWER_SAVE
14963 #define alc861vd_loopbacks alc880_loopbacks
14966 /* pcm configuration: identical with ALC880 */
14967 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14968 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14969 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14970 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14973 * configuration and preset
14975 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14976 [ALC660VD_3ST] = "3stack-660",
14977 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14978 [ALC660VD_ASUS_V1S] = "asus-v1s",
14979 [ALC861VD_3ST] = "3stack",
14980 [ALC861VD_3ST_DIG] = "3stack-digout",
14981 [ALC861VD_6ST_DIG] = "6stack-digout",
14982 [ALC861VD_LENOVO] = "lenovo",
14983 [ALC861VD_DALLAS] = "dallas",
14984 [ALC861VD_HP] = "hp",
14985 [ALC861VD_AUTO] = "auto",
14988 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14989 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14990 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14991 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14992 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14993 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14994 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14995 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14996 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14997 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14998 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
14999 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15000 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15001 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15002 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15003 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15007 static struct alc_config_preset alc861vd_presets[] = {
15009 .mixers = { alc861vd_3st_mixer },
15010 .init_verbs = { alc861vd_volume_init_verbs,
15011 alc861vd_3stack_init_verbs },
15012 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15013 .dac_nids = alc660vd_dac_nids,
15014 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15015 .channel_mode = alc861vd_3stack_2ch_modes,
15016 .input_mux = &alc861vd_capture_source,
15018 [ALC660VD_3ST_DIG] = {
15019 .mixers = { alc861vd_3st_mixer },
15020 .init_verbs = { alc861vd_volume_init_verbs,
15021 alc861vd_3stack_init_verbs },
15022 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15023 .dac_nids = alc660vd_dac_nids,
15024 .dig_out_nid = ALC861VD_DIGOUT_NID,
15025 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15026 .channel_mode = alc861vd_3stack_2ch_modes,
15027 .input_mux = &alc861vd_capture_source,
15030 .mixers = { alc861vd_3st_mixer },
15031 .init_verbs = { alc861vd_volume_init_verbs,
15032 alc861vd_3stack_init_verbs },
15033 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15034 .dac_nids = alc861vd_dac_nids,
15035 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15036 .channel_mode = alc861vd_3stack_2ch_modes,
15037 .input_mux = &alc861vd_capture_source,
15039 [ALC861VD_3ST_DIG] = {
15040 .mixers = { alc861vd_3st_mixer },
15041 .init_verbs = { alc861vd_volume_init_verbs,
15042 alc861vd_3stack_init_verbs },
15043 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15044 .dac_nids = alc861vd_dac_nids,
15045 .dig_out_nid = ALC861VD_DIGOUT_NID,
15046 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15047 .channel_mode = alc861vd_3stack_2ch_modes,
15048 .input_mux = &alc861vd_capture_source,
15050 [ALC861VD_6ST_DIG] = {
15051 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15052 .init_verbs = { alc861vd_volume_init_verbs,
15053 alc861vd_6stack_init_verbs },
15054 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15055 .dac_nids = alc861vd_dac_nids,
15056 .dig_out_nid = ALC861VD_DIGOUT_NID,
15057 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15058 .channel_mode = alc861vd_6stack_modes,
15059 .input_mux = &alc861vd_capture_source,
15061 [ALC861VD_LENOVO] = {
15062 .mixers = { alc861vd_lenovo_mixer },
15063 .init_verbs = { alc861vd_volume_init_verbs,
15064 alc861vd_3stack_init_verbs,
15065 alc861vd_eapd_verbs,
15066 alc861vd_lenovo_unsol_verbs },
15067 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15068 .dac_nids = alc660vd_dac_nids,
15069 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15070 .channel_mode = alc861vd_3stack_2ch_modes,
15071 .input_mux = &alc861vd_capture_source,
15072 .unsol_event = alc861vd_lenovo_unsol_event,
15073 .setup = alc861vd_lenovo_setup,
15074 .init_hook = alc861vd_lenovo_init_hook,
15076 [ALC861VD_DALLAS] = {
15077 .mixers = { alc861vd_dallas_mixer },
15078 .init_verbs = { alc861vd_dallas_verbs },
15079 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15080 .dac_nids = alc861vd_dac_nids,
15081 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15082 .channel_mode = alc861vd_3stack_2ch_modes,
15083 .input_mux = &alc861vd_dallas_capture_source,
15084 .unsol_event = alc_automute_amp_unsol_event,
15085 .setup = alc861vd_dallas_setup,
15086 .init_hook = alc_automute_amp,
15089 .mixers = { alc861vd_hp_mixer },
15090 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15091 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15092 .dac_nids = alc861vd_dac_nids,
15093 .dig_out_nid = ALC861VD_DIGOUT_NID,
15094 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15095 .channel_mode = alc861vd_3stack_2ch_modes,
15096 .input_mux = &alc861vd_hp_capture_source,
15097 .unsol_event = alc_automute_amp_unsol_event,
15098 .setup = alc861vd_dallas_setup,
15099 .init_hook = alc_automute_amp,
15101 [ALC660VD_ASUS_V1S] = {
15102 .mixers = { alc861vd_lenovo_mixer },
15103 .init_verbs = { alc861vd_volume_init_verbs,
15104 alc861vd_3stack_init_verbs,
15105 alc861vd_eapd_verbs,
15106 alc861vd_lenovo_unsol_verbs },
15107 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15108 .dac_nids = alc660vd_dac_nids,
15109 .dig_out_nid = ALC861VD_DIGOUT_NID,
15110 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15111 .channel_mode = alc861vd_3stack_2ch_modes,
15112 .input_mux = &alc861vd_capture_source,
15113 .unsol_event = alc861vd_lenovo_unsol_event,
15114 .setup = alc861vd_lenovo_setup,
15115 .init_hook = alc861vd_lenovo_init_hook,
15120 * BIOS auto configuration
15122 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15123 const struct auto_pin_cfg *cfg)
15125 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15129 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15130 hda_nid_t nid, int pin_type, int dac_idx)
15132 alc_set_pin_output(codec, nid, pin_type);
15135 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15137 struct alc_spec *spec = codec->spec;
15140 for (i = 0; i <= HDA_SIDE; i++) {
15141 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15142 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15144 alc861vd_auto_set_output_and_unmute(codec, nid,
15150 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15152 struct alc_spec *spec = codec->spec;
15155 pin = spec->autocfg.hp_pins[0];
15156 if (pin) /* connect to front and use dac 0 */
15157 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15158 pin = spec->autocfg.speaker_pins[0];
15160 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15163 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15165 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15167 struct alc_spec *spec = codec->spec;
15170 for (i = 0; i < AUTO_PIN_LAST; i++) {
15171 hda_nid_t nid = spec->autocfg.input_pins[i];
15172 if (alc_is_input_pin(codec, nid)) {
15173 alc_set_input_pin(codec, nid, i);
15174 if (nid != ALC861VD_PIN_CD_NID &&
15175 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15176 snd_hda_codec_write(codec, nid, 0,
15177 AC_VERB_SET_AMP_GAIN_MUTE,
15183 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15185 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15186 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15188 /* add playback controls from the parsed DAC table */
15189 /* Based on ALC880 version. But ALC861VD has separate,
15190 * different NIDs for mute/unmute switch and volume control */
15191 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15192 const struct auto_pin_cfg *cfg)
15195 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15196 hda_nid_t nid_v, nid_s;
15199 for (i = 0; i < cfg->line_outs; i++) {
15200 if (!spec->multiout.dac_nids[i])
15202 nid_v = alc861vd_idx_to_mixer_vol(
15204 spec->multiout.dac_nids[i]));
15205 nid_s = alc861vd_idx_to_mixer_switch(
15207 spec->multiout.dac_nids[i]));
15211 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15212 "Center Playback Volume",
15213 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15217 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15218 "LFE Playback Volume",
15219 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15223 err = add_control(spec, ALC_CTL_BIND_MUTE,
15224 "Center Playback Switch",
15225 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15229 err = add_control(spec, ALC_CTL_BIND_MUTE,
15230 "LFE Playback Switch",
15231 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15236 sprintf(name, "%s Playback Volume", chname[i]);
15237 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15238 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15242 sprintf(name, "%s Playback Switch", chname[i]);
15243 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15244 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15253 /* add playback controls for speaker and HP outputs */
15254 /* Based on ALC880 version. But ALC861VD has separate,
15255 * different NIDs for mute/unmute switch and volume control */
15256 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15257 hda_nid_t pin, const char *pfx)
15259 hda_nid_t nid_v, nid_s;
15266 if (alc880_is_fixed_pin(pin)) {
15267 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15268 /* specify the DAC as the extra output */
15269 if (!spec->multiout.hp_nid)
15270 spec->multiout.hp_nid = nid_v;
15272 spec->multiout.extra_out_nid[0] = nid_v;
15273 /* control HP volume/switch on the output mixer amp */
15274 nid_v = alc861vd_idx_to_mixer_vol(
15275 alc880_fixed_pin_idx(pin));
15276 nid_s = alc861vd_idx_to_mixer_switch(
15277 alc880_fixed_pin_idx(pin));
15279 sprintf(name, "%s Playback Volume", pfx);
15280 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15281 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15284 sprintf(name, "%s Playback Switch", pfx);
15285 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15286 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15289 } else if (alc880_is_multi_pin(pin)) {
15290 /* set manual connection */
15291 /* we have only a switch on HP-out PIN */
15292 sprintf(name, "%s Playback Switch", pfx);
15293 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15294 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15301 /* parse the BIOS configuration and set up the alc_spec
15302 * return 1 if successful, 0 if the proper config is not found,
15303 * or a negative error code
15304 * Based on ALC880 version - had to change it to override
15305 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15306 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15308 struct alc_spec *spec = codec->spec;
15310 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15312 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15316 if (!spec->autocfg.line_outs)
15317 return 0; /* can't find valid BIOS pin config */
15319 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15322 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15325 err = alc861vd_auto_create_extra_out(spec,
15326 spec->autocfg.speaker_pins[0],
15330 err = alc861vd_auto_create_extra_out(spec,
15331 spec->autocfg.hp_pins[0],
15335 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15339 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15341 if (spec->autocfg.dig_outs)
15342 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15344 if (spec->kctls.list)
15345 add_mixer(spec, spec->kctls.list);
15347 add_verb(spec, alc861vd_volume_init_verbs);
15349 spec->num_mux_defs = 1;
15350 spec->input_mux = &spec->private_imux[0];
15352 err = alc_auto_add_mic_boost(codec);
15356 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15361 /* additional initialization for auto-configuration model */
15362 static void alc861vd_auto_init(struct hda_codec *codec)
15364 struct alc_spec *spec = codec->spec;
15365 alc861vd_auto_init_multi_out(codec);
15366 alc861vd_auto_init_hp_out(codec);
15367 alc861vd_auto_init_analog_input(codec);
15368 alc861vd_auto_init_input_src(codec);
15369 if (spec->unsol_event)
15370 alc_inithook(codec);
15373 static int patch_alc861vd(struct hda_codec *codec)
15375 struct alc_spec *spec;
15376 int err, board_config;
15378 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15382 codec->spec = spec;
15384 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15388 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15389 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15391 board_config = ALC861VD_AUTO;
15394 if (board_config == ALC861VD_AUTO) {
15395 /* automatic parse from the BIOS config */
15396 err = alc861vd_parse_auto_config(codec);
15402 "hda_codec: Cannot set up configuration "
15403 "from BIOS. Using base mode...\n");
15404 board_config = ALC861VD_3ST;
15408 err = snd_hda_attach_beep_device(codec, 0x23);
15414 if (board_config != ALC861VD_AUTO)
15415 setup_preset(codec, &alc861vd_presets[board_config]);
15417 if (codec->vendor_id == 0x10ec0660) {
15418 /* always turn on EAPD */
15419 add_verb(spec, alc660vd_eapd_verbs);
15422 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15423 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15425 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15426 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15428 if (!spec->adc_nids) {
15429 spec->adc_nids = alc861vd_adc_nids;
15430 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15432 if (!spec->capsrc_nids)
15433 spec->capsrc_nids = alc861vd_capsrc_nids;
15435 set_capture_mixer(codec);
15436 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15438 spec->vmaster_nid = 0x02;
15440 codec->patch_ops = alc_patch_ops;
15442 if (board_config == ALC861VD_AUTO)
15443 spec->init_hook = alc861vd_auto_init;
15444 #ifdef CONFIG_SND_HDA_POWER_SAVE
15445 if (!spec->loopback.amplist)
15446 spec->loopback.amplist = alc861vd_loopbacks;
15448 codec->proc_widget_hook = print_realtek_coef;
15456 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15457 * configuration. Each pin widget can choose any input DACs and a mixer.
15458 * Each ADC is connected from a mixer of all inputs. This makes possible
15459 * 6-channel independent captures.
15461 * In addition, an independent DAC for the multi-playback (not used in this
15464 #define ALC662_DIGOUT_NID 0x06
15465 #define ALC662_DIGIN_NID 0x0a
15467 static hda_nid_t alc662_dac_nids[4] = {
15468 /* front, rear, clfe, rear_surr */
15472 static hda_nid_t alc272_dac_nids[2] = {
15476 static hda_nid_t alc662_adc_nids[2] = {
15481 static hda_nid_t alc272_adc_nids[1] = {
15486 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15487 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15491 /* FIXME: should be a matrix-type input source selection */
15492 static struct hda_input_mux alc662_capture_source = {
15496 { "Front Mic", 0x1 },
15502 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15510 static struct hda_input_mux alc663_capture_source = {
15514 { "Front Mic", 0x1 },
15519 #if 0 /* set to 1 for testing other input sources below */
15520 static struct hda_input_mux alc272_nc10_capture_source = {
15523 { "Autoselect Mic", 0x0 },
15524 { "Internal Mic", 0x1 },
15525 { "In-0x02", 0x2 },
15526 { "In-0x03", 0x3 },
15527 { "In-0x04", 0x4 },
15528 { "In-0x05", 0x5 },
15529 { "In-0x06", 0x6 },
15530 { "In-0x07", 0x7 },
15531 { "In-0x08", 0x8 },
15532 { "In-0x09", 0x9 },
15533 { "In-0x0a", 0x0a },
15534 { "In-0x0b", 0x0b },
15535 { "In-0x0c", 0x0c },
15536 { "In-0x0d", 0x0d },
15537 { "In-0x0e", 0x0e },
15538 { "In-0x0f", 0x0f },
15546 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15553 static struct hda_verb alc662_3ST_ch2_init[] = {
15554 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15555 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15556 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15557 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15564 static struct hda_verb alc662_3ST_ch6_init[] = {
15565 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15566 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15567 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15568 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15569 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15570 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15574 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15575 { 2, alc662_3ST_ch2_init },
15576 { 6, alc662_3ST_ch6_init },
15582 static struct hda_verb alc662_sixstack_ch6_init[] = {
15583 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15584 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15585 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15592 static struct hda_verb alc662_sixstack_ch8_init[] = {
15593 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15594 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15595 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15599 static struct hda_channel_mode alc662_5stack_modes[2] = {
15600 { 2, alc662_sixstack_ch6_init },
15601 { 6, alc662_sixstack_ch8_init },
15604 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15605 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15608 static struct snd_kcontrol_new alc662_base_mixer[] = {
15609 /* output mixer control */
15610 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15611 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15612 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15613 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15614 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15615 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15616 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15617 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15618 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15620 /*Input mixer control */
15621 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15622 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15623 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15624 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15625 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15626 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15627 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15628 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15632 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15633 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15634 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15635 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15636 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15637 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15638 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15639 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15640 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15641 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15642 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15643 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15647 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15648 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15649 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15650 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15651 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15652 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15653 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15654 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15655 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15656 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15657 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15658 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15659 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15660 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15661 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15662 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15663 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15664 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15668 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15669 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15670 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15671 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15672 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15673 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15674 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15675 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15676 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15677 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15681 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15682 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15683 ALC262_HIPPO_MASTER_SWITCH,
15685 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15686 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15687 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15689 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15690 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15691 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15695 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15696 ALC262_HIPPO_MASTER_SWITCH,
15697 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15698 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15699 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15700 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15701 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15702 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15703 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15704 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15705 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15709 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15710 .ops = &snd_hda_bind_vol,
15712 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15713 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15718 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15719 .ops = &snd_hda_bind_sw,
15721 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15722 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15727 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15728 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15729 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15730 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15731 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15735 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15736 .ops = &snd_hda_bind_sw,
15738 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15739 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15740 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15745 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15746 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15747 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15748 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15749 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15750 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15751 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15756 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15757 .ops = &snd_hda_bind_sw,
15759 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15760 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15761 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15766 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15767 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15768 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15769 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15770 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15771 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15772 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15776 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15777 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15778 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15779 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15780 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15781 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15782 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15783 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15787 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15788 .ops = &snd_hda_bind_vol,
15790 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15791 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15796 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15797 .ops = &snd_hda_bind_sw,
15799 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15800 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15805 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15806 HDA_BIND_VOL("Master Playback Volume",
15807 &alc663_asus_two_bind_master_vol),
15808 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15809 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15810 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15811 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15812 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15816 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15817 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15818 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15819 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15820 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15821 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15822 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15826 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15827 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15828 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15829 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15830 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15831 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15833 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15835 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15836 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15840 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15841 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15842 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15843 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15845 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15846 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15847 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15848 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15849 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15850 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15854 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15856 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15857 .name = "Channel Mode",
15858 .info = alc_ch_mode_info,
15859 .get = alc_ch_mode_get,
15860 .put = alc_ch_mode_put,
15865 static struct hda_verb alc662_init_verbs[] = {
15866 /* ADC: mute amp left and right */
15867 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15868 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15869 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15871 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15872 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15873 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15874 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15875 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15877 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15878 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15879 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15880 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15881 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15882 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15884 /* Front Pin: output 0 (0x0c) */
15885 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15886 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15888 /* Rear Pin: output 1 (0x0d) */
15889 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15890 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15892 /* CLFE Pin: output 2 (0x0e) */
15893 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15894 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15896 /* Mic (rear) pin: input vref at 80% */
15897 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15898 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15899 /* Front Mic pin: input vref at 80% */
15900 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15901 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15902 /* Line In pin: input */
15903 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15904 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15905 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15906 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15907 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15908 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15909 /* CD pin widget for input */
15910 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15912 /* FIXME: use matrix-type input source selection */
15913 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15915 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15916 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15918 /* always trun on EAPD */
15919 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15920 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15925 static struct hda_verb alc662_sue_init_verbs[] = {
15926 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15927 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15931 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15932 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15933 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15937 /* Set Unsolicited Event*/
15938 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15939 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15940 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15945 * generic initialization of ADC, input mixers and output mixers
15947 static struct hda_verb alc662_auto_init_verbs[] = {
15949 * Unmute ADC and set the default input to mic-in
15951 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15952 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15954 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15956 * Note: PASD motherboards uses the Line In 2 as the input for front
15957 * panel mic (mic 2)
15959 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15960 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15961 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15962 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15963 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15964 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15967 * Set up output mixers (0x0c - 0x0f)
15969 /* set vol=0 to output mixers */
15970 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15971 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15972 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15974 /* set up input amps for analog loopback */
15975 /* Amp Indices: DAC = 0, mixer = 1 */
15976 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15977 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15978 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15979 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15980 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15981 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15984 /* FIXME: use matrix-type input source selection */
15985 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15987 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15988 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15992 /* additional verbs for ALC663 */
15993 static struct hda_verb alc663_auto_init_verbs[] = {
15994 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15995 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15999 static struct hda_verb alc663_m51va_init_verbs[] = {
16000 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16001 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16002 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16003 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16004 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16005 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16006 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16007 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16008 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16012 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16013 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16014 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16015 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16016 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16017 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16018 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16019 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16023 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16024 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16025 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16026 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16027 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16028 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16029 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16030 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16031 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16035 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16036 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16037 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16038 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16041 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16042 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16046 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16047 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16048 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16049 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16050 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16051 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16052 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16053 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16054 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16055 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16056 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16057 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16058 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16062 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16063 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16064 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16065 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16066 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16067 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16068 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16069 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16070 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16071 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16072 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16073 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16074 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16078 static struct hda_verb alc663_g71v_init_verbs[] = {
16079 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16080 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16081 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16083 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16084 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16085 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16087 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16088 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16089 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16093 static struct hda_verb alc663_g50v_init_verbs[] = {
16094 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16095 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16096 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16098 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16099 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16103 static struct hda_verb alc662_ecs_init_verbs[] = {
16104 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16105 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16106 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16107 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16111 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16112 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16113 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16114 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16115 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16116 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16117 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16118 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16119 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16120 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16121 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16122 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16126 static struct hda_verb alc272_dell_init_verbs[] = {
16127 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16128 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16129 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16130 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16131 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16132 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16133 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16134 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16135 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16136 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16137 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16141 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16142 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16143 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16147 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16148 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16149 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16153 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16155 unsigned int present;
16156 unsigned char bits;
16158 present = snd_hda_codec_read(codec, 0x14, 0,
16159 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16160 bits = present ? HDA_AMP_MUTE : 0;
16161 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16162 HDA_AMP_MUTE, bits);
16165 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16167 unsigned int present;
16168 unsigned char bits;
16170 present = snd_hda_codec_read(codec, 0x1b, 0,
16171 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16172 bits = present ? HDA_AMP_MUTE : 0;
16173 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16174 HDA_AMP_MUTE, bits);
16175 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16176 HDA_AMP_MUTE, bits);
16179 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16182 if ((res >> 26) == ALC880_HP_EVENT)
16183 alc662_lenovo_101e_all_automute(codec);
16184 if ((res >> 26) == ALC880_FRONT_EVENT)
16185 alc662_lenovo_101e_ispeaker_automute(codec);
16188 /* unsolicited event for HP jack sensing */
16189 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16192 if ((res >> 26) == ALC880_MIC_EVENT)
16193 alc_mic_automute(codec);
16195 alc262_hippo_unsol_event(codec, res);
16198 static void alc662_eeepc_setup(struct hda_codec *codec)
16200 struct alc_spec *spec = codec->spec;
16202 alc262_hippo1_setup(codec);
16203 spec->ext_mic.pin = 0x18;
16204 spec->ext_mic.mux_idx = 0;
16205 spec->int_mic.pin = 0x19;
16206 spec->int_mic.mux_idx = 1;
16207 spec->auto_mic = 1;
16210 static void alc662_eeepc_inithook(struct hda_codec *codec)
16212 alc262_hippo_automute(codec);
16213 alc_mic_automute(codec);
16216 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16218 struct alc_spec *spec = codec->spec;
16220 spec->autocfg.hp_pins[0] = 0x14;
16221 spec->autocfg.speaker_pins[0] = 0x1b;
16224 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16226 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16228 unsigned int present;
16229 unsigned char bits;
16231 present = snd_hda_codec_read(codec, 0x21, 0,
16232 AC_VERB_GET_PIN_SENSE, 0)
16233 & AC_PINSENSE_PRESENCE;
16234 bits = present ? HDA_AMP_MUTE : 0;
16235 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16236 AMP_IN_MUTE(0), bits);
16237 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16238 AMP_IN_MUTE(0), bits);
16241 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16243 unsigned int present;
16244 unsigned char bits;
16246 present = snd_hda_codec_read(codec, 0x21, 0,
16247 AC_VERB_GET_PIN_SENSE, 0)
16248 & AC_PINSENSE_PRESENCE;
16249 bits = present ? HDA_AMP_MUTE : 0;
16250 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16251 AMP_IN_MUTE(0), bits);
16252 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16253 AMP_IN_MUTE(0), bits);
16254 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16255 AMP_IN_MUTE(0), bits);
16256 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16257 AMP_IN_MUTE(0), bits);
16260 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16262 unsigned int present;
16263 unsigned char bits;
16265 present = snd_hda_codec_read(codec, 0x15, 0,
16266 AC_VERB_GET_PIN_SENSE, 0)
16267 & AC_PINSENSE_PRESENCE;
16268 bits = present ? HDA_AMP_MUTE : 0;
16269 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16270 AMP_IN_MUTE(0), bits);
16271 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16272 AMP_IN_MUTE(0), bits);
16273 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16274 AMP_IN_MUTE(0), bits);
16275 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16276 AMP_IN_MUTE(0), bits);
16279 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16281 unsigned int present;
16282 unsigned char bits;
16284 present = snd_hda_codec_read(codec, 0x1b, 0,
16285 AC_VERB_GET_PIN_SENSE, 0)
16286 & AC_PINSENSE_PRESENCE;
16287 bits = present ? 0 : PIN_OUT;
16288 snd_hda_codec_write(codec, 0x14, 0,
16289 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16292 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16294 unsigned int present1, present2;
16296 present1 = snd_hda_codec_read(codec, 0x21, 0,
16297 AC_VERB_GET_PIN_SENSE, 0)
16298 & AC_PINSENSE_PRESENCE;
16299 present2 = snd_hda_codec_read(codec, 0x15, 0,
16300 AC_VERB_GET_PIN_SENSE, 0)
16301 & AC_PINSENSE_PRESENCE;
16303 if (present1 || present2) {
16304 snd_hda_codec_write_cache(codec, 0x14, 0,
16305 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16307 snd_hda_codec_write_cache(codec, 0x14, 0,
16308 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16312 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16314 unsigned int present1, present2;
16316 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16317 AC_VERB_GET_PIN_SENSE, 0)
16318 & AC_PINSENSE_PRESENCE;
16319 present2 = snd_hda_codec_read(codec, 0x15, 0,
16320 AC_VERB_GET_PIN_SENSE, 0)
16321 & AC_PINSENSE_PRESENCE;
16323 if (present1 || present2) {
16324 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16325 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16326 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16327 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16329 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16330 AMP_IN_MUTE(0), 0);
16331 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16332 AMP_IN_MUTE(0), 0);
16336 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16339 switch (res >> 26) {
16340 case ALC880_HP_EVENT:
16341 alc663_m51va_speaker_automute(codec);
16343 case ALC880_MIC_EVENT:
16344 alc_mic_automute(codec);
16349 static void alc663_m51va_setup(struct hda_codec *codec)
16351 struct alc_spec *spec = codec->spec;
16352 spec->ext_mic.pin = 0x18;
16353 spec->ext_mic.mux_idx = 0;
16354 spec->int_mic.pin = 0x12;
16355 spec->int_mic.mux_idx = 1;
16356 spec->auto_mic = 1;
16359 static void alc663_m51va_inithook(struct hda_codec *codec)
16361 alc663_m51va_speaker_automute(codec);
16362 alc_mic_automute(codec);
16365 /* ***************** Mode1 ******************************/
16366 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16367 #define alc663_mode1_setup alc663_m51va_setup
16368 #define alc663_mode1_inithook alc663_m51va_inithook
16370 /* ***************** Mode2 ******************************/
16371 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16374 switch (res >> 26) {
16375 case ALC880_HP_EVENT:
16376 alc662_f5z_speaker_automute(codec);
16378 case ALC880_MIC_EVENT:
16379 alc_mic_automute(codec);
16384 #define alc662_mode2_setup alc663_m51va_setup
16386 static void alc662_mode2_inithook(struct hda_codec *codec)
16388 alc662_f5z_speaker_automute(codec);
16389 alc_mic_automute(codec);
16391 /* ***************** Mode3 ******************************/
16392 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16395 switch (res >> 26) {
16396 case ALC880_HP_EVENT:
16397 alc663_two_hp_m1_speaker_automute(codec);
16399 case ALC880_MIC_EVENT:
16400 alc_mic_automute(codec);
16405 #define alc663_mode3_setup alc663_m51va_setup
16407 static void alc663_mode3_inithook(struct hda_codec *codec)
16409 alc663_two_hp_m1_speaker_automute(codec);
16410 alc_mic_automute(codec);
16412 /* ***************** Mode4 ******************************/
16413 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16416 switch (res >> 26) {
16417 case ALC880_HP_EVENT:
16418 alc663_21jd_two_speaker_automute(codec);
16420 case ALC880_MIC_EVENT:
16421 alc_mic_automute(codec);
16426 #define alc663_mode4_setup alc663_m51va_setup
16428 static void alc663_mode4_inithook(struct hda_codec *codec)
16430 alc663_21jd_two_speaker_automute(codec);
16431 alc_mic_automute(codec);
16433 /* ***************** Mode5 ******************************/
16434 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16437 switch (res >> 26) {
16438 case ALC880_HP_EVENT:
16439 alc663_15jd_two_speaker_automute(codec);
16441 case ALC880_MIC_EVENT:
16442 alc_mic_automute(codec);
16447 #define alc663_mode5_setup alc663_m51va_setup
16449 static void alc663_mode5_inithook(struct hda_codec *codec)
16451 alc663_15jd_two_speaker_automute(codec);
16452 alc_mic_automute(codec);
16454 /* ***************** Mode6 ******************************/
16455 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16458 switch (res >> 26) {
16459 case ALC880_HP_EVENT:
16460 alc663_two_hp_m2_speaker_automute(codec);
16462 case ALC880_MIC_EVENT:
16463 alc_mic_automute(codec);
16468 #define alc663_mode6_setup alc663_m51va_setup
16470 static void alc663_mode6_inithook(struct hda_codec *codec)
16472 alc663_two_hp_m2_speaker_automute(codec);
16473 alc_mic_automute(codec);
16476 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16478 unsigned int present;
16479 unsigned char bits;
16481 present = snd_hda_codec_read(codec, 0x21, 0,
16482 AC_VERB_GET_PIN_SENSE, 0)
16483 & AC_PINSENSE_PRESENCE;
16484 bits = present ? HDA_AMP_MUTE : 0;
16485 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16486 HDA_AMP_MUTE, bits);
16487 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16488 HDA_AMP_MUTE, bits);
16491 static void alc663_g71v_front_automute(struct hda_codec *codec)
16493 unsigned int present;
16494 unsigned char bits;
16496 present = snd_hda_codec_read(codec, 0x15, 0,
16497 AC_VERB_GET_PIN_SENSE, 0)
16498 & AC_PINSENSE_PRESENCE;
16499 bits = present ? HDA_AMP_MUTE : 0;
16500 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16501 HDA_AMP_MUTE, bits);
16504 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16507 switch (res >> 26) {
16508 case ALC880_HP_EVENT:
16509 alc663_g71v_hp_automute(codec);
16511 case ALC880_FRONT_EVENT:
16512 alc663_g71v_front_automute(codec);
16514 case ALC880_MIC_EVENT:
16515 alc_mic_automute(codec);
16520 #define alc663_g71v_setup alc663_m51va_setup
16522 static void alc663_g71v_inithook(struct hda_codec *codec)
16524 alc663_g71v_front_automute(codec);
16525 alc663_g71v_hp_automute(codec);
16526 alc_mic_automute(codec);
16529 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16532 switch (res >> 26) {
16533 case ALC880_HP_EVENT:
16534 alc663_m51va_speaker_automute(codec);
16536 case ALC880_MIC_EVENT:
16537 alc_mic_automute(codec);
16542 #define alc663_g50v_setup alc663_m51va_setup
16544 static void alc663_g50v_inithook(struct hda_codec *codec)
16546 alc663_m51va_speaker_automute(codec);
16547 alc_mic_automute(codec);
16550 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16551 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16552 ALC262_HIPPO_MASTER_SWITCH,
16554 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16555 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16556 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16558 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16559 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16560 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16564 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16565 /* Master Playback automatically created from Speaker and Headphone */
16566 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16567 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16568 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16569 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16571 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16572 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16573 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16575 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16576 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16577 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16581 #ifdef CONFIG_SND_HDA_POWER_SAVE
16582 #define alc662_loopbacks alc880_loopbacks
16586 /* pcm configuration: identical with ALC880 */
16587 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16588 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16589 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16590 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16593 * configuration and preset
16595 static const char *alc662_models[ALC662_MODEL_LAST] = {
16596 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16597 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16598 [ALC662_3ST_6ch] = "3stack-6ch",
16599 [ALC662_5ST_DIG] = "6stack-dig",
16600 [ALC662_LENOVO_101E] = "lenovo-101e",
16601 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16602 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16603 [ALC662_ECS] = "ecs",
16604 [ALC663_ASUS_M51VA] = "m51va",
16605 [ALC663_ASUS_G71V] = "g71v",
16606 [ALC663_ASUS_H13] = "h13",
16607 [ALC663_ASUS_G50V] = "g50v",
16608 [ALC663_ASUS_MODE1] = "asus-mode1",
16609 [ALC662_ASUS_MODE2] = "asus-mode2",
16610 [ALC663_ASUS_MODE3] = "asus-mode3",
16611 [ALC663_ASUS_MODE4] = "asus-mode4",
16612 [ALC663_ASUS_MODE5] = "asus-mode5",
16613 [ALC663_ASUS_MODE6] = "asus-mode6",
16614 [ALC272_DELL] = "dell",
16615 [ALC272_DELL_ZM1] = "dell-zm1",
16616 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16617 [ALC662_AUTO] = "auto",
16620 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16621 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16622 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16623 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16624 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16625 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16626 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16627 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16628 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16629 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16630 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16631 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16632 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16633 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16634 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16635 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16636 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16637 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16638 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16639 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16640 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16641 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16642 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16643 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16644 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16645 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16646 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16647 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16648 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16649 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16650 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16651 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16652 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16653 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16654 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16655 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16656 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16657 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16658 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16659 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16660 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16661 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16662 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16663 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16664 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16665 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16666 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16667 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16668 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16669 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16670 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16671 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16672 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16673 ALC662_3ST_6ch_DIG),
16674 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16675 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16676 ALC662_3ST_6ch_DIG),
16677 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16678 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16679 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16680 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16681 ALC662_3ST_6ch_DIG),
16682 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16687 static struct alc_config_preset alc662_presets[] = {
16688 [ALC662_3ST_2ch_DIG] = {
16689 .mixers = { alc662_3ST_2ch_mixer },
16690 .init_verbs = { alc662_init_verbs },
16691 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16692 .dac_nids = alc662_dac_nids,
16693 .dig_out_nid = ALC662_DIGOUT_NID,
16694 .dig_in_nid = ALC662_DIGIN_NID,
16695 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16696 .channel_mode = alc662_3ST_2ch_modes,
16697 .input_mux = &alc662_capture_source,
16699 [ALC662_3ST_6ch_DIG] = {
16700 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16701 .init_verbs = { alc662_init_verbs },
16702 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16703 .dac_nids = alc662_dac_nids,
16704 .dig_out_nid = ALC662_DIGOUT_NID,
16705 .dig_in_nid = ALC662_DIGIN_NID,
16706 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16707 .channel_mode = alc662_3ST_6ch_modes,
16709 .input_mux = &alc662_capture_source,
16711 [ALC662_3ST_6ch] = {
16712 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16713 .init_verbs = { alc662_init_verbs },
16714 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16715 .dac_nids = alc662_dac_nids,
16716 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16717 .channel_mode = alc662_3ST_6ch_modes,
16719 .input_mux = &alc662_capture_source,
16721 [ALC662_5ST_DIG] = {
16722 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16723 .init_verbs = { alc662_init_verbs },
16724 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16725 .dac_nids = alc662_dac_nids,
16726 .dig_out_nid = ALC662_DIGOUT_NID,
16727 .dig_in_nid = ALC662_DIGIN_NID,
16728 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16729 .channel_mode = alc662_5stack_modes,
16730 .input_mux = &alc662_capture_source,
16732 [ALC662_LENOVO_101E] = {
16733 .mixers = { alc662_lenovo_101e_mixer },
16734 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16735 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16736 .dac_nids = alc662_dac_nids,
16737 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16738 .channel_mode = alc662_3ST_2ch_modes,
16739 .input_mux = &alc662_lenovo_101e_capture_source,
16740 .unsol_event = alc662_lenovo_101e_unsol_event,
16741 .init_hook = alc662_lenovo_101e_all_automute,
16743 [ALC662_ASUS_EEEPC_P701] = {
16744 .mixers = { alc662_eeepc_p701_mixer },
16745 .init_verbs = { alc662_init_verbs,
16746 alc662_eeepc_sue_init_verbs },
16747 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16748 .dac_nids = alc662_dac_nids,
16749 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16750 .channel_mode = alc662_3ST_2ch_modes,
16751 .unsol_event = alc662_eeepc_unsol_event,
16752 .setup = alc662_eeepc_setup,
16753 .init_hook = alc662_eeepc_inithook,
16755 [ALC662_ASUS_EEEPC_EP20] = {
16756 .mixers = { alc662_eeepc_ep20_mixer,
16757 alc662_chmode_mixer },
16758 .init_verbs = { alc662_init_verbs,
16759 alc662_eeepc_ep20_sue_init_verbs },
16760 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16761 .dac_nids = alc662_dac_nids,
16762 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16763 .channel_mode = alc662_3ST_6ch_modes,
16764 .input_mux = &alc662_lenovo_101e_capture_source,
16765 .unsol_event = alc662_eeepc_unsol_event,
16766 .setup = alc662_eeepc_ep20_setup,
16767 .init_hook = alc662_eeepc_ep20_inithook,
16770 .mixers = { alc662_ecs_mixer },
16771 .init_verbs = { alc662_init_verbs,
16772 alc662_ecs_init_verbs },
16773 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16774 .dac_nids = alc662_dac_nids,
16775 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16776 .channel_mode = alc662_3ST_2ch_modes,
16777 .unsol_event = alc662_eeepc_unsol_event,
16778 .setup = alc662_eeepc_setup,
16779 .init_hook = alc662_eeepc_inithook,
16781 [ALC663_ASUS_M51VA] = {
16782 .mixers = { alc663_m51va_mixer },
16783 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16784 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16785 .dac_nids = alc662_dac_nids,
16786 .dig_out_nid = ALC662_DIGOUT_NID,
16787 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16788 .channel_mode = alc662_3ST_2ch_modes,
16789 .unsol_event = alc663_m51va_unsol_event,
16790 .setup = alc663_m51va_setup,
16791 .init_hook = alc663_m51va_inithook,
16793 [ALC663_ASUS_G71V] = {
16794 .mixers = { alc663_g71v_mixer },
16795 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16796 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16797 .dac_nids = alc662_dac_nids,
16798 .dig_out_nid = ALC662_DIGOUT_NID,
16799 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16800 .channel_mode = alc662_3ST_2ch_modes,
16801 .unsol_event = alc663_g71v_unsol_event,
16802 .setup = alc663_g71v_setup,
16803 .init_hook = alc663_g71v_inithook,
16805 [ALC663_ASUS_H13] = {
16806 .mixers = { alc663_m51va_mixer },
16807 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16808 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16809 .dac_nids = alc662_dac_nids,
16810 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16811 .channel_mode = alc662_3ST_2ch_modes,
16812 .unsol_event = alc663_m51va_unsol_event,
16813 .init_hook = alc663_m51va_inithook,
16815 [ALC663_ASUS_G50V] = {
16816 .mixers = { alc663_g50v_mixer },
16817 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16818 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16819 .dac_nids = alc662_dac_nids,
16820 .dig_out_nid = ALC662_DIGOUT_NID,
16821 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16822 .channel_mode = alc662_3ST_6ch_modes,
16823 .input_mux = &alc663_capture_source,
16824 .unsol_event = alc663_g50v_unsol_event,
16825 .setup = alc663_g50v_setup,
16826 .init_hook = alc663_g50v_inithook,
16828 [ALC663_ASUS_MODE1] = {
16829 .mixers = { alc663_m51va_mixer },
16830 .cap_mixer = alc662_auto_capture_mixer,
16831 .init_verbs = { alc662_init_verbs,
16832 alc663_21jd_amic_init_verbs },
16833 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16835 .dac_nids = alc662_dac_nids,
16836 .dig_out_nid = ALC662_DIGOUT_NID,
16837 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16838 .channel_mode = alc662_3ST_2ch_modes,
16839 .unsol_event = alc663_mode1_unsol_event,
16840 .setup = alc663_mode1_setup,
16841 .init_hook = alc663_mode1_inithook,
16843 [ALC662_ASUS_MODE2] = {
16844 .mixers = { alc662_1bjd_mixer },
16845 .cap_mixer = alc662_auto_capture_mixer,
16846 .init_verbs = { alc662_init_verbs,
16847 alc662_1bjd_amic_init_verbs },
16848 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16849 .dac_nids = alc662_dac_nids,
16850 .dig_out_nid = ALC662_DIGOUT_NID,
16851 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16852 .channel_mode = alc662_3ST_2ch_modes,
16853 .unsol_event = alc662_mode2_unsol_event,
16854 .setup = alc662_mode2_setup,
16855 .init_hook = alc662_mode2_inithook,
16857 [ALC663_ASUS_MODE3] = {
16858 .mixers = { alc663_two_hp_m1_mixer },
16859 .cap_mixer = alc662_auto_capture_mixer,
16860 .init_verbs = { alc662_init_verbs,
16861 alc663_two_hp_amic_m1_init_verbs },
16862 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16864 .dac_nids = alc662_dac_nids,
16865 .dig_out_nid = ALC662_DIGOUT_NID,
16866 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16867 .channel_mode = alc662_3ST_2ch_modes,
16868 .unsol_event = alc663_mode3_unsol_event,
16869 .setup = alc663_mode3_setup,
16870 .init_hook = alc663_mode3_inithook,
16872 [ALC663_ASUS_MODE4] = {
16873 .mixers = { alc663_asus_21jd_clfe_mixer },
16874 .cap_mixer = alc662_auto_capture_mixer,
16875 .init_verbs = { alc662_init_verbs,
16876 alc663_21jd_amic_init_verbs},
16877 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16879 .dac_nids = alc662_dac_nids,
16880 .dig_out_nid = ALC662_DIGOUT_NID,
16881 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16882 .channel_mode = alc662_3ST_2ch_modes,
16883 .unsol_event = alc663_mode4_unsol_event,
16884 .setup = alc663_mode4_setup,
16885 .init_hook = alc663_mode4_inithook,
16887 [ALC663_ASUS_MODE5] = {
16888 .mixers = { alc663_asus_15jd_clfe_mixer },
16889 .cap_mixer = alc662_auto_capture_mixer,
16890 .init_verbs = { alc662_init_verbs,
16891 alc663_15jd_amic_init_verbs },
16892 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16894 .dac_nids = alc662_dac_nids,
16895 .dig_out_nid = ALC662_DIGOUT_NID,
16896 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16897 .channel_mode = alc662_3ST_2ch_modes,
16898 .unsol_event = alc663_mode5_unsol_event,
16899 .setup = alc663_mode5_setup,
16900 .init_hook = alc663_mode5_inithook,
16902 [ALC663_ASUS_MODE6] = {
16903 .mixers = { alc663_two_hp_m2_mixer },
16904 .cap_mixer = alc662_auto_capture_mixer,
16905 .init_verbs = { alc662_init_verbs,
16906 alc663_two_hp_amic_m2_init_verbs },
16907 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16909 .dac_nids = alc662_dac_nids,
16910 .dig_out_nid = ALC662_DIGOUT_NID,
16911 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16912 .channel_mode = alc662_3ST_2ch_modes,
16913 .unsol_event = alc663_mode6_unsol_event,
16914 .setup = alc663_mode6_setup,
16915 .init_hook = alc663_mode6_inithook,
16918 .mixers = { alc663_m51va_mixer },
16919 .cap_mixer = alc272_auto_capture_mixer,
16920 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16921 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16922 .dac_nids = alc662_dac_nids,
16923 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16924 .adc_nids = alc272_adc_nids,
16925 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16926 .capsrc_nids = alc272_capsrc_nids,
16927 .channel_mode = alc662_3ST_2ch_modes,
16928 .unsol_event = alc663_m51va_unsol_event,
16929 .setup = alc663_m51va_setup,
16930 .init_hook = alc663_m51va_inithook,
16932 [ALC272_DELL_ZM1] = {
16933 .mixers = { alc663_m51va_mixer },
16934 .cap_mixer = alc662_auto_capture_mixer,
16935 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16936 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16937 .dac_nids = alc662_dac_nids,
16938 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16939 .adc_nids = alc662_adc_nids,
16941 .capsrc_nids = alc662_capsrc_nids,
16942 .channel_mode = alc662_3ST_2ch_modes,
16943 .unsol_event = alc663_m51va_unsol_event,
16944 .setup = alc663_m51va_setup,
16945 .init_hook = alc663_m51va_inithook,
16947 [ALC272_SAMSUNG_NC10] = {
16948 .mixers = { alc272_nc10_mixer },
16949 .init_verbs = { alc662_init_verbs,
16950 alc663_21jd_amic_init_verbs },
16951 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16952 .dac_nids = alc272_dac_nids,
16953 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16954 .channel_mode = alc662_3ST_2ch_modes,
16955 /*.input_mux = &alc272_nc10_capture_source,*/
16956 .unsol_event = alc663_mode4_unsol_event,
16957 .setup = alc663_mode4_setup,
16958 .init_hook = alc663_mode4_inithook,
16964 * BIOS auto configuration
16967 /* add playback controls from the parsed DAC table */
16968 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16969 const struct auto_pin_cfg *cfg)
16972 static const char *chname[4] = {
16973 "Front", "Surround", NULL /*CLFE*/, "Side"
16978 for (i = 0; i < cfg->line_outs; i++) {
16979 if (!spec->multiout.dac_nids[i])
16981 nid = alc880_idx_to_dac(i);
16984 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16985 "Center Playback Volume",
16986 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16990 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16991 "LFE Playback Volume",
16992 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16996 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16997 "Center Playback Switch",
16998 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17002 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17003 "LFE Playback Switch",
17004 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17009 sprintf(name, "%s Playback Volume", chname[i]);
17010 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17011 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
17015 sprintf(name, "%s Playback Switch", chname[i]);
17016 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17017 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
17026 /* add playback controls for speaker and HP outputs */
17027 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17038 /* ALC663 has a mono output pin on 0x17 */
17039 sprintf(name, "%s Playback Switch", pfx);
17040 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17041 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17045 if (alc880_is_fixed_pin(pin)) {
17046 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17047 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17048 /* specify the DAC as the extra output */
17049 if (!spec->multiout.hp_nid)
17050 spec->multiout.hp_nid = nid;
17052 spec->multiout.extra_out_nid[0] = nid;
17053 /* control HP volume/switch on the output mixer amp */
17054 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17055 sprintf(name, "%s Playback Volume", pfx);
17056 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17057 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17060 sprintf(name, "%s Playback Switch", pfx);
17061 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17062 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17065 } else if (alc880_is_multi_pin(pin)) {
17066 /* set manual connection */
17067 /* we have only a switch on HP-out PIN */
17068 sprintf(name, "%s Playback Switch", pfx);
17069 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17070 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17077 /* create playback/capture controls for input pins */
17078 #define alc662_auto_create_input_ctls \
17079 alc880_auto_create_input_ctls
17081 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17082 hda_nid_t nid, int pin_type,
17085 alc_set_pin_output(codec, nid, pin_type);
17086 /* need the manual connection? */
17087 if (alc880_is_multi_pin(nid)) {
17088 struct alc_spec *spec = codec->spec;
17089 int idx = alc880_multi_pin_idx(nid);
17090 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17091 AC_VERB_SET_CONNECT_SEL,
17092 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17096 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17098 struct alc_spec *spec = codec->spec;
17101 for (i = 0; i <= HDA_SIDE; i++) {
17102 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17103 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17105 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17110 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17112 struct alc_spec *spec = codec->spec;
17115 pin = spec->autocfg.hp_pins[0];
17116 if (pin) /* connect to front */
17118 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17119 pin = spec->autocfg.speaker_pins[0];
17121 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17124 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17126 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17128 struct alc_spec *spec = codec->spec;
17131 for (i = 0; i < AUTO_PIN_LAST; i++) {
17132 hda_nid_t nid = spec->autocfg.input_pins[i];
17133 if (alc_is_input_pin(codec, nid)) {
17134 alc_set_input_pin(codec, nid, i);
17135 if (nid != ALC662_PIN_CD_NID &&
17136 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17137 snd_hda_codec_write(codec, nid, 0,
17138 AC_VERB_SET_AMP_GAIN_MUTE,
17144 #define alc662_auto_init_input_src alc882_auto_init_input_src
17146 static int alc662_parse_auto_config(struct hda_codec *codec)
17148 struct alc_spec *spec = codec->spec;
17150 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17152 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17156 if (!spec->autocfg.line_outs)
17157 return 0; /* can't find valid BIOS pin config */
17159 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17162 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17165 err = alc662_auto_create_extra_out(spec,
17166 spec->autocfg.speaker_pins[0],
17170 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17174 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17178 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17180 if (spec->autocfg.dig_outs)
17181 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17183 if (spec->kctls.list)
17184 add_mixer(spec, spec->kctls.list);
17186 spec->num_mux_defs = 1;
17187 spec->input_mux = &spec->private_imux[0];
17189 add_verb(spec, alc662_auto_init_verbs);
17190 if (codec->vendor_id == 0x10ec0663)
17191 add_verb(spec, alc663_auto_init_verbs);
17193 err = alc_auto_add_mic_boost(codec);
17197 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17202 /* additional initialization for auto-configuration model */
17203 static void alc662_auto_init(struct hda_codec *codec)
17205 struct alc_spec *spec = codec->spec;
17206 alc662_auto_init_multi_out(codec);
17207 alc662_auto_init_hp_out(codec);
17208 alc662_auto_init_analog_input(codec);
17209 alc662_auto_init_input_src(codec);
17210 if (spec->unsol_event)
17211 alc_inithook(codec);
17214 static int patch_alc662(struct hda_codec *codec)
17216 struct alc_spec *spec;
17217 int err, board_config;
17219 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17223 codec->spec = spec;
17225 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17227 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17230 if (board_config < 0) {
17231 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17233 board_config = ALC662_AUTO;
17236 if (board_config == ALC662_AUTO) {
17237 /* automatic parse from the BIOS config */
17238 err = alc662_parse_auto_config(codec);
17244 "hda_codec: Cannot set up configuration "
17245 "from BIOS. Using base mode...\n");
17246 board_config = ALC662_3ST_2ch_DIG;
17250 err = snd_hda_attach_beep_device(codec, 0x1);
17256 if (board_config != ALC662_AUTO)
17257 setup_preset(codec, &alc662_presets[board_config]);
17259 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17260 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17262 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17263 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17265 if (!spec->adc_nids) {
17266 spec->adc_nids = alc662_adc_nids;
17267 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17269 if (!spec->capsrc_nids)
17270 spec->capsrc_nids = alc662_capsrc_nids;
17272 if (!spec->cap_mixer)
17273 set_capture_mixer(codec);
17274 if (codec->vendor_id == 0x10ec0662)
17275 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17277 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17279 spec->vmaster_nid = 0x02;
17281 codec->patch_ops = alc_patch_ops;
17282 if (board_config == ALC662_AUTO)
17283 spec->init_hook = alc662_auto_init;
17284 #ifdef CONFIG_SND_HDA_POWER_SAVE
17285 if (!spec->loopback.amplist)
17286 spec->loopback.amplist = alc662_loopbacks;
17288 codec->proc_widget_hook = print_realtek_coef;
17296 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17297 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17298 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17299 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17300 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17301 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17302 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17303 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17304 .patch = patch_alc861 },
17305 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17306 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17307 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17308 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17309 .patch = patch_alc882 },
17310 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17311 .patch = patch_alc662 },
17312 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17313 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17314 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17315 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17316 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17317 .patch = patch_alc882 },
17318 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17319 .patch = patch_alc882 },
17320 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17321 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17322 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17323 .patch = patch_alc882 },
17324 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17325 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17326 {} /* terminator */
17329 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17331 MODULE_LICENSE("GPL");
17332 MODULE_DESCRIPTION("Realtek HD-audio codec");
17334 static struct hda_codec_preset_list realtek_list = {
17335 .preset = snd_hda_preset_realtek,
17336 .owner = THIS_MODULE,
17339 static int __init patch_realtek_init(void)
17341 return snd_hda_add_codec_preset(&realtek_list);
17344 static void __exit patch_realtek_exit(void)
17346 snd_hda_delete_codec_preset(&realtek_list);
17349 module_init(patch_realtek_init)
17350 module_exit(patch_realtek_exit)